ark_ff::fields::field_hashers

Trait HashToField

Source
pub trait HashToField<F: Field>: Sized {
    // Required methods
    fn new(domain: &[u8]) -> Self;
    fn hash_to_field<const N: usize>(&self, msg: &[u8]) -> [F; N];
}
Expand description

Trait for hashing messages to field elements.

Required Methods§

Source

fn new(domain: &[u8]) -> Self

Initialises a new hash-to-field helper struct.

§Arguments
  • domain - bytes that get concatenated with the msg during hashing, in order to separate potentially interfering instantiations of the hasher.
Source

fn hash_to_field<const N: usize>(&self, msg: &[u8]) -> [F; N]

Hash an arbitrary msg to N elements of the field F.

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<F: Field, H: FixedOutputReset + Default + Clone, const SEC_PARAM: usize> HashToField<F> for DefaultFieldHasher<H, SEC_PARAM>