Last active
February 7, 2022 23:58
-
-
Save gauravvjn/172a4a9933626bd507e00ae6245e33a1 to your computer and use it in GitHub Desktop.
Create HMAC SHA256 signature/encryption/encode
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
""" | |
https://gist.github.com/Azadehkhojandi/50eaae4cf20b21faef186f2c8ee97873 | |
""" | |
import hmac | |
import hashlib | |
import binascii | |
def create_sha256_signature(key, message): | |
""" | |
""" | |
byte_key = binascii.unhexlify(key) | |
message = message.encode() | |
return hmac.new(byte_key, message, hashlib.sha256).hexdigest().upper() | |
key = "E49756B4C8FAB4E48222A3E7F3B97CC3" | |
message = "TEST STRING" | |
create_sha256_signature(key, message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment