Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Pending

- [\#301](https://github.com/arkworks-rs/algebra/pull/301) (ark-ec) Add `GLVParameters` trait definition.

### Breaking changes

- [\#300](https://github.com/arkworks-rs/algebra/pull/300) (ark-ec) Change the implementation of `Hash` trait of `GroupProjective` to use the affine coordinates.
Expand Down
35 changes: 35 additions & 0 deletions ec/src/glv.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use crate::ModelParameters;

/// The GLV parameters that are useful to compute the endomorphism
/// and scalar decomposition.
pub trait GLVParameters: Send + Sync + 'static + ModelParameters {
type CurveAffine;
type CurveProjective;

// phi(P) = lambda*P for all P
// constants that are used to calculate phi(P)
const COEFF_A1: Self::BaseField;
Comment thread
weikengchen marked this conversation as resolved.
const COEFF_A2: Self::BaseField;
const COEFF_A3: Self::BaseField;
const COEFF_B1: Self::BaseField;
const COEFF_B2: Self::BaseField;
const COEFF_B3: Self::BaseField;
const COEFF_C1: Self::BaseField;
const COEFF_C2: Self::BaseField;

// constants that are used to perform scalar decomposition
// This is a matrix which is practically the LLL reduced bases
const COEFF_N11: Self::ScalarField;
const COEFF_N12: Self::ScalarField;
const COEFF_N21: Self::ScalarField;
const COEFF_N22: Self::ScalarField;

/// mapping a point G to phi(G):= lambda G where psi is the endomorphism
fn endomorphism(base: &Self::CurveAffine) -> Self::CurveAffine;

/// decompose a scalar s into k1, k2, s.t. s = k1 + lambda k2
fn scalar_decomposition(k: &Self::ScalarField) -> (Self::ScalarField, Self::ScalarField);

/// perform GLV multiplication
fn glv_mul(base: &Self::CurveAffine, scalar: &Self::ScalarField) -> Self::CurveProjective;
}
2 changes: 2 additions & 0 deletions ec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ use zeroize::Zeroize;
pub mod models;
pub use self::models::*;

pub mod glv;

pub mod group;

pub mod msm;
Expand Down