pub struct Kmac128 { /* private fields */ }Expand description
KMAC128 message authentication code (SP 800-185).
Variable-length output; the default output length is 32 bytes. Uses a customization string (may be empty) for domain separation.
Implementations§
Source§impl Kmac128
impl Kmac128
Sourcepub fn new(custom: &[u8], output_len: usize) -> Result<Self, CryptoError>
pub fn new(custom: &[u8], output_len: usize) -> Result<Self, CryptoError>
Create a new KMAC128 with the given customization string and output length.
Returns CryptoError::BadInput if output_len is 0.
Trait Implementations§
Source§impl Mac for Kmac128
impl Mac for Kmac128
Source§fn key_len(&self) -> usize
fn key_len(&self) -> usize
Required key length (minimum acceptable length; MACs are often variable).
Source§fn output_len(&self) -> usize
fn output_len(&self) -> usize
Output tag length in bytes.
Source§fn mac(&self, key: &[u8], msg: &[u8], out: &mut [u8]) -> Result<(), CryptoError>
fn mac(&self, key: &[u8], msg: &[u8], out: &mut [u8]) -> Result<(), CryptoError>
Compute a MAC tag for
msg under key and write it into out.Source§fn verify(&self, key: &[u8], msg: &[u8], tag: &[u8]) -> Result<(), CryptoError>
fn verify(&self, key: &[u8], msg: &[u8], tag: &[u8]) -> Result<(), CryptoError>
Verify a MAC tag in constant time. Read more
Source§fn mac_to_vec(&self, key: &[u8], msg: &[u8]) -> Result<Vec<u8>, CryptoError>
fn mac_to_vec(&self, key: &[u8], msg: &[u8]) -> Result<Vec<u8>, CryptoError>
Convenience: compute MAC and return the tag as a
Vec<u8>.Auto Trait Implementations§
impl Freeze for Kmac128
impl RefUnwindSafe for Kmac128
impl Send for Kmac128
impl Sync for Kmac128
impl Unpin for Kmac128
impl UnsafeUnpin for Kmac128
impl UnwindSafe for Kmac128
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