Trait digest::VariableOutput[][src]

pub trait VariableOutput: Sized {
    fn new(output_size: usize) -> Result<Self, InvalidOutputSize>;
fn output_size(&self) -> usize;
fn finalize_variable(self, f: impl FnOnce(&[u8]));
fn finalize_variable_reset(&mut self, f: impl FnOnce(&[u8])); }

Trait for returning digest result with the variable size

Required methods

fn new(output_size: usize) -> Result<Self, InvalidOutputSize>[src]

Create new hasher instance with the given output size.

It will return Err(InvalidOutputSize) in case if hasher can not return specified output size. It will always return an error if output size equals to zero.

fn output_size(&self) -> usize[src]

Get output size of the hasher instance provided to the new method

fn finalize_variable(self, f: impl FnOnce(&[u8]))[src]

Retrieve result via closure and consume hasher.

Closure is guaranteed to be called, length of the buffer passed to it will be equal to output_size.

fn finalize_variable_reset(&mut self, f: impl FnOnce(&[u8]))[src]

Retrieve result via closure and reset the hasher state.

Closure is guaranteed to be called, length of the buffer passed to it will be equal to output_size.

Loading content...

Implementors

impl<D: VariableOutputDirty + Reset> VariableOutput for D[src]

Loading content...