Discuss / Python / 打卡

打卡

Topic source

°Destiny

#1 Created at ... [Delete] [Delete and Lock User]

第一题

import hashlib
def login(user, password):
    md5 = hashlib.md5()
    md5.update(password.encode('utf-8'))
    if md5.hexdigest()==db[user]:
        return True
    return False

第二题

def login(username, password):
    user = db[username]
    return user.password == get_md5(password+user.salt)

  • 1

Reply