Trait lambdaworks_crypto::hash::pedersen::Pedersen

source ·
pub trait Pedersen: PedersenParameters + Sealed {
    // Required methods
    fn hash(x: &FE<Self::F>, y: &FE<Self::F>) -> FE<Self::F>;
    fn lookup_and_accumulate(
        acc: &mut Point<Self::EC>,
        bits: &[bool],
        prep: &[Point<Self::EC>],
    );
}

Required Methods§

source

fn hash(x: &FE<Self::F>, y: &FE<Self::F>) -> FE<Self::F>

Implements Starkware version of Pedersen hash of x and y. Divides each of x and y into 4-bit chunks, and uses lookup tables to accumulate pre-calculated points corresponding to a given chunk. Accumulation starts from a “shift_point” whose points are derived from digits of pi. Pre-calculated points are multiples by powers of 2 of the “shift_point”.

Find specification at https://docs.starkware.co/starkex/crypto/pedersen-hash-function.html

source

fn lookup_and_accumulate( acc: &mut Point<Self::EC>, bits: &[bool], prep: &[Point<Self::EC>], )

Performs lookup to find the constant point corresponding to 4-bit chunks of given input. Keeps adding up those points to the given accumulation point.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<P: PedersenParameters<F = Stark252PrimeField>> Pedersen for P