import os
import time
import random
import sys
import string
import hashlib
users = {}
class User:
def __init__(self, username, password):
self.username = username
self.password = password
running = True
while running:
os.system("cls")
print("Welcome. Please register yourself.")
print()
uname = input("Username: ")
pword = input("Password: ")
users.update({"" + uname : "" + pword})
hash_object = hashlib.sha1(pword.encode())
pswrd = open("hash.txt", "a")
pswrd.write(str(hash_object))
pswrd.close()
for key, value in users.items():
print()
print(key, " : ", value)
time.sleep(3)
When I open the text file, it has this:
<sha1 HASH object @ 0x010E6600>
How can I prevent this? Any help is greatly appreciated!
P.S. I know that storing a username and password in a dictionary is not efficient, but it's the only way I can do it right now.