There are a few "XKCD password" generators out there, but the task seems so straight forward, so I wanted a compact and simple solution. My requirements were:
- One-line alias (or few-line function) to put in
.profile
- Standard Unix commands (require no packages)
- Column output (like
pwgen
) - Titlecase words (for readability)
- True randomness
(I'm happy to renounce command line options in exchange for simplicity.)
for i in {1..32}; do grep -E "^[a-z]{4,8}$" /usr/share/dict/words | gshuf -n4 | gsed 's/.*/\u&/' | tr -d '\n' | awk '{print $1}'; done | column
Current problems:
shuf
requiresbrew install coreutils
(since I'm on macOS).sed
requiresbrew install gnu-sed
.tr -d '\n' | awk '{print $1}'
seems silly.shuf
: Is it truly random?
How can I make a short, yet readable the command line that works on "all" Unix flavours?
PS! I also found that by using SCOWL, which has a range from short word lists with common names to long word lists with obscure words, you can trade-off memorability Vs. entropy.