Trait hmac::Mac[]

pub trait Mac: Clone {
    type OutputSize: ArrayLength<u8>;
    type KeySize: ArrayLength<u8>;
    pub fn new(key: &GenericArray<u8, Self::KeySize>) -> Self;
pub fn input(&mut self, data: &[u8]);
pub fn reset(&mut self);
pub fn result(self) -> MacResult<Self::OutputSize>; pub fn new_varkey(key: &[u8]) -> Result<Self, InvalidKeyLength> { ... }
pub fn result_reset(&mut self) -> MacResult<Self::OutputSize> { ... }
pub fn verify(self, code: &[u8]) -> Result<(), MacError> { ... } }

The Mac trait defines methods for a Message Authentication algorithm.

Associated Types

type OutputSize: ArrayLength<u8>

type KeySize: ArrayLength<u8>

Loading content...

Required methods

pub fn new(key: &GenericArray<u8, Self::KeySize>) -> Self

Create new MAC instance from key with fixed size.

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

Process input data.

pub fn reset(&mut self)

Reset Mac instance.

pub fn result(self) -> MacResult<Self::OutputSize>

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

Loading content...

Provided methods

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

Create 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.

pub fn result_reset(&mut self) -> MacResult<Self::OutputSize>

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

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

Check if code is correct for the processed input.

Loading content...

Implementors

impl<D> Mac for Hmac<D> where
    D: Input + BlockInput + FixedOutput + Reset + Default + Clone,
    D::BlockSize: ArrayLength<u8>,
    D::OutputSize: ArrayLength<u8>, 
[src]

type OutputSize = D::OutputSize

type KeySize = D::BlockSize

Loading content...