Upgrade for algebra/365 (#92)

* Upgrade for algebra/365

* Merge fix

* Fix
This commit is contained in:
Pratyush Mishra
2021-12-29 19:07:52 +03:00
committed by GitHub
parent 677b4ae751
commit d1ced15cc2
27 changed files with 310 additions and 336 deletions

View File

@@ -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);

View File

@@ -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);