{"id":21866097,"url":"https://github.com/code-inflation/pycrc32","last_synced_at":"2025-10-29T01:36:40.938Z","repository":{"id":221856549,"uuid":"755560655","full_name":"code-inflation/pycrc32","owner":"code-inflation","description":"SIMD-accelerated CRC32 checksum computation","archived":false,"fork":false,"pushed_at":"2025-09-08T12:26:50.000Z","size":65,"stargazers_count":3,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-25T14:40:34.214Z","etag":null,"topics":["checksum","crc","crc32","pycrc","python","python-crc","rust","simd"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/code-inflation.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-10T15:33:56.000Z","updated_at":"2025-07-08T17:31:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"ab34eb67-f097-43f4-9c5e-c7a245e6cf1c","html_url":"https://github.com/code-inflation/pycrc32","commit_stats":null,"previous_names":["code-inflation/pycrc32"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/code-inflation/pycrc32","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-inflation%2Fpycrc32","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-inflation%2Fpycrc32/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-inflation%2Fpycrc32/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-inflation%2Fpycrc32/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/code-inflation","download_url":"https://codeload.github.com/code-inflation/pycrc32/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-inflation%2Fpycrc32/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281544212,"owners_count":26519552,"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","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["checksum","crc","crc32","pycrc","python","python-crc","rust","simd"],"created_at":"2024-11-28T04:23:59.882Z","updated_at":"2025-10-29T01:36:40.923Z","avatar_url":"https://github.com/code-inflation.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pycrc32\n![PyPI - Version](https://img.shields.io/pypi/v/pycrc32)\n![Python Version](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue)\n![PyPI - License](https://img.shields.io/pypi/l/pycrc32)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/pycrc32)\n\n\n`pycrc32` is a Python module for SIMD-accelerated CRC32 checksum computation.  \nBig thanks to [rust-crc32fast](https://github.com/srijs/rust-crc32fast) - this project just provides Python bindings for their Rust implementation.\n\n## Installation\n```sh\npip install pycrc32\n```\n\n## Usage\n```python\nfrom pycrc32 import crc32\n\ndata = b\"123456789\"\nprint(f\"crc32 for {data!r} is {crc32(data)}\")\n```\n\n### Advanced Checksum Calculation with `Hasher`\nFor scenarios that require more flexibility, such as processing large amounts of data or computing the checksum in stages, you can use the `Hasher` class:\n```python\nfrom pycrc32 import Hasher\n\n# Create a new Hasher instance\nhasher = Hasher()\n\n# Update the hasher with data chunks\nhasher.update(b\"123456\")\nhasher.update(b\"789\")\n\n# Finalize the computation and get the checksum\nchecksum = hasher.finalize()\nprint(f\"Checksum: {checksum}\")\n\n# Reset the hasher to compute another checksum\nhasher.reset()\nhasher.update(b\"The quick brown fox jumps over the lazy dog\")\nnew_checksum = hasher.finalize()\nprint(f\"New checksum: {new_checksum}\")\n```\n\nYou can also initialize a `Hasher` with a specific initial CRC32 state:\n```python\ninitial_crc = 12345678\nhasher = Hasher.with_initial(initial_crc)\n\nhasher.update(b\"additional data\")\nfinal_checksum = hasher.finalize()\nprint(f\"Final checksum with initial state: {final_checksum}\")\n```\n\nTo combine checksums from different data blocks without needing to concatenate the data, use the `combine` method:\n```python\nhasher1 = Hasher()\nhasher1.update(b\"Data block 1\")\nchecksum1 = hasher1.finalize()\n\nhasher2 = Hasher()\nhasher2.update(b\"Data block 2\")\nchecksum2 = hasher2.finalize()\n\n# Combine checksums from hasher1 into hasher2\nhasher1.combine(hasher2)  # Combine the state of hasher2 into hasher1\n\n# The final checksum after combination\ncombined_checksum = hasher1.finalize()\nprint(f\"Combined checksum: {combined_checksum}\")\n```\n\n## Speed\nThe performance of `pycrc32` has been benchmarked on a trusty old Intel i7-8550U using 32MB of random input data. Below is a comparison of the median computation times across different libraries:\n\n| Library   | Median Time (s) |\n|-----------|-----------------|\n| `pycrc32` | 0.002703        |\n| `zlib`    | 0.019796        |\n| `fastcrc` | 0.071426        |\n\nWe reach almost 10x performance improvements compared to the `zlib` baseline implementation.  \nSee `scripts/bench.py` for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-inflation%2Fpycrc32","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcode-inflation%2Fpycrc32","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-inflation%2Fpycrc32/lists"}