How to generate a hash value using the HMAC method.
hmac_digest.py
import sha
import hmac
from hashlib import sha1
key = 'foo'
raw = 'baa'
hashed = hmac.new(key, raw, sha1)
digested = hashed.hexdigest()
print digested
print len(digested)
The result is as follows
python
8b1be576578bd4725ff7733f44fb8d7afed21808
40
Recommended Posts