Skip to content

Instantly share code, notes, and snippets.

@detrout
Created December 6, 2022 18:58
Show Gist options
  • Save detrout/4db9b2647d2b2bb23ce5124bf03fb533 to your computer and use it in GitHub Desktop.
Save detrout/4db9b2647d2b2bb23ce5124bf03fb533 to your computer and use it in GitHub Desktop.
Example of generating md5sums.
def make_python_md5sum(filename):
with open(filename, "rb") as instream:
md5 = hashlib.md5()
# for large files this might need to be a loop reading in
# chunks. md5.update will work correctly when being given blocks
block = instream.read()
md5.update(block)
return md5.hexdigest()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment