Advertisement
rfmonk

hmac_simple.py

Jan 31st, 2014
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 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.  
  9. digest_maker = hmac.new('secret-shared-key-goes-here')
  10.  
  11. with open('lorem.txt', 'rb') as f:
  12.     while True:
  13.         block = f.read(1024)
  14.         if not block:
  15.             break
  16.         digest_maker.update(block)
  17.  
  18. digest = digest_maker.hexdigest()
  19. print digest
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement