import hashlib
def md5_large_file(file_path): md5 = hashlib.md5() with open(file_path, “rb”) as f: for chunk in iter(lambda: f.read(4096), b""): md5.update(chunk)
return md5.hexdigest()
file_path = “large_file.txt” md5_hash = md5_large_file(file_path) print(f"MD5 hash of the file {file_path}: {md5_hash}")