Trait digest::VariableOutputDirty
source · [−]pub trait VariableOutputDirty: Sized {
fn new(output_size: usize) -> Result<Self, InvalidOutputSize>;
fn output_size(&self) -> usize;
fn finalize_variable_dirty(&mut self, f: impl FnOnce(&[u8]));
}
Expand description
Trait for variable-sized output digest implementations to use to retrieve the hash output.
Usage of this trait in user code is discouraged. Instead use the
VariableOutput::finalize_variable
or
VariableOutput::finalize_variable_reset
methods.
Types which impl this trait along with Reset
will receive a blanket
impl of VariableOutput
.
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
Retrieve result into provided buffer and leave hasher in a dirty state.
This method is expected to only be called once unless
Reset::reset
is called, after which point it can be
called again and reset again (and so on).