Sometimes you just have to generate some random bytes with high entropy. And OpenSSL can help you with this task.
rand command outputs
num pseudo-random bytes. Since in most cases we don’t want to deal with edge bytes, it’s better to use either
-base64 option in order to encode output and thus lead to a valid password.
Another problem is the length. When you use
-base64 option the output string is longer than passed
num. In order to keep the desired length, you have to chop it. For example, using the
Some useful links: