Skip to main content

hash_with

Function hash_with 

Source
pub fn hash_with(mode: Mode<'_>, input: &[u8]) -> Hash
Expand description

hash in any Mode: the plain hash, the keyed hash, or key derivation.

use blake3_servil_core::{Mode, convenience};
let key = [7u8; 32];
let mac = convenience::hash_with(Mode::Keyed(&key), b"foo");
let mut hasher = blake3_servil_core::convenience::Hasher::new(Mode::Keyed(&key), None);
hasher.update(b"foo");
assert_eq!(mac, hasher.finalize());