rustls::crypto::hash

Trait Hash

Source
pub trait Hash: Send + Sync {
    // Required methods
    fn start(&self) -> Box<dyn Context>;
    fn hash(&self, data: &[u8]) -> Output;
    fn output_len(&self) -> usize;
    fn algorithm(&self) -> HashAlgorithm;

    // Provided method
    fn fips(&self) -> bool { ... }
}
Expand description

Describes a single cryptographic hash function.

This interface can do both one-shot and incremental hashing, using Hash::hash() and Hash::start() respectively.

Required Methods§

Source

fn start(&self) -> Box<dyn Context>

Start an incremental hash computation.

Source

fn hash(&self, data: &[u8]) -> Output

Return the output of this hash function with input data.

Source

fn output_len(&self) -> usize

The length in bytes of this hash function’s output.

Source

fn algorithm(&self) -> HashAlgorithm

Which hash function this is, eg, HashAlgorithm::SHA256.

Provided Methods§

Source

fn fips(&self) -> bool

Return true if this is backed by a FIPS-approved implementation.

Implementors§