diff --git a/passphrase b/passphrase index 4c70b23..83a0753 100755 --- a/passphrase +++ b/passphrase @@ -10,6 +10,7 @@ COUNT=1 # default to one group of passphrases WORDS=3 # default to three-word phrases DICT='/usr/share/dict/words' # standard location of the words file +DICT='/home/nicholas/passphrase/testdict' # a test dictionary CLEANDICT="$(mktemp)" # create a temp file to store our sanitized dictionary PASSPHRASE=`grep "^[a-z]\{3,8\}$" $DICT` # sanitize the dictionary @@ -68,7 +69,20 @@ for (( y = 1; y <= $COUNT; y++ )); do # give us COUNT groups of passwords for (( z = 1; z <= $WORDS; z++ )); do # give us WORDS words words w...ords THERAND=$(( ((RANDOM<<15)|RANDOM) % DICTCOUNT )) # generate a pseudorandom number beteween 1 and the word count - printf `sed -n ''"$THERAND"' p' < $CLEANDICT`"$SPACE" # pull line number THERAND from our sanitized dictionary + + THEWORD=`sed -n ''"$THERAND"' p' < $CLEANDICT` + + THEWORDSUM=`echo $THEWORD | cksum` + + if [ "$THEWORDSUM" = "2364352366 7" ] || [ "$THEWORDSUM" = "1786501751 7" ] || [ "$THEWORDSUM" = "3985821159 5" ] || [ "$THEWORDSUM" = "3381753483 6" ]; then + + (( z-- )) + + else + + printf "$THEWORD " + + fi done echo ''