Read dictionary words from 1 to (n+1), not 0 to n. Rookie.

This commit is contained in:
nicholas 2018-09-06 16:37:34 -04:00
parent 74b7d45cf6
commit 4a161bc0a6

View File

@ -10,7 +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
# 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 +68,7 @@ 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
THERAND=$(( ((RANDOM<<15)|RANDOM) % DICTCOUNT + 1 )) # generate a pseudorandom number beteween 1 and the word count
THEWORD=`sed -n ''"$THERAND"' p' < $CLEANDICT`