md5 加密 import hashlib hash = hashlib.sha1() data = "你好" encode = hashlib.md5(data.encode("utf8")) print (encode.hexdigest()) 对md5 进行特定字符串加密 import hmac h = hmac.new(‘abcd‘) h.update(‘nihao‘) print h.hexdigest()
C:\Users\pcdog\AppData\Local\Programs\Python\Python35\python.exe C:/Users/pcdog/PycharmProjects/untitled/md5_hash.py
7eca689f0d3389d9dea66ae112e5cfd7
Process finished with exit code 0
本文出自 “于昊(Pcdog)的博客” 博客,请务必保留此出处http://433266.blog.51cto.com/423266/1740972
原文:http://433266.blog.51cto.com/423266/1740972