Created
March 28, 2018 12:01
-
-
Save SergioLaRosa/9a7a67e12a93b16bb7e7586f809a2926 to your computer and use it in GitHub Desktop.
Simple script to get md5 hash from files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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