Registry / serialization / libscrc

libscrc

JSON →
library1.8.1pypypi✓ verified 85d ago

libscrc is a Python library designed for calculating various Cyclic Redundancy Check (CRC) values, including CRC3, CRC4, CRC8, CRC16, CRC24, CRC32, CRC64, and CRC82. The latest version is 1.8.1, released on August 18, 2022. While releases are not frequent, the project shows ongoing maintenance and issue tracking through its GitHub repository.

pip install libscrc
INSTALL
IMPORT
SIG · LIBSCRC
L
libscrc
serializationpythonv1.8.1
Install
1.9s avg
Import
Disk
18MB
Pass rate
6/ 10
Env Coverage6 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.8.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 1.75s
py 3.11
✕ build_error
✓ 1.75s
py 3.12
✕ build_error
✓ 1.75s
py 3.13
✕ build_error
✕ build_error
py 3.9
✓ —
✓ 2.2s
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

libscrc
import libscrc
The primary import for accessing all CRC functions.

This quickstart demonstrates how to calculate common CRC types using `libscrc` functions like `modbus`, `intel`, `crc32`, and `xmodem`. It also includes an example of gradual CRC calculation, a feature supported since version 1.4+.

import libscrc # Calculate CRC16 (Modbus RTU) data_modbus = b'\x01\x02\x03\x04' crc_modbus = libscrc.modbus(data_modbus) print(f"CRC16 (Modbus) for {data_modbus.hex()}: {crc_modbus:04X}") # Calculate CRC8 (Intel Hex) data_intel = b'1234' crc_intel = libscrc.intel(data_intel) print(f"CRC8 (Intel Hex) for {data_intel.decode()}: {crc_intel:02X}") # Calculate CRC32 (File/WinRAR) data_crc32 = b'example data' crc_file = libscrc.crc32(data_crc32) print(f"CRC32 (File) for '{data_crc32.decode()}': {crc_file:08X}") # Gradual CRC calculation (e.g., XMODEM), supported since v1.4+ data_part1 = b'hello' data_part2 = b'world' initial_crc = libscrc.xmodem(data_part1) final_crc = libscrc.xmodem(data_part2, initial_crc) print(f"CRC16 (XMODEM) gradually: {final_crc:04X}")
Debug
Known issues
breakingInstallation may fail on systems without a C compiler or specific Python versions due to `libscrc` being a C extension. Pre-built wheels are not available for all Python versions and platforms.
fix
Ensure you have a C compiler and Python development headers installed (e.g., `build-essential` on Linux, Xcode Command Line Tools on macOS, Visual C++ Build Tools on Windows) before attempting `pip install libscrc`.
affects: All versions, especially on non-standard architectures or newer Python versions (e.g., Python 3.10+ on macOS, 3.13+ on other platforms).
gotchaThe API for 'gradually calculating functions' has seen revisions. It was introduced, reverted in v1.4 (2020-08-04) due to issues, and then updated again in v1.7 (2021-06-07).
fix
If using gradual CRC calculation, verify its behavior with your specific `libscrc` version. Refer to the GitHub README or PyPI changelog for the exact functionality available in your installed version.
affects: v1.4 - v1.7
gotchaCRC algorithms have many variants (polynomial, initial value, XOR-out, reflection settings). Using the wrong `libscrc` function or incorrect parameters will result in an invalid CRC.
fix
Always confirm the exact CRC standard you need and consult `libscrc`'s documentation or source code to ensure you are calling the correct function with appropriate parameters (e.g., `poly`, `initvalue`) for your specific use case.
affects: All versions
Errors
Common errors & fixes
ERROR: Failed building wheel for libscrc
The `libscrc` library is a C extension and requires a C compiler (like GCC or Clang) and Python development headers to compile if a pre-built wheel is not available for your system and Python version.
fix
Install the necessary build tools for your operating system. For Debian/Ubuntu: `sudo apt-get install build-essential python3-dev`. For macOS: `xcode-select --install`. For Windows, install 'Desktop development with C++' from Visual Studio Installer.
ModuleNotFoundError: No module named 'libscrc' (or ImportError)
This usually indicates that the `libscrc` package failed to install correctly, often due to compilation errors during the C extension build process, even if `pip install` seemed to finish.
fix
Review the output of `pip install libscrc` for any error messages, especially those related to building wheels or C compilation. Ensure a C compiler and Python development headers are installed, then try reinstalling.
Upgrade
Version history
1.8.1latest on PyPI · released Aug 18, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
4
Amazon
1
Resources
libscrc — pip install libscrc · libregistry