Skip to content

Instantly share code, notes, and snippets.

@SergioLaRosa
Created March 28, 2018 12:01
Show Gist options
  • Save SergioLaRosa/9a7a67e12a93b16bb7e7586f809a2926 to your computer and use it in GitHub Desktop.
Save SergioLaRosa/9a7a67e12a93b16bb7e7586f809a2926 to your computer and use it in GitHub Desktop.
Simple script to get md5 hash from files
#Written by Sergio La Rosa ([email protected])
#https://gist.github.com/SergioLaRosa/
#IMPORTANT: Python 3 only
import hashlib
#Change this parameters
filename = "example.bin"
read_bytes = 1024
m = hashlib.md5()
with open(filename, "rb") as f:
while True:
buf = f.read(read_bytes)
if not buf:
break
m.update(buf)
print(m.hexdigest())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment