pub struct Blake3Mac { /* private fields */ }Available on (crate features
mac-hmac or mac-blake3) and crate feature mac-blake3 only.Expand description
Streaming BLAKE3 keyed-mode MAC for inputs that don’t fit in memory.
Construct with Blake3Mac::new, absorb data with
update, and finalise with finalize
(returns the 32-byte tag) or verify (constant-time
compare against an expected tag).
§Example
use crypt_io::mac::Blake3Mac;
let key = [0x42u8; 32];
let mut m = Blake3Mac::new(&key);
m.update(b"first chunk ");
m.update(b"second chunk");
let tag = m.finalize();
assert_eq!(tag.len(), 32);Implementations§
Source§impl Blake3Mac
impl Blake3Mac
Sourcepub fn new(key: &[u8; 32]) -> Self
pub fn new(key: &[u8; 32]) -> Self
Construct a fresh keyed MAC.
Unlike HMAC this is infallible — BLAKE3’s keyed mode takes a type-checked 32-byte key, so there is no runtime length-check to fail.
Sourcepub fn update(&mut self, data: &[u8]) -> &mut Self
pub fn update(&mut self, data: &[u8]) -> &mut Self
Absorb data into the running MAC. Returns &mut Self so calls
can chain.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Blake3Mac
impl RefUnwindSafe for Blake3Mac
impl Send for Blake3Mac
impl Sync for Blake3Mac
impl Unpin for Blake3Mac
impl UnsafeUnpin for Blake3Mac
impl UnwindSafe for Blake3Mac
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more