Trait digest::Digest

source ·
pub trait Digest: OutputSizeUser {
    // Required methods
    fn new() -> Self;
    fn new_with_prefix(data: impl AsRef<[u8]>) -> Self;
    fn update(&mut self, data: impl AsRef<[u8]>);
    fn chain_update(self, data: impl AsRef<[u8]>) -> Self;
    fn finalize(self) -> Output<Self>;
    fn finalize_into(self, out: &mut Output<Self>);
    fn finalize_reset(&mut self) -> Output<Self>
       where Self: FixedOutputReset;
    fn finalize_into_reset(&mut self, out: &mut Output<Self>)
       where Self: FixedOutputReset;
    fn reset(&mut self)
       where Self: Reset;
    fn output_size() -> usize;
    fn digest(data: impl AsRef<[u8]>) -> Output<Self>;
}
Expand description

Convenience wrapper trait covering functionality of cryptographic hash functions with fixed output size.

This trait wraps Update, FixedOutput, [Default], and HashMarker traits and provides additional convenience methods.

Required Methods§

source

fn new() -> Self

Create new hasher instance.

source

fn new_with_prefix(data: impl AsRef<[u8]>) -> Self

Create new hasher instance which has processed the provided data.

source

fn update(&mut self, data: impl AsRef<[u8]>)

Process data, updating the internal state.

source

fn chain_update(self, data: impl AsRef<[u8]>) -> Self

Process input data in a chained manner.

source

fn finalize(self) -> Output<Self>

Retrieve result and consume hasher instance.

source

fn finalize_into(self, out: &mut Output<Self>)

Write result into provided array and consume the hasher instance.

source

fn finalize_reset(&mut self) -> Output<Self>
where Self: FixedOutputReset,

Retrieve result and reset hasher instance.

source

fn finalize_into_reset(&mut self, out: &mut Output<Self>)
where Self: FixedOutputReset,

Write result into provided array and reset the hasher instance.

source

fn reset(&mut self)
where Self: Reset,

Reset hasher instance to its initial state.

source

fn output_size() -> usize

Get output size of the hasher

source

fn digest(data: impl AsRef<[u8]>) -> Output<Self>

Compute hash of data.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<D: FixedOutput + Default + Update + HashMarker> Digest for D