import hashlib
import uuid
def ask_pass():
username = input("create your username: ")
password = input("create your password: ")
salt = uuid.uuid4().hex
hash_code = hashlib.sha256(salt.encode() + password.encode())
dict = {
username: {
'SALT': salt,
'HASH': hash_code
}
}
with open("file.pkl", "wb") as f:
pickle.dump(dict, f)
How can i use pickle in python in order to add the username and password in dict and store it in file? dict included Hash file and i get an error as "TypeError: can't pickle _hashlib.HASH objects".