Last active
December 11, 2015 12:29
-
-
Save thsutton/4601205 to your computer and use it in GitHub Desktop.
Generate a random passphrase from the words in your system dictionary.
This file contains hidden or 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/sh | |
| # | |
| # Generate an $N word passphrase from the words in $D. | |
| # | |
| N=6 | |
| D=/usr/share/dict/words | |
| R=/dev/random | |
| L=$(cat $D | wc -l) | |
| od -An -tu4 -N $(expr $N \* 4) $R | \ | |
| xargs -n 1 -I @ sh -c "head -n \$(expr @ % $L) $D | tail -1" | \ | |
| tr "[:upper:]" "[:lower:]" | \ | |
| tr "\n" " " | |
| echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment