{"id":17623747,"url":"https://github.com/wiseaidev/crc32-v2","last_synced_at":"2026-02-02T16:08:24.833Z","repository":{"id":207523694,"uuid":"719453561","full_name":"wiseaidev/crc32-v2","owner":"wiseaidev","description":"A port of the CRC-32 algorithm to Rust","archived":false,"fork":false,"pushed_at":"2024-12-07T20:47:55.000Z","size":48,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T14:52:45.806Z","etag":null,"topics":["crc","crc-algorithms","crc32","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/crc32-v2","language":"Rust","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/wiseaidev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-11-16T07:44:56.000Z","updated_at":"2024-12-07T20:39:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"98eedeee-4e2a-4b3e-9ee2-0f728b9e81d3","html_url":"https://github.com/wiseaidev/crc32-v2","commit_stats":null,"previous_names":["wiseaidev/crc32-v2"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiseaidev%2Fcrc32-v2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiseaidev%2Fcrc32-v2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiseaidev%2Fcrc32-v2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiseaidev%2Fcrc32-v2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wiseaidev","download_url":"https://codeload.github.com/wiseaidev/crc32-v2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248804718,"owners_count":21164127,"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-algorithms","crc32","rust"],"created_at":"2024-10-22T21:42:42.116Z","updated_at":"2026-02-02T16:08:19.793Z","avatar_url":"https://github.com/wiseaidev.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CRC32\n\n\u003e Fastest CRC32 Rust Implementation\n\nResurrecting the [`crc32`](https://crates.io/crates/crc32) crate from the ashes.\n\n### Usage\n\nAdd `crc32-v2` to your `Cargo.toml` file:\n\n```toml\n[dependencies]\ncrc32-v2 = \"0.0.5\"\n```\n\nor run:\n\n```sh\ncargo add crc32-v2\n```\n\n### Examples\n\n```rust\nuse crc32_v2::crc32;\nuse crc32_v2::byfour::crc32_little;\n\nconst CRC32_INIT: u32 = 0; // Initial CRC value, you can customize it\n\nfn main() {\n    // Your data to calculate CRC for\n    let data = b\"Hello, world!\";\n\n    // Calculate CRC\n    let result_crc = crc32(CRC32_INIT, data);\n\n    // Print the result\n    println!(\"CRC-32: {:x}\", result_crc);\n\n    // Calculate CRC using the little-endian method\n    let result_crc_little = crc32_little(CRC32_INIT, data);\n\n    // Print the result\n    println!(\"CRC-32 (Little Endian): {:x}\", result_crc_little);\n}\n\n// Output\n\n// CRC-32: ebe6c6e6\n// CRC-32 (Little Endian): a29eb9bf\n```\n\n### Benchmark\n\nRunning `cargo bench` provides the following performance insights:\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003ecargo bench\u003c/code\u003e\u003c/summary\u003e\n\n```sh\ncargo bench\n\n   Compiling crc32-v2 v0.0.5 (/home/mahmoud/Desktop/TODO/crc32-v2)\n    Finished `bench` profile [optimized] target(s) in 2.06s\n     Running unittests src/lib.rs (target/release/deps/crc32_v2-3c56bd9cac40bc4d)\n\nrunning 0 tests\n\ntest result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s\n\n     Running benches/benchmark.rs (target/release/deps/benchmark-f87f05a33c0b9723)\nBenchmarking `crc32-v2` crc32_while_loop(0, b\"hello\") performance:: Warming up fBenchmarking `crc32-v2` crc32_while_loop(0, b\"hello\") performance:: Collecting 1`crc32-v2` crc32_while_loop(0, b\"hello\") performance:\n                        time:   [6.6916 ns 6.7111 ns 6.7306 ns]\n                        change: [-6.2932% -5.1894% -3.8925%] (p = 0.00 \u003c 0.05)\n                        Performance has improved.\nFound 14 outliers among 100 measurements (14.00%)\n  7 (7.00%) low mild\n  2 (2.00%) high mild\n  5 (5.00%) high severe\n\nBenchmarking `crc32-v2` crc32_for_loop(0, b\"hello\") performance:: Warming up forBenchmarking `crc32-v2` crc32_for_loop(0, b\"hello\") performance:: Collecting 100`crc32-v2` crc32_for_loop(0, b\"hello\") performance:\n                        time:   [6.7552 ns 6.7719 ns 6.7884 ns]\n                        change: [-16.025% -12.793% -9.5779%] (p = 0.00 \u003c 0.05)\n                        Performance has improved.\nFound 4 outliers among 100 measurements (4.00%)\n  1 (1.00%) high mild\n  3 (3.00%) high severe\n\nBenchmarking `crc32fast` crc32fast::hash(b\"hello\") performance:: Warming up for Benchmarking `crc32fast` crc32fast::hash(b\"hello\") performance:: Collecting 100 `crc32fast` crc32fast::hash(b\"hello\") performance:\n                        time:   [8.4118 ns 8.4320 ns 8.4522 ns]\n                        change: [-9.0567% -7.0970% -5.3253%] (p = 0.00 \u003c 0.05)\n                        Performance has improved.\nFound 4 outliers among 100 measurements (4.00%)\n  4 (4.00%) high severe\n\nBenchmarking `crc32fast` crc32fast::Hasher::new().update(b\"hello\").finalize() peBenchmarking `crc32fast` crc32fast::Hasher::new().update(b\"hello\").finalize() peBenchmarking `crc32fast` crc32fast::Hasher::new().update(b\"hello\").finalize() peBenchmarking `crc32fast` crc32fast::Hasher::new().update(b\"hello\").finalize() pe`crc32fast` crc32fast::Hasher::new().update(b\"hello\").finalize() performance:\n                        time:   [21.334 ns 21.379 ns 21.419 ns]\n                        change: [-6.8627% -5.2041% -3.7228%] (p = 0.00 \u003c 0.05)\n                        Performance has improved.\nFound 5 outliers among 100 measurements (5.00%)\n  2 (2.00%) high mild\n  3 (3.00%) high severe\n```\n\n\u003c/details\u003e\n\nBelow is a summarized table of results, highlighting the execution times for each method:\n\n| **Method**                                     | **Mean Time (ns)** | **Outliers (%)** | **Description**                                |\n|-----------------------------------------------|---------------------|-------------------|------------------------------------------------|\n| `crc32_v2_while_loop(0, b\"hello\")`               | 6.71               |    14.00%           | CRC32-V2 built-in function using a while loop, optimized.   |\n| `crc32_v2_for_loop(0, b\"hello\")`                 | 6.77               |    4.00%            | Custom CRC32-V2 using a for loop, optimized.     |\n| `crc32fast::hash(b\"hello\")`                   | 8.43               |    4.00%            | crc32fast built-in hashing method.                |\n| `crc32fast::Hasher::new().update(b\"hello\").finalize()`   | 21.38              |    5.00%            | Hasher object approach, slower initialization.|\n\n1. **Fastest Method**: The built-in `crc32_v2_while_loop` implementation shows the best performance, slightly outperforming the `crc32_for_loop`.\n1. **crc32fast Performance**: The `crc32fast::hash` method is slightly slower than the `crc32-v2` implementation.\n1. **Hasher Object Method**: The `crc32fast::Hasher` object approach is significantly slower for some reason.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiseaidev%2Fcrc32-v2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwiseaidev%2Fcrc32-v2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiseaidev%2Fcrc32-v2/lists"}