tkue
6/21/2017 - 12:35 AM

Calculate CRC32

Calculate CRC32

def calc_crc32(file_path: str):
    if not file_path:
        return

    import binascii

    with open(file_path, 'rb') as f:
        buf = f.read()
        buf = (binascii.crc32(buf) & 0xFFFFFFFF)
        return "%08X" % buf