pub trait ExtendableOutput: Sized + Update {
type Reader: XofReader;
// Required method
fn finalize_xof(self) -> Self::Reader;
// Provided methods
fn finalize_xof_into(self, out: &mut [u8]) { ... }
fn digest_xof(input: impl AsRef<[u8]>, output: &mut [u8])
where Self: Default { ... }
fn finalize_boxed(self, output_size: usize) -> Box<[u8]> { ... }
}
Expand description
Trait for hash functions with extendable-output (XOF).
Required Associated Types§
Required Methods§
Sourcefn finalize_xof(self) -> Self::Reader
fn finalize_xof(self) -> Self::Reader
Retrieve XOF reader and consume hasher instance.
Provided Methods§
Sourcefn finalize_xof_into(self, out: &mut [u8])
fn finalize_xof_into(self, out: &mut [u8])
Finalize XOF and write result into out
.
Sourcefn digest_xof(input: impl AsRef<[u8]>, output: &mut [u8])where
Self: Default,
fn digest_xof(input: impl AsRef<[u8]>, output: &mut [u8])where
Self: Default,
Compute hash of data
and write it into output
.
Sourcefn finalize_boxed(self, output_size: usize) -> Box<[u8]>
Available on crate feature alloc
only.
fn finalize_boxed(self, output_size: usize) -> Box<[u8]>
alloc
only.Retrieve result into a boxed slice of the specified size and consume the hasher.
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§
Source§impl<T> ExtendableOutput for CoreWrapper<T>where
T: ExtendableOutputCore,
T::BlockSize: IsLess<U256>,
Le<T::BlockSize, U256>: NonZero,
<T::ReaderCore as BlockSizeUser>::BlockSize: IsLess<U256>,
Le<<T::ReaderCore as BlockSizeUser>::BlockSize, U256>: NonZero,
Available on crate feature core-api
only.
impl<T> ExtendableOutput for CoreWrapper<T>where
T: ExtendableOutputCore,
T::BlockSize: IsLess<U256>,
Le<T::BlockSize, U256>: NonZero,
<T::ReaderCore as BlockSizeUser>::BlockSize: IsLess<U256>,
Le<<T::ReaderCore as BlockSizeUser>::BlockSize, U256>: NonZero,
Available on crate feature
core-api
only.