pub struct Kmac256 { /* private fields */ }Expand description
KMAC256 message authentication code (SP 800-185).
Variable-length output; the default output length is 64 bytes. Uses a customization string (may be empty) for domain separation.
Implementations§
Source§impl Kmac256
impl Kmac256
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 KMAC256 with the given customization string and output length.
Returns CryptoError::BadInput if output_len is 0.
Trait Implementations§
Source§impl Mac for Kmac256
impl Mac for Kmac256
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 Kmac256
impl RefUnwindSafe for Kmac256
impl Send for Kmac256
impl Sync for Kmac256
impl Unpin for Kmac256
impl UnsafeUnpin for Kmac256
impl UnwindSafe for Kmac256
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