pub trait VariableOutput: Sized {
// Required methods
fn new(output_size: usize) -> Result<Self, InvalidLength>;
fn output_size(&self) -> usize;
fn variable_result(self, buffer: &mut [u8]) -> Result<&[u8], InvalidLength>;
}Expand description
Trait for returning digest result with the varaible size
Required Methods§
Sourcefn new(output_size: usize) -> Result<Self, InvalidLength>
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.
Sourcefn output_size(&self) -> usize
fn output_size(&self) -> usize
Get output size of the hasher instance provided to the new method
Sourcefn variable_result(self, buffer: &mut [u8]) -> Result<&[u8], InvalidLength>
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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.