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

View File

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