Skip to content

Latest commit

 

History

History
15 lines (12 loc) · 363 Bytes

snippets.md

File metadata and controls

15 lines (12 loc) · 363 Bytes

Snippets

Checksum of files (python)

import zlib

def crc32(filename, chunksize=65536): """Compute the CRC-32 checksum of the contents of the given filename""" with open(filename, "rb") as f: checksum = 0 while (chunk := f.read(chunksize)) : checksum = zlib.crc32(chunk, checksum) return checksum