Monday, November 29, 2010

PyMOTW: hmac - O'Reilly ONLamp Blog

PyMOTW: hmac - O'Reilly ONLamp Blog: "import hmac
import hashlib

digest_maker = hmac.new('secret-shared-key-goes-here', '', hashlib.sha1)

f = open('hmac_sha.py', 'rb')
try:
while True:
block = f.read(1024)
if not block:
break
digest_maker.update(block)
finally:
f.close()

digest = digest_maker.hexdigest()
print digest

- Sent using Google Toolbar"

No comments: