Expand description
§CRC32 V2
This crate provides a simple CRC32 implementation in Rust.
§Usage
To use this crate, add the following to your Cargo.toml
file:
[dependencies]
crc32_v2 = "0.0.4"
Then, you can use the crc32
or crc32_little
functions to calculate the CRC32 checksum of a byte buffer.
§Example
use crc32_v2::byfour::crc32_little;
use crc32_v2::crc32;
let crc = crc32(0, &[0u8, 1u8, 2u8, 3u8]);
assert_eq!(crc, 0x8BB98613);
let crc_little = crc32_little(crc, &[0u8, 1u8, 2u8, 3u8]);
assert_eq!(crc, 0x8BB98613);
§Implementation Details
The CRC32 algorithm is implemented using a standard polynomial and lookup tables for optimization.
The crc32
function takes two parameters:
start_crc
: the initial CRC32 value (usually 0)buf
: a slice containing the input bytes
It returns a u32
, which is the CRC32 checksum of the input buffer.
Modules§
Functions§
- crc32
- This function calculates the CRC32 checksum of a byte buffer using a standard CRC32 algorithm.