本文共 529 字,大约阅读时间需要 1 分钟。
This module implements the HMAC algorithm as described by .
hmac.new(key, msg=None, digestmod='')hmac.digest(key, meg, digest)
HMAC.update(msg) # m.update(a);m.update(b) is equivalent to m.update(a+b)HMAC.digest()HMAC.hexdigest()HMAC.copy()HMAC.digest_sizeHMAC.block_sizeHMAC.compare_digest(a,b)
import hmacmessage = b'Hello, world!'key = b'secret'h = hmac.new(key, message, digestmod='MD5') # 如果消息很长,可以多次调用h.update(msg)h.hexdigest()
转载地址:http://upge.baihongyu.com/