Guest User

Untitled

a guest
May 27th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. f = open(fileName)
  2. while not endOfFile:
  3. f.read(128)
  4.  
  5. def md5_for_file(f, block_size=2**20):
  6. md5 = hashlib.md5()
  7. while True:
  8. data = f.read(block_size)
  9. if not data:
  10. break
  11. md5.update(data)
  12. return md5.digest()
  13.  
  14. import hashlib
  15. md5 = hashlib.md5()
  16. with open('myfile.txt','rb') as f:
  17. for chunk in iter(lambda: f.read(8192), ''):
  18. md5.update(chunk)
  19. return md5.digest()
Add Comment
Please, Sign In to add comment