Created
March 9, 2016 08:00
-
-
Save bhuvidya/f4f82f52fa4ecc8fe995 to your computer and use it in GitHub Desktop.
dice ware word generator
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/bash | |
# see https://blog.agilebits.com/2011/06/21/toward-better-master-passwords/ | |
# and http://world.std.com/~reinhold/diceware.wordlist.asc | |
DICEWARE_STASH_FILE=~/tmp/diceware.txt | |
WORDS=$1 | |
[[ "$WORDS" == "" ]] && WORDS=5 | |
# make sure the directory of the stash file exists... | |
DIR=$(dirname "$DICEWARE_STASH_FILE") | |
#[ ! | |
# stash the current list of diceware words | |
[ ! -d ~/tmp ] && mkdir ~/tmp | |
if [ ! -f $DICEWARE_STASH_FILE ]; then | |
curl -s http://world.std.com/~reinhold/diceware.wordlist.asc | grep -E "^[1-6]{5}" > $DICEWARE_STASH_FILE | |
fi | |
# create some random sequences of "dice throws" | |
export LC_CTYPE=C | |
for i in {1..10}; do | |
cat /dev/urandom | tr -dc '1-6' | fold -w 5 | /usr/bin/head -n $WORDS | while read throw; do | |
grep -E "^$throw" $DICEWARE_STASH_FILE | awk '{ printf "%s ", $2 }' | |
done | |
echo | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
chmod +x diceware_passwd.sh
./diceware_passwd.sh
this will download the diceware word list if it hasn't been already, then generate lists of 5 random words from the big list. you can pass a number as a parameter to the script to generate that many words in each string.
why is diceware good for generating strong yet memorable passwords? see: