Skip to main content

hash

Function hash 

Source
pub fn hash(mode: Mode<'_>, input: &[Block], len: usize) -> Hash
Expand description

The hash in mode of the message of len bytes that starts input: a batch of one. The message starts a block, so on a cache line; the bytes past its end, in its last block and any after, are ignored. Tuned for call after call: for a hash now and then amid other work, convenience::hash is the faster call.

use blake3_servil_core::{Mode, convenience, throughput::{self, Batch}};
let mut message = Batch::new(100, 1);
message.set(0, &[7u8; 100]);
assert_eq!(throughput::hash(Mode::Plain, message.blocks(), 100), convenience::hash(&[7u8; 100]));