Skip to main content

VariableOutputCore

Trait VariableOutputCore 

pub trait VariableOutputCore:
    Sized
    + UpdateCore
    + OutputSizeUser
    + BufferKindUser
where Self::BlockSize: IsLess<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>>, <Self::BlockSize as IsLess<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>>>::Output: NonZero,
{ const TRUNC_SIDE: TruncSide; // Required methods fn new(output_size: usize) -> Result<Self, InvalidOutputSize>; fn finalize_variable_core( &mut self, buffer: &mut BlockBuffer<Self::BlockSize, Self::BufferKind>, out: &mut GenericArray<u8, Self::OutputSize>, ); }
Expand description

Core trait for hash functions with variable output size.

Maximum output size is equal to OutputSizeUser::OutputSize. Users are expected to truncate result returned by the finalize_variable_core to output_size passed to the new method during construction. Truncation side is defined by the TRUNC_SIDE associated constant.

Required Associated Constants§

const TRUNC_SIDE: TruncSide

Side which should be used in a truncated result.

Required Methods§

fn new(output_size: usize) -> Result<Self, InvalidOutputSize>

Initialize hasher state for given output size.

Returns InvalidOutputSize if output_size is not valid for the algorithm, e.g. if it’s bigger than the OutputSize associated type.

fn finalize_variable_core( &mut self, buffer: &mut BlockBuffer<Self::BlockSize, Self::BufferKind>, out: &mut GenericArray<u8, Self::OutputSize>, )

Finalize hasher and write full hashing result into the out buffer.

The result must be truncated to output_size used during hasher construction. Truncation side is defined by the TRUNC_SIDE associated constant.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl VariableOutputCore for Blake2bVarCore

§

const TRUNC_SIDE: TruncSide = TruncSide::Left

§

fn new(output_size: usize) -> Result<Blake2bVarCore, InvalidOutputSize>

§

fn finalize_variable_core( &mut self, buffer: &mut BlockBuffer<<Blake2bVarCore as BlockSizeUser>::BlockSize, <Blake2bVarCore as BufferKindUser>::BufferKind>, out: &mut GenericArray<u8, <Blake2bVarCore as OutputSizeUser>::OutputSize>, )

§

impl VariableOutputCore for Blake2sVarCore

§

const TRUNC_SIDE: TruncSide = TruncSide::Left

§

fn new(output_size: usize) -> Result<Blake2sVarCore, InvalidOutputSize>

§

fn finalize_variable_core( &mut self, buffer: &mut BlockBuffer<<Blake2sVarCore as BlockSizeUser>::BlockSize, <Blake2sVarCore as BufferKindUser>::BufferKind>, out: &mut GenericArray<u8, <Blake2sVarCore as OutputSizeUser>::OutputSize>, )

Implementors§

§

impl VariableOutputCore for Sha256VarCore

§

const TRUNC_SIDE: TruncSide = TruncSide::Left

§

impl VariableOutputCore for Sha512VarCore

§

const TRUNC_SIDE: TruncSide = TruncSide::Left