{"id":9471,"library":"anycrc","title":"AnyCRC Library","description":"anycrc is a Python library providing extremely fast CRC (Cyclic Redundancy Check) calculations. It leverages hardware acceleration on Intel (SSE4.2, AVX512) and Arm (ARMv8-CRC) processors for significant speedups, claiming up to 10x faster than previous versions. The current version is 2.0.0, maintaining an active development pace with notable updates for performance and Python version compatibility.","status":"active","version":"2.0.0","language":"en","source_language":"en","source_url":"https://github.com/marzooqy/anycrc","tags":["crc","checksum","hardware-acceleration","performance"],"install":[{"cmd":"pip install anycrc","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"crc","correct":"from anycrc import crc"}],"quickstart":{"code":"from anycrc import crc\n\n# Calculate CRC32 MPEG2\nc32 = crc.crc32_mpeg2()\nchecksum_mpeg2 = c32.calc(b\"Hello, World!\")\nprint(f\"CRC32 MPEG2 of 'Hello, World!': {checksum_mpeg2:08x}\")\n\n# Calculate CRC16 CCITT\nc16 = crc.crc16_ccitt()\nchecksum_ccitt = c16.calc(b\"Another string\")\nprint(f\"CRC16 CCITT of 'Another string': {checksum_ccitt:04x}\")","lang":"python","description":"Initialize a CRC algorithm object and then use its `calc()` method to compute the checksum for byte-like data."},"warnings":[{"fix":"Update your code to instantiate CRC algorithms as objects (e.g., `c = crc.crc32_mpeg2()`) and then call the `calc()` method on the instance (e.g., `c.calc(data)`). Refer to the official documentation or GitHub README for updated API usage.","message":"Version 2.0.0 switched the underlying CRC implementation from `crcany` to a custom library and introduced significant API changes due to a new object caching mechanism (introduced in 1.3.0). Direct calls to global functions like `anycrc.crc32()` are no longer supported.","severity":"breaking","affected_versions":">=1.3.0, >=2.0.0"},{"fix":"Upgrade your Python environment to version 3.8 or newer to use current `anycrc` releases.","message":"Python 3.7 support was officially dropped in version 1.3.5. Users running Python 3.7 will not be able to install or use anycrc versions 1.3.5 or newer.","severity":"deprecated","affected_versions":">=1.3.5"},{"fix":"No action is strictly required as the library gracefully falls back. However, for maximum performance, ensure the application runs on hardware with the specified CRC acceleration instructions. No user-level configuration is available to force hardware acceleration.","message":"While anycrc provides significant speedups through hardware acceleration on compatible Intel and Arm CPUs, performance will degrade to a software implementation if the necessary CPU features (e.g., SSE4.2, AVX512 for Intel; ARMv8-CRC for Arm) are not present.","severity":"gotcha","affected_versions":"All versions >=2.0.0"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Ensure you are importing `crc` as `from anycrc import crc` and then instantiating the specific CRC algorithm, e.g., `c = crc.crc32_mpeg2()`.","cause":"Attempting to access a CRC algorithm directly from the `anycrc` module or as a static method, when it's an attribute of the `crc` submodule and requires instantiation.","error":"AttributeError: module 'anycrc.crc' has no attribute 'crc32_mpeg2'"},{"fix":"First create an instance of the CRC algorithm: `c = crc.crc32_mpeg2()`, then call `calc()` on that instance: `checksum = c.calc(data)`.","cause":"This error occurs if you try to call the `calc()` method on the CRC algorithm class itself (e.g., `crc.crc32_mpeg2.calc(data)`) instead of on an instantiated object of that class.","error":"TypeError: calc() missing 1 required positional argument: 'data'"},{"fix":"Convert your string to bytes using `.encode()` or prefix it with `b` (e.g., `b\"my string\"`) before passing it to `calc()`.","cause":"The `calc()` method expects binary data (bytes or bytearray) for CRC calculation, but a string was provided.","error":"TypeError: argument must be a bytes-like object, not str"}]}