Trait crypto_mac::Mac

source ·
pub trait Mac: Clone {
    type OutputSize: ArrayLength<u8>;

    // Required methods
    fn update(&mut self, data: &[u8]);
    fn reset(&mut self);
    fn finalize(self) -> Output<Self>;

    // Provided methods
    fn finalize_reset(&mut self) -> Output<Self> { ... }
    fn verify(self, tag: &[u8]) -> Result<(), MacError> { ... }
}
Expand description

The Mac trait defines methods for a Message Authentication algorithm.

Required Associated Types§

source

type OutputSize: ArrayLength<u8>

Output size of the [Mac]

Required Methods§

source

fn update(&mut self, data: &[u8])

Update MAC state with the given data.

source

fn reset(&mut self)

Reset Mac instance.

source

fn finalize(self) -> Output<Self>

Obtain the result of a Mac computation as a Output and consume Mac instance.

Provided Methods§

source

fn finalize_reset(&mut self) -> Output<Self>

Obtain the result of a Mac computation as a Output and reset Mac instance.

source

fn verify(self, tag: &[u8]) -> Result<(), MacError>

Check if tag/code value is correct for the processed input.

Implementors§