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)
当我打开文本文件时,它有这个:
<sha1 HASH object @ 0x010E6600>
我怎样才能防止这种情况?任何帮助是极大的赞赏!
PS我知道将用户名和密码存储在字典中效率不高,但这是我现在唯一可以做到的方法。
喵喵时光机
相关分类