Skip to main content

HashFactory

Enum HashFactory 

Source
pub enum HashFactory {
    SHA224(SHA224),
    SHA256(SHA256),
    SHA384(SHA384),
    SHA512(SHA512),
    SHA3_224(SHA3_224),
    SHA3_256(SHA3_256),
    SHA3_384(SHA3_384),
    SHA3_512(SHA3_512),
}
Expand description

All members must impl Hash. Note: no SHAKE because SHAKE is not NIST approved as a hash function. See FIPS 202 section A.2.

Variants§

§

SHA224(SHA224)

§

SHA256(SHA256)

§

SHA384(SHA384)

§

SHA512(SHA512)

§

SHA3_224(SHA3_224)

§

SHA3_256(SHA3_256)

§

SHA3_384(SHA3_384)

§

SHA3_512(SHA3_512)

Trait Implementations§

Source§

impl AlgorithmFactory for HashFactory

Source§

fn default_128_bit() -> HashFactory

Get the default configured algorithm at the 128-bit security level.
Source§

fn default_256_bit() -> HashFactory

Get the default configured algorithm at the 256-bit security level.
Source§

fn new(alg_name: &str) -> Result<Self, FactoryError>

Create an instance of the algorithm by name.
Source§

impl Default for HashFactory

Source§

fn default() -> HashFactory

Returns the “default value” for a type. Read more
Source§

impl Hash for HashFactory

Source§

fn block_bitlen(&self) -> usize

The size of the internal block in bits – needed by functions such as HMAC to compute security parameters.
Source§

fn output_len(&self) -> usize

The size of the output in bytes.
Source§

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

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])

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>

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

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>

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>

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

Returns the maximum security strength that this KDF is capable of supporting, based on the underlying primitives.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.