Hacker News new | ask | show | jobs
by garethrees 2660 days ago
This one-line shell script is a bit simpler:

    base64 /dev/urandom | head -c 16
(Vary the number of characters according to the desired entropy: you get 6 bits of entropy for each character of output, so 16*6 = 96 bits in the example. Use /dev/random or /dev/arandom if you prefer those random sources.)

For passphrases, use GNU shuf (from the coreutils package):

    shuf -n 4 --random-source=/dev/urandom /usr/share/dict/words
1 comments

Also `openssl rand -hex 16` works pretty well :)