crc: Pure Python CRC library · Pythie
Pure Python CRC library
Maintained. Last release 3 months ago, commits in 2 of the last 26 weeks. Weaker on commit activity and release cadence.
CRC
Calculate CRC checksums, verify CRC checksum, predefined CRC configurations, custom CRC configurations
Available CRC Configurations
For convenience various frequently used crc configurations ship with the library out of the box.
CRC8 CRC16 CRC32 CRC64 CCITT XMODEM CRC32 CRC64 AUTOSAR GSM AUTOSAR SAEJ1850 PROFIBUS BZIP2 SAEJ1850_ZERO MODBUS POSIX BLUETOOTH IBM-3740 MAXIM-DOW KERMIT
If you find yourself in the position, where having a new configuration available out of the
box would be desirable, feel free to create a PR or file an issue .
Custom Configurations If you want to create a custom configuration, you should have the following information available:
This library currently only supports bit widths of full bytes 8, 16, 24, 32, ...
width
polynom
init value
final xor value
reversed input
reversed output
In case you only have a name of a specific crc configuration/algorithm and you are unsure what are the specific parameters
of it, a look into this crc-catalogue might help.
Requirements
Installation
Examples
Create a Calculator
Pre defined configuration from crc import Calculator, Crc8
calculator = Calculator(Crc8.CCITT)
Custom configuration from crc import Calculator, Configuration
config = Configuration(
width=8,
polynomial=0x07,
init_value=0x00,
final_xor_value=0x00,
reverse_input=False,
reverse_output=False,
)
calculator = Calculator(config)
Calculate a checksum
Standard from crc import Calculator, Crc8
expected = 0xBC
data = bytes([0, 1, 2, 3, 4, 5])
calculator = Calculator(Crc8.CCITT)
assert expected == calculator.checksum(data)
Optimized for speed from crc import Calculator, Crc8
expected = 0xBC
data = bytes([0, 1, 2, 3, 4, 5])
calculator = Calculator(Crc8.CCITT, optimized=True)
assert expected == calculator.checksum(data)
Verify a checksum
Standard from crc import Calculator, Crc8
expected = 0xBC
data = bytes([0, 1, 2, 3, 4, 5])
calculator = Calculator(Crc8.CCITT)
assert calculator.verify(data, expected)
Optimized for speed from crc import Calculator, Crc8
expected = 0xBC
data = bytes([0, 1, 2, 3, 4, 5])
calculator = Calculator(Crc8.CCITT, optimized=True)
assert calculator.verify(data, expected)
Calculate a checksum with raw registers
Register from crc import Crc8, Register
expected = 0xBC
data = bytes([0, 1, 2, 3, 4, 5])
register = Register(Crc8.CCITT)
register.init()
register.update(data)
assert expected == register.digest()
TableBasedRegister from crc import Crc8, TableBasedRegister
expected = 0xBC
data = bytes([0, 1, 2, 3, 4, 5])
register = TableBasedRegister(Crc8.CCITT)
register.init()
register.update(data)
assert expected == register.digest()
References & Resources Popularity
Downloads, last 7 days 163.2K-10%
Stars, last 7 days –
Direct dependents 29
All dependents 40 45
Fair
Maintenance, out of 100
Recent release
last release 91 days ago
Commit activity
2/26 weeks with commits
Release cadence
1 releases in 12 months
Issues & PRs handled
59% closed in the past year
Contributor spread
7 authors in last 100 commits
Releases
Latest 8.0.0
Released Aug 29, 2026
Releases, 12 months 1
First release May 26, 2018 Compatibility
Requires Python <4.0,>=3.11
Tested on 3.11 · 3.12 · 3.13 · 3.14
License BSD-2-Clause (Permissive) AlternativesUse instead of crc: tools that do the same job, closest first.
Compare with fastcrc → Compare with crc32c → Compare with crccheck → Compare all 4 →
fastcrc 0.5.0 Active Pythie’s Index: 64A hyper-fast Python module for computing CRC(8, 16, 32, 64) checksum
crc32c 2.9.post0 Active Pythie’s Index: 74A python package implementing the crc32c algorithm in hardware and software
crccheck 1.3.1 Maintained Pythie’s Index: 23Calculation library for CRCs and checksums
A python wrapper of the C library 'Google CRC32C'
libscrc 1.8.1 Maintained Pythie’s Index: 9Library for calculating CRC3/CRC4/CRC8/CRC16/CRC24/CRC32/CRC64/CRC82
crcmod 1.7 Inactive Pythie’s Index: 19CRC Generator