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, Hasher, WIDTH};
let mut hasher = Hasher::new();
hasher.write(&[0, 1, 2]);
hasher.write(&[3, 4]);
let incrementally_computed_hash = hasher.finish();
let mut batch_digest = [0; WIDTH];
batch_hash(&[0, 1, 2, 3, 4], &mut batch_digest);
assert_eq!(
hasher.finish(),
batch_digest,
);
Modules§
Structs§
- Hasher
- A stateful hasher for incrementally computing WILLIAM3 digests.
Constants§
- WIDTH
- The number of bytes in a WILLIAM3 digest.
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
.