Guest User

Untitled

a guest
Jul 20th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. import hashlib
  2. import base64
  3.  
  4. def file_hash(filename):
  5. h = hashlib.sha1()
  6. with open(filename, 'rb', buffering=0) as f:
  7. for b in iter(lambda : f.read(128*1024), b''):
  8. h.update(b)
  9. return h.digest()
  10.  
  11. if __name__=='__main__':
  12. digest = file_hash("filename")
  13. print base64.b32encode(digest).lower()
Add Comment
Please, Sign In to add comment