Created
November 2, 2012 08:45
-
-
Save treyka/3999558 to your computer and use it in GitHub Desktop.
quick shell hack for generating xkcd-style passwords
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# quick shell hack for generating xkcd-style passwords | |
wordcount=$1 | |
MIN_WORD_LENGTH=4 | |
MAX_WORD_LENGTH=7 | |
LANGUAGE='en' | |
for i in $(seq 1 ${wordcount}); do | |
echo -n $(aspell -d "${LANGUAGE}" dump master \ | |
| egrep "^[[:alpha:]]{$MIN_WORD_LENGTH,$MAX_WORD_LENGTH}$" \ | |
| shuf | tail -n 1 | tr [:upper:] [:lower:]) | |
echo -n " " | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment