The `crc32c` Python package provides an implementation of the CRC32C checksum algorithm, intelligently leveraging hardware acceleration (Intel SSE 4.2, ARMv8 crc32 instructions) when available, and falling back to an optimized software implementation otherwise. As of version 2.8, it offers robust data integrity verification across various platforms. The library aims for regular updates.
pip install crc32cVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic CRC32C calculation, incremental updates, usage of the `CRC32CHash` object, and how to check for hardware acceleration.
Replace `crc32c.crc32(...)` with `crc32c.crc32c(...)`.
If setting `CRC32C_SW_MODE`, use `force` to always use software implementation or `none` to raise an error if hardware is unavailable, instead of `auto`.
Update exception handling for `crc32c` import/execution to catch `RuntimeWarning` or `RuntimeError` when `CRC32C_SW_MODE='none'` is set, instead of `ImportError`.
Ensure your C/C++ compiler (gcc/clang/Visual Studio) is up-to-date and supports modern extensions. Using a platform with pre-built binary wheels from PyPI is the easiest way to avoid this.
Ensure the Python package is installed using pip: `pip install crc32c`. Verify you are in the correct Python environment. If `google-crc32c` is also installed and causing conflicts, try managing dependencies carefully or isolating environments.
Update your code to use the `crc32c()` function instead of the deprecated `crc32()` function: `import crc32c; checksum = crc32c.crc32c(data)`.
Either ensure your CPU has hardware CRC32C support (Intel SSE 4.2 or ARMv8 crc32 instructions), or allow the software fallback by unsetting `CRC32C_SW_MODE` or setting it to 'auto' or 'force'. Example: `export CRC32C_SW_MODE=force` (before running your Python script).
Install the required build tools for your operating system (e.g., `build-essential` on Debian/Ubuntu, Xcode Command Line Tools on macOS, or Visual Studio Build Tools on Windows). Alternatively, try installing a specific version for which a wheel might exist, or ensure you are on a widely supported platform/Python version.
No dependency data recorded yet.