#!/usr/bin/env python3 import zlib file_path='/home/thomas/test' crc32_hash = 0 with open(file_path, 'rb') as f: while chunk := f.read(8192): crc32_hash = zlib.crc32(chunk, crc32_hash) print(format(crc32_hash & 0xFFFFFFFF, '08x')) dd if=/dev/zero bs=1M of=/home/thomas/test count=40960