How to generate random hex string using OpenSSL
The following command will generate a 32-bytes long random hex string
openssl rand -hex 16
Example:
$ openssl rand -hex 16
122166dd9e2d617246da9af9d7d3cd6f
The command listsĀ 16
, notĀ 32
because OpenSSL will generate 16 random binary bytes and then convert these 16 bytes into 32 hex characters.