Trait coins_bip32::ecdsa::signature::digest::VariableOutput [−]
Trait for returning digest result with the variable size
Required methods
pub 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.
pub fn output_size(&self) -> usize
Get output size of the hasher instance provided to the new
method
pub fn finalize_variable(self, f: impl FnOnce(&[u8]))
Retrieve result via closure and consume hasher.
Closure is guaranteed to be called, length of the buffer passed to it
will be equal to output_size
.
pub fn finalize_variable_reset(&mut self, f: impl FnOnce(&[u8]))
Retrieve result via closure and reset the hasher state.
Closure is guaranteed to be called, length of the buffer passed to it
will be equal to output_size
.
Provided methods
pub fn finalize_boxed(self) -> Box<[u8], Global>
Retrieve result into a boxed slice and consume hasher.
Box<[u8]>
is used instead of Vec<u8>
to save stack space, since
they have size of 2 and 3 words respectively.
pub fn finalize_boxed_reset(&mut self) -> Box<[u8], Global>
Retrieve result into a boxed slice and reset hasher state.
Box<[u8]>
is used instead of Vec<u8>
to save stack space, since
they have size of 2 and 3 words respectively.
Implementors
impl<D> VariableOutput for D where
D: VariableOutputDirty + Reset,
D: VariableOutputDirty + Reset,