Trait digest::VariableOutput [−][src]
pub trait VariableOutput: Sized { fn new(output_size: usize) -> Result<Self, InvalidLength>; fn output_size(&self) -> usize; fn variable_result(self, buffer: &mut [u8]) -> Result<&[u8], InvalidLength>; }
Trait for returning digest result with the varaible size
Required Methods
fn new(output_size: usize) -> Result<Self, InvalidLength>
Create new hasher instance with given output size. Will return
Err(InvalidLength)
in case if hasher can not work with the given
output size. Will always return an error if output size equals to zero.
fn output_size(&self) -> usize
Get output size of the hasher instance provided to the new
method
fn variable_result(self, buffer: &mut [u8]) -> Result<&[u8], InvalidLength>
Retrieve the digest result into provided buffer. Length of the buffer
must be equal to output size provided to the new
method, otherwise
Err(InvalidLength)
will be returned