| Vulnerabilities | |||||
|---|---|---|---|---|---|
| Version | Suggest | Low | Medium | High | Critical |
| 3.4.0 | 0 | 0 | 0 | 0 | 0 |
| 3.3.0 | 0 | 0 | 0 | 0 | 0 |
| 3.2.1 | 0 | 0 | 0 | 0 | 0 |
| 3.2.0 | 0 | 0 | 0 | 0 | 0 |
| 3.1.0 | 0 | 0 | 0 | 0 | 0 |
| 3.0.1 | 0 | 0 | 0 | 0 | 0 |
| 3.0.0 | 0 | 0 | 0 | 0 | 0 |
| 2.1.0 | 0 | 0 | 0 | 0 | 0 |
| 2.0.0 | 0 | 0 | 0 | 0 | 0 |
| 1.9.0 | 0 | 0 | 0 | 0 | 0 |
| 1.8.1 | 0 | 0 | 0 | 0 | 0 |
| 1.8.0 | 0 | 0 | 0 | 0 | 0 |
| 1.7.0 | 0 | 0 | 0 | 0 | 0 |
| 1.6.0 | 0 | 0 | 0 | 0 | 0 |
| 1.5.0 | 0 | 0 | 0 | 0 | 0 |
| 1.4.0 | 0 | 0 | 0 | 0 | 0 |
| 1.3.0 | 0 | 0 | 0 | 0 | 0 |
| 1.2.0 | 0 | 0 | 0 | 0 | 0 |
| 1.1.0 | 0 | 0 | 0 | 0 | 0 |
| 1.0.0 | 0 | 0 | 0 | 0 | 0 |
| 0.3.1 | 0 | 0 | 0 | 0 | 0 |
| 0.3.0 | 0 | 0 | 0 | 0 | 0 |
| 0.2.0 | 0 | 0 | 0 | 0 | 0 |
| 0.1.1 | 0 | 0 | 0 | 0 | 0 |
| 0.1.0 | 0 | 0 | 0 | 0 | 0 |
| 0.0.1 | 0 | 0 | 0 | 0 | 0 |
3.4.0 - This version is safe to use because it has no known security vulnerabilities at this time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform
Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.
Apache-2.0 - Apache License 2.0Rust implementation of CRC.
Add crc to Cargo.toml
[dependencies]
crc = "3.4.0"Using a well-known algorithm:
const X25: crc::Crc<u16> = crc::Crc::<u16>::new(&crc::CRC_16_IBM_SDLC);
assert_eq!(X25.checksum(b"123456789"), 0x906e);Using a custom algorithm:
const CUSTOM_ALG: crc::Algorithm<u16> = crc::Algorithm {
width: 16,
poly: 0x8005,
init: 0xffff,
refin: false,
refout: false,
xorout: 0x0000,
check: 0xaee7,
residue: 0x0000
};
let crc = crc::Crc::<u16>::new(&CUSTOM_ALG);
let mut digest = crc.digest();
digest.update(b"123456789");
assert_eq!(digest.finalize(), 0xaee7);This crate's MSRV is 1.83.
At a minimum, the MSRV will be <= the oldest stable release in the last 12 months. MSRV may be bumped in minor version releases.
This crate has several pluggable implementations:
NoTable doesn't use a lookup table, and thus minimizes binary size and memory usage.Table<1> uses a lookup table with 256 entries (e.g. for u32 thats 256 * 4 bytes).Table<16> uses a lookup table with 16 * 256 entries (e.g. for u32 thats 16 * 256 * 4 bytes).Table<1> is the default implementation, but this can be overridden by specifying I in Crc<W, I>. E.g.: Crc<u32, NoTable>, Crc<u64, Table<16>>, ...
NOTE: 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.
cargo bench with AMD Ryzen 7 3800X (comparison).
| Width | NoTable | Bytewise | Slice16 |
|---|---|---|---|
| 8 | 0.113 | 0.585 | 3.11 |
| 16 | 0.105 | 0.483 | 3.23 |
| 32 | 0.111 | 0.516 | 3.30 |
| 64 | 0.139 | 0.517 | 2.92 |
| 82 | 0.091 | 0.438 | 0.623 |
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.