AnyCRC Library

2.0.0 · active · verified Fri Apr 17

anycrc is a Python library providing extremely fast CRC (Cyclic Redundancy Check) calculations. It leverages hardware acceleration on Intel (SSE4.2, AVX512) and Arm (ARMv8-CRC) processors for significant speedups, claiming up to 10x faster than previous versions. The current version is 2.0.0, maintaining an active development pace with notable updates for performance and Python version compatibility.

Common errors

Warnings

Install

Imports

Quickstart

Initialize a CRC algorithm object and then use its `calc()` method to compute the checksum for byte-like data.

from anycrc import crc

# Calculate CRC32 MPEG2
c32 = crc.crc32_mpeg2()
checksum_mpeg2 = c32.calc(b"Hello, World!")
print(f"CRC32 MPEG2 of 'Hello, World!': {checksum_mpeg2:08x}")

# Calculate CRC16 CCITT
c16 = crc.crc16_ccitt()
checksum_ccitt = c16.calc(b"Another string")
print(f"CRC16 CCITT of 'Another string': {checksum_ccitt:04x}")

view raw JSON →