Created
February 17, 2021 22:29
-
-
Save EvansWinner/a81415dd6295b14347a85752b4ef85f1 to your computer and use it in GitHub Desktop.
This file contains 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
""" Generate a quasi-random (temp!) password that is easy to communicate | |
and remember, consisting of one capitalized longish word and one numeral. | |
""" | |
from random import randint | |
# words file from | |
# https://raw.githubusercontent.com/first20hours/google-10000-english/master/google-10000-english-usa-no-swears-long.txt | |
path='C:/Users/ewinner/h/pwgen/words' # <== change this to your path.... | |
phon={ | |
'a':'alpha', | |
'b':'bravo', | |
'c':'charley', | |
'd':'delta', | |
'e':'echo', | |
'f':'foxtrot', | |
'g':'gulf', | |
'h':'hotel', | |
'i':'india', | |
'j':'juliette', | |
'k':'kilo', | |
'l':'lima', | |
'm':'mike', | |
'n':'november', | |
'o':'oscar', | |
'p':'papa', | |
'q':'quebec', | |
'r':'romeo', | |
's':'sierra', | |
't':'tango', | |
'u':'uniform', | |
'v':'victor', | |
'w':'whiskey', | |
'x':'x-ray', | |
'y':'yankey', | |
'z':'zulu', | |
'0':'zero', | |
'1':'one', | |
'2':'two', | |
'3':'three', | |
'4':'four', | |
'5':'five', | |
'6':'six', | |
'7':'seven', | |
'8':'eight', | |
'9':'nine', | |
} | |
def phonetic(s:str,sep:str)->str: | |
ret='' | |
for c in s: | |
if c==c.upper()and c not in ['0','1','2','3','4','5','6','7','8','9']: | |
ret+=phon[c.lower()].upper()+sep | |
else:ret+=phon[c]+sep | |
return ret[:-1] | |
with open(path) as f: | |
ls=f.readlines();l_num=randint(1,len(ls));l=ls[l_num+1] | |
pw=l.capitalize().rstrip('\n')+str(randint(2,9)) | |
print(pw+'\n'+"That's: "+phonetic(pw,' ')+'.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment