crc32_light

Crates.iocrc32_light
lib.rscrc32_light
version0.1.2
created_at2024-01-19 10:49:19.242573+00
updated_at2025-11-26 13:14:21.262403+00
descriptionCalculate CRC-32 checksum
homepagehttps://github.com/kujirahand/rust-crc32
repositoryhttps://github.com/kujirahand/rust-crc32
max_upload_size
id1105179
size19,520
kujirahand (kujirahand)

documentation

https://docs.rs/crc32_light

README

rust-crc32

Calculate CRC-32 checksum for binary data.

How to install

cargo add crc32_light

How to use

use crc32_light::crc32;
fn main() {
    let crc = crc32(b"dog");
    println!("CRC32 = 0x{:08x}", crc);
}

Memo

It provides three methods for calculating CRC32:

  • crc32basic() — A simple and easy-to-understand implementation.
  • crc32() — An optimized version of crc32basic() designed to improve processing speed.
  • crc32speed() — A highly optimized implementation focused on maximum performance.

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.

Streaming API

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);
}
Commit count: 4

cargo fmt