2

次の方法で HMAC_SHA1 ハッシュを作成する必要があります。

auth_reponse = HMAC_SHA1(key=session_id, data=decypted_challenge)

M2Crypto でこれを行うにはどうすればよいですか?

4

1 に答える 1

3

試す:

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

よろしく!

于 2012-09-10T02:59:53.167 に答える