pub trait NewMac: Sized {
type KeySize: ArrayLength<u8>;
fn new(key: &GenericArray<u8, Self::KeySize>) -> Self;
fn new_from_slice(key: &[u8]) -> Result<Self, InvalidKeyLength> { ... }
}
Expand description
Instantiate a Mac
algorithm.
Required Associated Types§
sourcetype KeySize: ArrayLength<u8>
type KeySize: ArrayLength<u8>
Key size in bytes with which cipher guaranteed to be initialized.
Required Methods§
sourcefn new(key: &GenericArray<u8, Self::KeySize>) -> Self
fn new(key: &GenericArray<u8, Self::KeySize>) -> Self
Initialize new MAC instance from key with fixed size.
Provided Methods§
sourcefn new_from_slice(key: &[u8]) -> Result<Self, InvalidKeyLength>
fn new_from_slice(key: &[u8]) -> Result<Self, InvalidKeyLength>
Initialize new MAC instance from key with variable size.
Default implementation will accept only keys with length equal to
KeySize
, but some MACs can accept range of key lengths.