import hashlib
def private_passwd(passwd: str) -> str:
return hashlib.md5(passwd.encode(encoding=‘UTF-8‘)).hexdigest()
import base64
def private_passwd(passwd: str) -> str:
"""base64 加密"""
return base64.b64encode(passwd.encode())
def public_passwd(b64_passwd: str) -> str:
"""base64 解密"""
return base64.b64decode(b64_passwd)
import hashlib
def private_passwd(passwd: str) -> str:
return hashlib.sha1(passwd.encode(‘utf-8‘)).hexdigest()
原文:https://www.cnblogs.com/test-works/p/15355379.html