pub struct Blake2bKeyed { /* private fields */ }Expand description
BLAKE2b keyed-hash (MAC mode), with variable output size 1–64 bytes.
BLAKE2b in keyed mode is a one-pass MAC: the key is absorbed as the first block. Keys must be between 1 and 64 bytes inclusive.
Implementations§
Source§impl Blake2bKeyed
impl Blake2bKeyed
Sourcepub fn new(key: &[u8]) -> Result<Self, CryptoError>
pub fn new(key: &[u8]) -> Result<Self, CryptoError>
Create a keyed BLAKE2b hasher.
§Errors
Returns CryptoError::InvalidKey if key is empty or longer than 64 bytes.
Sourcepub fn hash(&self, msg: &[u8], out: &mut [u8]) -> Result<(), CryptoError>
pub fn hash(&self, msg: &[u8], out: &mut [u8]) -> Result<(), CryptoError>
Hash msg under this key; output is written to out.
out.len() must be between 1 and 64 bytes inclusive.
§Errors
Returns CryptoError::BadInput if out is empty or longer than 64 bytes.
Returns CryptoError::InvalidKey if the key is invalid (should not
happen after successful new).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Blake2bKeyed
impl RefUnwindSafe for Blake2bKeyed
impl Send for Blake2bKeyed
impl Sync for Blake2bKeyed
impl Unpin for Blake2bKeyed
impl UnsafeUnpin for Blake2bKeyed
impl UnwindSafe for Blake2bKeyed
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