CRC¶
A pure Python library to calculate and verify CRC checksums.
What it does¶
from crc import Calculator, Crc8
calculator = Calculator(Crc8.CCITT)
calculator.checksum(b"123456789") # (1)!
calculator.verify(b"123456789", 0xF4) # (2)!
- Returns the checksum as an
int, here0xF4. - Returns
Trueif the data matches the expected checksum.
Why use it¶
-
No dependencies
Does not contribute to potentional dependency conflicts, easy to vendor if needed.
-
Batteries included
More than 20 predefined configurations, plus support for custom configurations.
-
Portable
As pure Python library with no native dependencies it runs wherever a python runs.
-
Flexible input
Works with
bytes,int,files,streams,iterablesand anything convertible tobytes.
Where to go next¶
-
Getting started
Install the library and calculate your first checksum.
-
Usage guide
Task oriented guides for calculating, verifying and configuring CRCs.
-
Configurations
Browse every CRC configuration that ships with the library, including all of their parameters.
-
API reference
Detailed documentation for the
Calculator,Configurationand the low level register types. -
Command line
Generate CRC lookup tables straight from your terminal with the bundled
crccommand. -
Development
Set up a development environment and learn how to contribute.
Project links¶
-
Source code
-
Package
-
Issues
-
License