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>
11 + ToBytesGadget<ConstraintF>
12 + AllocGadget<P::Output, ConstraintF>
13 + Clone
14 + Debug;
15
16 fn new_seed<CS: ConstraintSystem<ConstraintF>>(cs: CS, output: &P::Seed) -> Vec<UInt8>;
17
18 fn check_evaluation_gadget<CS: ConstraintSystem<ConstraintF>>(
19 cs: CS,
20 seed: &[UInt8],
21 input: &[UInt8],
22 ) -> Result<Self::OutputGadget, SynthesisError>;
23}