Generate some easy to remember passwords

2016-03-17

This method is not suitable for transmitting sensitive data. For such purposes, consider using a public key encryption scheme like PGP or GnuPG. The following procedure is appropriate for generating passwords for online logins and similar applications.

Word List Acquisition

Begin by preparing a text file with dictionary words. We will download word lists from Scowl.

wget "http://downloads.sourceforge.net/wordlist/scowl-2016.01.19.tar.gz" && \
tar -zxvf scowl-2016.01.19.tar.gz --wildcards --strip-components=2 scowl-2016.01.19/final/english-words.*

We will use the files english-words.10 and english-words.20, which contain a multitude of common words. We will filter and remove unwanted words. Other files are available, but they may contain less frequently used words that could be harder to remember.

To create a word list from english-words.10 and english-words.20 with 5 characters or more:

cat english-words.10 english-words.20 | grep -v "'" | grep -e "....." | uniq | xz -9 -e > words.txt.xz

On Mac OSX, set LANG=C to avoid a charset error with uniq.

To count the number of words in the list:

xz -dc words.txt.xz | wc -l

Four-Word Password Generation

We will randomly sort and create a password with four words, capitalizing the first letter of each.

On Mac OSX, install coreutils and gnu-sed on Homebrew.

Linux:

xz -dc words.txt.xz | sort -R | head -n 4 | sed 's/^\(.\)/\U\1/' | tr -d '\n'

Mac:

xz -dc words.txt.xz | gsort -R | head -n 4 | gsed 's/^\(.\)/\U\1/' | tr -d '\n'

Generation of Ten Random Four-Word Passwords

Repeat the above command ten times.

Linux:

for i in {0..9}; do xz -dc words.txt.xz | sort -R | head -n 4 | sed 's/^\(.\)/\U\1/' | tr -d '\n'; echo ""; done

Generation of Ten Random Three-Word Passwords

Generate ten random three-word passwords.

Linux:

for i in {0..9}; do xz -dc words.txt.xz | sort -R | head -n 3 | sed 's/^\(.\)/\U\1/' | tr -d '\n'; echo ""; done

Mac:

for i in {0..9}; do xz -dc words.txt.xz | gsort -R | head -n 3 | gsed 's/^\(.\)/\U\1/' | tr -d '\n'; echo ""; done