diff --git a/auth.py b/auth.py index 576f974..1ce83a7 100644 --- a/auth.py +++ b/auth.py @@ -7,11 +7,27 @@ def get_credentials(): password = getpass.getpass('Enter your password: ') return username, hash_string(password) +def salt_string(inputstring, salts, pwdb): + for salt in salts: + if ''.join(inputstring, salt) in pwdb.Values.ToList(): + continue + else: + salted_pw = ''.join(inputstring, salt) + salt_index = salts.index(salt) + return salted_pw, salt_index + def hash_string(inputstring): # hash the string hashed_password = sum(ord(char) for char in inputstring) - return hashed_password + return hashed_password + +def get_salts(filename): + # maybe reading it from an environment variable would be better + with open(filename, 'r') as f: + salts = f.read() + f.close() + def authenticate(username, password, pwdb): if username in pwdb: if password == pwdb[username]: