Skip certain words.

This commit is contained in:
nicholas 2018-09-06 16:36:25 -04:00
parent 3acb27538e
commit 74b7d45cf6

View File

@ -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 ''