Use string library instead of monolithic arrays

up max length to 25
This commit is contained in:
amcmanu3 2023-11-13 16:02:50 -05:00
parent 91e62c647e
commit 623d6f5855

View File

@ -365,84 +365,16 @@ class Helpers:
def create_pass(self): def create_pass(self):
# maximum length of password needed # maximum length of password needed
# this can be changed to suit your password length max_len = 25
max_len = 12
# declare arrays of the character that we need in out password # declare arrays of the character that we need in out password
# Represented as chars to enable easy string concatenation # Represented as chars to enable easy string concatenation
digits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] digits = string.digits
locase = [ locase = string.ascii_lowercase
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
]
upcase = [ upcase = string.ascii_uppercase
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
]
symbols = [ symbols = string.punctuation
"@",
"#",
"$",
"%",
"=",
":",
"?",
".",
"/",
"|",
"~",
"*",
"(",
")",
]
# combines all the character arrays above to form one array # combines all the character arrays above to form one array
combo = digits + upcase + locase + symbols combo = digits + upcase + locase + symbols