Discuss / Python / 第二题~

第二题~

Topic source

執謎卜誤

#1 Created at ... [Delete] [Delete and Lock User]
def get_md5(s):
    md5 = hashlib.md5()
    md5.update(s.encode('utf-8'))
    return md5.hexdigest()

def register(username, password):
    db[username] = get_md5(password + username + 'the-Salt')

def login(username, password):
    if get_md5(password + username + 'the-Salt') == db[username]:
        return True
    else:return False

  • 1

Reply