Created
October 29, 2019 08:43
-
-
Save thuhak/0cd0507f1cc8b646332c0cd86088e4d4 to your computer and use it in GitHub Desktop.
check_md5
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
from hashlib import md5 | |
from functools import partial | |
def calc_md5(some_file): | |
mymd5 = md5() | |
try: | |
with open(some_file, 'rb') as f: | |
data = iter(partial(f.read, 8192), b'') | |
for d in data: | |
mymd5.update(d) | |
return mymd5.hexdigest() | |
except: | |
return None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment