The `crc` library provides pure Python implementations for calculating, verifying, and configuring Cyclic Redundancy Check (CRC) checksums. It supports various predefined CRC configurations (e.g., CRC8, CRC16, CRC32, CRC64) and allows for custom configurations. Currently at version 7.1.0, the library is actively maintained with regular releases, often including new CRC configurations and bug fixes, and requires Python >=3.8 and <4.0.
pip install crcVerified import paths — ran on the pinned version, not inferred.
Calculates the CRC-8 CCITT checksum for a sample byte sequence and verifies it. This demonstrates the basic usage of a predefined CRC configuration.
Replace `Crc16.CCITT` with `Crc16.XMODEM` if you relied on the previous values, or with `Crc16.KERMIT` for the new official CCITT parameters.
Upgrade your Python environment to version 3.8 or newer.
If your application depends on the original (pre-6.0.0) `SAEJ1850` values, switch to `SAE_J1850_ZERO`. Otherwise, continue using `SAEJ1850` for the corrected specification.
Ensure all imports follow standard package patterns, e.g., `from crc import Calculator, Crc8`.
Upgrade to version 6.1.2 or newer to resolve this issue. In older affected versions, avoid manual manipulation of CRC registers if relying on reverse output configurations.
Run `pip install crc` to install the library.
Encode the string to bytes before passing it to the checksum method, e.g., `data.encode('utf-8')`.First, create a `Calculator` instance with the desired configuration, then call `checksum` on the calculator, e.g., `calculator = Calculator(Crc8.CCITT)` and then `calculator.checksum(data)`.