mirror of
https://github.com/arnaucube/ark-curves-cherry-picked.git
synced 2026-01-11 08:21:33 +01:00
Catch up with algebra (#106)
Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
use ark_ec::{
|
||||
models::{ModelParameters, SWModelParameters},
|
||||
short_weierstrass_jacobian::{GroupAffine, GroupProjective},
|
||||
models::{short_weierstrass::SWCurveConfig, CurveConfig},
|
||||
short_weierstrass::{Affine, Projective},
|
||||
};
|
||||
use ark_ff::MontFp;
|
||||
use ark_ff::{Field, MontFp};
|
||||
|
||||
use crate::{Fq, Fr};
|
||||
|
||||
pub type G1Affine = GroupAffine<Parameters>;
|
||||
pub type G1Projective = GroupProjective<Parameters>;
|
||||
pub type G1Affine = Affine<Parameters>;
|
||||
pub type G1Projective = Projective<Parameters>;
|
||||
|
||||
#[derive(Clone, Default, PartialEq, Eq)]
|
||||
pub struct Parameters;
|
||||
|
||||
impl ModelParameters for Parameters {
|
||||
impl CurveConfig for Parameters {
|
||||
type BaseField = Fq;
|
||||
type ScalarField = Fr;
|
||||
|
||||
@@ -30,19 +30,18 @@ impl ModelParameters for Parameters {
|
||||
|
||||
/// COFACTOR^(-1) mod r =
|
||||
/// 91141326767669940707819291241958318717982251277713150053234367522357946997763584490607453720072232540829942217804
|
||||
const COFACTOR_INV: Fr = MontFp!(Fr, "91141326767669940707819291241958318717982251277713150053234367522357946997763584490607453720072232540829942217804");
|
||||
const COFACTOR_INV: Fr = MontFp!("91141326767669940707819291241958318717982251277713150053234367522357946997763584490607453720072232540829942217804");
|
||||
}
|
||||
|
||||
impl SWModelParameters for Parameters {
|
||||
impl SWCurveConfig for Parameters {
|
||||
/// COEFF_A = 0
|
||||
const COEFF_A: Fq = MontFp!(Fq, "0");
|
||||
const COEFF_A: Fq = Fq::ZERO;
|
||||
|
||||
/// COEFF_B = -1
|
||||
const COEFF_B: Fq = MontFp!(Fq, "-1");
|
||||
const COEFF_B: Fq = MontFp!("-1");
|
||||
|
||||
/// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
|
||||
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
|
||||
(G1_GENERATOR_X, G1_GENERATOR_Y);
|
||||
const GENERATOR: G1Affine = G1Affine::new_unchecked(G1_GENERATOR_X, G1_GENERATOR_Y);
|
||||
#[inline(always)]
|
||||
fn mul_by_a(_elem: &Self::BaseField) -> Self::BaseField {
|
||||
use ark_ff::Zero;
|
||||
@@ -52,8 +51,8 @@ impl SWModelParameters for Parameters {
|
||||
|
||||
/// G1_GENERATOR_X =
|
||||
/// 6238772257594679368032145693622812838779005809760824733138787810501188623461307351759238099287535516224314149266511977132140828635950940021790489507611754366317801811090811367945064510304504157188661901055903167026722666149426237
|
||||
pub const G1_GENERATOR_X: Fq = MontFp!(Fq, "6238772257594679368032145693622812838779005809760824733138787810501188623461307351759238099287535516224314149266511977132140828635950940021790489507611754366317801811090811367945064510304504157188661901055903167026722666149426237");
|
||||
pub const G1_GENERATOR_X: Fq = MontFp!("6238772257594679368032145693622812838779005809760824733138787810501188623461307351759238099287535516224314149266511977132140828635950940021790489507611754366317801811090811367945064510304504157188661901055903167026722666149426237");
|
||||
|
||||
/// G1_GENERATOR_Y =
|
||||
/// 2101735126520897423911504562215834951148127555913367997162789335052900271653517958562461315794228241561913734371411178226936527683203879553093934185950470971848972085321797958124416462268292467002957525517188485984766314758624099
|
||||
pub const G1_GENERATOR_Y: Fq = MontFp!(Fq, "2101735126520897423911504562215834951148127555913367997162789335052900271653517958562461315794228241561913734371411178226936527683203879553093934185950470971848972085321797958124416462268292467002957525517188485984766314758624099");
|
||||
pub const G1_GENERATOR_Y: Fq = MontFp!("2101735126520897423911504562215834951148127555913367997162789335052900271653517958562461315794228241561913734371411178226936527683203879553093934185950470971848972085321797958124416462268292467002957525517188485984766314758624099");
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
use ark_ec::{
|
||||
models::{ModelParameters, SWModelParameters},
|
||||
short_weierstrass_jacobian::{GroupAffine, GroupProjective},
|
||||
models::{short_weierstrass::SWCurveConfig, CurveConfig},
|
||||
short_weierstrass::{Affine, Projective},
|
||||
};
|
||||
use ark_ff::MontFp;
|
||||
use ark_ff::{Field, MontFp};
|
||||
|
||||
use crate::{Fq, Fr};
|
||||
|
||||
pub type G2Affine = GroupAffine<Parameters>;
|
||||
pub type G2Projective = GroupProjective<Parameters>;
|
||||
pub type G2Affine = Affine<Parameters>;
|
||||
pub type G2Projective = Projective<Parameters>;
|
||||
|
||||
#[derive(Clone, Default, PartialEq, Eq)]
|
||||
pub struct Parameters;
|
||||
|
||||
impl ModelParameters for Parameters {
|
||||
impl CurveConfig for Parameters {
|
||||
type BaseField = Fq;
|
||||
type ScalarField = Fr;
|
||||
|
||||
@@ -30,19 +30,18 @@ impl ModelParameters for Parameters {
|
||||
|
||||
/// COFACTOR^(-1) mod r =
|
||||
/// 214911522365886453591244899095480747723790054550866810551297776298664428889000553861210287833206024638187939842124
|
||||
const COFACTOR_INV: Fr = MontFp!(Fr, "214911522365886453591244899095480747723790054550866810551297776298664428889000553861210287833206024638187939842124");
|
||||
const COFACTOR_INV: Fr = MontFp!("214911522365886453591244899095480747723790054550866810551297776298664428889000553861210287833206024638187939842124");
|
||||
}
|
||||
|
||||
impl SWModelParameters for Parameters {
|
||||
impl SWCurveConfig for Parameters {
|
||||
/// COEFF_A = 0
|
||||
const COEFF_A: Fq = MontFp!(Fq, "0");
|
||||
const COEFF_A: Fq = Fq::ZERO;
|
||||
|
||||
/// COEFF_B = 4
|
||||
const COEFF_B: Fq = MontFp!(Fq, "4");
|
||||
const COEFF_B: Fq = MontFp!("4");
|
||||
|
||||
/// AFFINE_GENERATOR_COEFFS = (G2_GENERATOR_X, G2_GENERATOR_Y)
|
||||
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
|
||||
(G2_GENERATOR_X, G2_GENERATOR_Y);
|
||||
const GENERATOR: G2Affine = G2Affine::new_unchecked(G2_GENERATOR_X, G2_GENERATOR_Y);
|
||||
|
||||
#[inline(always)]
|
||||
fn mul_by_a(_elem: &Self::BaseField) -> Self::BaseField {
|
||||
@@ -53,8 +52,8 @@ impl SWModelParameters for Parameters {
|
||||
|
||||
/// G2_GENERATOR_X =
|
||||
/// 6445332910596979336035888152774071626898886139774101364933948236926875073754470830732273879639675437155036544153105017729592600560631678554299562762294743927912429096636156401171909259073181112518725201388196280039960074422214428
|
||||
pub const G2_GENERATOR_X: Fq = MontFp!(Fq, "6445332910596979336035888152774071626898886139774101364933948236926875073754470830732273879639675437155036544153105017729592600560631678554299562762294743927912429096636156401171909259073181112518725201388196280039960074422214428");
|
||||
pub const G2_GENERATOR_X: Fq = MontFp!("6445332910596979336035888152774071626898886139774101364933948236926875073754470830732273879639675437155036544153105017729592600560631678554299562762294743927912429096636156401171909259073181112518725201388196280039960074422214428");
|
||||
|
||||
/// G2_GENERATOR_Y =
|
||||
/// 562923658089539719386922163444547387757586534741080263946953401595155211934630598999300396317104182598044793758153214972605680357108252243146746187917218885078195819486220416605630144001533548163105316661692978285266378674355041
|
||||
pub const G2_GENERATOR_Y: Fq = MontFp!(Fq, "562923658089539719386922163444547387757586534741080263946953401595155211934630598999300396317104182598044793758153214972605680357108252243146746187917218885078195819486220416605630144001533548163105316661692978285266378674355041");
|
||||
pub const G2_GENERATOR_Y: Fq = MontFp!("562923658089539719386922163444547387757586534741080263946953401595155211934630598999300396317104182598044793758153214972605680357108252243146746187917218885078195819486220416605630144001533548163105316661692978285266378674355041");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use ark_algebra_test_templates::{
|
||||
curves::*, generate_bilinearity_test, generate_g1_test, generate_g2_test, groups::*, msm::*,
|
||||
curves::*, generate_bilinearity_test, generate_g1_test, generate_g2_test, msm::*,
|
||||
};
|
||||
use ark_ec::{AffineCurve, PairingEngine};
|
||||
use ark_ff::{Field, One, PrimeField};
|
||||
|
||||
Reference in New Issue
Block a user