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;
}
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.

Implementors§