
Research
SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.
crc
Advanced tools
Calculate CRC checksums, verify CRC checksum, predefined CRC configurations, custom 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.
If you want to create a custom configuration, you should have the following information available:
🗒 Note:
This library currently only supports bit widths of full bytes 8, 16, 24, 32, ...
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.
pip install crc
from crc import Calculator, Crc8
calculator = Calculator(Crc8.CCITT)
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)
from crc import Calculator, Crc8
expected = 0xBC
data = bytes([0, 1, 2, 3, 4, 5])
calculator = Calculator(Crc8.CCITT)
assert expected == calculator.checksum(data)
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)
from crc import Calculator, Crc8
expected = 0xBC
data = bytes([0, 1, 2, 3, 4, 5])
calculator = Calculator(Crc8.CCITT)
assert calculator.verify(data, expected)
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)
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()
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()
FAQs
Pure Python CRC library
We found that crc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.