pub fn update_multithreaded<'h>(
hasher: &'h mut Hasher,
input: &[u8],
) -> &'h mut Hasher ⓘExpand description
Hasher::update, eligible to use
other CPU cores above the split threshold (512 KiB per eligible aligned
subtree, an implementation heuristic): always the same digest as
single-threaded update. Shorter updates hash on the calling thread.
One Hasher may take both calls. The program calls
initialize_multithreaded first.
§Panics
Panics if initialize_multithreaded
has not been called, if the pool was invalidated by fork(), if the
cumulative input length exceeds 2^64 - 1 bytes, or if hasher was
poisoned by a prior unwinding Hasher::update_with call
(after a panic).
use blake3_servil::{Mode, convenience::Hasher, throughput};
let input = vec![7u8; 3 << 20];
let mut hasher = Hasher::new(Mode::Plain, Some(input.len() as u64));
for piece in input.chunks(64 * 1024) {
throughput::update_multithreaded(&mut hasher, piece);
}
assert_eq!(hasher.finalize(), blake3_servil::convenience::hash(&input));