Advertisement
rfmonk

hmac_sha.py

Jan 31st, 2014
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. # this is from The Python
  4. # Standard Library by example
  5. # ISBN13: 9780321767349
  6.  
  7. import hmac
  8. import hashlib
  9.  
  10. digest_maker = hmac.new('secret-key', '', hashlib.sha1)
  11.  
  12. with open('hmac_sha.py', 'rb') as f:
  13.     while True:
  14.         block = f.read(1024)
  15.         if not block:
  16.             break
  17.         digest_maker.update(block)
  18.  
  19. digest = digest_maker.hexdigest()
  20. print digest
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement