Browse Source

Upgrade for algebra/365 (#92)

* Upgrade for algebra/365

* Merge fix

* Fix
update-to-latest-arkworks
Pratyush Mishra 2 years ago
committed by GitHub
parent
commit
d1ced15cc2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 310 additions and 336 deletions
  1. +8
    -16
      bls12_377/src/curves/g1.rs
  2. +19
    -19
      bls12_377/src/curves/g2.rs
  3. +10
    -9
      bls12_381/src/curves/g1.rs
  4. +9
    -9
      bls12_381/src/curves/g2.rs
  5. +6
    -6
      bn254/src/curves/g1.rs
  6. +14
    -14
      bn254/src/curves/g2.rs
  7. +11
    -11
      bw6_761/src/curves/g1.rs
  8. +11
    -11
      bw6_761/src/curves/g2.rs
  9. +10
    -10
      cp6_782/src/curves/g1.rs
  10. +20
    -20
      cp6_782/src/curves/g2.rs
  11. +8
    -8
      ed_on_bls12_377/src/curves/mod.rs
  12. +8
    -16
      ed_on_bls12_381/src/curves/mod.rs
  13. +8
    -16
      ed_on_bls12_381_bandersnatch/src/curves/mod.rs
  14. +8
    -8
      ed_on_bn254/src/curves/mod.rs
  15. +8
    -8
      ed_on_cp6_782/src/curves/mod.rs
  16. +8
    -8
      ed_on_mnt4_298/src/curves/mod.rs
  17. +8
    -8
      ed_on_mnt4_753/src/curves/mod.rs
  18. +8
    -8
      mnt4_298/src/curves/g1.rs
  19. +16
    -16
      mnt4_298/src/curves/g2.rs
  20. +7
    -8
      mnt4_753/src/curves/g1.rs
  21. +23
    -23
      mnt4_753/src/curves/g2.rs
  22. +7
    -8
      mnt6_298/src/curves/g1.rs
  23. +21
    -21
      mnt6_298/src/curves/g2.rs
  24. +7
    -8
      mnt6_753/src/curves/g1.rs
  25. +35
    -35
      mnt6_753/src/curves/g2.rs
  26. +6
    -6
      pallas/src/curves/mod.rs
  27. +6
    -6
      vesta/src/curves/mod.rs

+ 8
- 16
bls12_377/src/curves/g1.rs

@ -18,6 +18,14 @@ pub struct Parameters;
impl ModelParameters for Parameters {
type BaseField = Fq;
type ScalarField = Fr;
/// COFACTOR = (x - 1)^2 / 3 = 30631250834960419227450344600217059328
const COFACTOR: &'static [u64] = &[0x0, 0x170b5d4430000000];
/// COFACTOR_INV = COFACTOR^{-1} mod r
/// = 5285428838741532253824584287042945485047145357130994810877
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "5285428838741532253824584287042945485047145357130994810877");
}
impl SWModelParameters for Parameters {
@ -28,14 +36,6 @@ impl SWModelParameters for Parameters {
#[rustfmt::skip]
const COEFF_B: Fq = FQ_ONE;
/// COFACTOR = (x - 1)^2 / 3 = 30631250834960419227450344600217059328
const COFACTOR: &'static [u64] = &[0x0, 0x170b5d4430000000];
/// COFACTOR_INV = COFACTOR^{-1} mod r
/// = 5285428838741532253824584287042945485047145357130994810877
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "5285428838741532253824584287042945485047145357130994810877");
/// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
(G1_GENERATOR_X, G1_GENERATOR_Y);
@ -106,14 +106,6 @@ impl TEModelParameters for Parameters {
#[rustfmt::skip]
const COEFF_D: Fq = field_new!(Fq, "122268283598675559488486339158635529096981886914877139579534153582033676785385790730042363341236035746924960903179");
/// COFACTOR = (x - 1)^2 / 3 = 30631250834960419227450344600217059328
const COFACTOR: &'static [u64] = &[0x0, 0x170b5d4430000000];
/// COFACTOR_INV = COFACTOR^{-1} mod r
/// = 5285428838741532253824584287042945485047145357130994810877
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "5285428838741532253824584287042945485047145357130994810877");
/// AFFINE_GENERATOR_COEFFS = (GENERATOR_X, GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
(TE_GENERATOR_X, TE_GENERATOR_Y);

+ 19
- 19
bls12_377/src/curves/g2.rs

@ -9,6 +9,25 @@ pub struct Parameters;
impl ModelParameters for Parameters {
type BaseField = Fq2;
type ScalarField = Fr;
/// COFACTOR =
/// 7923214915284317143930293550643874566881017850177945424769256759165301436616933228209277966774092486467289478618404761412630691835764674559376407658497
#[rustfmt::skip]
const COFACTOR: &'static [u64] = &[
0x0000000000000001,
0x452217cc90000000,
0xa0f3622fba094800,
0xd693e8c36676bd09,
0x8c505634fae2e189,
0xfbb36b00e1dcc40c,
0xddd88d99a6f6a829,
0x26ba558ae9562a,
];
/// COFACTOR_INV = COFACTOR^{-1} mod r
/// = 6764900296503390671038341982857278410319949526107311149686707033187604810669
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "6764900296503390671038341982857278410319949526107311149686707033187604810669");
}
impl SWModelParameters for Parameters {
@ -31,25 +50,6 @@ impl SWModelParameters for Parameters {
field_new!(Fq, "155198655607781456406391640216936120121836107652948796323930557600032281009004493664981332883744016074664192874906"),
);
/// COFACTOR =
/// 7923214915284317143930293550643874566881017850177945424769256759165301436616933228209277966774092486467289478618404761412630691835764674559376407658497
#[rustfmt::skip]
const COFACTOR: &'static [u64] = &[
0x0000000000000001,
0x452217cc90000000,
0xa0f3622fba094800,
0xd693e8c36676bd09,
0x8c505634fae2e189,
0xfbb36b00e1dcc40c,
0xddd88d99a6f6a829,
0x26ba558ae9562a,
];
/// COFACTOR_INV = COFACTOR^{-1} mod r
/// = 6764900296503390671038341982857278410319949526107311149686707033187604810669
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "6764900296503390671038341982857278410319949526107311149686707033187604810669");
/// AFFINE_GENERATOR_COEFFS = (G2_GENERATOR_X, G2_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
(G2_GENERATOR_X, G2_GENERATOR_Y);

