Python中的加密

# 明文
import hashlib

msg = '我是明文'
# md5加密
md5 = hashlib.md5(msg.encode('utf-8'))
print(md5.hexdigest())

# sha1加密
sha1 = hashlib.sha1(msg.encode('utf-8'))
print(sha1.hexdigest())

# sha256加密
sha256 = hashlib.sha256(msg.encode('utf-8'))
print(sha256.hexdigest())

posted @ 2021-02-22 16:45  kevin.l  阅读(52)  评论(0编辑  收藏  举报