Skip to content

Instantly share code, notes, and snippets.

@F-atal1ty
F-atal1ty / CalculateMd5
Created March 8, 2022 02:00 — forked from juusimaa/CalculateMd5
Python (3.x) function to calculate MD5 checksum for given file.
def calculateMD5(filename, block_size=2**20):
"""Returns MD% checksum for given file.
"""
import hashlib
md5 = hashlib.md5()
try:
file = open(filename, 'rb')
while True:
data = file.read(block_size)