Expand description
An implementation of the Bab family of hash functions.
The crate root exposes the WILLIAM3 instantiation of Bab, which is a concrete hash function you can use immediately. The generic module provides parmaterisable implementations of Bab, which you can use to define your own hash functions.
use bab_rs::{batch_hash, William3Hasher, William3Digest, WIDTH, Hasher, HasherWrite};
let mut hasher = William3Hasher::new();
hasher.write(&[0, 1, 2]);
hasher.write(&[3, 4]);
let incrementally_computed_hash = hasher.finish();
let mut batch_digest = William3Digest::default();
batch_hash(&[0, 1, 2, 3, 4], &mut batch_digest);
assert_eq!(
hasher.finish(),
batch_digest,
);Modules§
Structs§
- William3
Digest - William3
Hasher - A stateful hasher for incrementally computing WILLIAM3 digests.
Constants§
- WIDTH
- The number of bytes in a WILLIAM3 digest.
Traits§
- Hasher
- A trait for hashing an arbitrary stream of bytes.
The write methods are defined in the
HasherWritetrait. - Hasher
Write - A trait for writing data to a hasher.
Functions§
- batch_
hash - Computes the WILLIAM3 digest of the given input bytes, and writes it into
out. - batch_
hash_ keyed - Computes the keyed WILLIAM3 digest of the given input bytes for a given
key, and writes the digest intoout.