Trait VariableOutput
trait VariableOutput: Sized + Update
Trait for hash functions with variable-size output.
Required Methods
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 hash of the specified output size.fn output_size(self: &Self) -> usizeGet output size of the hasher instance provided to the
newmethodfn finalize_variable(self: Self, out: &mut [u8]) -> Result<(), InvalidBufferSize>Write result into the output buffer.
Returns
Err(InvalidOutputSize)ifoutsize is not equal toself.output_size().
Provided Methods
fn digest_variable<impl AsRef<[u8]>: AsRef<[u8]>>(input: impl AsRef<[u8]>, output: &mut [u8]) -> Result<(), InvalidOutputSize>Compute hash of
dataand write it tooutput.Length of the output hash is determined by
output. Ifoutputis bigger thanSelf::MAX_OUTPUT_SIZE, this method returnsInvalidOutputSize.fn finalize_boxed(self: Self) -> Box<[u8]>Retrieve result into a boxed slice and consume hasher.
Box<[u8]>is used instead ofVec<u8>to save stack space, since they have size of 2 and 3 words respectively.
Implementors
impl<T> VariableOutput for RtVariableCoreWrapper<T>