Trait cryptraits::hmac::Hmac

source ·
pub trait Hmac: Zeroize {
    type E: Error;

    // Required methods
    fn new_from_slice(key: &[u8]) -> Result<Self, Self::E>
       where Self: Sized;
    fn update(&mut self, data: &[u8]);
    fn verify_slice(self, tag: &[u8]) -> Result<(), Self::E>;
    fn finalize(self) -> Vec<u8>;
}
Expand description

Trait represents HMAC.

Required Associated Types§

source

type E: Error

HMAC Error type.

Required Methods§

source

fn new_from_slice(key: &[u8]) -> Result<Self, Self::E>
where Self: Sized,

Create new value from variable size key.

source

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

Update state using the provided data.

source

fn verify_slice(self, tag: &[u8]) -> Result<(), Self::E>

Check truncated tag correctness using all bytes of calculated tag.

source

fn finalize(self) -> Vec<u8>

Obtain the result of a MAC computation as a Vec and consume MAC instance.

Implementors§