{"library":"crc32c","title":"CRC32C Checksum Library","description":"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.","status":"active","version":"2.8","language":"en","source_language":"en","source_url":"https://github.com/ICRAR/crc32c","tags":["crc32c","checksum","hardware-acceleration","data-integrity","hashing"],"install":[{"cmd":"pip install crc32c","lang":"bash","label":"Install crc32c"}],"dependencies":[],"imports":[{"note":"Main module import","symbol":"crc32c","correct":"import crc32c"},{"note":"The 'crc32c.crc32' function is deprecated; use 'crc32c.crc32c' instead for the core checksum calculation.","wrong":"crc32c.crc32(data)","symbol":"crc32c","correct":"crc32c.crc32c(data)"},{"note":"For streaming checksum calculations with a hash-like object.","symbol":"CRC32CHash","correct":"from crc32c import CRC32CHash"}],"quickstart":{"code":"import crc32c\n\n# Calculate CRC32C for a byte string\ndata = b\"hello world\"\nchecksum = crc32c.crc32c(data)\nprint(f\"CRC32C checksum of '{data.decode()}': {checksum}\")\n\n# Incremental calculation (similar to binascii.crc32 with 'value' parameter)\ncrc_part1 = crc32c.crc32c(b\"hello\")\ncrc_total = crc32c.crc32c(b\" world\", value=crc_part1)\nprint(f\"Incremental CRC32C: {crc_total}\")\n\n# Using the hash-like object\nhash_obj = crc32c.CRC32CHash()\nhash_obj.update(b\"hello\")\nhash_obj.update(b\" world\")\nprint(f\"CRC32CHash object checksum: {hash_obj.checksum}\")\n\n# Check if hardware acceleration is in use\nprint(f\"Hardware acceleration in use: {crc32c.hardware_based}\")","lang":"python","description":"Demonstrates basic CRC32C calculation, incremental updates, usage of the `CRC32CHash` object, and how to check for hardware acceleration."},"warnings":[{"fix":"Replace `crc32c.crc32(...)` with `crc32c.crc32c(...)`.","message":"The `crc32c.crc32` function is deprecated and will be removed in future versions. Users should switch to `crc32c.crc32c` for all checksum calculations.","severity":"deprecated","affected_versions":"<=2.8"},{"fix":"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`.","message":"The `auto` value for the `CRC32C_SW_MODE` environment variable, which controls software fallback behavior, is planned for discontinuation. It's recommended to explicitly use `force` or `none` if specific fallback control is needed.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update exception handling for `crc32c` import/execution to catch `RuntimeWarning` or `RuntimeError` when `CRC32C_SW_MODE='none'` is set, instead of `ImportError`.","message":"In versions up to 2.6, an `ImportError` was raised if no hardware support was found and software fallback was not enabled. As of version 2.7, this behavior has changed: `CRC32C_SW_MODE='none'` will now issue a `RuntimeWarning` on import and a `RuntimeError` on execution if hardware support is missing.","severity":"breaking","affected_versions":">=2.7 (breaking change from <=2.6)"},{"fix":"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.","message":"The project uses specific `gcc`/`clang` compiler extensions. If installing from source (e.g., when no pre-built wheel is available for your platform/Python version), older compiler versions might fail to build the package.","severity":"gotcha","affected_versions":"All versions (when building from source)"}],"env_vars":null,"last_verified":"2026-04-06T00:00:00.000Z","next_check":"2026-07-05T00:00:00.000Z"}