implement sha256 hashing of password for security reason #7

Merged
otizonaizit merged 3 commits from romaingu/2024-heraklion-git:hash_pwd into main 2024-08-26 14:40:13 +02:00
Showing only changes of commit de4dc255ac - Show all commits

10
auth.py
View file

@ -7,14 +7,14 @@ PWDB_PATH = 'pwdb.json'
def get_credentials():
username = input('Enter your username: ')
password = getpass('Enter your password: ')
return (username, password)
hashed_password = pwhash(getpass('Enter your password: '))
return (username, hashed_password)
def authenticate(username, password, pwdb):
return password == pwdb[username]
def authenticate(username, hashed_password, pwdb):
return hashed_password == pwdb[username]
def add_user(username, pwdb):
pwdb[username] = input(f'Enter password for {username}: ')
pwdb[username] = pwhash(input(f'Enter password for {username}: '))
return pwdb
def read_pwdb(PWDB_PATH):