Skip to main content

Digest011

Trait Digest011 

Source
pub trait Digest011: 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) -> Array<u8, Self::OutputSize>;
    fn finalize_into(self, out: &mut Array<u8, Self::OutputSize>);
    fn finalize_reset(&mut self) -> Array<u8, Self::OutputSize>
       where Self: FixedOutputReset;
    fn finalize_into_reset(&mut self, out: &mut Array<u8, Self::OutputSize>)
       where Self: FixedOutputReset;
    fn reset(&mut self)
       where Self: Reset;
    fn output_size() -> usize;
    fn digest(data: impl AsRef<[u8]>) -> Array<u8, Self::OutputSize>;
}
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) -> Array<u8, Self::OutputSize>

Retrieve result and consume hasher instance.

Source

fn finalize_into(self, out: &mut Array<u8, Self::OutputSize>)

Write result into provided array and consume the hasher instance.

Source

fn finalize_reset(&mut self) -> Array<u8, Self::OutputSize>
where Self: FixedOutputReset,

Retrieve result and reset hasher instance.

Source

fn finalize_into_reset(&mut self, out: &mut Array<u8, Self::OutputSize>)
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]>) -> Array<u8, Self::OutputSize>

Compute hash of data.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

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