Trait crypto_mac::NewMac[][src]

pub trait NewMac: Sized {
    type KeySize: ArrayLength<u8>;
    fn new(key: &Key<Self>) -> Self;

    fn new_from_slice(key: &[u8]) -> Result<Self, InvalidKeyLength> { ... }
}

Instantiate a Mac algorithm.

Associated Types

type KeySize: ArrayLength<u8>[src]

Key size in bytes with which cipher guaranteed to be initialized.

Loading content...

Required methods

fn new(key: &Key<Self>) -> Self[src]

Initialize new MAC instance from key with fixed size.

Loading content...

Provided methods

fn new_from_slice(key: &[u8]) -> Result<Self, InvalidKeyLength>[src]

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.

Loading content...

Implementors

impl<T> NewMac for T where
    T: FromBlockCipher,
    T::Cipher: NewBlockCipher
[src]

This is supported on crate feature cipher only.

type KeySize = <Self::Cipher as NewBlockCipher>::KeySize

Loading content...