lambdaworks_crypto/commitments/
traits.rs1use lambdaworks_math::{
2 field::{element::FieldElement, traits::IsField},
3 polynomial::Polynomial,
4};
5
6pub trait IsCommitmentScheme<F: IsField> {
7 type Commitment;
8
9 fn commit(&self, p: &Polynomial<FieldElement<F>>) -> Self::Commitment;
10
11 fn open(
12 &self,
13 x: &FieldElement<F>,
14 y: &FieldElement<F>,
15 p: &Polynomial<FieldElement<F>>,
16 ) -> Self::Commitment;
17 fn open_batch(
18 &self,
19 x: &FieldElement<F>,
20 y: &[FieldElement<F>],
21 p: &[Polynomial<FieldElement<F>>],
22 upsilon: &FieldElement<F>,
23 ) -> Self::Commitment;
24
25 fn verify(
26 &self,
27 x: &FieldElement<F>,
28 y: &FieldElement<F>,
29 p_commitment: &Self::Commitment,
30 proof: &Self::Commitment,
31 ) -> bool;
32
33 fn verify_batch(
34 &self,
35 x: &FieldElement<F>,
36 ys: &[FieldElement<F>],
37 p_commitments: &[Self::Commitment],
38 proof: &Self::Commitment,
39 upsilon: &FieldElement<F>,
40 ) -> bool;
41}