+ 10
- 9
bls12_381/src/curves/g1.rs

@ -18,6 +18,14 @@ pub struct Parameters;
impl ModelParameters for Parameters {
type BaseField = Fq;
type ScalarField = Fr;
/// COFACTOR = (x - 1)^2 / 3 = 76329603384216526031706109802092473003
const COFACTOR: &'static [u64] = &[0x8c00aaab0000aaab, 0x396c8c005555e156];
/// COFACTOR_INV = COFACTOR^{-1} mod r
/// = 52435875175126190458656871551744051925719901746859129887267498875565241663483
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "52435875175126190458656871551744051925719901746859129887267498875565241663483");
}
impl SWModelParameters for Parameters {
@ -28,14 +36,6 @@ impl SWModelParameters for Parameters {
#[rustfmt::skip]
const COEFF_B: Fq = field_new!(Fq, "4");
/// COFACTOR = (x - 1)^2 / 3 = 76329603384216526031706109802092473003
const COFACTOR: &'static [u64] = &[0x8c00aaab0000aaab, 0x396c8c005555e156];
/// COFACTOR_INV = COFACTOR^{-1} mod r
/// = 52435875175126190458656871551744051925719901746859129887267498875565241663483
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "52435875175126190458656871551744051925719901746859129887267498875565241663483");
/// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
(G1_GENERATOR_X, G1_GENERATOR_Y);
@ -45,7 +45,8 @@ impl SWModelParameters for Parameters {
Self::BaseField::zero()
}
fn is_in_correct_subgroup_assuming_on_curve(p: &GroupAffine<Parameters>) -> bool {
#[inline]
fn is_in_correct_subgroup_assuming_on_curve(p: &G1Affine) -> bool {
// Algorithm from Section 6 of https://eprint.iacr.org/2021/1130.
//
// Check that endomorphism_p(P) == -[X^2]P

+ 9
- 9
bls12_381/src/curves/g2.rs

@ -17,14 +17,6 @@ pub struct Parameters;
impl ModelParameters for Parameters {
type BaseField = Fq2;
type ScalarField = Fr;
}
impl SWModelParameters for Parameters {
/// COEFF_A = [0, 0]
const COEFF_A: Fq2 = field_new!(Fq2, g1::Parameters::COEFF_A, g1::Parameters::COEFF_A,);
/// COEFF_B = [4, 4]
const COEFF_B: Fq2 = field_new!(Fq2, g1::Parameters::COEFF_B, g1::Parameters::COEFF_B,);
/// COFACTOR = (x^8 - 4 x^7 + 5 x^6) - (4 x^4 + 6 x^3 - 4 x^2 - 4 x + 13) //
/// 9
@ -45,6 +37,14 @@ impl SWModelParameters for Parameters {
/// 26652489039290660355457965112010883481355318854675681319708643586776743290055
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "26652489039290660355457965112010883481355318854675681319708643586776743290055");
}
impl SWModelParameters for Parameters {
/// COEFF_A = [0, 0]
const COEFF_A: Fq2 = field_new!(Fq2, g1::Parameters::COEFF_A, g1::Parameters::COEFF_A,);
/// COEFF_B = [4, 4]
const COEFF_B: Fq2 = field_new!(Fq2, g1::Parameters::COEFF_B, g1::Parameters::COEFF_B,);
/// AFFINE_GENERATOR_COEFFS = (G2_GENERATOR_X, G2_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
@ -55,7 +55,7 @@ impl SWModelParameters for Parameters {
Self::BaseField::zero()
}
fn is_in_correct_subgroup_assuming_on_curve(point: &GroupAffine<Parameters>) -> bool {
fn is_in_correct_subgroup_assuming_on_curve(point: &G2Affine) -> bool {
// Algorithm from Section 4 of https://eprint.iacr.org/2021/1130.
//
// Checks that [p]P = [X]P

+ 6
- 6
bn254/src/curves/g1.rs

@ -9,6 +9,12 @@ pub struct Parameters;
impl ModelParameters for Parameters {
type BaseField = Fq;
type ScalarField = Fr;
/// COFACTOR = 1
const COFACTOR: &'static [u64] = &[0x1];
/// COFACTOR_INV = COFACTOR^{-1} mod r = 1
const COFACTOR_INV: Fr = field_new!(Fr, "1");
}
impl SWModelParameters for Parameters {
@ -18,12 +24,6 @@ impl SWModelParameters for Parameters {
/// COEFF_B = 3
const COEFF_B: Fq = field_new!(Fq, "3");
/// COFACTOR = 1
const COFACTOR: &'static [u64] = &[0x1];
/// COFACTOR_INV = COFACTOR^{-1} mod r = 1
const COFACTOR_INV: Fr = field_new!(Fr, "1");
/// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
(G1_GENERATOR_X, G1_GENERATOR_Y);

+ 14
- 14
bn254/src/curves/g2.rs

@ -9,20 +9,6 @@ pub struct Parameters;
impl ModelParameters for Parameters {
type BaseField = Fq2;
type ScalarField = Fr;
}
impl SWModelParameters for Parameters {
/// COEFF_A = [0, 0]
#[rustfmt::skip]
const COEFF_A: Fq2 = field_new!(Fq2, field_new!(Fq, "0"), field_new!(Fq, "0"));
/// COEFF_B = 3/(u+9)
/// = (19485874751759354771024239261021720505790618469301721065564631296452457478373, 266929791119991161246907387137283842545076965332900288569378510910307636690)
#[rustfmt::skip]
const COEFF_B: Fq2 = field_new!(Fq2,
field_new!(Fq, "19485874751759354771024239261021720505790618469301721065564631296452457478373"),
field_new!(Fq, "266929791119991161246907387137283842545076965332900288569378510910307636690"),
);
/// COFACTOR = (36 * X^4) + (36 * X^3) + (30 * X^2) + 6*X + 1
/// = 21888242871839275222246405745257275088844257914179612981679871602714643921549
@ -37,6 +23,20 @@ impl SWModelParameters for Parameters {
/// COFACTOR_INV = COFACTOR^{-1} mod r
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "10944121435919637613327163357776759465618812564592884533313067514031822496649");
}
impl SWModelParameters for Parameters {
/// COEFF_A = [0, 0]
#[rustfmt::skip]
const COEFF_A: Fq2 = field_new!(Fq2, field_new!(Fq, "0"), field_new!(Fq, "0"));
/// COEFF_B = 3/(u+9)
/// = (19485874751759354771024239261021720505790618469301721065564631296452457478373, 266929791119991161246907387137283842545076965332900288569378510910307636690)
#[rustfmt::skip]
const COEFF_B: Fq2 = field_new!(Fq2,
field_new!(Fq, "19485874751759354771024239261021720505790618469301721065564631296452457478373"),
field_new!(Fq, "266929791119991161246907387137283842545076965332900288569378510910307636690"),
);
/// AFFINE_GENERATOR_COEFFS = (G2_GENERATOR_X, G2_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =

+ 11
- 11
bw6_761/src/curves/g1.rs

@ -14,17 +14,6 @@ pub struct Parameters;
impl ModelParameters for Parameters {
type BaseField = Fq;
type ScalarField = Fr;
}
impl SWModelParameters for Parameters {
/// COEFF_A = 0
#[rustfmt::skip]
const COEFF_A: Fq = field_new!(Fq, "0");
/// COEFF_B = -1
#[rustfmt::skip]
const COEFF_B: Fq = field_new!(Fq, "-1");
/// COFACTOR =
/// 26642435879335816683987677701488073867751118270052650655942102502312977592501693353047140953112195348280268661194876
@ -42,6 +31,17 @@ impl SWModelParameters for Parameters {
/// 91141326767669940707819291241958318717982251277713150053234367522357946997763584490607453720072232540829942217804
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "91141326767669940707819291241958318717982251277713150053234367522357946997763584490607453720072232540829942217804");
}
impl SWModelParameters for Parameters {
/// COEFF_A = 0
#[rustfmt::skip]
const COEFF_A: Fq = field_new!(Fq, "0");
/// COEFF_B = -1
#[rustfmt::skip]
const COEFF_B: Fq = field_new!(Fq, "-1");
/// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =

+ 11
- 11
bw6_761/src/curves/g2.rs

@ -14,17 +14,6 @@ pub struct Parameters;
impl ModelParameters for Parameters {
type BaseField = Fq;
type ScalarField = Fr;
}
impl SWModelParameters for Parameters {
/// COEFF_A = 0
#[rustfmt::skip]
const COEFF_A: Fq = field_new!(Fq, "0");
/// COEFF_B = 4
#[rustfmt::skip]
const COEFF_B: Fq = field_new!(Fq, "4");
/// COFACTOR =
/// 26642435879335816683987677701488073867751118270052650655942102502312977592501693353047140953112195348280268661194869
@ -42,6 +31,17 @@ impl SWModelParameters for Parameters {
/// 214911522365886453591244899095480747723790054550866810551297776298664428889000553861210287833206024638187939842124
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "214911522365886453591244899095480747723790054550866810551297776298664428889000553861210287833206024638187939842124");
}
impl SWModelParameters for Parameters {
/// COEFF_A = 0
#[rustfmt::skip]
const COEFF_A: Fq = field_new!(Fq, "0");
/// COEFF_B = 4
#[rustfmt::skip]
const COEFF_B: Fq = field_new!(Fq, "4");
/// AFFINE_GENERATOR_COEFFS = (G2_GENERATOR_X, G2_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =

+ 10
- 10
cp6_782/src/curves/g1.rs

@ -15,16 +15,6 @@ pub struct Parameters;
impl ModelParameters for Parameters {
type BaseField = Fq;
type ScalarField = Fr;
}
impl SWModelParameters for Parameters {
/// COEFF_A = 5
#[rustfmt::skip]
const COEFF_A: Fq = field_new!(Fq, "5");
/// COEFF_B = 17764315118651679038286329069295091506801468118146712649886336045535808055361274148466772191243305528312843236347777260247138934336850548243151534538734724191505953341403463040067571652261229308333392040104884438208594329793895206056414
#[rustfmt::skip]
const COEFF_B: Fq = field_new!(Fq, "17764315118651679038286329069295091506801468118146712649886336045535808055361274148466772191243305528312843236347777260247138934336850548243151534538734724191505953341403463040067571652261229308333392040104884438208594329793895206056414");
/// COFACTOR =
/// 86482221941698704497288378992285180119495364068003923046442785886272123124361700722982503222189455144364945735564951561028
@ -43,6 +33,16 @@ impl SWModelParameters for Parameters {
/// 163276846538158998893990986356139314746223949404500031940624325017036397274793417940375498603127780919653358641788
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "163276846538158998893990986356139314746223949404500031940624325017036397274793417940375498603127780919653358641788");
}
impl SWModelParameters for Parameters {
/// COEFF_A = 5
#[rustfmt::skip]
const COEFF_A: Fq = field_new!(Fq, "5");
/// COEFF_B = 17764315118651679038286329069295091506801468118146712649886336045535808055361274148466772191243305528312843236347777260247138934336850548243151534538734724191505953341403463040067571652261229308333392040104884438208594329793895206056414
#[rustfmt::skip]
const COEFF_B: Fq = field_new!(Fq, "17764315118651679038286329069295091506801468118146712649886336045535808055361274148466772191243305528312843236347777260247138934336850548243151534538734724191505953341403463040067571652261229308333392040104884438208594329793895206056414");
/// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =

+ 20
- 20
cp6_782/src/curves/g2.rs

@ -15,26 +15,6 @@ pub struct Parameters;
impl ModelParameters for Parameters {
type BaseField = Fq3;
type ScalarField = Fr;
}
impl SWModelParameters for Parameters {
/// COEFF_A = (0, 0, COEFF_A * TWIST^2) = (0, 0, 5)
#[rustfmt::skip]
const COEFF_A: Fq3 = field_new!(Fq3,
FQ_ZERO,
FQ_ZERO,
field_new!(Fq, "5"),
);
/// COEFF_B = (G1::COEFF_B * TWIST^3, 0, 0) =
/// (7237353553714858194254855835825640240663090882935418626687402315497764195116318527743248304684159666286416318482685337633828994152723793439622384740540789612754127688659139509552568164770448654259255628317166934203899992395064470477612,
/// 0, 0)
#[rustfmt::skip]
const COEFF_B: Fq3 = field_new!(Fq3,
field_new!(Fq, "7237353553714858194254855835825640240663090882935418626687402315497764195116318527743248304684159666286416318482685337633828994152723793439622384740540789612754127688659139509552568164770448654259255628317166934203899992395064470477612"),
FQ_ZERO,
FQ_ZERO,
);
/// COFACTOR =
/// 43276679045916726782882096851503554444292580777869919574700824986947162516693702667493938255647666346010819253090121562084993205202476199057555142869892665220155573207800985012241638987472334344174208389303164492698303448192856551557283997344470334833850065978668184377503856699635686872344035470027430053642178229054516302338812152178131995800255516474185251732445975837621097393375441662426280154371264547168198834382681059556891327702516519955053315674076980350109237328216856859758931256208439575383786363605925879337208599843910819433766160937121108797819223653884174994325142959644019600
@ -77,6 +57,26 @@ impl SWModelParameters for Parameters {
/// 45586359457219724873147353901735745013467692594291916855200979604570630929674383405372210802279573887880950375598
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "45586359457219724873147353901735745013467692594291916855200979604570630929674383405372210802279573887880950375598");
}
impl SWModelParameters for Parameters {
/// COEFF_A = (0, 0, COEFF_A * TWIST^2) = (0, 0, 5)
#[rustfmt::skip]
const COEFF_A: Fq3 = field_new!(Fq3,
FQ_ZERO,
FQ_ZERO,
field_new!(Fq, "5"),
);
/// COEFF_B = (G1::COEFF_B * TWIST^3, 0, 0) =
/// (7237353553714858194254855835825640240663090882935418626687402315497764195116318527743248304684159666286416318482685337633828994152723793439622384740540789612754127688659139509552568164770448654259255628317166934203899992395064470477612,
/// 0, 0)
#[rustfmt::skip]
const COEFF_B: Fq3 = field_new!(Fq3,
field_new!(Fq, "7237353553714858194254855835825640240663090882935418626687402315497764195116318527743248304684159666286416318482685337633828994152723793439622384740540789612754127688659139509552568164770448654259255628317166934203899992395064470477612"),
FQ_ZERO,
FQ_ZERO,
);
/// AFFINE_GENERATOR_COEFFS = (G2_GENERATOR_X, G2_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =

+ 8
- 8
ed_on_bls12_377/src/curves/mod.rs

@ -17,6 +17,14 @@ pub struct EdwardsParameters;
impl ModelParameters for EdwardsParameters {
type BaseField = Fq;
type ScalarField = Fr;
/// COFACTOR = 4
const COFACTOR: &'static [u64] = &[4];
/// COFACTOR_INV =
/// 527778859339273151515551558673846658209717731602102048798421311598680340096
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "527778859339273151515551558673846658209717731602102048798421311598680340096");
}
impl TEModelParameters for EdwardsParameters {
@ -28,14 +36,6 @@ impl TEModelParameters for EdwardsParameters {
#[rustfmt::skip]
const COEFF_D: Fq = field_new!(Fq, "3021");
/// COFACTOR = 4
const COFACTOR: &'static [u64] = &[4];
/// COFACTOR_INV =
/// 527778859339273151515551558673846658209717731602102048798421311598680340096
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "527778859339273151515551558673846658209717731602102048798421311598680340096");
/// Generated randomly
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) = (GENERATOR_X, GENERATOR_Y);

+ 8
- 16
ed_on_bls12_381/src/curves/mod.rs

@ -58,6 +58,14 @@ pub type SWParameters = JubjubParameters;
impl ModelParameters for JubjubParameters {
type BaseField = Fq;
type ScalarField = Fr;
/// COFACTOR = 8
const COFACTOR: &'static [u64] = &[8];
/// COFACTOR^(-1) mod r =
/// 819310549611346726241370945440405716213240158234039660170669895299022906775
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "819310549611346726241370945440405716213240158234039660170669895299022906775");
}
impl TEModelParameters for JubjubParameters {
@ -69,14 +77,6 @@ impl TEModelParameters for JubjubParameters {
#[rustfmt::skip]
const COEFF_D: Fq = field_new!(Fq, "19257038036680949359750312669786877991949435402254120286184196891950884077233");
/// COFACTOR = 8
const COFACTOR: &'static [u64] = &[8];
/// COFACTOR^(-1) mod r =
/// 819310549611346726241370945440405716213240158234039660170669895299022906775
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "819310549611346726241370945440405716213240158234039660170669895299022906775");
/// AFFINE_GENERATOR_COEFFS = (GENERATOR_X, GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) = (GENERATOR_X, GENERATOR_Y);
@ -114,14 +114,6 @@ impl SWModelParameters for JubjubParameters {
#[rustfmt::skip]
const COEFF_B: Self::BaseField = field_new!(Fq, "48351165704696163914533707656614864561753505123260775585269522553028192119009");
/// COFACTOR = 8
const COFACTOR: &'static [u64] = &[8];
/// COFACTOR^(-1) mod r =
/// 819310549611346726241370945440405716213240158234039660170669895299022906775
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "819310549611346726241370945440405716213240158234039660170669895299022906775");
/// generators
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
(SW_GENERATOR_X, SW_GENERATOR_Y);

+ 8
- 16
ed_on_bls12_381_bandersnatch/src/curves/mod.rs

@ -60,6 +60,14 @@ pub type SWParameters = BandersnatchParameters;
impl ModelParameters for BandersnatchParameters {
type BaseField = Fq;
type ScalarField = Fr;
/// COFACTOR = 4
const COFACTOR: &'static [u64] = &[4];
/// COFACTOR^(-1) mod r =
/// 9831726595336160714896451345284868594481866920080427688839802480047265754601
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "9831726595336160714896451345284868594481866920080427688839802480047265754601");
}
impl TEModelParameters for BandersnatchParameters {
@ -71,14 +79,6 @@ impl TEModelParameters for BandersnatchParameters {
#[rustfmt::skip]
const COEFF_D: Fq = field_new!(Fq, "45022363124591815672509500913686876175488063829319466900776701791074614335719");
/// COFACTOR = 4
const COFACTOR: &'static [u64] = &[4];
/// COFACTOR^(-1) mod r =
/// 9831726595336160714896451345284868594481866920080427688839802480047265754601
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "9831726595336160714896451345284868594481866920080427688839802480047265754601");
/// AFFINE_GENERATOR_COEFFS = (GENERATOR_X, GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
(TE_GENERATOR_X, TE_GENERATOR_Y);
@ -134,14 +134,6 @@ impl SWModelParameters for BandersnatchParameters {
#[rustfmt::skip]
const COEFF_B: Self::BaseField = field_new!(Fq, "29569587568322301171008055308580903175558631321415017492731745847794083609535");
/// COFACTOR = 4
const COFACTOR: &'static [u64] = &[4];
/// COFACTOR^(-1) mod r =
/// 9831726595336160714896451345284868594481866920080427688839802480047265754601
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "9831726595336160714896451345284868594481866920080427688839802480047265754601");
/// generators
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
(SW_GENERATOR_X, SW_GENERATOR_Y);

+ 8
- 8
ed_on_bn254/src/curves/mod.rs

@ -25,6 +25,14 @@ pub struct EdwardsParameters;
impl ModelParameters for EdwardsParameters {
type BaseField = Fq;
type ScalarField = Fr;
/// COFACTOR = 8
const COFACTOR: &'static [u64] = &[8];
/// COFACTOR^(-1) mod r =
/// 2394026564107420727433200628387514462817212225638746351800188703329891451411
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "2394026564107420727433200628387514462817212225638746351800188703329891451411");
}
impl TEModelParameters for EdwardsParameters {
@ -42,14 +50,6 @@ impl TEModelParameters for EdwardsParameters {
#[rustfmt::skip]
const COEFF_D: Fq = field_new!(Fq, "9706598848417545097372247223557719406784115219466060233080913168975159366771");
/// COFACTOR = 8
const COFACTOR: &'static [u64] = &[8];
/// COFACTOR^(-1) mod r =
/// 2394026564107420727433200628387514462817212225638746351800188703329891451411
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "2394026564107420727433200628387514462817212225638746351800188703329891451411");
/// AFFINE_GENERATOR_COEFFS = (GENERATOR_X, GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) = (GENERATOR_X, GENERATOR_Y);

+ 8
- 8
ed_on_cp6_782/src/curves/mod.rs

@ -18,6 +18,14 @@ pub struct EdwardsParameters;
impl ModelParameters for EdwardsParameters {
type BaseField = Fq;
type ScalarField = Fr;
/// COFACTOR = 8
const COFACTOR: &'static [u64] = &[8];
/// COFACTOR^(-1) mod r =
/// 12124894969357926281749346891948134384518445910386624712788431705725441736421489799867521238554906438478484045560
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "12124894969357926281749346891948134384518445910386624712788431705725441736421489799867521238554906438478484045560");
}
impl TEModelParameters for EdwardsParameters {
@ -29,14 +37,6 @@ impl TEModelParameters for EdwardsParameters {
#[rustfmt::skip]
const COEFF_D: Fq = field_new!(Fq, "79743");
/// COFACTOR = 8
const COFACTOR: &'static [u64] = &[8];
/// COFACTOR^(-1) mod r =
/// 12124894969357926281749346891948134384518445910386624712788431705725441736421489799867521238554906438478484045560
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "12124894969357926281749346891948134384518445910386624712788431705725441736421489799867521238554906438478484045560");
/// AFFINE_GENERATOR_COEFFS = (GENERATOR_X, GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) = (GENERATOR_X, GENERATOR_Y);

+ 8
- 8
ed_on_mnt4_298/src/curves/mod.rs

@ -18,6 +18,14 @@ pub struct EdwardsParameters;
impl ModelParameters for EdwardsParameters {
type BaseField = Fq;
type ScalarField = Fr;
/// COFACTOR = 4
const COFACTOR: &'static [u64] = &[4];
/// COFACTOR_INV (mod r) =
/// 29745142885578832859584328103315528221570304936126890280067991221921526670592508030983158
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "29745142885578832859584328103315528221570304936126890280067991221921526670592508030983158");
}
// Many parameters need to be written down in the Montgomery residue form,
@ -40,14 +48,6 @@ impl TEModelParameters for EdwardsParameters {
#[rustfmt::skip]
const COEFF_D: Fq = field_new!(Fq, "4212");
/// COFACTOR = 4
const COFACTOR: &'static [u64] = &[4];
/// COFACTOR_INV (mod r) =
/// 29745142885578832859584328103315528221570304936126890280067991221921526670592508030983158
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "29745142885578832859584328103315528221570304936126890280067991221921526670592508030983158");
/// Generated randomly
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) = (GENERATOR_X, GENERATOR_Y);

+ 8
- 8
ed_on_mnt4_753/src/curves/mod.rs

@ -18,6 +18,14 @@ pub struct EdwardsParameters;
impl ModelParameters for EdwardsParameters {
type BaseField = Fq;
type ScalarField = Fr;
/// COFACTOR = 8
const COFACTOR: &'static [u64] = &[8];
/// COFACTOR_INV (mod r) =
/// 4582647449616135528381398492791944685893671397494963179726320631987147963874964803303316505414568319530101512550297775574042810022553679071007001162683923594233560231270043634777390699589793776691858866199511300853468155295505
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "4582647449616135528381398492791944685893671397494963179726320631987147963874964803303316505414568319530101512550297775574042810022553679071007001162683923594233560231270043634777390699589793776691858866199511300853468155295505");
}
impl TEModelParameters for EdwardsParameters {
@ -29,14 +37,6 @@ impl TEModelParameters for EdwardsParameters {
#[rustfmt::skip]
const COEFF_D: Fq = field_new!(Fq, "317690");
/// COFACTOR = 8
const COFACTOR: &'static [u64] = &[8];
/// COFACTOR_INV (mod r) =
/// 4582647449616135528381398492791944685893671397494963179726320631987147963874964803303316505414568319530101512550297775574042810022553679071007001162683923594233560231270043634777390699589793776691858866199511300853468155295505
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "4582647449616135528381398492791944685893671397494963179726320631987147963874964803303316505414568319530101512550297775574042810022553679071007001162683923594233560231270043634777390699589793776691858866199511300853468155295505");
/// Generated randomly
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) = (GENERATOR_X, GENERATOR_Y);

+ 8
- 8
mnt4_298/src/curves/g1.rs

@ -15,6 +15,14 @@ pub struct Parameters;
impl ModelParameters for Parameters {
type BaseField = Fq;
type ScalarField = Fr;
/// COFACTOR = 1
const COFACTOR: &'static [u64] = &[1];
/// COFACTOR^(-1) mod r =
/// 1
#[rustfmt::skip]
const COFACTOR_INV: Fr = FR_ONE;
}
impl SWModelParameters for Parameters {
@ -28,14 +36,6 @@ impl SWModelParameters for Parameters {
#[rustfmt::skip]
const COEFF_B: Fq = field_new!(Fq, "423894536526684178289416011533888240029318103673896002803341544124054745019340795360841685");
/// COFACTOR = 1
const COFACTOR: &'static [u64] = &[1];
/// COFACTOR^(-1) mod r =
/// 1
#[rustfmt::skip]
const COFACTOR_INV: Fr = FR_ONE;
/// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
(G1_GENERATOR_X, G1_GENERATOR_Y);

+ 16
- 16
mnt4_298/src/curves/g2.rs

@ -16,6 +16,22 @@ pub struct Parameters;
impl ModelParameters for Parameters {
type BaseField = Fq2;
type ScalarField = Fr;
/// COFACTOR =
/// 475922286169261325753349249653048451545124879932565935237842521413255878328503110407553025
#[rustfmt::skip]
const COFACTOR: &'static [u64] = &[
15480692783052488705,
9802782456999489873,
14622846468721090623,
11702080941310629006,
4110145082483,
];
/// COFACTOR^(-1) mod r =
/// 475922286169261325753349249653048451545124878207887910632124039320641839552134835598065665
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "475922286169261325753349249653048451545124878207887910632124039320641839552134835598065665");
}
/// MUL_BY_A_C0 = NONRESIDUE * COEFF_A
@ -43,22 +59,6 @@ impl SWModelParameters for Parameters {
field_new!(Fq, "67372828414711144619833451280373307321534573815811166723479321465776723059456513877937430"),
);
/// COFACTOR =
/// 475922286169261325753349249653048451545124879932565935237842521413255878328503110407553025
#[rustfmt::skip]
const COFACTOR: &'static [u64] = &[
15480692783052488705,
9802782456999489873,
14622846468721090623,
11702080941310629006,
4110145082483,
];
/// COFACTOR^(-1) mod r =
/// 475922286169261325753349249653048451545124878207887910632124039320641839552134835598065665
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "475922286169261325753349249653048451545124878207887910632124039320641839552134835598065665");
/// AFFINE_GENERATOR_COEFFS = (G2_GENERATOR_X, G2_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
(G2_GENERATOR_X, G2_GENERATOR_Y);

+ 7
- 8
mnt4_753/src/curves/g1.rs

@ -16,6 +16,13 @@ pub struct Parameters;
impl ModelParameters for Parameters {
type BaseField = Fq;
type ScalarField = Fr;
/// COFACTOR = 1
const COFACTOR: &'static [u64] = &[1];
/// COFACTOR^(-1) mod r = 1
#[rustfmt::skip]
const COFACTOR_INV: Fr = FR_ONE;
}
impl SWModelParameters for Parameters {
@ -27,14 +34,6 @@ impl SWModelParameters for Parameters {
#[rustfmt::skip]
const COEFF_B: Fq = field_new!(Fq, "28798803903456388891410036793299405764940372360099938340752576406393880372126970068421383312482853541572780087363938442377933706865252053507077543420534380486492786626556269083255657125025963825610840222568694137138741554679540");
/// COFACTOR = 1
const COFACTOR: &'static [u64] = &[1];
/// COFACTOR^(-1) mod r =
/// 1
#[rustfmt::skip]
const COFACTOR_INV: Fr = FR_ONE;
/// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
(G1_GENERATOR_X, G1_GENERATOR_Y);

+ 23
- 23
mnt4_753/src/curves/g2.rs

@ -17,6 +17,29 @@ pub struct Parameters;
impl ModelParameters for Parameters {
type BaseField = Fq2;
type ScalarField = Fr;
/// COFACTOR =
/// 41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888049094905534395567574915333486969589229856772141392370549616644545554517640527237829320384324374366385444967219201
#[rustfmt::skip]
const COFACTOR: &'static [u64] = &[
16436257212445032449,
8690275530472745198,
17315389657026393162,
1645397558963170979,
3544984605440726586,
12665092767997125024,
11083680675069097885,
575819899841080717,
6825179918269667443,
13256793349531086829,
1162650133526138285,
497830423872529,
];
/// COFACTOR^(-1) mod r =
/// 102345604409665481004734934052318066391634848395005988700111949231215905051467807945653833683883449458834877235200
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "102345604409665481004734934052318066391634848395005988700111949231215905051467807945653833683883449458834877235200");
}
/// MUL_BY_A_C0 = NONRESIDUE * COEFF_A
@ -44,29 +67,6 @@ impl SWModelParameters for Parameters {
field_new!(Fq, "39196523001581428369576759982967177918859161321667605855515469914917622337081756705006832951954384669101573360625169461998308377011601613979275218690841934572954991361632773738259652003389826903175898479855893660378722437317212")
);
/// COFACTOR =
/// 41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888049094905534395567574915333486969589229856772141392370549616644545554517640527237829320384324374366385444967219201
#[rustfmt::skip]
const COFACTOR: &'static [u64] = &[
16436257212445032449,
8690275530472745198,
17315389657026393162,
1645397558963170979,
3544984605440726586,
12665092767997125024,
11083680675069097885,
575819899841080717,
6825179918269667443,
13256793349531086829,
1162650133526138285,
497830423872529,
];
/// COFACTOR^(-1) mod r =
/// 102345604409665481004734934052318066391634848395005988700111949231215905051467807945653833683883449458834877235200
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "102345604409665481004734934052318066391634848395005988700111949231215905051467807945653833683883449458834877235200");
/// AFFINE_GENERATOR_COEFFS = (G2_GENERATOR_X, G2_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
(G2_GENERATOR_X, G2_GENERATOR_Y);

+ 7
- 8
mnt6_298/src/curves/g1.rs

@ -16,6 +16,13 @@ pub struct Parameters;
impl ModelParameters for Parameters {
type BaseField = Fq;
type ScalarField = Fr;
/// COFACTOR = 1
const COFACTOR: &'static [u64] = &[1];
/// COFACTOR^(-1) mod r = 1
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "1");
}
impl SWModelParameters for Parameters {
@ -27,14 +34,6 @@ impl SWModelParameters for Parameters {
#[rustfmt::skip]
const COEFF_B: Fq = field_new!(Fq, "106700080510851735677967319632585352256454251201367587890185989362936000262606668469523074");
/// COFACTOR = 1
const COFACTOR: &'static [u64] = &[1];
/// COFACTOR^(-1) mod r =
/// 1
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "1");
/// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
(G1_GENERATOR_X, G1_GENERATOR_Y);

+ 21
- 21
mnt6_298/src/curves/g2.rs

@ -17,6 +17,27 @@ pub struct Parameters;
impl ModelParameters for Parameters {
type BaseField = Fq3;
type ScalarField = Fr;
/// COFACTOR =
/// 226502022472576270196498690498308461791828762732602586162207535351960270082712694977333372361549082214519252261735048131889018501404377856786623430385820659037970876666767495659520
#[rustfmt::skip]
const COFACTOR: &'static [u64] = &[
15308190245346869248,
10669098443577192943,
4561413759929581409,
3680089780298582849,
17336300687782721465,
10745756320947240891,
17479264233688728128,
16828697388537672097,
4184034152442024798,
915787,
];
/// COFACTOR^(-1) mod r =
/// 79320381028210220958891541608841408590854146655427655872973753568875979721417185067925504
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "79320381028210220958891541608841408590854146655427655872973753568875979721417185067925504");
}
/// MUL_BY_A_C0 = NONRESIDUE * COEFF_A = 5 * 11
@ -40,27 +61,6 @@ impl SWModelParameters for Parameters {
FQ_ZERO,
);
/// COFACTOR =
/// 226502022472576270196498690498308461791828762732602586162207535351960270082712694977333372361549082214519252261735048131889018501404377856786623430385820659037970876666767495659520
#[rustfmt::skip]
const COFACTOR: &'static [u64] = &[
15308190245346869248,
10669098443577192943,
4561413759929581409,
3680089780298582849,
17336300687782721465,
10745756320947240891,
17479264233688728128,
16828697388537672097,
4184034152442024798,
915787,
];
/// COFACTOR^(-1) mod r =
/// 79320381028210220958891541608841408590854146655427655872973753568875979721417185067925504
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "79320381028210220958891541608841408590854146655427655872973753568875979721417185067925504");
/// AFFINE_GENERATOR_COEFFS = (G2_GENERATOR_X, G2_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
(G2_GENERATOR_X, G2_GENERATOR_Y);

+ 7
- 8
mnt6_753/src/curves/g1.rs

@ -16,6 +16,13 @@ pub struct Parameters;
impl ModelParameters for Parameters {
type BaseField = Fq;
type ScalarField = Fr;
/// COFACTOR = 1
const COFACTOR: &'static [u64] = &[1];
/// COFACTOR^(-1) mod r = 1
#[rustfmt::skip]
const COFACTOR_INV: Fr = FR_ONE;
}
impl SWModelParameters for Parameters {
@ -27,14 +34,6 @@ impl SWModelParameters for Parameters {
#[rustfmt::skip]
const COEFF_B: Fq = field_new!(Fq, "11625908999541321152027340224010374716841167701783584648338908235410859267060079819722747939267925389062611062156601938166010098747920378738927832658133625454260115409075816187555055859490253375704728027944315501122723426879114");
/// COFACTOR = 1
const COFACTOR: &'static [u64] = &[1];
/// COFACTOR^(-1) mod r =
/// 1
#[rustfmt::skip]
const COFACTOR_INV: Fr = FR_ONE;
/// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
(G1_GENERATOR_X, G1_GENERATOR_Y);

+ 35
- 35
mnt6_753/src/curves/g2.rs

@ -17,6 +17,41 @@ pub struct Parameters;
impl ModelParameters for Parameters {
type BaseField = Fq3;
type ScalarField = Fr;
/// COFACTOR =
/// 1755483545388786116744270475466687259186947712032004459714210070280389500116987496124098574823389466285978151140155508638765729019174599527183600372094760023144398285325863550664578643924584541949466179502227232245309952839189635010671372908411609248348904807785904229403747495114436660255866932060472369629692502198423138429922875792635236729929780298333055698257230963645509826963717287902205842627121011526048163097042046361575549171961352924692480000
#[rustfmt::skip]
const COFACTOR: &'static [u64] = &[
17839255819456086016,
500623104730997740,
2110252009236161768,
1500878543414750896,
12839751506594314239,
8978537329634833065,
13830010955957826199,
7626514311663165506,
14876243211944528805,
2316601947950921451,
2601177562497904269,
18300670698693155036,
17321427554953155530,
12586270719596716948,
807965545138267130,
13086323046094411844,
16597411233431396880,
5578519820383338987,
16478065054289650824,
12110148809888520863,
5901144846689643164,
3407195776166256068,
14663852814447346059,
13435169368,
];
/// COFACTOR^(-1) mod r =
/// 6983081827986492233724035798540106188028451653325658178630583820170892135428517795509815627298389820236345161981341515817589065927929152555581161598204976128690232061758269440757592419606754539638220064054062394397574161203200
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "6983081827986492233724035798540106188028451653325658178630583820170892135428517795509815627298389820236345161981341515817589065927929152555581161598204976128690232061758269440757592419606754539638220064054062394397574161203200");
}
/// MUL_BY_A_C0 = NONRESIDUE * COEFF_A
@ -54,41 +89,6 @@ impl SWModelParameters for Parameters {
FQ_ZERO,
);
/// COFACTOR =
/// 1755483545388786116744270475466687259186947712032004459714210070280389500116987496124098574823389466285978151140155508638765729019174599527183600372094760023144398285325863550664578643924584541949466179502227232245309952839189635010671372908411609248348904807785904229403747495114436660255866932060472369629692502198423138429922875792635236729929780298333055698257230963645509826963717287902205842627121011526048163097042046361575549171961352924692480000
#[rustfmt::skip]
const COFACTOR: &'static [u64] = &[
17839255819456086016,
500623104730997740,
2110252009236161768,
1500878543414750896,
12839751506594314239,
8978537329634833065,
13830010955957826199,
7626514311663165506,
14876243211944528805,
2316601947950921451,
2601177562497904269,
18300670698693155036,
17321427554953155530,
12586270719596716948,
807965545138267130,
13086323046094411844,
16597411233431396880,
5578519820383338987,
16478065054289650824,
12110148809888520863,
5901144846689643164,
3407195776166256068,
14663852814447346059,
13435169368,
];
/// COFACTOR^(-1) mod r =
/// 6983081827986492233724035798540106188028451653325658178630583820170892135428517795509815627298389820236345161981341515817589065927929152555581161598204976128690232061758269440757592419606754539638220064054062394397574161203200
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, "6983081827986492233724035798540106188028451653325658178630583820170892135428517795509815627298389820236345161981341515817589065927929152555581161598204976128690232061758269440757592419606754539638220064054062394397574161203200");
/// AFFINE_GENERATOR_COEFFS = (G2_GENERATOR_X, G2_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
(G2_GENERATOR_X, G2_GENERATOR_Y);

