Trait crypto_mac::Mac
[−]
[src]
pub trait Mac: Sized {
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
type OutputSize: ArrayLength<u8>
Required Methods
fn new(key: &[u8]) -> Self
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
fn input(&mut self, data: &[u8])
Process input data.
fn result(self) -> MacResult<Self::OutputSize>
Obtain the result of a Mac computation as a MacResult.
Provided Methods
fn verify(self, code: &[u8]) -> bool
Check if code is correct for the processed input