import pickle
import hashlib
import uuid
def ask_pass():
username = input("Please create your username: ")
password = input("Please create your password: ")
salt = uuid.uuid4().hex
hash_code = hashlib.sha256(salt.encode() + password.encode())
dict = {username: {'SALT': salt,
'HASH': hash_code.hexdigest()
}
}
input_user=open("file.txt", "wb")
pickle.dump(dict, input_user)
I want to add multiple user to the file.txt but my code delete the previous username and password in stored file.txt every time when i create new username and password. what needs to be change in order to have every user information store it in the file.txt, also how existing users can change their password that being created before?