Registry / serialization / fastcrc

fastcrc

JSON →
library0.3.6pypypi✓ verified 24d ago

fastcrc is a hyper-fast Python module for computing CRC (Cyclic Redundancy Check) checksums across 8, 16, 32, and 64-bit standards. It leverages highly optimized Rust code for performance. The current version is 0.3.5, and it maintains an active release cadence with several updates per year, focusing on performance, platform support, and new CRC algorithms.

pip install fastcrc
INSTALL
IMPORT
SIG · FASTCRC
F
fastcrc
serializationpythonv0.3.6
Install
1.6s avg
Import
14ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.6 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.014s · 19.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.014s · 19MB
17MB installed
● package 17MB
Code
Verified usage

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

crc8
from fastcrc import crc8
Imports specific CRC bit-width modules to access various algorithms.
crc16
from fastcrc import crc16
Imports specific CRC bit-width modules to access various algorithms.
crc32
from fastcrc import crc32
Imports specific CRC bit-width modules to access various algorithms.
crc64
from fastcrc import crc64
Imports specific CRC bit-width modules to access various algorithms.

This quickstart demonstrates how to import and use the fastcrc library to compute checksums for various CRC standards (8, 16, 32, 64-bit) using different algorithms. It also shows an example of chained CRC calculation using the optional 'initial' parameter.

from fastcrc import crc8, crc16, crc32, crc64 data = b"123456789" # Compute CRC-8 using the cdma2000 algorithm print(f"crc8 checksum with cdma2000 algorithm: {crc8.cdma2000(data)}") # Compute CRC-16 using the xmodem algorithm print(f"crc16 checksum with xmodem algorithm: {crc16.xmodem(data)}") # Compute CRC-32 using the aixm algorithm print(f"crc32 checksum with aixm algorithm: {crc32.aixm(data)}") # Compute CRC-64 using the ecma_182 algorithm print(f"crc64 checksum with ecma_182 algorithm: {crc64.ecma_182(data)}") # Chained CRC calculation with initial data initial_crc = crc16.xmodem(b'1234') final_crc = crc16.xmodem(b'56789', initial_crc) print(f"crc16 checksum with xmodem algorithm (chained): {final_crc}")
Debug
Known issues
breakingSupport for Python 3.6 was dropped in version 0.3.0. Users on Python 3.6 must use an older version of fastcrc.
fix
Upgrade to Python 3.7 or newer, or pin fastcrc to <0.3.0.
affects: >=0.3.0
deprecatedThe functions `fastcrc.crc16.ibm_refin` and `fastcrc.crc32.reversed_reciprocal_refin` were introduced as experimental in v0.2.1 and may be removed in future releases without further notice.
fix
Avoid using these experimental functions for production code, or be prepared for potential removal or API changes.
affects: >=0.2.1
gotchaAll CRC functions in `fastcrc` expect bytes-like objects as input data. Passing other types (e.g., string) will result in a TypeError.
fix
Ensure data is encoded to bytes (e.g., `my_string.encode('utf-8')`) before passing it to CRC functions.
affects: All versions
gotchaVersion 0.2.0 introduced an `initial` optional parameter to all CRC functions, allowing for chained CRC calculations. If migrating from older versions, ensure you are aware of this parameter for multi-part data processing.
fix
Consult the documentation for proper usage of the `initial` parameter when performing incremental CRC calculations across multiple data chunks.
affects: >=0.2.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'fastcrc'
The 'fastcrc' package is not installed in your Python environment or is not accessible in the current PYTHONPATH.
fix
Ensure fastcrc is installed using pip: `pip install fastcrc`
TypeError: 'str' object cannot be converted to 'bytes' implicitly
Fastcrc functions expect byte-like objects (e.g., `bytes` or `bytearray`) as input for the `data` argument, but a Python string (`str`) was provided.
fix
Convert the string to bytes before passing it to fastcrc functions, typically by encoding it (e.g., `data_string.encode('utf-8')`).
`import fastcrc.crc32
data = "123456789".encode('utf-8')
checksum = fastcrc.crc32.aixm(data)`
AttributeError: module 'fastcrc.crcXX' has no attribute 'YYY'
You are trying to call a CRC algorithm (YYY) that does not exist or is misspelled within the specified CRC width module (crcXX, e.g., crc8, crc16).
fix
Consult the fastcrc documentation or source code to verify the correct name of the desired CRC algorithm (e.g., 'cdma2000', 'xmodem', 'aixm') for the given bit width (crc8, crc16, crc32, crc64). The available algorithms can be listed programmatically (e.g., `dir(fastcrc.crc16)`).
`from fastcrc import crc16
data = b"test"
checksum = crc16.xmodem(data)`
Fastcrc CRC result mismatch / unexpected CRC value
The calculated CRC checksum does not match an expected value (e.g., from an online calculator or another system) because different CRC parameters (algorithm, initial value, polynomial, reflection, XOR output) are being used.
fix
Verify that all CRC parameters (algorithm name, initial value, `refin`, `refout`, `xorout`, and polynomial) used by fastcrc exactly match the specification of the external system or online calculator. Fastcrc provides many standard algorithms; ensure you are calling the correct one for your specific CRC standard. Also ensure the input data type is `bytes` (not `str`).
Upgrade
Version history
0.3.6latest on PyPI · released May 6, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
25 hits · last 30 days
node
24
Resources
fastcrc — pip install fastcrc · libregistry