2015-04-24 - [updated 2015-08-06]
This is a recipe for creating a memorable password (passphrase) from a text file. Ideally you want to concatenate the text of several books to obtain a text file with a rich vocabulary of greater than 20,000 words. Here’s one I prepared earlier.
I’m using a Macintosh computer so I need to install gshuf via Homebrew1. After installing Homebrew use:
brew install coreutils
Generate wordlist.txt (example here) which is a sorted list of unique words from text.txt:
tr -cs A-Za-z '\n' < text.txt | tr A-Z a-z | sort | uniq > wordlist.txt
Check the number of words in wordlist.txt with:
wc -l wordlist.txt
Grab six random words from wordlist.txt and write them to sixwords.txt (example here):
tr -cs A-Za-z '\n' < wordlist.txt | tr A-Z a-z | sort | uniq | gshuf --random-source=/dev/random -n6 > sixwords.txt
That’s about it.