Created
October 15, 2012 16:02
-
-
Save theY4Kman/3893296 to your computer and use it in GitHub Desktop.
Python SHA-256 HMAC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Crypto import HMAC, SHA256 | |
def hmac_sha256(key, msg): | |
hash_obj = HMAC.new(key=key, msg=msg, digestmod=SHA256) | |
return hash_obj.hexdigest() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On Windows 7 I get this error:
from Crypto import HMAC, SHA256
Traceback (most recent call last):
File "", line 1, in
from Crypto import HMAC, SHA256
ImportError: cannot import name 'HMAC'