Created
February 7, 2019 09:53
-
-
Save ahmedsadman/7388585c87be8df0fd26b336f004fb15 to your computer and use it in GitHub Desktop.
Check file MD5
This file contains 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
import hashlib | |
def check_md5(filename, block_size = 128): | |
f = open(filename, 'rb') | |
md5 = hashlib.md5() | |
while True: | |
data = f.read(block_size) | |
if not data:break | |
md5.update(data) | |
f.close() | |
return md5.hexdigest().upper() | |
print check_md5('download.txt') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment