Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ring proof compat layer for Edwards form pks #14

Merged
merged 6 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/ietf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ impl<S: IetfSuite> ark_serialize::Valid for Proof<S> {
}
}

pub trait IetfProver<S: IetfSuite> {
pub trait Prover<S: IetfSuite> {
/// Generate a proof for the given input/output and user additional data.
fn prove(&self, input: Input<S>, output: Output<S>, ad: impl AsRef<[u8]>) -> Proof<S>;
}

pub trait IetfVerifier<S: IetfSuite> {
pub trait Verifier<S: IetfSuite> {
/// Verify a proof for the given input/output and user additional data.
fn verify(
&self,
Expand All @@ -85,7 +85,7 @@ pub trait IetfVerifier<S: IetfSuite> {
) -> Result<(), Error>;
}

impl<S: IetfSuite> IetfProver<S> for Secret<S> {
impl<S: IetfSuite> Prover<S> for Secret<S> {
fn prove(&self, input: Input<S>, output: Output<S>, ad: impl AsRef<[u8]>) -> Proof<S> {
let k = S::nonce(&self.scalar, input);
let k_b = (S::Affine::generator() * k).into_affine();
Expand All @@ -101,7 +101,7 @@ impl<S: IetfSuite> IetfProver<S> for Secret<S> {
}
}

impl<S: IetfSuite> IetfVerifier<S> for Public<S> {
impl<S: IetfSuite> Verifier<S> for Public<S> {
fn verify(
&self,
input: Input<S>,
Expand Down
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ pub mod prelude {
pub use ark_std;
}

pub type ScalarField<S> = <<S as Suite>::Affine as AffineRepr>::ScalarField;
pub type BaseField<S> = <<S as Suite>::Affine as AffineRepr>::BaseField;
pub type AffinePoint<S> = <S as Suite>::Affine;

pub type BaseField<S> = <AffinePoint<S> as AffineRepr>::BaseField;
pub type ScalarField<S> = <AffinePoint<S> as AffineRepr>::ScalarField;
pub type CurveConfig<S> = <AffinePoint<S> as AffineRepr>::Config;

pub type HashOutput<S> = digest::Output<<S as Suite>::Hasher>;

/// Verification error(s)
#[derive(Debug)]
pub enum Error {
VerificationFailure,
}
Expand Down
8 changes: 4 additions & 4 deletions src/pedersen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<S: PedersenSuite> Proof<S> {
}
}

pub trait PedersenProver<S: PedersenSuite> {
pub trait Prover<S: PedersenSuite> {
/// Generate a proof for the given input/output and user additional data.
///
/// Returns the proof together with the associated blinding factor.
Expand All @@ -32,7 +32,7 @@ pub trait PedersenProver<S: PedersenSuite> {
) -> (Proof<S>, ScalarField<S>);
}

pub trait PedersenVerifier<S: PedersenSuite> {
pub trait Verifier<S: PedersenSuite> {
/// Verify a proof for the given input/output and user additional data.
fn verify(
input: Input<S>,
Expand All @@ -42,7 +42,7 @@ pub trait PedersenVerifier<S: PedersenSuite> {
) -> Result<(), Error>;
}

impl<S: PedersenSuite> PedersenProver<S> for Secret<S> {
impl<S: PedersenSuite> Prover<S> for Secret<S> {
fn prove(
&self,
input: Input<S>,
Expand Down Expand Up @@ -81,7 +81,7 @@ impl<S: PedersenSuite> PedersenProver<S> for Secret<S> {
}
}

impl<S: PedersenSuite> PedersenVerifier<S> for Public<S> {
impl<S: PedersenSuite> Verifier<S> for Public<S> {
fn verify(
input: Input<S>,
output: Output<S>,
Expand Down
Loading
Loading