OpenSSL - Generate Psuedo Random Passwords

26-07-2013 | Remy van Elst


Table of Contents


This a snippet to generate a psuedo random password fast via the command line with OpenSSL. It generates a number of random bytes, which can either be output raw, as Base64 or as HEX. The Base64 output is a good password most of the time.

# Base64
openssl rand -base64 NUMBER
# HEX
openssl rand -hex NUMBER

Examples:

openssl rand -base64 48
aqnZUEcnnkQVGaNmKOFBGlx+TScS5WCNaOlNEvTkluw0//g14ZOwTsjBkaDSYSq6

openssl rand -base64 10
c7UxZgREfmN+bQ==

openssl rand -hex 48
8eb0d5eb8a45e4a4ac60b284d317383e91c9d372e3b67b154155c0a1b183c5deb2e5d6dceb6366704828c494951925d5

openssl rand -hex 8
feedfacedeadbeef

Tags: base64, hex, openssl, password, ssl,