11 unstable releases
0.6.3 | Apr 12, 2022 |
---|---|
0.6.1 | Jan 5, 2022 |
0.6.0 | Jan 20, 2021 |
0.5.0 | Jul 4, 2020 |
0.2.0 | Nov 11, 2017 |
#36 in Algorithms
312,799 downloads per month
Used in 135 crates
(28 directly)
22KB
452 lines
CRC32C
Rust implementation of the CRC-32-Castagnoli algorithm with hardware acceleration where possible.
Hardware accelleration on the following architectures:
- x84-64 with SSE 4.2
- All stable versions of Rust
- If SSE 4.2 is enabled at compile time, it will only build the SSE implementation. Otherwise, the
cpuid
is used to find the best implementation at runtime.
- aarch64 with crc feature
- Only available on nightly (enabled by default without feature)
All other processors utilize a software fallback.
Usage
First, add this to your Cargo.toml
:
[dependencies]
crc32c = "0.6"
extern crate crc32c;
fn main() {
let message = b"Hello world!";
let crc = crc32c::crc32c(message);
println!("hash = {}", crc);
}
License
You may use this code under either the Apache 2.0 license or the MIT license, at your option.