Skip to content

Instantly share code, notes, and snippets.

@delarco
Created April 8, 2021 02:17
Show Gist options
  • Save delarco/8625b1513f4a2c38d2cd65d022af5058 to your computer and use it in GitHub Desktop.
Save delarco/8625b1513f4a2c38d2cd65d022af5058 to your computer and use it in GitHub Desktop.
import sys
import hashlib
def get_file_md5(filepath):
hash_md5 = hashlib.md5()
with open(filepath, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_md5.update(chunk)
return hash_md5.hexdigest()
print(get_file_md5(sys.argv[1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment