pub struct SHA3<PARAMS: SHA3Params> { /* private fields */ }Implementations§
Trait Implementations§
Source§impl<PARAMS: SHA3Params> Hash for SHA3<PARAMS>
impl<PARAMS: SHA3Params> Hash for SHA3<PARAMS>
Source§fn block_bitlen(&self) -> usize
fn block_bitlen(&self) -> usize
As per FIPS 202 Table 3. Required, for example, to compute the pad lengths in HMAC.
Source§fn output_len(&self) -> usize
fn output_len(&self) -> usize
The size of the output in bytes.
Source§fn hash(self, data: &[u8]) -> Vec<u8> ⓘ
fn hash(self, data: &[u8]) -> Vec<u8> ⓘ
A static one-shot API that hashes the provided data.
data can be of any length, including zero bytes.Source§fn hash_out(self, data: &[u8], output: &mut [u8]) -> usize
fn hash_out(self, data: &[u8], output: &mut [u8]) -> usize
A static one-shot API that hashes the provided data into the provided output slice.
data can be of any length, including zero bytes.
The return value is the number of bytes written.Source§fn do_update(&mut self, data: &[u8])
fn do_update(&mut self, data: &[u8])
Provide a chunk of data to be absorbed into the hashes.
data can be of any length, including zero bytes.
do_update() is intended to be used as part of a streaming interface, and so may by called multiple times.Source§fn do_final(self) -> Vec<u8> ⓘ
fn do_final(self) -> Vec<u8> ⓘ
Finish absorbing input and produce the hashes output.
Consumes self, so this must be the final call to this object.
Source§fn do_final_out(self, output: &mut [u8]) -> usize
fn do_final_out(self, output: &mut [u8]) -> usize
Finish absorbing input and produce the hashes output.
Consumes self, so this must be the final call to this object. Read more
Source§fn do_final_partial_bits(
self,
partial_byte: u8,
num_partial_bits: usize,
) -> Result<Vec<u8>, HashError>
fn do_final_partial_bits( self, partial_byte: u8, num_partial_bits: usize, ) -> Result<Vec<u8>, HashError>
The same as Hash::do_final, but allows for supplying a partial byte as the last input.
Assumes that the input is in the least significant bits (big endian).
Source§fn do_final_partial_bits_out(
self,
partial_byte: u8,
num_partial_bits: usize,
output: &mut [u8],
) -> Result<usize, HashError>
fn do_final_partial_bits_out( self, partial_byte: u8, num_partial_bits: usize, output: &mut [u8], ) -> Result<usize, HashError>
The same as Hash::do_final_out, but allows for supplying a partial byte as the last input.
Assumes that the input is in the least significant bits (big endian).
will be placed in the first Hash::output_len bytes.
The return value is the number of bytes written.
Source§fn max_security_strength(&self) -> SecurityStrength
fn max_security_strength(&self) -> SecurityStrength
Returns the maximum security strength that this KDF is capable of supporting, based on the underlying primitives.
Source§impl<PARAMS: SHA3Params> KDF for SHA3<PARAMS>
SHA3 is allowed to be used as a KDF in the form HASH(X) as per NIST SP 800-56C.
impl<PARAMS: SHA3Params> KDF for SHA3<PARAMS>
SHA3 is allowed to be used as a KDF in the form HASH(X) as per NIST SP 800-56C.
Source§fn derive_key(
self,
key: &impl KeyMaterial,
additional_input: &[u8],
) -> Result<Box<dyn KeyMaterial>, KDFError>
fn derive_key( self, key: &impl KeyMaterial, additional_input: &[u8], ) -> Result<Box<dyn KeyMaterial>, KDFError>
Returns a KeyMaterialInternal. For the KDF to be considered “fully-seeded” and be capable of outputting full-entropy KeyMaterials, it requires full-entropy input that is at least the bit size (ie 256 bits for SHA3-256, etc).
Source§fn derive_key_out(
self,
key: &impl KeyMaterial,
additional_input: &[u8],
output_key: &mut impl KeyMaterial,
) -> Result<usize, KDFError>
fn derive_key_out( self, key: &impl KeyMaterial, additional_input: &[u8], output_key: &mut impl KeyMaterial, ) -> Result<usize, KDFError>
Source§fn derive_key_from_multiple(
self,
keys: &[&impl KeyMaterial],
additional_input: &[u8],
) -> Result<Box<dyn KeyMaterial>, KDFError>
fn derive_key_from_multiple( self, keys: &[&impl KeyMaterial], additional_input: &[u8], ) -> Result<Box<dyn KeyMaterial>, KDFError>
Meant to be used for hybrid key establishment schemes or other spit-key scenarios where multiple
keys need to be combined into a single key of the same length. Read more
Source§fn derive_key_from_multiple_out(
self,
keys: &[&impl KeyMaterial],
additional_input: &[u8],
output_key: &mut impl KeyMaterial,
) -> Result<usize, KDFError>
fn derive_key_from_multiple_out( self, keys: &[&impl KeyMaterial], additional_input: &[u8], output_key: &mut impl KeyMaterial, ) -> Result<usize, KDFError>
Source§fn max_security_strength(&self) -> SecurityStrength
fn max_security_strength(&self) -> SecurityStrength
Returns the maximum security strength that this KDF is capable of supporting, based on the underlying primitives.
Auto Trait Implementations§
impl<PARAMS> Freeze for SHA3<PARAMS>
impl<PARAMS> RefUnwindSafe for SHA3<PARAMS>where
PARAMS: RefUnwindSafe,
impl<PARAMS> Send for SHA3<PARAMS>where
PARAMS: Send,
impl<PARAMS> Sync for SHA3<PARAMS>where
PARAMS: Sync,
impl<PARAMS> Unpin for SHA3<PARAMS>where
PARAMS: Unpin,
impl<PARAMS> UnwindSafe for SHA3<PARAMS>where
PARAMS: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more