-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from NOOMA-42/feat/common-interface-for-commit…
…ment-schemes Feature/Implement the common interface for commitment schemes
- Loading branch information
Showing
4 changed files
with
367 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use ff::PrimeField; | ||
|
||
/// A trait defining a common interface for commitment schemes with zk proving capabilities | ||
pub trait CommitmentScheme<F: PrimeField> { | ||
/// The commitment | ||
type Commitment; | ||
/// The type of the opening (proof) | ||
type Opening; | ||
/// The type of additional data needed for verification (e.g., Merkle path or evaluation point) | ||
type Witness; | ||
/// The type of public parameters (if needed) | ||
type PublicParams; | ||
|
||
/// Setup the commitment scheme | ||
fn setup(k: Option<u32>) -> Self; | ||
|
||
/// Commit to a value | ||
fn commit(&self, witness: Self::Witness) -> Self::Commitment; | ||
|
||
/// Open a commitment | ||
fn open(&self, witness: Self::Witness) -> Self::Opening; | ||
|
||
/// Verify a commitment | ||
fn verify( | ||
&self, | ||
commitment: Self::Commitment, | ||
opening: Self::Opening, | ||
witness: Self::Witness, | ||
) -> bool; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.