fastcrc is a hyper-fast Python module for computing CRC (Cyclic Redundancy Check) checksums across 8, 16, 32, and 64-bit standards. It leverages highly optimized Rust code for performance. The current version is 0.3.5, and it maintains an active release cadence with several updates per year, focusing on performance, platform support, and new CRC algorithms.
pip install fastcrcVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import and use the fastcrc library to compute checksums for various CRC standards (8, 16, 32, 64-bit) using different algorithms. It also shows an example of chained CRC calculation using the optional 'initial' parameter.
Upgrade to Python 3.7 or newer, or pin fastcrc to <0.3.0.
Avoid using these experimental functions for production code, or be prepared for potential removal or API changes.
Ensure data is encoded to bytes (e.g., `my_string.encode('utf-8')`) before passing it to CRC functions.Consult the documentation for proper usage of the `initial` parameter when performing incremental CRC calculations across multiple data chunks.
Ensure fastcrc is installed using pip: `pip install fastcrc`
Convert the string to bytes before passing it to fastcrc functions, typically by encoding it (e.g., `data_string.encode('utf-8')`).
`import fastcrc.crc32
data = "123456789".encode('utf-8')
checksum = fastcrc.crc32.aixm(data)`Consult the fastcrc documentation or source code to verify the correct name of the desired CRC algorithm (e.g., 'cdma2000', 'xmodem', 'aixm') for the given bit width (crc8, crc16, crc32, crc64). The available algorithms can be listed programmatically (e.g., `dir(fastcrc.crc16)`). `from fastcrc import crc16 data = b"test" checksum = crc16.xmodem(data)`
Verify that all CRC parameters (algorithm name, initial value, `refin`, `refout`, `xorout`, and polynomial) used by fastcrc exactly match the specification of the external system or online calculator. Fastcrc provides many standard algorithms; ensure you are calling the correct one for your specific CRC standard. Also ensure the input data type is `bytes` (not `str`).
No dependency data recorded yet.