hashlib 加密模块使用说明

import hashlib  #hashilib 模块

m = hashlib.md5()

m.update('hello 天王盖地虎'.encode(encoding = 'utf-8))

m.hexdigest()  #  显示密码 

m = hashlib.sha256()

m.update(b'123456')

m.hexdigest()  #  显示密码 

import hmac  #hmac 模块

h = hmac.new(b'123345', '我是 12345'.encode(encoding = 'utf-8))

h.hexdigest()

原文地址:https://www.cnblogs.com/my-love-is-python/p/9077838.html