Last active
January 13, 2020 21:19
-
-
Save mike-spainhower/6911621 to your computer and use it in GitHub Desktop.
Bourne Shell script that outputs xkcd password generator passwords using secure random. http://xkcd.com/936/
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/sh | |
rand_num="" | |
tot_words="`wc -l /usr/share/dict/words | cut -f1 -d' '`" | |
refresh_random () { | |
rand_num=`od -An -N4 -tu4 /dev/random` | |
} | |
for i in `seq 1 4` ; do | |
refresh_random | |
printf `tail -$((rand_num % tot_words)) /usr/share/dict/words | head -1 | sed "s;';;g"` | |
if [ $i != 4 ] ; then printf _ ; fi | |
done | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment