#[must_use]
pub(crate) fn crc32c(data: &[u8]) -> u32 {
crc32c::crc32c(data)
}
#[must_use]
pub(crate) fn crc32c_append(seed: u32, data: &[u8]) -> u32 {
crc32c::crc32c_append(seed, data)
}
#[cfg(test)]
mod tests {
use super::*;
use assert2::assert;
const VECTORS: &[(&[u8], u32)] = &[
(b"", 0x0000_0000),
(b"a", 0xC1D0_4330),
(b"123456789", 0xE306_9283),
(b"The quick brown fox jumps over the lazy dog", 0x2262_0404),
];
#[test]
fn known_vectors() {
for (input, expected) in VECTORS {
let got = crc32c(input);
assert!(
got == *expected,
"input={input:?}: expected {expected:#010x}, got {got:#010x}"
);
}
}
}