{"id":5165,"library":"crcmod-plus","title":"CRCmod-plus","description":"crcmod-plus is a modernized Python package for generating objects that compute the Cyclic Redundancy Check (CRC). It is a drop-in replacement for the original `crcmod` 1.7 package, having dropped Python 2 support and updated the build pipeline for modern Python environments. It enables the use of any 8, 16, 24, 32, or 64-bit CRC, allowing users to specify custom polynomials or utilize a variety of predefined CRC algorithms. The library maintains a moderate release cadence, primarily focusing on Python compatibility and minor enhancements.","status":"active","version":"2.3.1","language":"python","source_language":"en","source_url":"https://github.com/ntamas/crcmod-plus","tags":["crc","checksum","data integrity","cryptography","crcmod"],"install":[{"cmd":"pip install crcmod-plus","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"wrong":"import crcmod","symbol":"mkCrcFun","correct":"from crcmod import mkCrcFun"},{"wrong":"import crcmod","symbol":"Crc","correct":"from crcmod import Crc"},{"wrong":"import crcmod","symbol":"crcmod","correct":"from crcmod import crcmod"}],"quickstart":{"code":"import crcmod\nimport crcmod.predefined\n\n# --- Custom CRC-32 calculation ---\n# Create a CRC function using a custom polynomial (e.g., CRC-32-ISO-HDLC)\ncrc32_func_custom = crcmod.mkCrcFun(0x104C11DB7, initCrc=0, xorOut=0xFFFFFFFF)\ndata_bytes = b\"123456789\"\ncrc_value_custom = crc32_func_custom(data_bytes)\nprint(f\"Custom CRC-32 for '123456789': {hex(crc_value_custom)}\")\n\n# Alternatively, use the Crc class for a stateful calculator\ncrc32_obj_custom = crcmod.Crc(0x104C11DB7, initCrc=0, xorOut=0xFFFFFFFF)\ncrc32_obj_custom.update(b\"123\")\ncrc32_obj_custom.update(b\"456789\")\nprint(f\"Custom CRC-32 (Crc class) for '123456789': {hex(crc32_obj_custom.crcValue)}\")\n\n# --- Predefined CRC-16 (XMODEM) calculation ---\n# Create a CRC function using a predefined algorithm name\ncrc16_func_xmodem = crcmod.predefined.mkCrcFun('xmodem')\ncrc_value_xmodem = crc16_func_xmodem(data_bytes)\nprint(f\"Predefined CRC-16 (XMODEM) for '123456789': {hex(crc_value_xmodem)}\")\n\n# Alternatively, use the PredefinedCrc class\ncrc16_obj_xmodem = crcmod.predefined.PredefinedCrc('xmodem')\ncrc16_obj_xmodem.update(data_bytes)\nprint(f\"Predefined CRC-16 (XMODEM, PredefinedCrc class) for '123456789': {hex(crc16_obj_xmodem.crcValue)}\")","lang":"python","description":"This quickstart demonstrates how to calculate CRCs using both custom polynomials via `crcmod.mkCrcFun` and `crcmod.Crc` class, and predefined algorithms via `crcmod.predefined.mkCrcFun` and `crcmod.predefined.PredefinedCrc` class."},"warnings":[{"fix":"Upgrade to Python 3.9+ and install `crcmod-plus`.","message":"crcmod-plus dropped support for Python 2.x. If migrating from the original `crcmod` 1.7, ensure your environment is Python 3.9 or newer.","severity":"breaking","affected_versions":"<2.0.0 (original `crcmod`) -> 2.0.0+"},{"fix":"Ensure all input data is encoded to `bytes` (e.g., `my_string.encode('utf-8')`) before passing it to CRC functions.","message":"CRC functions and classes in `crcmod-plus` (and `crcmod`) expect byte strings (`bytes`) as input for Python 3.x. Passing Unicode strings (`str`) will result in a TypeError.","severity":"gotcha","affected_versions":"2.0.0+"},{"fix":"Always use `pip install crcmod-plus` to ensure you are getting the actively maintained and Python 3.9+ compatible version.","message":"While `crcmod-plus` is a drop-in replacement for `crcmod` 1.7, it is a distinct package. Users should explicitly install `crcmod-plus` for the modernized, Python 3-compatible version, as the original `crcmod` on PyPI is old and unmaintained.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always use `import crcmod.predefined` when intending to use predefined CRC algorithms or classes.","message":"The `crcmod.predefined` module, which contains standard CRC algorithms, needs to be explicitly imported (e.g., `import crcmod.predefined`). Symbols like `mkPredefinedCrcFun` are not directly available under `import crcmod`.","severity":"gotcha","affected_versions":"All versions, especially before 2.3.1 if relying on implicit side-effects"}],"env_vars":null,"search_vec":"'1.7':33 '16':56 '2':38 '24':57 '32':58 '64':60 '8':55 'algorithm':76 'allow':63 'bit':61 'build':43 'cadenc':83 'check':20 'checksum':93 'compat':88 'comput':16 'crc':21,62,75,92 'crcmod':2,5,32,97 'crcmod-plus':1,4 'cryptographi':96 'custom':67 'cyclic':18 'data':94 'drop':26,36 'drop-in':25 'enabl':50 'enhanc':91 'environ':48 'focus':85 'generat':13 'integr':95 'librari':78 'maintain':79 'minor':90 'moder':81 'modern':9,46 'object':14 'origin':31 'packag':11,34 'pipelin':44 'plus':3,6 'polynomi':68 'predefin':74 'primarili':84 'python':10,37,47,87 'redund':19 'releas':82 'replac':28 'specifi':66 'support':39 'updat':41 'use':52 'user':64 'util':70 'varieti':72","created_at":"2026-04-14T01:21:59.919305+00:00","updated_at":"2026-04-16T04:04:52.042716+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.3.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/ntamas/crcmod-plus","docs":"https://github.com/ntamas/crcmod-plus#readme","changelog":"https://github.com/ntamas/crcmod-plus/blob/main/CHANGELOG.md","pypi":"https://pypi.org/project/crcmod-plus/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-08-30","next_check":"2026-07-30","install_tag":null}}