+ 6
- 6
pallas/src/curves/mod.rs

@ -14,6 +14,12 @@ pub struct PallasParameters;
impl ModelParameters for PallasParameters {
type BaseField = Fq;
type ScalarField = Fr;
/// COFACTOR = 1
const COFACTOR: &'static [u64] = &[0x1];
/// COFACTOR_INV = 1
const COFACTOR_INV: Fr = field_new!(Fr, "1");
}
pub type Affine = GroupAffine<PallasParameters>;
@ -26,12 +32,6 @@ impl SWModelParameters for PallasParameters {
/// COEFF_B = 5
const COEFF_B: Fq = field_new!(Fq, "5");
/// COFACTOR = 1
const COFACTOR: &'static [u64] = &[0x1];
/// COFACTOR_INV = 1
const COFACTOR_INV: Fr = field_new!(Fr, "1");
/// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
(G_GENERATOR_X, G_GENERATOR_Y);

+ 6
- 6
vesta/src/curves/mod.rs

@ -14,6 +14,12 @@ pub struct VestaParameters;
impl ModelParameters for VestaParameters {
type BaseField = Fq;
type ScalarField = Fr;
/// COFACTOR = 1
const COFACTOR: &'static [u64] = &[0x1];
/// COFACTOR_INV = 1
const COFACTOR_INV: Fr = field_new!(Fr, "1");
}
pub type Affine = GroupAffine<VestaParameters>;
@ -26,12 +32,6 @@ impl SWModelParameters for VestaParameters {
/// COEFF_B = 5
const COEFF_B: Fq = field_new!(Fq, "5");
/// COFACTOR = 1
const COFACTOR: &'static [u64] = &[0x1];
/// COFACTOR_INV = 1
const COFACTOR_INV: Fr = field_new!(Fr, "1");
/// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
(G_GENERATOR_X, G_GENERATOR_Y);

Loading…
Cancel
Save