openvm_circuit::arch::hasher

Trait Hasher

Source
pub trait Hasher<const CHUNK: usize, F: Field> {
    // Required method
    fn compress(&self, left: &[F; CHUNK], right: &[F; CHUNK]) -> [F; CHUNK];

    // Provided methods
    fn hash(&self, values: &[F; CHUNK]) -> [F; CHUNK] { ... }
    fn merkle_root(&self, values: &[F]) -> [F; CHUNK] { ... }
}

Required Methods§

Source

fn compress(&self, left: &[F; CHUNK], right: &[F; CHUNK]) -> [F; CHUNK]

Statelessly compresses two chunks of data into a single chunk.

Provided Methods§

Source

fn hash(&self, values: &[F; CHUNK]) -> [F; CHUNK]

Source

fn merkle_root(&self, values: &[F]) -> [F; CHUNK]

Chunk a list of fields. Use chunks as leaves to computes the root of the Merkle tree. Assumption: the number of public values is a power of two * CHUNK.

Implementors§

Source§

impl<F: PrimeField32> Hasher<PERIPHERY_POSEIDON2_CHUNK_SIZE, F> for Poseidon2PeripheryChip<F>

Source§

impl<F: PrimeField32> Hasher<{ CHUNK }, F> for Poseidon2Hasher<F>

Source§

impl<F: PrimeField32, const SBOX_REGISTERS: usize> Hasher<PERIPHERY_POSEIDON2_CHUNK_SIZE, F> for Poseidon2PeripheryBaseChip<F, SBOX_REGISTERS>