Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我必须以以下方式创建 HMAC_SHA1 哈希:
auth_reponse = HMAC_SHA1(key=session_id, data=decypted_challenge)
我怎么能用 M2Crypto 做到这一点?
尝试:
from M2Crypto.EVP import HMAC import base64 hmac = HMAC(session_id,'sha1') hmac.update(decypted_challenge) auth_response = base64.encodestring(hmac.digest()) #Base64 format
或者:
auth_response = hmac.digest() #Binary format
问候!