Registry / serialization / anycrc

anycrc

JSON →
library2.0.0pypypi✓ verified 85d ago

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.

pip install anycrc
INSTALL
IMPORT
SIG · ANYCRC
A
anycrc
serializationpythonv2.0.0
Install
2.4s avg
Import
40ms
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.024s · 20.4MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.4s · import 0.024s · 22MB
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

crc
from anycrc import crc

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}")
Debug
Known issues
breakingVersion 2.0.0 switched the underlying CRC implementation from `crcany` to a custom library and introduced significant API changes due to a new object caching mechanism (introduced in 1.3.0). Direct calls to global functions like `anycrc.crc32()` are no longer supported.
fix
Update your code to instantiate CRC algorithms as objects (e.g., `c = crc.crc32_mpeg2()`) and then call the `calc()` method on the instance (e.g., `c.calc(data)`). Refer to the official documentation or GitHub README for updated API usage.
affects: >=1.3.0, >=2.0.0
deprecatedPython 3.7 support was officially dropped in version 1.3.5. Users running Python 3.7 will not be able to install or use anycrc versions 1.3.5 or newer.
fix
Upgrade your Python environment to version 3.8 or newer to use current `anycrc` releases.
affects: >=1.3.5
gotchaWhile anycrc provides significant speedups through hardware acceleration on compatible Intel and Arm CPUs, performance will degrade to a software implementation if the necessary CPU features (e.g., SSE4.2, AVX512 for Intel; ARMv8-CRC for Arm) are not present.
fix
No action is strictly required as the library gracefully falls back. However, for maximum performance, ensure the application runs on hardware with the specified CRC acceleration instructions. No user-level configuration is available to force hardware acceleration.
affects: All versions >=2.0.0
Errors
Common errors & fixes
AttributeError: module 'anycrc.crc' has no attribute 'crc32_mpeg2'
Attempting to access a CRC algorithm directly from the `anycrc` module or as a static method, when it's an attribute of the `crc` submodule and requires instantiation.
fix
Ensure you are importing `crc` as `from anycrc import crc` and then instantiating the specific CRC algorithm, e.g., `c = crc.crc32_mpeg2()`.
TypeError: calc() missing 1 required positional argument: 'data'
This error occurs if you try to call the `calc()` method on the CRC algorithm class itself (e.g., `crc.crc32_mpeg2.calc(data)`) instead of on an instantiated object of that class.
fix
First create an instance of the CRC algorithm: `c = crc.crc32_mpeg2()`, then call `calc()` on that instance: `checksum = c.calc(data)`.
TypeError: argument must be a bytes-like object, not str
The `calc()` method expects binary data (bytes or bytearray) for CRC calculation, but a string was provided.
fix
Convert your string to bytes using `.encode()` or prefix it with `b` (e.g., `b"my string"`) before passing it to `calc()`.
Upgrade
Version history
2.0.0latest on PyPI · released Mar 24, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
35 hits · last 30 days
node
30
OpenAI (training)
1
Resources