halo2curves_axiom::bls12_381::hash_to_curve

Trait HashToField

Source
pub trait HashToField: Sized {
    type InputLength: ArrayLength<u8>;

    // Required method
    fn from_okm(okm: &GenericArray<u8, Self::InputLength>) -> Self;

    // Provided method
    fn hash_to_field<X: ExpandMessage>(
        message: &[u8],
        dst: &[u8],
        output: &mut [Self],
    ) { ... }
}
Expand description

Enables a byte string to be hashed into one or more field elements for a given curve.

Implements section 5 of draft-irtf-cfrg-hash-to-curve-12.

Required Associated Types§

Source

type InputLength: ArrayLength<u8>

The length of the data used to produce an individual field element.

This must be set to m * L = m * ceil((ceil(log2(p)) + k) / 8), where p is the characteristic of Self, m is the extension degree of Self, and k is the security parameter.

Required Methods§

Source

fn from_okm(okm: &GenericArray<u8, Self::InputLength>) -> Self

Interprets the given output keying material as a big endian integer, and reduces it into a field element.

Provided Methods§

Source

fn hash_to_field<X: ExpandMessage>( message: &[u8], dst: &[u8], output: &mut [Self], )

Hashes a byte string of arbitrary length into one or more elements of Self, using ExpandMessage variant X.

Implements section 5.3 of draft-irtf-cfrg-hash-to-curve-12.

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§