arnaucube
arnaucube/ark-r1cs-stdPublic Self-hosted repository
ark-r1cs-std/crypto-primitives/src/prf/constraints.rs
crypto-primitives/src/prf/constraints.rsRaw
 1use algebra::Field;
 2use std::fmt::Debug;
 3
 4use crate::prf::PRF;
 5use r1cs_core::{ConstraintSystem, SynthesisError};
 6
 7use r1cs_std::prelude::*;
 8
 9pub trait PRFGadget<P: PRF, ConstraintF: Field> {
10    type OutputGadget: EqGadget<ConstraintF> + ToBytesGadget<ConstraintF> + AllocGadget<P::Output, ConstraintF> + Clone + Debug;
11
12    fn new_seed<CS: ConstraintSystem<ConstraintF>>(cs: CS, output: &P::Seed) -> Vec<UInt8>;
13
14    fn check_evaluation_gadget<CS: ConstraintSystem<ConstraintF>>(
15        cs: CS,
16        seed: &[UInt8],
17        input: &[UInt8],
18    ) -> Result<Self::OutputGadget, SynthesisError>;
19}