db = {} import hashlib def getmd5(path): m2 = hashlib.md5() m2.update(path.encode('utf8')) return m2.hexdigest()def reg(username, password): db[username] = getmd5(password + username + 'the-Salt') def login(username, password): if username in db: u=db[username] p=getmd5(password + username + 'the-Salt') print(u==p) else: print('请输入正确的用户名和密码')
Sign in to make a reply
ColinShi2011
db = {} import hashlib def getmd5(path): m2 = hashlib.md5() m2.update(path.encode('utf8')) return m2.hexdigest()
def reg(username, password): db[username] = getmd5(password + username + 'the-Salt') def login(username, password): if username in db: u=db[username] p=getmd5(password + username + 'the-Salt') print(u==p) else: print('请输入正确的用户名和密码')