| Crates.io | crc32_light |
| lib.rs | crc32_light |
| version | 0.1.2 |
| created_at | 2024-01-19 10:49:19.242573+00 |
| updated_at | 2025-11-26 13:14:21.262403+00 |
| description | Calculate CRC-32 checksum |
| homepage | https://github.com/kujirahand/rust-crc32 |
| repository | https://github.com/kujirahand/rust-crc32 |
| max_upload_size | |
| id | 1105179 |
| size | 19,520 |
Calculate CRC-32 checksum for binary data.
cargo add crc32_light
use crc32_light::crc32;
fn main() {
let crc = crc32(b"dog");
println!("CRC32 = 0x{:08x}", crc);
}
It provides three methods for calculating CRC32:
crc32basic() designed to improve processing speed.When processing data up to 100 KB, crc32 is the fastest. However, for data larger than 1 MB, all implementations reach the limitations of memory bandwidth, so the differences between algorithms become less noticeable.
You can calculate CRC32 in a streaming manner using the Crc32Stream struct:
use crc32_light::Crc32Stream;
fn main() {
let mut stream = Crc32Stream::new();
stream.update(b"hello ");
stream.update(b"world");
let crc = stream.finalize();
println!("CRC32 = 0x{:08x}", crc);
}