[−]Trait iop_keyvault::Mac
The Mac
trait defines methods for a Message Authentication algorithm.
Associated Types
type OutputSize: ArrayLength<u8>
type KeySize: ArrayLength<u8>
Required methods
fn new(key: &GenericArray<u8, Self::KeySize>) -> Self
Create new MAC instance from key with fixed size.
fn input(&mut self, data: &[u8])
Process input data.
fn reset(&mut self)
Reset Mac
instance.
fn result(self) -> MacResult<Self::OutputSize>
Obtain the result of a Mac
computation as a MacResult
and consume
Mac
instance.
Provided methods
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.
fn result_reset(&mut self) -> MacResult<Self::OutputSize>
Obtain the result of a Mac
computation as a MacResult
and reset
Mac
instance.
fn verify(self, code: &[u8]) -> Result<(), MacError>
Check if code is correct for the processed input.
Implementations on Foreign Types
impl<D> Mac for Hmac<D> where
D: Input + BlockInput + FixedOutput + Reset + Default + Clone,
<D as BlockInput>::BlockSize: ArrayLength<u8>,
<D as FixedOutput>::OutputSize: ArrayLength<u8>,
[src]
D: Input + BlockInput + FixedOutput + Reset + Default + Clone,
<D as BlockInput>::BlockSize: ArrayLength<u8>,
<D as FixedOutput>::OutputSize: ArrayLength<u8>,
type OutputSize = <D as FixedOutput>::OutputSize
type KeySize = <D as BlockInput>::BlockSize
fn new(key: &GenericArray<u8, <Hmac<D> as Mac>::KeySize>) -> Hmac<D>
[src]
fn new_varkey(key: &[u8]) -> Result<Hmac<D>, InvalidKeyLength>
[src]
fn input(&mut self, data: &[u8])
[src]
fn result(self) -> MacResult<<D as FixedOutput>::OutputSize>
[src]
fn reset(&mut self)
[src]
impl Mac for Blake2s
[src]
type OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>
type KeySize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>
fn new(
key: &GenericArray<u8, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>
) -> Blake2s
[src]
key: &GenericArray<u8, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>
) -> Blake2s
fn new_varkey(key: &[u8]) -> Result<Blake2s, InvalidKeyLength>
[src]
fn input(&mut self, data: &[u8])
[src]
fn reset(&mut self)
[src]
fn result(self) -> MacResult<<Blake2s as Mac>::OutputSize>
[src]
impl Mac for Blake2b
[src]
type OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>
type KeySize = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>
fn new(
key: &GenericArray<u8, UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>
) -> Blake2b
[src]
key: &GenericArray<u8, UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>
) -> Blake2b