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()

posted on 2018-05-23 17:07  python我的最爱  阅读(148)  评论(0编辑  收藏  举报