Trait hmac::Mac [] [src]

pub trait Mac {
    type OutputSize: ArrayLength<u8>;
    fn new(key: &[u8]) -> Self;
fn input(&mut self, data: &[u8]);
fn result(self) -> MacResult<Self::OutputSize>; fn verify(self, code: &[u8]) -> bool { ... } }

The Mac trait defines methods for a Message Authentication function.

Associated Types

Required Methods

Create new MAC instance. DO NOT USE low-entropy keys (e.g. passwords)!

For low-entropy keys first use an appropriate key derivation function (KDF), e.g. argon2, scrypt or PBKDF2

Process input data.

Obtain the result of a Mac computation as a MacResult.

Provided Methods

Check if code is correct for the processed input