Skip to main content

Verified CRC source-code for C, Rust, VHDL, Python — catalogue-driven, self-test embedded.

Project description

crcglot

Verified CRC source code for C, Rust, VHDL, and Python. Catalogue-driven, self-test embedded, multi-language by design.

LLMs will gladly write you CRC code. It might even be right. crcglot guarantees the generated code matches the canonical reveng catalogue test vector (crc("123456789") == <check value>) and ships a self-test you can run on your toolchain to prove it.

Quick start

pip install crcglot

crcglot c crc32 --slice8 file=mycrc       # → mycrc.h + mycrc.c
crcglot rust crc64-xz --slice8 > mycrc.rs
crcglot vhdl crc32 > mycrc.vhd
crcglot python crc16-modbus > mycrc.py

crcglot list                              # browse the catalogue
crcglot info crc32                        # show parameters

What you get per language

Function Purpose
<fname>_init / _update / _finalize Streaming triple — feed data chunk by chunk
<fname> One-shot wrapper that calls the streaming triple
<fname>_self_test Verify against the reveng check value on your toolchain

C / Rust / VHDL ship _self_test() returning 0/1 (or boolean for VHDL). Python verifies via the docstring's check: line — the same interpreter generated it.

Implementations

Flag Description Width support
(default) bit-by-bit Smallest code, zero RAM table, slowest All
--table 256-entry lookup table, 4-8× faster All
--slice8 8 lookup tables, 5-10× faster than --table CRC-32 / CRC-64 only

Each generated file embeds the chosen implementation and the self-test. In constrained embedded targets, standard toolchain flags (-Wl,--gc-sections for C, LTO for Rust) strip whatever you don't call.

Custom polynomials

For algorithms not in the catalogue, pass Rocksoft/Williams parameters directly:

crcglot c --custom width=16 poly=0x1234 init=0xFFFF refin=true refout=true xorout=0x0000 file=mycustom

Catalogue

64+ algorithms covering everything from CRC-8 (ATM, AUTOSAR, Bluetooth, Maxim 1-Wire) through CRC-16 (Modbus, XMODEM, CCITT, IBM SDLC) through CRC-32 (Ethernet, bzip2, iSCSI, AUTOSAR) to CRC-64 (XZ, ECMA-182, NVMe, Redis). Browse with crcglot list.

Acknowledgments

CRC catalogue data is derived from Greg Cook's reveng project — the canonical source for CRC algorithm parameters since 1999.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crcglot-0.1.0.tar.gz (24.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crcglot-0.1.0-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

Details for the file crcglot-0.1.0.tar.gz.

File metadata

  • Download URL: crcglot-0.1.0.tar.gz
  • Upload date:
  • Size: 24.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for crcglot-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bc047478169cb55a5aa229dfff4e418f48ec7737ccd8c8d5cc4efcdbcb422f8f
MD5 33cf2f4980363550f08cb2acb51c06d3
BLAKE2b-256 b774f65b1f69b352da9bc5656b886d02e2d626082977853b70fb8ad67bb406d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for crcglot-0.1.0.tar.gz:

Publisher: publish.yml on hucker/crcglot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file crcglot-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: crcglot-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for crcglot-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 873e11f4708048dadce2482cf08f5a1a40a8389ab15fe443a89c1b99f1fec531
MD5 e33e708930b342845d13e71f793818f8
BLAKE2b-256 938e68fc9b563f24f21143684ed59d1fa3e8d4a2b0b48cb6bf632a97b7c79118

See more details on using hashes here.

Provenance

The following attestation bundles were made for crcglot-0.1.0-py3-none-any.whl:

Publisher: publish.yml on hucker/crcglot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page