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, "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);

View File

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