Skip to content

Instantly share code, notes, and snippets.

@igorzakhar
Last active April 20, 2017 16:33
Show Gist options
  • Save igorzakhar/e17369f84b1a5bafb6e4c3eb4a87e89c to your computer and use it in GitHub Desktop.
Save igorzakhar/e17369f84b1a5bafb6e4c3eb4a87e89c to your computer and use it in GitHub Desktop.
MD5 checksum of a file
#from http://stackoverflow.com/questions/3431825/generating-an-md5-checksum-of-a-file
def md5(fname):
hash_md5 = hashlib.md5()
with open(fname, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_md5.update(chunk)
return hash_md5.hexdigest()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment