{"id":13439270,"url":"https://github.com/mrhooray/crc-rs","last_synced_at":"2025-05-15T18:08:26.801Z","repository":{"id":28731461,"uuid":"32252710","full_name":"mrhooray/crc-rs","owner":"mrhooray","description":"Rust implementation of CRC(16, 32, 64) with support of various standards","archived":false,"fork":false,"pushed_at":"2024-04-08T17:19:53.000Z","size":147,"stargazers_count":198,"open_issues_count":20,"forks_count":48,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-03T05:09:23.991Z","etag":null,"topics":["checksum","crc","crc16","crc32","crc64","hash","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrhooray.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2015-03-15T09:22:04.000Z","updated_at":"2025-03-21T00:22:05.000Z","dependencies_parsed_at":"2023-02-18T20:00:35.238Z","dependency_job_id":"8ae1c841-c6c4-4fe3-a3e1-6beab8e2cfe9","html_url":"https://github.com/mrhooray/crc-rs","commit_stats":{"total_commits":116,"total_committers":20,"mean_commits":5.8,"dds":0.4655172413793104,"last_synced_commit":"c6d99b51f297b757632b5d409ef746055dd75848"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhooray%2Fcrc-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhooray%2Fcrc-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhooray%2Fcrc-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhooray%2Fcrc-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrhooray","download_url":"https://codeload.github.com/mrhooray/crc-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248360228,"owners_count":21090665,"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":["checksum","crc","crc16","crc32","crc64","hash","rust"],"created_at":"2024-07-31T03:01:12.533Z","updated_at":"2025-05-15T18:08:26.795Z","avatar_url":"https://github.com/mrhooray.png","language":"Rust","funding_links":[],"categories":["Libraries","库 Libraries","库","Rust"],"sub_categories":["Encoding","编码 Encoding","编码(Encoding)","加密 Encoding"],"readme":"# crc\n\nRust implementation of CRC.\n\n[![ci](https://github.com/mrhooray/crc-rs/actions/workflows/ci.yaml/badge.svg)](https://github.com/mrhooray/crc-rs/actions/workflows/ci.yaml)\n[![Crate](https://img.shields.io/crates/v/crc.svg)](https://crates.io/crates/crc)\n[![Docs](https://docs.rs/crc/badge.svg)](https://docs.rs/crc)\n[![License](https://img.shields.io/crates/l/crc.svg?maxAge=2592000)](https://github.com/mrhooray/crc-rs#license)\n\n### Usage\n\nAdd `crc` to `Cargo.toml`\n```toml\n[dependencies]\ncrc = \"3.3.0\"\n```\n\n### Examples\n\nUsing a well-known algorithm:\n```rust\nconst X25: crc::Crc\u003cu16\u003e = crc::Crc::\u003cu16\u003e::new(\u0026crc::CRC_16_IBM_SDLC);\nassert_eq!(X25.checksum(b\"123456789\"), 0x906e);\n```\n\nUsing a custom algorithm:\n```rust\nconst CUSTOM_ALG: crc::Algorithm\u003cu16\u003e = crc::Algorithm {\n    width: 16,\n    poly: 0x8005,\n    init: 0xffff,\n    refin: false,\n    refout: false,\n    xorout: 0x0000,\n    check: 0xaee7,\n    residue: 0x0000\n};\nlet crc = crc::Crc::\u003cu16\u003e::new(\u0026CUSTOM_ALG);\nlet mut digest = crc.digest();\ndigest.update(b\"123456789\");\nassert_eq!(digest.finalize(), 0xaee7);\n```\n\n### Minimum supported Rust version (MSRV)\n\nThis crate's MSRV is 1.65.\n\nAt a minimum, the MSRV will be \u003c= the oldest stable release in the last 12 months. MSRV may be bumped in minor version releases.\n\n### Implementations\n\nThis crate has several pluggable implementations:\n\n1. `NoTable` doesn't use a lookup table, and thus minimizes binary size and memory usage.\n2. `Table\u003c1\u003e` uses a lookup table with 256 entries (e.g. for u32 thats 256 * 4 bytes).\n3. `Table\u003c16\u003e` uses a lookup table with 16 * 256 entries (e.g. for u32 thats 16 * 256 * 4 bytes).\n\n`Table\u003c1\u003e` is the default implementation, but this can be overridden by specifying `I` in `Crc\u003cW, I\u003e`. E.g.: `Crc\u003cu32, NoTable\u003e`, `Crc\u003cu64, Table\u003c16\u003e\u003e`, ...\n\nNOTE: Lookup tables will increase binary size if they're generated at compile-time. Wrapping `Crc` initialization in a `std::cell::OnceCell` may be preferable if binary size is a concern.\n\n### Benchmark\n\n`cargo bench` with AMD Ryzen 7 3800X ([comparison](http://create.stephan-brumme.com/crc32/)).\n\n#### Throughput (GiB/s)\n\n| Width | NoTable | Bytewise | Slice16 |\n|-------|---------|----------|---------|\n| 8     | 0.113   | 0.585    | 3.11    |\n| 16    | 0.105   | 0.483    | 3.23    |\n| 32    | 0.111   | 0.516    | 3.30    |\n| 64    | 0.139   | 0.517    | 2.92    |\n| 82    | 0.091   | 0.438    | 0.623   |\n\n### License\n\nLicensed under either of\n\n * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT License ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any\nadditional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrhooray%2Fcrc-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrhooray%2Fcrc-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrhooray%2Fcrc-rs/lists"}