Registry / serialization / crcmod-plus

crcmod-plus

JSON →
library2.3.1pypypi✓ verified 24d ago

crcmod-plus is a modernized Python package for generating objects that compute the Cyclic Redundancy Check (CRC). It is a drop-in replacement for the original `crcmod` 1.7 package, having dropped Python 2 support and updated the build pipeline for modern Python environments. It enables the use of any 8, 16, 24, 32, or 64-bit CRC, allowing users to specify custom polynomials or utilize a variety of predefined CRC algorithms. The library maintains a moderate release cadence, primarily focusing on Python compatibility and minor enhancements.

pip install crcmod-plus
INSTALL
IMPORT
SIG · CRCMOD-PLUS
C
crcmod-plus
serializationpythonv2.3.1
Install
1.6s avg
Import
14ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.3.1 · 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 · 17.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.014s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

mkCrcFun
from crcmod import mkCrcFun
import crcmod
Crc
from crcmod import Crc
import crcmod
crcmod
from crcmod import crcmod
import crcmod

This quickstart demonstrates how to calculate CRCs using both custom polynomials via `crcmod.mkCrcFun` and `crcmod.Crc` class, and predefined algorithms via `crcmod.predefined.mkCrcFun` and `crcmod.predefined.PredefinedCrc` class.

import crcmod import crcmod.predefined # --- Custom CRC-32 calculation --- # Create a CRC function using a custom polynomial (e.g., CRC-32-ISO-HDLC) crc32_func_custom = crcmod.mkCrcFun(0x104C11DB7, initCrc=0, xorOut=0xFFFFFFFF) data_bytes = b"123456789" crc_value_custom = crc32_func_custom(data_bytes) print(f"Custom CRC-32 for '123456789': {hex(crc_value_custom)}") # Alternatively, use the Crc class for a stateful calculator crc32_obj_custom = crcmod.Crc(0x104C11DB7, initCrc=0, xorOut=0xFFFFFFFF) crc32_obj_custom.update(b"123") crc32_obj_custom.update(b"456789") print(f"Custom CRC-32 (Crc class) for '123456789': {hex(crc32_obj_custom.crcValue)}") # --- Predefined CRC-16 (XMODEM) calculation --- # Create a CRC function using a predefined algorithm name crc16_func_xmodem = crcmod.predefined.mkCrcFun('xmodem') crc_value_xmodem = crc16_func_xmodem(data_bytes) print(f"Predefined CRC-16 (XMODEM) for '123456789': {hex(crc_value_xmodem)}") # Alternatively, use the PredefinedCrc class crc16_obj_xmodem = crcmod.predefined.PredefinedCrc('xmodem') crc16_obj_xmodem.update(data_bytes) print(f"Predefined CRC-16 (XMODEM, PredefinedCrc class) for '123456789': {hex(crc16_obj_xmodem.crcValue)}")
Debug
Known issues
breakingcrcmod-plus dropped support for Python 2.x. If migrating from the original `crcmod` 1.7, ensure your environment is Python 3.9 or newer.
fix
Upgrade to Python 3.9+ and install `crcmod-plus`.
affects: <2.0.0 (original `crcmod`) -> 2.0.0+
gotchaCRC functions and classes in `crcmod-plus` (and `crcmod`) expect byte strings (`bytes`) as input for Python 3.x. Passing Unicode strings (`str`) will result in a TypeError.
fix
Ensure all input data is encoded to `bytes` (e.g., `my_string.encode('utf-8')`) before passing it to CRC functions.
affects: 2.0.0+
gotchaWhile `crcmod-plus` is a drop-in replacement for `crcmod` 1.7, it is a distinct package. Users should explicitly install `crcmod-plus` for the modernized, Python 3-compatible version, as the original `crcmod` on PyPI is old and unmaintained.
fix
Always use `pip install crcmod-plus` to ensure you are getting the actively maintained and Python 3.9+ compatible version.
affects: All versions
gotchaThe `crcmod.predefined` module, which contains standard CRC algorithms, needs to be explicitly imported (e.g., `import crcmod.predefined`). Symbols like `mkPredefinedCrcFun` are not directly available under `import crcmod`.
fix
Always use `import crcmod.predefined` when intending to use predefined CRC algorithms or classes.
affects: All versions, especially before 2.3.1 if relying on implicit side-effects
Upgrade
Version history
2.3.1latest on PyPI · released Oct 10, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
26 hits · last 30 days
node
22
Resources
crcmod-plus — pip install crcmod-plus · libregistry