Registry / serialization / crcengine

crcengine

JSON →
library0.4.0.post1pypypi✓ verified 85d ago

A library for CRC calculation and code generation in Python. Current version 0.4.0.post1. Supports many CRC algorithms and can generate CRC code. Release cadence is sporadic.

pip install crcengine
INSTALL
IMPORT
SIG · CRCENGINE
C
crcengine
serializationpythonv0.4.0.post1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

crcengine
import crcengine

Compute CRC using predefined or custom parameters.

import crcengine # Predefined algorithms available crc = crcengine.new('crc32c') data = b'hello world' checksum = crc(data) print(hex(checksum)) # e.g. 0x... # Using CrcParams for custom CRC (v0.4.0+) from crcengine import CrcParams params = CrcParams(width=16, polynomial=0x8005, seed=0x0000, reflect_input=False, reflect_output=False, xor_out=0x0000) crc16 = crcengine.new(params) print(hex(crc16(b'test')))
Debug
Known issues
deprecatedPassing separate polynomial and seed arguments to crcengine.new() is deprecated since v0.4.0. Use CrcParams instead.
fix
Use from crcengine import CrcParams; params = CrcParams(...); crc = crcengine.new(params)
affects: >=0.4.0
gotchaCRC polynomials under 8 bits wide caused an invalid shift and Exception before v0.4.0. Fixed in v0.4.0.
fix
Upgrade to v0.4.0+ or avoid polynomials <8 bits width.
affects: <0.4.0
gotchaFunction crcengine.new() returns a callable that takes bytes, not a class instance. Do not attempt to create instances.
fix
Call the returned function directly: crc = crcengine.new('crc32'); crc(b'data')
affects: all
Errors
Common errors & fixes
AttributeError: module 'crcengine' has no attribute 'CrcParams'
Using crcengine version <0.4.0 which does not have CrcParams.
fix
Upgrade crcengine: pip install --upgrade crcengine
TypeError: new() got an unexpected keyword argument 'polynomial'
Passing separate polynomial/seed arguments is deprecated in v0.4.0+ and removed in some versions? Actually it's deprecated but still works in 0.4.0. Might be removed later.
fix
Use CrcParams object: from crcengine import CrcParams; crcengine.new(CrcParams(...))
Upgrade
Version history
0.4.0.post1latest on PyPI · released Apr 16, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
crcengine — pip install crcengine · libregistry