pub fn hash_each_with(mode: Mode<'_>, items: &[&[u8]], out: &mut [[u8; 32]])Expand description
The hash of each message, of any lengths, on the calling thread:
out[i] is hash_with(mode, items[i]). Short
messages hash together, so a collection of small items (a directory’s
files, a repository’s objects) takes less time than one call each.
Requires out.len() == items.len().
use blake3_servil::Mode;
let items: Vec<Vec<u8>> = (0..100).map(|i| vec![i as u8; 100 * i]).collect();
let slices: Vec<&[u8]> = items.iter().map(|m| m.as_slice()).collect();
let mut out = vec![[0u8; 32]; slices.len()];
blake3_servil::hash_each_with(Mode::Hash, &slices, &mut out);
assert_eq!(&out[42], blake3_servil::hash(&items[42]).as_bytes());