如何使用 OpenSSL 生成随机十六进制字符串

以下命令将生成 32 字节长的随机十六进制字符串

how-to-generate-random-hex-string-using-openssl.sh
openssl rand -hex 16

示例:

openssl_rand_example.txt
$ openssl rand -hex 16
122166dd9e2d617246da9af9d7d3cd6f

命令列出 16 而不是 32,因为 OpenSSL 将生成 16 个随机二进制字节,然后将这 16 个字节转换为 32 个十六进制字符。


Check out similar posts by category: Linux