Module crc32

Module crc32 

Source
Expand description

CRC32C implementation of the Hasher trait.

This implementation uses the crc-fast crate to generate CRC32C (iSCSI/Castagnoli) checksums as specified in RFC 3720. CRC32C uses polynomial 0x1EDC6F41.

§Warning

CRC32 is not a cryptographic hash function. It is designed for error detection, not security. Use SHA-256 or Blake3 for cryptographic purposes.

§Example

use commonware_cryptography::{Hasher, Crc32};

// One-shot checksum (returns u32 directly)
let checksum: u32 = Crc32::checksum(b"hello world");

// Using the Hasher trait
let mut hasher = Crc32::new();
hasher.update(b"hello ");
hasher.update(b"world");
let digest = hasher.finalize();

// Convert digest to u32
assert_eq!(digest.as_u32(), checksum);

Structs§

Crc32
CRC32C hasher.
Digest
Digest of a CRC32 hashing operation (4 bytes).