Skip to content

Instantly share code, notes, and snippets.

@zgzhong
Last active January 26, 2018 05:34
Show Gist options
  • Select an option

  • Save zgzhong/cf907a19e953ba3822dbd3290a90565f to your computer and use it in GitHub Desktop.

Select an option

Save zgzhong/cf907a19e953ba3822dbd3290a90565f to your computer and use it in GitHub Desktop.
from hashlib import md5
# this function calculate the md5 value of the file
def md5sum(fname):
with open(fname, 'rb') as f:
m = md5()
while True:
d = f.read(8192)
if not d:
break
m.update(d)
return m.hexdigest()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment