标签:sha1 been 相关 3.x hashlib ges bee pytho mac
用于加密相关的操作,3.x里代替了md5模块和sha模块,主要提供 SHA1, SHA224, SHA256, SHA384, SHA512 ,MD5 算法
#!/usr/bin/env python
import hashlib
#
# m = hashlib.md5()
# m.update(b"Hello")
# print(m.hexdigest())
# m.update(b"It‘s me")
# print(m.hexdigest())
# m.update(b"It‘s been a long time since we spoken...")
#
m2 = hashlib.md5()
m2.update("HelloIt‘s me天王盖地虎".encode(encoding="utf-8"))
print(m2.hexdigest())
#
# s2 = hashlib.sha1()
# s2.update(b"HelloIt‘s me")
# print(s2.hexdigest())
import hmac
h = hmac.new(b‘abcdefg‘,‘12346efd你是‘.encode(‘utf-8‘))
print(h.digest())
标签:sha1 been 相关 3.x hashlib ges bee pytho mac
原文地址:https://www.cnblogs.com/rongye/p/9942909.html