pub trait VariableOutputReset: VariableOutput + Reset {
// Required method
fn finalize_variable_reset(
&mut self,
out: &mut [u8],
) -> Result<(), InvalidBufferSize>;
// Provided method
fn finalize_boxed_reset(&mut self) -> Box<[u8]> { ... }
}
Expand description
Trait for hash functions with variable-size output able to reset themselves.
Required Methods§
Sourcefn finalize_variable_reset(
&mut self,
out: &mut [u8],
) -> Result<(), InvalidBufferSize>
fn finalize_variable_reset( &mut self, out: &mut [u8], ) -> Result<(), InvalidBufferSize>
Write result into the output buffer and reset the hasher state.
Returns Err(InvalidOutputSize)
if out
size is not equal to
self.output_size()
.
Provided Methods§
Sourcefn finalize_boxed_reset(&mut self) -> Box<[u8]>
Available on crate feature alloc
only.
fn finalize_boxed_reset(&mut self) -> Box<[u8]>
alloc
only.Retrieve result into a boxed slice and reset the hasher state.
Box<[u8]>
is used instead of Vec<u8>
to save stack space, since
they have size of 2 and 3 words respectively.
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.
Implementors§
impl<T> VariableOutputReset for RtVariableCoreWrapper<T>where
T: VariableOutputCore + UpdateCore + Reset,
T::BlockSize: IsLess<U256>,
Le<T::BlockSize, U256>: NonZero,
Available on crate feature
core-api
only.