Trait universal_hash::UniversalHash
source · [−]pub trait UniversalHash: BlockSizeUser + Sized {
fn update_with_backend(
&mut self,
f: impl UhfClosure<BlockSize = Self::BlockSize>
);
fn finalize(self) -> Block<Self>;
fn update(&mut self, blocks: &[Block<Self>]) { ... }
fn update_padded(&mut self, data: &[u8]) { ... }
fn verify(self, expected: &Block<Self>) -> Result<(), Error> { ... }
}Expand description
The UniversalHash trait defines a generic interface for universal hash
functions.
Required Methods
fn update_with_backend(
&mut self,
f: impl UhfClosure<BlockSize = Self::BlockSize>
)
fn update_with_backend(
&mut self,
f: impl UhfClosure<BlockSize = Self::BlockSize>
)
Update hash function state using the provided rank-2 closure.
Provided Methods
Update hash function state with the provided block.
fn update_padded(&mut self, data: &[u8])
fn update_padded(&mut self, data: &[u8])
Input data into the universal hash function. If the length of the
data is not a multiple of the block size, the remaining data is
padded with zeroes up to the BlockSize.
This approach is frequently used by AEAD modes which use Message Authentication Codes (MACs) based on universal hashing.