Skip to main content

ExpandMsg

Trait ExpandMsg 

Source
pub trait ExpandMsg<K> {
    type Hash;
    type Expander<'dst>: Expander + Sized;
    type Error: Error;

    // Required method
    fn expand_message<'dst>(
        msg: &[&[u8]],
        dst: &'dst [&[u8]],
        len_in_bytes: NonZero<u16>,
    ) -> Result<Self::Expander<'dst>, Self::Error>;
}
Expand description

Trait for types implementing expand_message interface for hash_to_field.

K is the target security level in bytes: https://www.rfc-editor.org/rfc/rfc9380.html#section-8.9-2.2 https://www.rfc-editor.org/rfc/rfc9380.html#name-target-security-levels

§Errors

See implementors of ExpandMsg for errors.

Required Associated Types§

Source

type Hash

The hash used by this implementation.

Source

type Expander<'dst>: Expander + Sized

Type holding data for the Expander.

Source

type Error: Error

Error returned by ExpandMsg::expand_message.

Required Methods§

Source

fn expand_message<'dst>( msg: &[&[u8]], dst: &'dst [&[u8]], len_in_bytes: NonZero<u16>, ) -> Result<Self::Expander<'dst>, Self::Error>

Expands msg to the required number of bytes.

Returns an expander that can be used to call read until enough bytes have been consumed

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<HashT, K> ExpandMsg<K> for ExpandMsgXmd<HashT>
where HashT: BlockSizeUser + Default + FixedOutput + HashMarker, HashT::OutputSize: IsLessOrEqual<HashT::BlockSize, Output = True> + IsGreaterOrEqual<Prod<K, U2>, Output = True>, K: Mul<U2>,

Source§

type Hash = HashT

Source§

type Expander<'dst> = ExpanderXmd<'dst, HashT>

Source§

type Error = ExpandMsgXmdError

Source§

impl<HashT, K> ExpandMsg<K> for ExpandMsgXof<HashT>
where HashT: Default + ExtendableOutput + Update + HashMarker + CollisionResistance<CollisionResistance: IsGreaterOrEqual<K, Output = True>>, K: Mul<U2, Output: ArraySize>,