Skip to main content

FieldHasherVariable

Trait FieldHasherVariable 

Source
pub trait FieldHasherVariable<C: CircuitConfig>: FieldHasher {
    type DigestVariable: Clone + Copy;

    // Required methods
    fn hash(
        builder: &mut Builder<C>,
        input: &[Felt<SP1Field>],
    ) -> Self::DigestVariable;
    fn compress(
        builder: &mut Builder<C>,
        input: [Self::DigestVariable; 2],
    ) -> Self::DigestVariable;
    fn assert_digest_eq(
        builder: &mut Builder<C>,
        a: Self::DigestVariable,
        b: Self::DigestVariable,
    );
    fn select_chain_digest(
        builder: &mut Builder<C>,
        should_swap: C::Bit,
        input: [Self::DigestVariable; 2],
    ) -> [Self::DigestVariable; 2];
    fn print_digest(builder: &mut Builder<C>, digest: Self::DigestVariable);
}

Required Associated Types§

Required Methods§

Source

fn hash( builder: &mut Builder<C>, input: &[Felt<SP1Field>], ) -> Self::DigestVariable

Source

fn compress( builder: &mut Builder<C>, input: [Self::DigestVariable; 2], ) -> Self::DigestVariable

Source

fn assert_digest_eq( builder: &mut Builder<C>, a: Self::DigestVariable, b: Self::DigestVariable, )

Source

fn select_chain_digest( builder: &mut Builder<C>, should_swap: C::Bit, input: [Self::DigestVariable; 2], ) -> [Self::DigestVariable; 2]

Source

fn print_digest(builder: &mut Builder<C>, digest: Self::DigestVariable)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<C: CircuitConfig<Bit = Felt<SP1Field>>> FieldHasherVariable<C> for SP1GlobalContext

Source§

type DigestVariable = [Felt<KoalaBear>; 8]

Source§

fn hash( builder: &mut Builder<C>, input: &[Felt<SP1Field>], ) -> Self::DigestVariable

Source§

fn compress( builder: &mut Builder<C>, input: [Self::DigestVariable; 2], ) -> Self::DigestVariable

Source§

fn assert_digest_eq( builder: &mut Builder<C>, a: Self::DigestVariable, b: Self::DigestVariable, )

Source§

fn select_chain_digest( builder: &mut Builder<C>, should_swap: <C as CircuitConfig>::Bit, input: [Self::DigestVariable; 2], ) -> [Self::DigestVariable; 2]

Source§

fn print_digest(builder: &mut Builder<C>, digest: Self::DigestVariable)

Source§

impl<C: CircuitConfig<N = Bn254Fr, Bit = Var<Bn254Fr>>> FieldHasherVariable<C> for SP1OuterGlobalContext

Source§

type DigestVariable = [Var<Bn254Fr>; 1]

Source§

fn hash( builder: &mut Builder<C>, input: &[Felt<SP1Field>], ) -> Self::DigestVariable

Source§

fn compress( builder: &mut Builder<C>, input: [Self::DigestVariable; 2], ) -> Self::DigestVariable

Source§

fn assert_digest_eq( builder: &mut Builder<C>, a: Self::DigestVariable, b: Self::DigestVariable, )

Source§

fn select_chain_digest( builder: &mut Builder<C>, should_swap: <C as CircuitConfig>::Bit, input: [Self::DigestVariable; 2], ) -> [Self::DigestVariable; 2]

Source§

fn print_digest(builder: &mut Builder<C>, digest: Self::DigestVariable)

Implementors§