mirror of
https://github.com/arnaucube/ark-curves-cherry-picked.git
synced 2026-01-08 15:01:29 +01:00
Update BLS12-377
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
use ark_ec::models::{ModelParameters, SWModelParameters};
|
||||
use ark_ff::{
|
||||
biginteger::{BigInteger256, BigInteger384},
|
||||
field_new, Zero,
|
||||
};
|
||||
|
||||
use crate::{Fq, Fr};
|
||||
use crate::{Fq, Fr, fields::{FQ_ZERO, FQ_ONE}};
|
||||
|
||||
#[derive(Clone, Default, PartialEq, Eq)]
|
||||
pub struct Parameters;
|
||||
@@ -16,18 +15,11 @@ impl ModelParameters for Parameters {
|
||||
|
||||
impl SWModelParameters for Parameters {
|
||||
/// COEFF_A = 0
|
||||
const COEFF_A: Fq = field_new!(Fq, BigInteger384([0x0, 0x0, 0x0, 0x0, 0x0, 0x0]));
|
||||
const COEFF_A: Fq = FQ_ZERO;
|
||||
|
||||
/// COEFF_B = 1
|
||||
#[rustfmt::skip]
|
||||
const COEFF_B: Fq = field_new!(Fq, BigInteger384([
|
||||
0x2cdffffffffff68,
|
||||
0x51409f837fffffb1,
|
||||
0x9f7db3a98a7d3ff2,
|
||||
0x7b4e97b76e7c6305,
|
||||
0x4cf495bf803c84e8,
|
||||
0x8d6661e2fdf49a,
|
||||
]));
|
||||
const COEFF_B: Fq = FQ_ONE;
|
||||
|
||||
/// COFACTOR = (x - 1)^2 / 3 = 30631250834960419227450344600217059328
|
||||
const COFACTOR: &'static [u64] = &[0x0, 0x170b5d4430000000];
|
||||
@@ -35,12 +27,7 @@ impl SWModelParameters for Parameters {
|
||||
/// COFACTOR_INV = COFACTOR^{-1} mod r
|
||||
/// = 5285428838741532253824584287042945485047145357130994810877
|
||||
#[rustfmt::skip]
|
||||
const COFACTOR_INV: Fr = field_new!(Fr, BigInteger256([
|
||||
2013239619100046060,
|
||||
4201184776506987597,
|
||||
2526766393982337036,
|
||||
1114629510922847535,
|
||||
]));
|
||||
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) =
|
||||
@@ -55,23 +42,9 @@ impl SWModelParameters for Parameters {
|
||||
/// G1_GENERATOR_X =
|
||||
/// 81937999373150964239938255573465948239988671502647976594219695644855304257327692006745978603320413799295628339695
|
||||
#[rustfmt::skip]
|
||||
pub const G1_GENERATOR_X: Fq = field_new!(Fq, BigInteger384([
|
||||
0x260f33b9772451f4,
|
||||
0xc54dd773169d5658,
|
||||
0x5c1551c469a510dd,
|
||||
0x761662e4425e1698,
|
||||
0xc97d78cc6f065272,
|
||||
0xa41206b361fd4d,
|
||||
]));
|
||||
pub const G1_GENERATOR_X: Fq = field_new!(Fq, "81937999373150964239938255573465948239988671502647976594219695644855304257327692006745978603320413799295628339695");
|
||||
|
||||
/// G1_GENERATOR_Y =
|
||||
/// 241266749859715473739788878240585681733927191168601896383759122102112907357779751001206799952863815012735208165030
|
||||
#[rustfmt::skip]
|
||||
pub const G1_GENERATOR_Y: Fq = field_new!(Fq, BigInteger384([
|
||||
0x8193961fb8cb81f3,
|
||||
0x638d4c5f44adb8,
|
||||
0xfafaf3dad4daf54a,
|
||||
0xc27849e2d655cd18,
|
||||
0x2ec3ddb401d52814,
|
||||
0x7da93326303c71,
|
||||
]));
|
||||
pub const G1_GENERATOR_Y: Fq = field_new!(Fq, "241266749859715473739788878240585681733927191168601896383759122102112907357779751001206799952863815012735208165030");
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
use ark_ec::models::{ModelParameters, SWModelParameters};
|
||||
use ark_ff::{
|
||||
biginteger::{BigInteger256, BigInteger384},
|
||||
field_new, Zero,
|
||||
};
|
||||
|
||||
use crate::{g1, Fq, Fq2, Fr};
|
||||
use crate::{g1, Fq, Fq2, Fr, fields::FQ_ZERO};
|
||||
|
||||
#[derive(Clone, Default, PartialEq, Eq)]
|
||||
pub struct Parameters;
|
||||
@@ -30,15 +29,8 @@ impl SWModelParameters for Parameters {
|
||||
/// 155198655607781456406391640216936120121836107652948796323930557600032281009004493664981332883744016074664192874906]
|
||||
#[rustfmt::skip]
|
||||
const COEFF_B: Fq2 = field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([0, 0, 0, 0, 0, 0])),
|
||||
field_new!(Fq, BigInteger384([
|
||||
9255502405446297221,
|
||||
10229180150694123945,
|
||||
9215585410771530959,
|
||||
13357015519562362907,
|
||||
5437107869987383107,
|
||||
16259554076827459,
|
||||
])),
|
||||
FQ_ZERO,
|
||||
field_new!(Fq, "155198655607781456406391640216936120121836107652948796323930557600032281009004493664981332883744016074664192874906"),
|
||||
);
|
||||
|
||||
/// COFACTOR =
|
||||
@@ -58,12 +50,7 @@ impl SWModelParameters for Parameters {
|
||||
/// COFACTOR_INV = COFACTOR^{-1} mod r
|
||||
/// = 6764900296503390671038341982857278410319949526107311149686707033187604810669
|
||||
#[rustfmt::skip]
|
||||
const COFACTOR_INV: Fr = field_new!(Fr, BigInteger256([
|
||||
15499857013495546999,
|
||||
4613531467548868169,
|
||||
14546778081091178013,
|
||||
549402535258503313,
|
||||
]));
|
||||
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) =
|
||||
@@ -83,47 +70,19 @@ pub const G2_GENERATOR_Y: Fq2 = field_new!(Fq2, G2_GENERATOR_Y_C0, G2_GENERATOR_
|
||||
/// G2_GENERATOR_X_C0 =
|
||||
/// 233578398248691099356572568220835526895379068987715365179118596935057653620464273615301663571204657964920925606294
|
||||
#[rustfmt::skip]
|
||||
pub const G2_GENERATOR_X_C0: Fq = field_new!(Fq, BigInteger384([
|
||||
0x68904082f268725b,
|
||||
0x668f2ea74f45328b,
|
||||
0xebca7a65802be84f,
|
||||
0x1e1850f4c1ada3e6,
|
||||
0x830dc22d588ef1e9,
|
||||
0x1862a81767c0982,
|
||||
]));
|
||||
pub const G2_GENERATOR_X_C0: Fq = field_new!(Fq, "233578398248691099356572568220835526895379068987715365179118596935057653620464273615301663571204657964920925606294");
|
||||
|
||||
/// G2_GENERATOR_X_C1 =
|
||||
/// 140913150380207355837477652521042157274541796891053068589147167627541651775299824604154852141315666357241556069118
|
||||
#[rustfmt::skip]
|
||||
pub const G2_GENERATOR_X_C1: Fq = field_new!(Fq, BigInteger384([
|
||||
0x5f02a915c91c7f39,
|
||||
0xf8c553ba388da2a7,
|
||||
0xd51a416dbd198850,
|
||||
0xe943c6f38ae3073a,
|
||||
0xffe24aa8259a4981,
|
||||
0x11853391e73dfdd,
|
||||
]));
|
||||
pub const G2_GENERATOR_X_C1: Fq = field_new!(Fq, "140913150380207355837477652521042157274541796891053068589147167627541651775299824604154852141315666357241556069118");
|
||||
|
||||
/// G2_GENERATOR_Y_C0 =
|
||||
/// 63160294768292073209381361943935198908131692476676907196754037919244929611450776219210369229519898517858833747423
|
||||
#[rustfmt::skip]
|
||||
pub const G2_GENERATOR_Y_C0: Fq = field_new!(Fq, BigInteger384([
|
||||
0xd5b19b897881430f,
|
||||
0x5be9118a5b371ed,
|
||||
0x6063f91f86c131ee,
|
||||
0x3244a61be8f4ec19,
|
||||
0xa02e425b9f9a3a12,
|
||||
0x18af8c04f3360d2,
|
||||
]));
|
||||
pub const G2_GENERATOR_Y_C0: Fq = field_new!(Fq, "63160294768292073209381361943935198908131692476676907196754037919244929611450776219210369229519898517858833747423");
|
||||
|
||||
/// G2_GENERATOR_Y_C1 =
|
||||
/// 149157405641012693445398062341192467754805999074082136895788947234480009303640899064710353187729182149407503257491
|
||||
#[rustfmt::skip]
|
||||
pub const G2_GENERATOR_Y_C1: Fq = field_new!(Fq, BigInteger384([
|
||||
0x57601ac71a5b96f5,
|
||||
0xe99acc1714f2440e,
|
||||
0x2339612f10118ea9,
|
||||
0x8321e68a3b1cd722,
|
||||
0x2b543b050cc74917,
|
||||
0x590182b396c112,
|
||||
]));
|
||||
pub const G2_GENERATOR_Y_C1: Fq = field_new!(Fq, "149157405641012693445398062341192467754805999074082136895788947234480009303640899064710353187729182149407503257491");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use ark_ff::{biginteger::BigInteger384 as BigInteger, field_new, fields::*};
|
||||
use ark_ff::{biginteger::BigInteger384 as BigInteger, fields::*};
|
||||
|
||||
pub type Fq = Fp384<FqParameters>;
|
||||
|
||||
@@ -113,6 +113,6 @@ impl FpParameters for FqParameters {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub const FQ_ONE: Fq = field_new!(Fq, FqParameters::R);
|
||||
pub const FQ_ONE: Fq = Fq::new(FqParameters::R);
|
||||
#[allow(dead_code)]
|
||||
pub const FQ_ZERO: Fq = field_new!(Fq, BigInteger([0, 0, 0, 0, 0, 0]));
|
||||
pub const FQ_ZERO: Fq = Fq::new(BigInteger([0, 0, 0, 0, 0, 0]));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::*;
|
||||
use ark_ff::{biginteger::BigInteger384, field_new, fields::*};
|
||||
use ark_ff::{field_new, fields::*};
|
||||
|
||||
pub type Fq12 = Fp12<Fq12Parameters>;
|
||||
|
||||
@@ -14,147 +14,60 @@ impl Fp12Parameters for Fq12Parameters {
|
||||
#[rustfmt::skip]
|
||||
const FROBENIUS_COEFF_FP12_C1: &'static [Fq2] = &[
|
||||
// Fp2::NONRESIDUE^(((q^0) - 1) / 6)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0x2cdffffffffff68,
|
||||
0x51409f837fffffb1,
|
||||
0x9f7db3a98a7d3ff2,
|
||||
0x7b4e97b76e7c6305,
|
||||
0x4cf495bf803c84e8,
|
||||
0x8d6661e2fdf49a,
|
||||
])),
|
||||
FQ_ZERO,
|
||||
),
|
||||
field_new!(Fq2, FQ_ONE, FQ_ZERO),
|
||||
// Fp2::NONRESIDUE^(((q^1) - 1) / 6)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0x6ec47a04a3f7ca9e,
|
||||
0xa42e0cb968c1fa44,
|
||||
0x578d5187fbd2bd23,
|
||||
0x930eeb0ac79dd4bd,
|
||||
0xa24883de1e09a9ee,
|
||||
0xdaa7058067d46f,
|
||||
])),
|
||||
field_new!(Fq, "92949345220277864758624960506473182677953048909283248980960104381795901929519566951595905490535835115111760994353"),
|
||||
FQ_ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^2) - 1) / 6)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0x5892506da58478da,
|
||||
0x133366940ac2a74b,
|
||||
0x9b64a150cdf726cf,
|
||||
0x5cc426090a9c587e,
|
||||
0x5cf848adfdcd640c,
|
||||
0x4702bf3ac02380,
|
||||
])),
|
||||
field_new!(Fq, "80949648264912719408558363140637477264845294720710499478137287262712535938301461879813459410946"),
|
||||
FQ_ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^3) - 1) / 6)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0x982c13d9d084771f,
|
||||
0xfd49de0c6da34a32,
|
||||
0x61a530d183ab0e53,
|
||||
0xdf8fe44106dd9879,
|
||||
0x40f29b58d88472bc,
|
||||
0x158723199046d5d,
|
||||
])),
|
||||
field_new!(Fq, "216465761340224619389371505802605247630151569547285782856803747159100223055385581585702401816380679166954762214499"),
|
||||
FQ_ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^4) - 1) / 6)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0xdacd106da5847973,
|
||||
0xd8fe2454bac2a79a,
|
||||
0x1ada4fd6fd832edc,
|
||||
0xfb9868449d150908,
|
||||
0xd63eb8aeea32285e,
|
||||
0x167d6a36f873fd0,
|
||||
])),
|
||||
field_new!(Fq, "80949648264912719408558363140637477264845294720710499478137287262712535938301461879813459410945"),
|
||||
FQ_ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^5) - 1) / 6)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0x296799d52c8cac81,
|
||||
0x591bd15304e14fee,
|
||||
0xa17df4987d85130,
|
||||
0x4c80f9363f3fc3bc,
|
||||
0x9eaa177aba7ac8ce,
|
||||
0x7dcb2c189c98ed,
|
||||
])),
|
||||
field_new!(Fq, "123516416119946754630746545296132064952198520638002533875843642777304321125866014634106496325844844051843001220146"),
|
||||
FQ_ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^6) - 1) / 6)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0x823ac00000000099,
|
||||
0xc5cabdc0b000004f,
|
||||
0x7f75ae862f8c080d,
|
||||
0x9ed4423b9278b089,
|
||||
0x79467000ec64c452,
|
||||
0x120d3e434c71c50,
|
||||
])),
|
||||
field_new!(Fq, BigInteger384([0x0, 0x0, 0x0, 0x0, 0x0, 0x0])),
|
||||
field_new!(Fq, "-1"),
|
||||
FQ_ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^7) - 1) / 6)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0x164445fb5c083563,
|
||||
0x72dd508ac73e05bc,
|
||||
0xc76610a7be368adc,
|
||||
0x8713eee839573ed1,
|
||||
0x23f281e24e979f4c,
|
||||
0xd39340975d3c7b,
|
||||
])),
|
||||
field_new!(Fq, "165715080792691229252027773188420350858440463845631411558924158284924566418821255823372982649037525009328560463824"),
|
||||
FQ_ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^8) - 1) / 6)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0x2c766f925a7b8727,
|
||||
0x3d7f6b0253d58b5,
|
||||
0x838ec0deec122131,
|
||||
0xbd5eb3e9f658bb10,
|
||||
0x6942bd126ed3e52e,
|
||||
0x1673786dd04ed6a,
|
||||
])),
|
||||
field_new!(Fq, "258664426012969093929703085429980814127835149614277183275038967946009968870203535512256352201271898244626862047231"),
|
||||
FQ_ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^9) - 1) / 6)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0xecdcac262f7b88e2,
|
||||
0x19c17f37c25cb5cd,
|
||||
0xbd4e315e365e39ac,
|
||||
0x3a92f5b1fa177b15,
|
||||
0x85486a67941cd67e,
|
||||
0x55c8147ec0a38d,
|
||||
])),
|
||||
field_new!(Fq, "42198664672744474621281227892288285906241943207628877683080515507620245292955241189266486323192680957485559243678"),
|
||||
FQ_ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^10) - 1) / 6)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0xaa3baf925a7b868e,
|
||||
0x3e0d38ef753d5865,
|
||||
0x4191258bc861923,
|
||||
0x1e8a71ae63e00a87,
|
||||
0xeffc4d11826f20dc,
|
||||
0x4663a2a83dd119,
|
||||
])),
|
||||
field_new!(Fq, "258664426012969093929703085429980814127835149614277183275038967946009968870203535512256352201271898244626862047232"),
|
||||
FQ_ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^11) - 1) / 6)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0x5ba1262ad3735380,
|
||||
0xbdef8bf12b1eb012,
|
||||
0x14db82e63230f6cf,
|
||||
0xcda1e0bcc1b54fd3,
|
||||
0x2790ee45b226806c,
|
||||
0x1306f19ff2877fd,
|
||||
])),
|
||||
field_new!(Fq, "135148009893022339379906188398761468584194992116912126664040619889416147222474808140862391813728516072597320238031"),
|
||||
FQ_ZERO,
|
||||
),
|
||||
];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::*;
|
||||
use ark_ff::{biginteger::BigInteger384 as BigInteger, field_new, fields::*};
|
||||
use ark_ff::{field_new, fields::*};
|
||||
|
||||
pub type Fq2 = Fp2<Fq2Parameters>;
|
||||
|
||||
@@ -10,50 +10,19 @@ impl Fp2Parameters for Fq2Parameters {
|
||||
|
||||
/// NONRESIDUE = -5
|
||||
#[rustfmt::skip]
|
||||
const NONRESIDUE: Fq = field_new!(Fq, BigInteger([
|
||||
0xfc0b8000000002fa,
|
||||
0x97d39cf6e000018b,
|
||||
0x2072420fbfa05044,
|
||||
0xcbbcbd50d97c3802,
|
||||
0xbaf1ec35813f9eb,
|
||||
0x9974a2c0945ad2,
|
||||
]));
|
||||
const NONRESIDUE: Fq = field_new!(Fq, "-5");
|
||||
|
||||
/// QUADRATIC_NONRESIDUE = U
|
||||
#[rustfmt::skip]
|
||||
const QUADRATIC_NONRESIDUE: (Fq, Fq) = (
|
||||
field_new!(Fq, BigInteger([0, 0, 0, 0, 0, 0])),
|
||||
field_new!(Fq, BigInteger([
|
||||
202099033278250856u64,
|
||||
5854854902718660529u64,
|
||||
11492539364873682930u64,
|
||||
8885205928937022213u64,
|
||||
5545221690922665192u64,
|
||||
39800542322357402u64,
|
||||
])),
|
||||
);
|
||||
const QUADRATIC_NONRESIDUE: (Fq, Fq) = (FQ_ZERO, FQ_ONE);
|
||||
|
||||
/// Coefficients for the Frobenius automorphism.
|
||||
#[rustfmt::skip]
|
||||
const FROBENIUS_COEFF_FP2_C1: &'static [Fq] = &[
|
||||
// NONRESIDUE**(((q^0) - 1) / 2)
|
||||
field_new!(Fq, BigInteger([
|
||||
0x2cdffffffffff68,
|
||||
0x51409f837fffffb1,
|
||||
0x9f7db3a98a7d3ff2,
|
||||
0x7b4e97b76e7c6305,
|
||||
0x4cf495bf803c84e8,
|
||||
0x8d6661e2fdf49a,
|
||||
])),
|
||||
FQ_ONE,
|
||||
// NONRESIDUE**(((q^1) - 1) / 2)
|
||||
field_new!(Fq, BigInteger([
|
||||
0x823ac00000000099,
|
||||
0xc5cabdc0b000004f,
|
||||
0x7f75ae862f8c080d,
|
||||
0x9ed4423b9278b089,
|
||||
0x79467000ec64c452,
|
||||
0x120d3e434c71c50,
|
||||
])),
|
||||
field_new!(Fq, "-1"),
|
||||
];
|
||||
|
||||
#[inline(always)]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::*;
|
||||
use ark_ff::{biginteger::BigInteger384, field_new, fields::*};
|
||||
use ark_ff::{field_new, fields::*};
|
||||
|
||||
pub type Fq6 = Fp6<Fq6Parameters>;
|
||||
|
||||
@@ -11,166 +11,60 @@ impl Fp6Parameters for Fq6Parameters {
|
||||
|
||||
/// NONRESIDUE = U
|
||||
#[rustfmt::skip]
|
||||
const NONRESIDUE: Fq2 = field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([0, 0, 0, 0, 0, 0])),
|
||||
field_new!(Fq, BigInteger384([
|
||||
202099033278250856u64,
|
||||
5854854902718660529u64,
|
||||
11492539364873682930u64,
|
||||
8885205928937022213u64,
|
||||
5545221690922665192u64,
|
||||
39800542322357402u64,
|
||||
])),
|
||||
);
|
||||
const NONRESIDUE: Fq2 = field_new!(Fq2, FQ_ZERO, FQ_ONE);
|
||||
|
||||
#[rustfmt::skip]
|
||||
const FROBENIUS_COEFF_FP6_C1: &'static [Fq2] = &[
|
||||
// Fp2::NONRESIDUE^(((q^0) - 1) / 3)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0x2cdffffffffff68,
|
||||
0x51409f837fffffb1,
|
||||
0x9f7db3a98a7d3ff2,
|
||||
0x7b4e97b76e7c6305,
|
||||
0x4cf495bf803c84e8,
|
||||
0x8d6661e2fdf49a,
|
||||
])),
|
||||
field_new!(Fq, BigInteger384([0x0, 0x0, 0x0, 0x0, 0x0, 0x0])),
|
||||
),
|
||||
field_new!(Fq2, FQ_ONE, FQ_ZERO),
|
||||
// Fp2::NONRESIDUE^(((q^1) - 1) / 3)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0x5892506da58478da,
|
||||
0x133366940ac2a74b,
|
||||
0x9b64a150cdf726cf,
|
||||
0x5cc426090a9c587e,
|
||||
0x5cf848adfdcd640c,
|
||||
0x4702bf3ac02380,
|
||||
])),
|
||||
field_new!(Fq, BigInteger384([0x0, 0x0, 0x0, 0x0, 0x0, 0x0])),
|
||||
field_new!(Fq, "80949648264912719408558363140637477264845294720710499478137287262712535938301461879813459410946"),
|
||||
FQ_ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^2) - 1) / 3)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0xdacd106da5847973,
|
||||
0xd8fe2454bac2a79a,
|
||||
0x1ada4fd6fd832edc,
|
||||
0xfb9868449d150908,
|
||||
0xd63eb8aeea32285e,
|
||||
0x167d6a36f873fd0,
|
||||
])),
|
||||
field_new!(Fq, BigInteger384([0x0, 0x0, 0x0, 0x0, 0x0, 0x0])),
|
||||
field_new!(Fq, "80949648264912719408558363140637477264845294720710499478137287262712535938301461879813459410945"),
|
||||
FQ_ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^3) - 1) / 3)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0x823ac00000000099,
|
||||
0xc5cabdc0b000004f,
|
||||
0x7f75ae862f8c080d,
|
||||
0x9ed4423b9278b089,
|
||||
0x79467000ec64c452,
|
||||
0x120d3e434c71c50,
|
||||
])),
|
||||
field_new!(Fq, BigInteger384([0x0, 0x0, 0x0, 0x0, 0x0, 0x0])),
|
||||
),
|
||||
field_new!(Fq2, field_new!(Fq, "-1"), FQ_ZERO),
|
||||
// Fp2::NONRESIDUE^(((q^4) - 1) / 3)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0x2c766f925a7b8727,
|
||||
0x3d7f6b0253d58b5,
|
||||
0x838ec0deec122131,
|
||||
0xbd5eb3e9f658bb10,
|
||||
0x6942bd126ed3e52e,
|
||||
0x1673786dd04ed6a,
|
||||
])),
|
||||
field_new!(Fq, BigInteger384([0x0, 0x0, 0x0, 0x0, 0x0, 0x0])),
|
||||
field_new!(Fq, "258664426012969093929703085429980814127835149614277183275038967946009968870203535512256352201271898244626862047231"),
|
||||
FQ_ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^5) - 1) / 3)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0xaa3baf925a7b868e,
|
||||
0x3e0d38ef753d5865,
|
||||
0x4191258bc861923,
|
||||
0x1e8a71ae63e00a87,
|
||||
0xeffc4d11826f20dc,
|
||||
0x4663a2a83dd119,
|
||||
])),
|
||||
field_new!(Fq, BigInteger384([0x0, 0x0, 0x0, 0x0, 0x0, 0x0])),
|
||||
field_new!(Fq, "258664426012969093929703085429980814127835149614277183275038967946009968870203535512256352201271898244626862047232"),
|
||||
FQ_ZERO,
|
||||
),
|
||||
];
|
||||
#[rustfmt::skip]
|
||||
const FROBENIUS_COEFF_FP6_C2: &'static [Fq2] = &[
|
||||
// Fp2::NONRESIDUE^((2*(q^0) - 2) / 3)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0x2cdffffffffff68,
|
||||
0x51409f837fffffb1,
|
||||
0x9f7db3a98a7d3ff2,
|
||||
0x7b4e97b76e7c6305,
|
||||
0x4cf495bf803c84e8,
|
||||
0x8d6661e2fdf49a,
|
||||
])),
|
||||
field_new!(Fq, BigInteger384([0x0, 0x0, 0x0, 0x0, 0x0, 0x0])),
|
||||
),
|
||||
field_new!(Fq2, FQ_ONE, FQ_ZERO),
|
||||
// Fp2::NONRESIDUE^((2*(q^1) - 2) / 3)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0xdacd106da5847973,
|
||||
0xd8fe2454bac2a79a,
|
||||
0x1ada4fd6fd832edc,
|
||||
0xfb9868449d150908,
|
||||
0xd63eb8aeea32285e,
|
||||
0x167d6a36f873fd0,
|
||||
])),
|
||||
field_new!(Fq, BigInteger384([0x0, 0x0, 0x0, 0x0, 0x0, 0x0])),
|
||||
field_new!(Fq, "80949648264912719408558363140637477264845294720710499478137287262712535938301461879813459410945"),
|
||||
FQ_ZERO
|
||||
),
|
||||
// Fp2::NONRESIDUE^((2*(q^2) - 2) / 3)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0x2c766f925a7b8727,
|
||||
0x3d7f6b0253d58b5,
|
||||
0x838ec0deec122131,
|
||||
0xbd5eb3e9f658bb10,
|
||||
0x6942bd126ed3e52e,
|
||||
0x1673786dd04ed6a,
|
||||
])),
|
||||
field_new!(Fq, BigInteger384([0x0, 0x0, 0x0, 0x0, 0x0, 0x0])),
|
||||
field_new!(Fq, "258664426012969093929703085429980814127835149614277183275038967946009968870203535512256352201271898244626862047231"),
|
||||
FQ_ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^((2*(q^3) - 2) / 3)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0x2cdffffffffff68,
|
||||
0x51409f837fffffb1,
|
||||
0x9f7db3a98a7d3ff2,
|
||||
0x7b4e97b76e7c6305,
|
||||
0x4cf495bf803c84e8,
|
||||
0x8d6661e2fdf49a,
|
||||
])),
|
||||
field_new!(Fq, BigInteger384([0x0, 0x0, 0x0, 0x0, 0x0, 0x0])),
|
||||
),
|
||||
field_new!(Fq2, FQ_ONE, FQ_ZERO),
|
||||
// Fp2::NONRESIDUE^((2*(q^4) - 2) / 3)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0xdacd106da5847973,
|
||||
0xd8fe2454bac2a79a,
|
||||
0x1ada4fd6fd832edc,
|
||||
0xfb9868449d150908,
|
||||
0xd63eb8aeea32285e,
|
||||
0x167d6a36f873fd0,
|
||||
])),
|
||||
field_new!(Fq, BigInteger384([0x0, 0x0, 0x0, 0x0, 0x0, 0x0])),
|
||||
field_new!(Fq, "80949648264912719408558363140637477264845294720710499478137287262712535938301461879813459410945"),
|
||||
FQ_ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^((2*(q^5) - 2) / 3)
|
||||
field_new!(Fq2,
|
||||
field_new!(Fq, BigInteger384([
|
||||
0x2c766f925a7b8727,
|
||||
0x3d7f6b0253d58b5,
|
||||
0x838ec0deec122131,
|
||||
0xbd5eb3e9f658bb10,
|
||||
0x6942bd126ed3e52e,
|
||||
0x1673786dd04ed6a,
|
||||
])),
|
||||
field_new!(Fq, BigInteger384([0x0, 0x0, 0x0, 0x0, 0x0, 0x0])),
|
||||
field_new!(Fq, "258664426012969093929703085429980814127835149614277183275038967946009968870203535512256352201271898244626862047231"),
|
||||
FQ_ZERO,
|
||||
),
|
||||
];
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ fn test_fq6() {
|
||||
let h: Fq6 = rng.gen();
|
||||
field_test(g, h);
|
||||
}
|
||||
|
||||
frobenius_test::<Fq6, _>(Fq::characteristic(), 13);
|
||||
let byte_size = Fq6::zero().serialized_size();
|
||||
field_serialization_test::<Fq6>(byte_size);
|
||||
|
||||
Reference in New Issue
Block a user