python MD5

import hashlib

传入的非二禁制

def mymd5(pwd):
    md = hashlib.md5()
    md.update(pwd.encode('utf8'))
    return md.hexdigest()

传入二进制

def myuuid(u):
    md = hashlib.md5()
    md.update(u.bytes)
    return md.hexdigest()

猜你喜欢

转载自blog.csdn.net/weixin_42571739/article/details/81408120