Trait digest::VariableOutput
source · [−]pub trait VariableOutput: Sized {
fn new(output_size: usize) -> Result<Self, InvalidOutputSize>;
fn output_size(&self) -> usize;
fn variable_result<F: FnOnce(&[u8])>(self, f: F);
fn vec_result(self) -> Vec<u8> { ... }
}
Expand description
Trait for returning digest result with the variable size
Required methods
fn new(output_size: usize) -> Result<Self, InvalidOutputSize>
fn new(output_size: usize) -> Result<Self, InvalidOutputSize>
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
fn output_size(&self) -> usize
Get output size of the hasher instance provided to the new
method
Provided methods
fn vec_result(self) -> Vec<u8>
fn vec_result(self) -> Vec<u8>
Retrieve result into vector and consume hasher.