1
我對的方法來建立一個HMAC_SHA1哈希:蟒蛇M2Crypto HMAC SHA1
auth_reponse = HMAC_SHA1(key=session_id, data=decypted_challenge)
我怎樣才能做到這一點與M2Crypto?
我對的方法來建立一個HMAC_SHA1哈希:蟒蛇M2Crypto 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
商祺!