Compare commits

..

2 commits

Author SHA1 Message Date
ASPP Student de4dc255ac implement hashing password where needed 2024-08-26 15:31:17 +03:00
ASPP Student 487f0f9597 fix hashing password 2024-08-26 15:31:04 +03:00

View file

@ -14,7 +14,7 @@ def authenticate(username, hashed_password, pwdb):
return hashed_password == pwdb[username]
def add_user(username, pwdb):
pwdb[username] = pwhash(getpass(f'Enter password for {username}: '))
pwdb[username] = pwhash(input(f'Enter password for {username}: '))
return pwdb
def read_pwdb(PWDB_PATH):
@ -36,6 +36,8 @@ def pwhash(pwd):
m.update(encoded_pwd)
return m.hexdigest()
if __name__ == "__main__":
PWDB_PATH = 'pwdb.json'
pwdb = read_pwdb(PWDB_PATH)