Advertisement
rfmonk

hmac_base64.py

Jan 31st, 2014
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 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 base64
  8. import hmac
  9. import hashlib
  10.  
  11. with open('lorem.txt', 'rb') as f:
  12.     body = f.read()
  13.  
  14. hash = hmac.new('secret-key', body, hashlib.sha1)
  15. digest = hash.digest()
  16. print base64.encodestring(digest)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement