|
@ -3,9 +3,9 @@ use ark_ec::{ |
|
|
mnt6::MNT6Parameters,
|
|
|
mnt6::MNT6Parameters,
|
|
|
models::{ModelParameters, SWModelParameters},
|
|
|
models::{ModelParameters, SWModelParameters},
|
|
|
};
|
|
|
};
|
|
|
use ark_ff::{biginteger::BigInteger320, field_new};
|
|
|
|
|
|
|
|
|
use ark_ff::{field_new};
|
|
|
|
|
|
|
|
|
use crate::{g1, Fq, Fq3, Fr};
|
|
|
|
|
|
|
|
|
use crate::{g1, Fq, Fq3, Fr, FQ_ZERO};
|
|
|
|
|
|
|
|
|
pub type G2Affine = mnt6::G2Affine<crate::Parameters>;
|
|
|
pub type G2Affine = mnt6::G2Affine<crate::Parameters>;
|
|
|
pub type G2Projective = mnt6::G2Projective<crate::Parameters>;
|
|
|
pub type G2Projective = mnt6::G2Projective<crate::Parameters>;
|
|
@ -19,25 +19,13 @@ impl ModelParameters for Parameters { |
|
|
type ScalarField = Fr;
|
|
|
type ScalarField = Fr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/// MUL_BY_A_C0 = NONRESIDUE * COEFF_A
|
|
|
|
|
|
|
|
|
/// MUL_BY_A_C0 = NONRESIDUE * COEFF_A = 5 * 11
|
|
|
#[rustfmt::skip]
|
|
|
#[rustfmt::skip]
|
|
|
pub const MUL_BY_A_C0: Fq = field_new!(Fq, BigInteger320([
|
|
|
|
|
|
0xa07b458bf1496fab,
|
|
|
|
|
|
0xde8254e6541f9fb4,
|
|
|
|
|
|
0xb1b5cc7bf859c3ea,
|
|
|
|
|
|
0xf83c4d58364645a9,
|
|
|
|
|
|
0x30a29b55fa2,
|
|
|
|
|
|
]));
|
|
|
|
|
|
|
|
|
pub const MUL_BY_A_C0: Fq = field_new!(Fq, "55");
|
|
|
|
|
|
|
|
|
/// MUL_BY_A_C1 = NONRESIDUE * COEFF_A
|
|
|
/// MUL_BY_A_C1 = NONRESIDUE * COEFF_A
|
|
|
#[rustfmt::skip]
|
|
|
#[rustfmt::skip]
|
|
|
pub const MUL_BY_A_C1: Fq = field_new!(Fq, BigInteger320([
|
|
|
|
|
|
0xa07b458bf1496fab,
|
|
|
|
|
|
0xde8254e6541f9fb4,
|
|
|
|
|
|
0xb1b5cc7bf859c3ea,
|
|
|
|
|
|
0xf83c4d58364645a9,
|
|
|
|
|
|
0x30a29b55fa2,
|
|
|
|
|
|
]));
|
|
|
|
|
|
|
|
|
pub const MUL_BY_A_C1: Fq = field_new!(Fq, "55");
|
|
|
|
|
|
|
|
|
/// MUL_BY_A_C2 = COEFF_A
|
|
|
/// MUL_BY_A_C2 = COEFF_A
|
|
|
pub const MUL_BY_A_C2: Fq = g1::Parameters::COEFF_A;
|
|
|
pub const MUL_BY_A_C2: Fq = g1::Parameters::COEFF_A;
|
|
@ -46,15 +34,10 @@ impl SWModelParameters for Parameters { |
|
|
const COEFF_A: Fq3 = crate::Parameters::TWIST_COEFF_A;
|
|
|
const COEFF_A: Fq3 = crate::Parameters::TWIST_COEFF_A;
|
|
|
#[rustfmt::skip]
|
|
|
#[rustfmt::skip]
|
|
|
const COEFF_B: Fq3 = field_new!(Fq3,
|
|
|
const COEFF_B: Fq3 = field_new!(Fq3,
|
|
|
field_new!(Fq, BigInteger320([
|
|
|
|
|
|
0x79a4c2cea3c84026,
|
|
|
|
|
|
0x4b50cad0f3233baa,
|
|
|
|
|
|
0x9ded82770e7a4410,
|
|
|
|
|
|
0x5ade8b105838b95d,
|
|
|
|
|
|
0xe4036e0a3a,
|
|
|
|
|
|
])),
|
|
|
|
|
|
field_new!(Fq, BigInteger320([0, 0, 0, 0, 0])),
|
|
|
|
|
|
field_new!(Fq, BigInteger320([0, 0, 0, 0, 0])),
|
|
|
|
|
|
|
|
|
// 5 * G1::COEFF_B
|
|
|
|
|
|
field_new!(Fq, "57578116384997352636487348509878309737146377454014423897662211075515354005624851787652233"),
|
|
|
|
|
|
FQ_ZERO,
|
|
|
|
|
|
FQ_ZERO,
|
|
|
);
|
|
|
);
|
|
|
|
|
|
|
|
|
/// COFACTOR =
|
|
|
/// COFACTOR =
|
|
@ -76,13 +59,7 @@ impl SWModelParameters for Parameters { |
|
|
/// COFACTOR^(-1) mod r =
|
|
|
/// COFACTOR^(-1) mod r =
|
|
|
/// 79320381028210220958891541608841408590854146655427655872973753568875979721417185067925504
|
|
|
/// 79320381028210220958891541608841408590854146655427655872973753568875979721417185067925504
|
|
|
#[rustfmt::skip]
|
|
|
#[rustfmt::skip]
|
|
|
const COFACTOR_INV: Fr = field_new!(Fr, BigInteger320([
|
|
|
|
|
|
5837598184463018016,
|
|
|
|
|
|
7845868194417674836,
|
|
|
|
|
|
12170332588914158076,
|
|
|
|
|
|
6950611683754678431,
|
|
|
|
|
|
102280178745,
|
|
|
|
|
|
]));
|
|
|
|
|
|
|
|
|
const COFACTOR_INV: Fr = field_new!(Fr, "79320381028210220958891541608841408590854146655427655872973753568875979721417185067925504");
|
|
|
|
|
|
|
|
|
/// AFFINE_GENERATOR_COEFFS = (G2_GENERATOR_X, G2_GENERATOR_Y)
|
|
|
/// AFFINE_GENERATOR_COEFFS = (G2_GENERATOR_X, G2_GENERATOR_Y)
|
|
|
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
|
|
|
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
|
|
@ -104,56 +81,10 @@ const G2_GENERATOR_X: Fq3 = |
|
|
const G2_GENERATOR_Y: Fq3 =
|
|
|
const G2_GENERATOR_Y: Fq3 =
|
|
|
field_new!(Fq3, G2_GENERATOR_Y_C0, G2_GENERATOR_Y_C1, G2_GENERATOR_Y_C2);
|
|
|
field_new!(Fq3, G2_GENERATOR_Y_C0, G2_GENERATOR_Y_C1, G2_GENERATOR_Y_C2);
|
|
|
|
|
|
|
|
|
#[rustfmt::skip]
|
|
|
|
|
|
pub const G2_GENERATOR_X_C0: Fq = field_new!(Fq, BigInteger320([
|
|
|
|
|
|
0x15ca12fc5d551ea7,
|
|
|
|
|
|
0x9e0b2b2b2bb8b979,
|
|
|
|
|
|
0xe6e66283ad5a786a,
|
|
|
|
|
|
0x46ba0aedcc383c07,
|
|
|
|
|
|
0x243853463ed,
|
|
|
|
|
|
]));
|
|
|
|
|
|
|
|
|
pub const G2_GENERATOR_X_C0: Fq = field_new!(Fq, "421456435772811846256826561593908322288509115489119907560382401870203318738334702321297427");
|
|
|
|
|
|
pub const G2_GENERATOR_X_C1: Fq = field_new!(Fq, "103072927438548502463527009961344915021167584706439945404959058962657261178393635706405114");
|
|
|
|
|
|
pub const G2_GENERATOR_X_C2: Fq = field_new!(Fq, "143029172143731852627002926324735183809768363301149009204849580478324784395590388826052558");
|
|
|
|
|
|
|
|
|
#[rustfmt::skip]
|
|
|
|
|
|
pub const G2_GENERATOR_X_C1: Fq = field_new!(Fq, BigInteger320([
|
|
|
|
|
|
0x2c0e3dd7be176130,
|
|
|
|
|
|
0x27a15d879495904b,
|
|
|
|
|
|
0x6f1f0d2dd1502a82,
|
|
|
|
|
|
0x9782ee3c70834da,
|
|
|
|
|
|
0x2c28bb71862,
|
|
|
|
|
|
]));
|
|
|
|
|
|
|
|
|
|
|
|
#[rustfmt::skip]
|
|
|
|
|
|
pub const G2_GENERATOR_X_C2: Fq = field_new!(Fq, BigInteger320([
|
|
|
|
|
|
0xf3e5f4eb9631e1f1,
|
|
|
|
|
|
0x657801e80c50778,
|
|
|
|
|
|
0x2d2abb128fee90f3,
|
|
|
|
|
|
0x72e58e4c3aa3598c,
|
|
|
|
|
|
0x100b8026b9d,
|
|
|
|
|
|
]));
|
|
|
|
|
|
|
|
|
|
|
|
#[rustfmt::skip]
|
|
|
|
|
|
pub const G2_GENERATOR_Y_C0: Fq = field_new!(Fq, BigInteger320([
|
|
|
|
|
|
0xb1cddd6c64a67c5f,
|
|
|
|
|
|
0xa01e90d89aa5d2ba,
|
|
|
|
|
|
0x39e9a733be49ed1,
|
|
|
|
|
|
0x9438f46f63d3264f,
|
|
|
|
|
|
0x12cc928ef10,
|
|
|
|
|
|
]));
|
|
|
|
|
|
|
|
|
|
|
|
#[rustfmt::skip]
|
|
|
|
|
|
pub const G2_GENERATOR_Y_C1: Fq = field_new!(Fq, BigInteger320([
|
|
|
|
|
|
0xa1529b7265ad4be7,
|
|
|
|
|
|
0x21c5e827cf309306,
|
|
|
|
|
|
0x9b3d647bd8c70b22,
|
|
|
|
|
|
0x42835bf373e4b213,
|
|
|
|
|
|
0xd3c77c9ff9,
|
|
|
|
|
|
]));
|
|
|
|
|
|
|
|
|
|
|
|
#[rustfmt::skip]
|
|
|
|
|
|
pub const G2_GENERATOR_Y_C2: Fq = field_new!(Fq, BigInteger320([
|
|
|
|
|
|
0x610557ec4b58b8df,
|
|
|
|
|
|
0x51a23865b52045f1,
|
|
|
|
|
|
0x9dcfd915a09da608,
|
|
|
|
|
|
0x6d65c95f69adb700,
|
|
|
|
|
|
0x2d3c3d195a1,
|
|
|
|
|
|
]));
|
|
|
|
|
|
|
|
|
pub const G2_GENERATOR_Y_C0: Fq = field_new!(Fq, "464673596668689463130099227575639512541218133445388869383893594087634649237515554342751377");
|
|
|
|
|
|
pub const G2_GENERATOR_Y_C1: Fq = field_new!(Fq, "100642907501977375184575075967118071807821117960152743335603284583254620685343989304941678");
|
|
|
|
|
|
pub const G2_GENERATOR_Y_C2: Fq = field_new!(Fq, "123019855502969896026940545715841181300275180157288044663051565390506010149881373807142903");
|