if acrostic:
worddict = wordlist_to_worddict(wordlist)
- # useful if driving the logic from other code
- if not interactive:
+ def gen_passwd():
if not acrostic:
- passwd = delimiter.join(choose_words(wordlist, numwords))
+ words = choose_words(wordlist, numwords)
else:
- passwd = delimiter.join(find_acrostic(acrostic, worddict))
+ words = find_acrostic(acrostic, worddict)
+
+ return delimiter.join(words)
- return passwd
+ # useful if driving the logic from other code
+ if not interactive:
+ return gen_passwd()
# else, interactive session
# define input validators
accepted = False
while not accepted:
- if not acrostic:
- passwd = delimiter.join(choose_words(wordlist, numwords))
- else:
- passwd = delimiter.join(find_acrostic(acrostic, worddict))
+ passwd = gen_passwd()
print("Generated: " + passwd)
accepted = try_input("Accept? [yN] ", accepted_validator)