pub fn hash_each(
mode: Mode<'_>,
items: &[(&[Block], usize)],
out: &mut [[u8; 32]],
)Expand description
The hash of each message, of any lengths, on the calling thread:
out[i] is hash(mode, items[i].0, items[i].1), each item a message of items[i].1 bytes starting its
blocks (the bytes past its end ignored). 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_core::{Mode, convenience, throughput::{self, Block}};
let blocks: Vec<Vec<Block>> = (0..100).map(|i| vec![Block([i as u8; 64]); (100 * i as usize).div_ceil(64)]).collect();
let items: Vec<(&[Block], usize)> = blocks.iter().enumerate().map(|(i, b)| (&b[..], 100 * i)).collect();
let mut out = vec![[0u8; 32]; items.len()];
throughput::hash_each(Mode::Plain, &items, &mut out);
assert_eq!(&out[42], convenience::hash(&[42u8; 4200]).as_bytes());