{"id":20210644,"url":"https://github.com/nicoretti/crc","last_synced_at":"2025-05-16T14:05:12.671Z","repository":{"id":43205652,"uuid":"54417044","full_name":"Nicoretti/crc","owner":"Nicoretti","description":"Pure Python CRC library","archived":false,"fork":false,"pushed_at":"2025-04-13T13:03:57.000Z","size":2628,"stargazers_count":60,"open_issues_count":4,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-14T13:17:16.966Z","etag":null,"topics":["crc","crc-calculation","crc16","crc32","crc64","crc8","hacktoberfest","python"],"latest_commit_sha":null,"homepage":"https://nicoretti.github.io/crc/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nicoretti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-21T19:33:31.000Z","updated_at":"2025-04-30T01:27:38.000Z","dependencies_parsed_at":"2023-02-13T01:30:55.184Z","dependency_job_id":"d23dd48d-03f5-41fc-9f73-5b09370d6ebd","html_url":"https://github.com/Nicoretti/crc","commit_stats":{"total_commits":270,"total_committers":4,"mean_commits":67.5,"dds":0.062962962962963,"last_synced_commit":"e041d41be5a9a815db85ef49f4d2f65b3c98b42f"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nicoretti%2Fcrc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nicoretti%2Fcrc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nicoretti%2Fcrc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nicoretti%2Fcrc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nicoretti","download_url":"https://codeload.github.com/Nicoretti/crc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254544146,"owners_count":22088807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crc","crc-calculation","crc16","crc32","crc64","crc8","hacktoberfest","python"],"created_at":"2024-11-14T05:48:51.693Z","updated_at":"2025-05-16T14:05:12.654Z","avatar_url":"https://github.com/Nicoretti.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eCRC\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n\nCalculate CRC checksums, verify CRC checksum, predefined CRC configurations, custom CRC configurations\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\n\u003ca href=\"https://github.com/Nicoretti/crc/actions\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/checks-status/nicoretti/crc/master\" alt=\"Checks Master\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://coveralls.io/github/Nicoretti/crc\"\u003e\n    \u003cimg src=\"https://img.shields.io/coverallsCoverage/github/Nicoretti/crc\" alt=\"Coverage\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://opensource.org/licenses/BSD-2-Clause\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/l/crc\" alt=\"License\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/crc/\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/dm/crc\" alt=\"Downloads\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/crc/\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/pyversions/crc\" alt=\"Supported Python Versions\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/crc/\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/crc\" alt=\"PyPi Package\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n---\n* Documentation: [https://nicoretti.github.io/crc](https://nicoretti.github.io/crc)\n* Source Code: [https://github.com/Nicoretti/crc](https://github.com/Nicoretti/crc)\n---\n\n## Available CRC Configurations\nFor convenience various frequently used crc configurations ship with the library out of the box.\n\n| CRC8          | CRC16    | CRC32   | CRC64 |\n|---------------|----------|---------|-------|\n| CCITT         | XMODEM   | CRC32   | CRC64 |\n| AUTOSAR       | GSM      | AUTOSAR |       |\n| SAEJ1850      | PROFIBUS | BZIP2   |       |\n| SAEJ1850_ZERO | MODBUS   | POSIX   |       |\n| BLUETOOTH     | IBM-3740 |         |       |\n| MAXIM-DOW     | KERMIT   |         |       | \n\nIf you find yourself in the position, where having a new configuration available out of the\nbox would be desirable, feel free to create a [PR](https://github.com/Nicoretti/crc/pulls) or file an [issue](https://github.com/Nicoretti/crc/issues).\n\n## Custom Configurations\n\nIf you want to create a custom configuration, you should have the following information available:\n\n🗒 Note:\n\n    This library currently only supports bit widths of full bytes 8, 16, 24, 32, ...\n\n* **width**\n* **polynom**\n* **init value**\n* **final xor value**\n* **reversed input**\n* **reversed output**\n\nIn case you only have a name of a specific crc configuration/algorithm and you are unsure what are the specific parameters\nof it, a look into this [crc-catalogue](http://reveng.sourceforge.net/crc-catalogue/all.htm) might help.\n\n\n## Requirements\n* [\\\u003e= Python 3.8](https://www.python.org)\n\n## Installation\n\n```shell\npip install crc\n```\n\n## Examples\n\n### Create a Calculator\n\n#### Pre defined configuration\n\n```python\nfrom crc import Calculator, Crc8\n\ncalculator = Calculator(Crc8.CCITT)\n```\n#### Custom configuration\n\n```python\nfrom crc import Calculator, Configuration\n\nconfig = Configuration(\n    width=8,\n    polynomial=0x07,\n    init_value=0x00,\n    final_xor_value=0x00,\n    reverse_input=False,\n    reverse_output=False,\n)\n\ncalculator = Calculator(config)\n```\n\n### Calculate a checksum\n\n#### Standard\n\n```python\nfrom crc import Calculator, Crc8\n\nexpected = 0xBC\ndata = bytes([0, 1, 2, 3, 4, 5])\ncalculator = Calculator(Crc8.CCITT)\n\nassert expected == calculator.checksum(data)\n```\n\n#### Optimized for speed\n\n```python\nfrom crc import Calculator, Crc8\n\nexpected = 0xBC\ndata = bytes([0, 1, 2, 3, 4, 5])\ncalculator = Calculator(Crc8.CCITT, optimized=True)\n\nassert expected == calculator.checksum(data)\n```\n\n### Verify a checksum\n\n#### Standard\n\n```python\nfrom crc import Calculator, Crc8\n\nexpected = 0xBC\ndata = bytes([0, 1, 2, 3, 4, 5])\ncalculator = Calculator(Crc8.CCITT)\n\nassert calculator.verify(data, expected)\n```\n\n#### Optimized for speed\n\n```python\nfrom crc import Calculator, Crc8\n\nexpected = 0xBC\ndata = bytes([0, 1, 2, 3, 4, 5])\ncalculator = Calculator(Crc8.CCITT, optimized=True)\n\nassert calculator.verify(data, expected)\n```\n\n### Calculate a checksum with raw registers\n\n#### Register\n\n```python\nfrom crc import Crc8, Register\n\nexpected = 0xBC\ndata = bytes([0, 1, 2, 3, 4, 5])\nregister = Register(Crc8.CCITT)\n\nregister.init()\nregister.update(data)\nassert expected == register.digest()\n```\n#### TableBasedRegister\n\n```python\nfrom crc import Crc8, TableBasedRegister\n\nexpected = 0xBC\ndata = bytes([0, 1, 2, 3, 4, 5])\nregister = TableBasedRegister(Crc8.CCITT)\n\nregister.init()\nregister.update(data)\nassert expected == register.digest()\n```\n\nReferences \u0026 Resources\n-----------------------\n* [A Painless guide to crc error detection algorithms](http://www.zlib.net/crc_v3.txt)\n* [CRC-Catalogue](http://reveng.sourceforge.net/crc-catalogue/all.htm)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicoretti%2Fcrc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicoretti%2Fcrc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicoretti%2Fcrc/lists"}