pub struct HalftimeHash16 { /* private fields */ }Expand description
Almost-universal hash with a 16-byte tag (HalftimeHash16, Section 4).
Implementations§
Source§impl HalftimeHash16
impl HalftimeHash16
Sourcepub fn digest(key: &Key<Self>, data: &[u8]) -> Block<Self>
pub fn digest(key: &Key<Self>, data: &[u8]) -> Block<Self>
Hash data in one shot with a 32-byte RustCrypto key (NH KDF entropy).
Sourcepub fn from_master_key(key: &impl MasterKey) -> Self
pub fn from_master_key(key: &impl MasterKey) -> Self
Construct from any supported master key ([Key32], [Key64], [Key128]).
A 32-byte key is expanded into input entropy with NH on demand (convenient KDF). Longer keys are folded to 32 bytes with NH before expansion.
Sourcepub fn digest_master_key(key: &impl MasterKey, data: &[u8]) -> Block<Self>
pub fn digest_master_key(key: &impl MasterKey, data: &[u8]) -> Block<Self>
One-shot hash with a master key of any supported length.
Sourcepub fn with_entropy(entropy: &[u64]) -> Result<Self, EntropyTooShort>
pub fn with_entropy(entropy: &[u64]) -> Result<Self, EntropyTooShort>
Construct with caller-supplied input entropy (C++ reference style).
The buffer must hold at least Self::entropy_words_needed words for the
maximum message length you will hash (defaults to 1 MiB).
Sourcepub fn with_entropy_for(
entropy: &[u64],
max_input_bytes: usize,
) -> Result<Self, EntropyTooShort>
pub fn with_entropy_for( entropy: &[u64], max_input_bytes: usize, ) -> Result<Self, EntropyTooShort>
Like Self::with_entropy, but validate for a specific maximum message size.
Sourcepub fn digest_with_entropy(
entropy: &[u64],
data: &[u8],
) -> Result<Block<Self>, EntropyTooShort>
pub fn digest_with_entropy( entropy: &[u64], data: &[u8], ) -> Result<Block<Self>, EntropyTooShort>
One-shot hash with external entropy sized for data.len().
Sourcepub fn entropy_words_needed(input_bytes: usize) -> usize
pub fn entropy_words_needed(input_bytes: usize) -> usize
Number of u64 entropy words required to hash up to input_bytes of message data.
Trait Implementations§
Source§impl BlockSizeUser for HalftimeHash16
impl BlockSizeUser for HalftimeHash16
Source§impl Debug for HalftimeHash16
impl Debug for HalftimeHash16
Source§impl KeyInit for HalftimeHash16
impl KeyInit for HalftimeHash16
Source§fn new(key: &Key<Self>) -> Self
fn new(key: &Key<Self>) -> Self
32-byte key; entropy is expanded on demand via NH (see Self::from_master_key).
Source§fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>
fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>
Source§impl KeySizeUser for HalftimeHash16
impl KeySizeUser for HalftimeHash16
Source§impl UniversalHash for HalftimeHash16
impl UniversalHash for HalftimeHash16
Source§fn update_with_backend(
&mut self,
f: impl UhfClosure<BlockSize = Self::BlockSize>,
)
fn update_with_backend( &mut self, f: impl UhfClosure<BlockSize = Self::BlockSize>, )
Source§fn update_padded(&mut self, data: &[u8])
fn update_padded(&mut self, data: &[u8])
BlockSize. Read more