From 31664a0e2eeb6306b9f20567eb64b616f6da94dc Mon Sep 17 00:00:00 2001 From: Pratyush Mishra Date: Sun, 29 Nov 2020 14:01:25 -0800 Subject: [PATCH] Update BN254 --- bn254/src/curves/g1.rs | 42 ++------- bn254/src/curves/g2.rs | 58 +++---------- bn254/src/curves/mod.rs | 43 ++-------- bn254/src/fields/fq.rs | 4 +- bn254/src/fields/fq12.rs | 158 +++++++++------------------------- bn254/src/fields/fq2.rs | 37 ++------ bn254/src/fields/fq6.rs | 179 +++++++++------------------------------ 7 files changed, 108 insertions(+), 413 deletions(-) diff --git a/bn254/src/curves/g1.rs b/bn254/src/curves/g1.rs index 8a5eb84..b9a36bb 100644 --- a/bn254/src/curves/g1.rs +++ b/bn254/src/curves/g1.rs @@ -1,5 +1,5 @@ use ark_ec::models::{ModelParameters, SWModelParameters}; -use ark_ff::{biginteger::BigInteger256, field_new, Zero}; +use ark_ff::{field_new, Zero}; use crate::{Fq, Fr}; @@ -13,28 +13,16 @@ impl ModelParameters for Parameters { impl SWModelParameters for Parameters { /// COEFF_A = 0 - const COEFF_A: Fq = field_new!(Fq, BigInteger256([0x0, 0x0, 0x0, 0x0])); + const COEFF_A: Fq = field_new!(Fq, "0"); /// COEFF_B = 3 - #[rustfmt::skip] - const COEFF_B: Fq = field_new!(Fq, BigInteger256([ - 0x7a17caa950ad28d7, - 0x1f6ac17ae15521b9, - 0x334bea4e696bd284, - 0x2a1f6744ce179d8e, - ])); + const COEFF_B: Fq = field_new!(Fq, "3"); /// COFACTOR = 1 const COFACTOR: &'static [u64] = &[0x1]; /// COFACTOR_INV = COFACTOR^{-1} mod r = 1 - #[rustfmt::skip] - const COFACTOR_INV: Fr = field_new!(Fr, BigInteger256([ - 0xac96341c4ffffffb, - 0x36fc76959f60cd29, - 0x666ea36f7879462e, - 0xe0a77c19a07df2f, - ])); + 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) = @@ -46,22 +34,8 @@ impl SWModelParameters for Parameters { } } -/// G1_GENERATOR_X = -/// 1 -#[rustfmt::skip] -pub const G1_GENERATOR_X: Fq = field_new!(Fq, BigInteger256([ - 0xd35d438dc58f0d9d, - 0x0a78eb28f5c70b3d, - 0x666ea36f7879462c, - 0x0e0a77c19a07df2f, -])); +/// G1_GENERATOR_X = 1 +pub const G1_GENERATOR_X: Fq = field_new!(Fq, "1"); -/// G1_GENERATOR_Y = -/// 2 -#[rustfmt::skip] -pub const G1_GENERATOR_Y: Fq = field_new!(Fq, BigInteger256([ - 0xa6ba871b8b1e1b3a, - 0x14f1d651eb8e167b, - 0xccdd46def0f28c58, - 0x1c14ef83340fbe5e, -])); +/// G1_GENERATOR_Y = 2 +pub const G1_GENERATOR_Y: Fq = field_new!(Fq, "2"); diff --git a/bn254/src/curves/g2.rs b/bn254/src/curves/g2.rs index 21ec78e..28160be 100644 --- a/bn254/src/curves/g2.rs +++ b/bn254/src/curves/g2.rs @@ -1,7 +1,7 @@ use ark_ec::models::{ModelParameters, SWModelParameters}; -use ark_ff::{biginteger::BigInteger256, field_new, Zero}; +use ark_ff::{field_new, Zero}; -use crate::{g1, Fq, Fq2, Fr}; +use crate::{Fq, Fq2, Fr}; #[derive(Clone, Default, PartialEq, Eq)] pub struct Parameters; @@ -14,27 +14,14 @@ impl ModelParameters for Parameters { impl SWModelParameters for Parameters { /// COEFF_A = [0, 0] #[rustfmt::skip] - const COEFF_A: Fq2 = field_new!(Fq2, - g1::Parameters::COEFF_A, - g1::Parameters::COEFF_A, - ); + const COEFF_A: Fq2 = field_new!(Fq2, field_new!(Fq, "0"), field_new!(Fq, "0")); /// COEFF_B = 3/(u+9) /// = (19485874751759354771024239261021720505790618469301721065564631296452457478373, 266929791119991161246907387137283842545076965332900288569378510910307636690) #[rustfmt::skip] const COEFF_B: Fq2 = field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0x3bf938e377b802a8, - 0x020b1b273633535d, - 0x26b7edf049755260, - 0x2514c6324384a86d, - ])), - field_new!(Fq, BigInteger256([ - 0x38e7ecccd1dcff67, - 0x65f0b37d93ce0d3e, - 0xd749d0dd22ac00aa, - 0x0141b9ce4a688d4d, - ])), + field_new!(Fq, "19485874751759354771024239261021720505790618469301721065564631296452457478373"), + field_new!(Fq, "266929791119991161246907387137283842545076965332900288569378510910307636690"), ); /// COFACTOR = (36 * X^4) + (36 * X^3) + (30 * X^2) + 6*X + 1 @@ -49,12 +36,7 @@ impl SWModelParameters for Parameters { /// COFACTOR_INV = COFACTOR^{-1} mod r #[rustfmt::skip] - const COFACTOR_INV: Fr = field_new!(Fr, BigInteger256([ - 0x7fff17d53ff2895e, - 0xd0617390cf7919e5, - 0xb9af426b22d0eb61, - 0x270485e31bd72a4d, - ])); + const COFACTOR_INV: Fr = field_new!(Fr, "10944121435919637613327163357776759465618812564592884533313067514031822496649"); /// AFFINE_GENERATOR_COEFFS = (G2_GENERATOR_X, G2_GENERATOR_Y) const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) = @@ -74,39 +56,19 @@ pub const G2_GENERATOR_Y: Fq2 = field_new!(Fq2, G2_GENERATOR_Y_C0, G2_GENERATOR_ /// G2_GENERATOR_X_C0 = /// 10857046999023057135944570762232829481370756359578518086990519993285655852781 #[rustfmt::skip] -pub const G2_GENERATOR_X_C0: Fq = field_new!(Fq, BigInteger256([ - 0x8e83b5d102bc2026, - 0xdceb1935497b0172, - 0xfbb8264797811adf, - 0x19573841af96503b, -])); +pub const G2_GENERATOR_X_C0: Fq = field_new!(Fq, "10857046999023057135944570762232829481370756359578518086990519993285655852781"); /// G2_GENERATOR_X_C1 = /// 11559732032986387107991004021392285783925812861821192530917403151452391805634 #[rustfmt::skip] -pub const G2_GENERATOR_X_C1: Fq = field_new!(Fq, BigInteger256([ - 0xafb4737da84c6140, - 0x6043dd5a5802d8c4, - 0x09e950fc52a02f86, - 0x14fef0833aea7b6b, -])); +pub const G2_GENERATOR_X_C1: Fq = field_new!(Fq, "11559732032986387107991004021392285783925812861821192530917403151452391805634"); /// G2_GENERATOR_Y_C0 = /// 8495653923123431417604973247489272438418190587263600148770280649306958101930 #[rustfmt::skip] -pub const G2_GENERATOR_Y_C0: Fq = field_new!(Fq, BigInteger256([ - 0x619dfa9d886be9f6, - 0xfe7fd297f59e9b78, - 0xff9e1a62231b7dfe, - 0x28fd7eebae9e4206, -])); +pub const G2_GENERATOR_Y_C0: Fq = field_new!(Fq, "8495653923123431417604973247489272438418190587263600148770280649306958101930"); /// G2_GENERATOR_Y_C1 = /// 4082367875863433681332203403145435568316851327593401208105741076214120093531 #[rustfmt::skip] -pub const G2_GENERATOR_Y_C1: Fq = field_new!(Fq, BigInteger256([ - 0x64095b56c71856ee, - 0xdc57f922327d3cbb, - 0x55f935be33351076, - 0x0da4a0e693fd6482, -])); +pub const G2_GENERATOR_Y_C1: Fq = field_new!(Fq, "4082367875863433681332203403145435568316851327593401208105741076214120093531"); diff --git a/bn254/src/curves/mod.rs b/bn254/src/curves/mod.rs index 43a3f3a..a7c713d 100644 --- a/bn254/src/curves/mod.rs +++ b/bn254/src/curves/mod.rs @@ -3,7 +3,7 @@ use ark_ec::{ bn, bn::{Bn, BnParameters, TwistType}, }; -use ark_ff::{biginteger::BigInteger256, field_new}; +use ark_ff::field_new; pub mod g1; pub mod g2; @@ -23,47 +23,16 @@ impl BnParameters for Parameters { ]; /// `ate_loop_count` is positive. const ATE_LOOP_COUNT_IS_NEGATIVE: bool = false; + const TWIST_MUL_BY_Q_X: Fq2 = field_new!( Fq2, - field_new!( - Fq, - BigInteger256([ - 0xb5773b104563ab30, - 0x347f91c8a9aa6454, - 0x7a007127242e0991, - 0x1956bcd8118214ec, - ]) - ), - field_new!( - Fq, - BigInteger256([ - 0x6e849f1ea0aa4757, - 0xaa1c7b6d89f89141, - 0xb6e713cdfae0ca3a, - 0x26694fbb4e82ebc3, - ]) - ), + field_new!(Fq, "21575463638280843010398324269430826099269044274347216827212613867836435027261"), + field_new!(Fq, "10307601595873709700152284273816112264069230130616436755625194854815875713954"), ); const TWIST_MUL_BY_Q_Y: Fq2 = field_new!( Fq2, - field_new!( - Fq, - BigInteger256([ - 0xe4bbdd0c2936b629, - 0xbb30f162e133bacb, - 0x31a9d1b6f9645366, - 0x253570bea500f8dd, - ]) - ), - field_new!( - Fq, - BigInteger256([ - 0xa1d77ce45ffe77c7, - 0x07affd117826d1db, - 0x6d16bd27bb7edc6b, - 0x2c87200285defecc, - ]) - ), + field_new!(Fq, "2821565182194536844548159561693502659359617185244120367078079554186484126554"), + field_new!(Fq, "3505843767911556378687030309984248845540243509899259641013678093033130930403"), ); const TWIST_TYPE: TwistType = TwistType::D; type Fp = Fq; diff --git a/bn254/src/fields/fq.rs b/bn254/src/fields/fq.rs index 92ae6e0..090349e 100644 --- a/bn254/src/fields/fq.rs +++ b/bn254/src/fields/fq.rs @@ -92,5 +92,5 @@ impl FpParameters for FqParameters { ]); } -pub const FQ_ONE: Fq = field_new!(Fq, FqParameters::R); -pub const FQ_ZERO: Fq = field_new!(Fq, BigInteger([0, 0, 0, 0])); +pub const FQ_ONE: Fq = field_new!(Fq, "1"); +pub const FQ_ZERO: Fq = field_new!(Fq, "0"); diff --git a/bn254/src/fields/fq12.rs b/bn254/src/fields/fq12.rs index aded28e..8eae78e 100644 --- a/bn254/src/fields/fq12.rs +++ b/bn254/src/fields/fq12.rs @@ -1,5 +1,5 @@ use super::*; -use ark_ff::{biginteger::BigInteger256, field_new, fields::*}; +use ark_ff::{field_new, fields::*}; pub type Fq12 = Fp12; @@ -14,146 +14,64 @@ impl Fp12Parameters for Fq12Parameters { #[rustfmt::skip] const FROBENIUS_COEFF_FP12_C1: &'static [Fq2] = &[ // Fp2::NONRESIDUE^(((q^0) - 1) / 6) - FQ2_ONE, + field_new!(Fq2, + field_new!(Fq, "1"), + field_new!(Fq, "0"), + ), // Fp2::NONRESIDUE^(((q^1) - 1) / 6) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0xaf9ba69633144907, - 0xca6b1d7387afb78a, - 0x11bded5ef08a2087, - 0x02f34d751a1f3a7c, - ])), - field_new!(Fq, BigInteger256([ - 0xa222ae234c492d72, - 0xd00f02a4565de15b, - 0xdc2ff3a253dfc926, - 0x10a75716b3899551, - ])), + field_new!(Fq2, + field_new!(Fq, "8376118865763821496583973867626364092589906065868298776909617916018768340080"), + field_new!(Fq, "16469823323077808223889137241176536799009286646108169935659301613961712198316"), ), // Fp2::NONRESIDUE^(((q^2) - 1) / 6) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0xca8d800500fa1bf2, - 0xf0c5d61468b39769, - 0x0e201271ad0d4418, - 0x04290f65bad856e6, - ])), - FQ_ZERO, + field_new!(Fq2, + field_new!(Fq, "21888242871839275220042445260109153167277707414472061641714758635765020556617"), + field_new!(Fq, "0"), ), // Fp2::NONRESIDUE^(((q^3) - 1) / 6) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0x365316184e46d97d, - 0x0af7129ed4c96d9f, - 0x659da72fca1009b5, - 0x08116d8983a20d23, - ])), - field_new!(Fq, BigInteger256([ - 0xb1df4af7c39c1939, - 0x3d9f02878a73bf7f, - 0x9b2220928caf0ae0, - 0x26684515eff054a6, - ])), + field_new!(Fq2, + field_new!(Fq, "11697423496358154304825782922584725312912383441159505038794027105778954184319"), + field_new!(Fq, "303847389135065887422783454877609941456349188919719272345083954437860409601"), ), // Fp2::NONRESIDUE^(((q^4) - 1) / 6) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0x3350c88e13e80b9c, - 0x7dce557cdb5e56b9, - 0x6001b4b8b615564a, - 0x2682e617020217e0, - ])), - FQ_ZERO, + field_new!(Fq2, + field_new!(Fq, "21888242871839275220042445260109153167277707414472061641714758635765020556616"), + field_new!(Fq, "0"), ), // Fp2::NONRESIDUE^(((q^5) - 1) / 6) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0x86b76f821b329076, - 0x408bf52b4d19b614, - 0x53dfb9d0d985e92d, - 0x051e20146982d2a7, - ])), - field_new!(Fq, BigInteger256([ - 0x0fbc9cd47752ebc7, - 0x6d8fffe33415de24, - 0xbef22cf038cf41b9, - 0x15c0edff3c66bf54, - ])), + field_new!(Fq2, + field_new!(Fq, "3321304630594332808241809054958361220322477375291206261884409189760185844239"), + field_new!(Fq, "5722266937896532885780051958958348231143373700109372999374820235121374419868"), ), // Fp2::NONRESIDUE^(((q^6) - 1) / 6) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0x68c3488912edefaa, - 0x8d087f6872aabf4f, - 0x51e1a24709081231, - 0x2259d6b14729c0fa, - ])), - FQ_ZERO, + field_new!(Fq2, + field_new!(Fq, "-1"), + field_new!(Fq, "0"), ), // Fp2::NONRESIDUE^(((q^7) - 1) / 6) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0x8c84e580a568b440, - 0xcd164d1de0c21302, - 0xa692585790f737d5, - 0x2d7100fdc71265ad, - ])), - field_new!(Fq, BigInteger256([ - 0x99fdddf38c33cfd5, - 0xc77267ed1213e931, - 0xdc2052142da18f36, - 0x1fbcf75c2da80ad7, - ])), + field_new!(Fq2, + field_new!(Fq, "13512124006075453725662431877630910996106405091429524885779419978626457868503"), + field_new!(Fq, "5418419548761466998357268504080738289687024511189653727029736280683514010267"), ), // Fp2::NONRESIDUE^(((q^8) - 1) / 6) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0x71930c11d782e155, - 0xa6bb947cffbe3323, - 0xaa303344d4741444, - 0x2c3b3f0d26594943, - ])), - FQ_ZERO, + field_new!(Fq2, + field_new!(Fq, "2203960485148121921418603742825762020974279258880205651966"), + field_new!(Fq, "0"), ), // Fp2::NONRESIDUE^(((q^9) - 1) / 6) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0x05cd75fe8a3623ca, - 0x8c8a57f293a85cee, - 0x52b29e86b7714ea8, - 0x2852e0e95d8f9306, - ])), - field_new!(Fq, BigInteger256([ - 0x8a41411f14e0e40e, - 0x59e26809ddfe0b0d, - 0x1d2e2523f4d24d7d, - 0x09fc095cf1414b83, - ])), + field_new!(Fq2, + field_new!(Fq, "10190819375481120917420622822672549775783927716138318623895010788866272024264"), + field_new!(Fq, "21584395482704209334823622290379665147239961968378104390343953940207365798982"), ), // Fp2::NONRESIDUE^(((q^10) - 1) / 6) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0x08cfc388c494f1ab, - 0x19b315148d1373d4, - 0x584e90fdcb6c0213, - 0x09e1685bdf2f8849, - ])), - FQ_ZERO, + field_new!(Fq2, + field_new!(Fq, "2203960485148121921418603742825762020974279258880205651967"), + field_new!(Fq, "0"), ), // Fp2::NONRESIDUE^(((q^11) - 1) / 6) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0xb5691c94bd4a6cd1, - 0x56f575661b581478, - 0x64708be5a7fb6f30, - 0x2b462e5e77aecd82, - ])), - field_new!(Fq, BigInteger256([ - 0x2c63ef42612a1180, - 0x29f16aae345bec69, - 0xf95e18c648b216a4, - 0x1aa36073a4cae0d4, - ])), + field_new!(Fq2, + field_new!(Fq, "18566938241244942414004596690298913868373833782006617400804628704885040364344"), + field_new!(Fq, "16165975933942742336466353786298926857552937457188450663314217659523851788715"), ), ]; } diff --git a/bn254/src/fields/fq2.rs b/bn254/src/fields/fq2.rs index fa7b2aa..8231c56 100644 --- a/bn254/src/fields/fq2.rs +++ b/bn254/src/fields/fq2.rs @@ -1,5 +1,5 @@ use super::*; -use ark_ff::{biginteger::BigInteger256 as BigInteger, field_new, fields::*}; +use ark_ff::{field_new, fields::*}; pub type Fq2 = Fp2; @@ -10,47 +10,22 @@ impl Fp2Parameters for Fq2Parameters { /// NONRESIDUE = -1 #[rustfmt::skip] - const NONRESIDUE: Fq = field_new!(Fq, BigInteger([ - 0x68c3488912edefaa, - 0x8d087f6872aabf4f, - 0x51e1a24709081231, - 0x2259d6b14729c0fa, - ])); + const NONRESIDUE: Fq = field_new!(Fq, "-1"); /// QUADRATIC_NONRESIDUE = U+2 #[rustfmt::skip] const QUADRATIC_NONRESIDUE: (Fq, Fq) = ( - field_new!(Fq, BigInteger([ - 12014063508332092218u64, - 1509222997478479483u64, - 14762033076929465432u64, - 2023505479389396574u64, - ])), - field_new!(Fq, BigInteger([ - 202099033278250856u64, - 8885205928937022213u64, - 5545221690922665192u64, - 39800542322357402u64, - ])), + field_new!(Fq, "2"), + field_new!(Fq, "1"), ); /// Coefficients for the Frobenius automorphism. #[rustfmt::skip] const FROBENIUS_COEFF_FP2_C1: &'static [Fq] = &[ // NONRESIDUE**(((q^0) - 1) / 2) - field_new!(Fq, BigInteger([ - 0xd35d438dc58f0d9d, - 0x0a78eb28f5c70b3d, - 0x666ea36f7879462c, - 0xe0a77c19a07df2f, - ])), + field_new!(Fq, "1"), // NONRESIDUE**(((q^1) - 1) / 2) - field_new!(Fq, BigInteger([ - 0x68c3488912edefaa, - 0x8d087f6872aabf4f, - 0x51e1a24709081231, - 0x2259d6b14729c0fa, - ])), + field_new!(Fq, "-1"), ]; #[inline(always)] diff --git a/bn254/src/fields/fq6.rs b/bn254/src/fields/fq6.rs index d6e27e5..9c678b0 100644 --- a/bn254/src/fields/fq6.rs +++ b/bn254/src/fields/fq6.rs @@ -1,5 +1,5 @@ use super::*; -use ark_ff::{biginteger::BigInteger256, field_new, fields::*}; +use ark_ff::{field_new, fields::*}; pub type Fq6 = Fp6; @@ -11,175 +11,72 @@ impl Fp6Parameters for Fq6Parameters { /// NONRESIDUE = U+9 #[rustfmt::skip] - const NONRESIDUE: Fq2 = field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0xf60647ce410d7ff7, - 0x2f3d6f4dd31bd011, - 0x2943337e3940c6d1, - 0x1d9598e8a7e39857, - ])), - field_new!(Fq, BigInteger256([ - 202099033278250856u64, - 8885205928937022213u64, - 5545221690922665192u64, - 39800542322357402u64, - ])), - ); + const NONRESIDUE: Fq2 = field_new!(Fq2, field_new!(Fq, "9"), field_new!(Fq, "1")); #[rustfmt::skip] const FROBENIUS_COEFF_FP6_C1: &'static [Fq2] = &[ // Fp2::NONRESIDUE^(((q^0) - 1) / 3) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0xd35d438dc58f0d9d, - 0x0a78eb28f5c70b3d, - 0x666ea36f7879462c, - 0xe0a77c19a07df2f, - ])), - field_new!(Fq, BigInteger256([0x0, 0x0, 0x0, 0x0])), + field_new!(Fq2, + field_new!(Fq, "1"), + field_new!(Fq, "0"), ), // Fp2::NONRESIDUE^(((q^1) - 1) / 3) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0xb5773b104563ab30, - 0x347f91c8a9aa6454, - 0x7a007127242e0991, - 0x1956bcd8118214ec, - ])), - field_new!(Fq, BigInteger256([ - 0x6e849f1ea0aa4757, - 0xaa1c7b6d89f89141, - 0xb6e713cdfae0ca3a, - 0x26694fbb4e82ebc3, - ])), + field_new!(Fq2, + field_new!(Fq, "21575463638280843010398324269430826099269044274347216827212613867836435027261"), + field_new!(Fq, "10307601595873709700152284273816112264069230130616436755625194854815875713954"), ), // Fp2::NONRESIDUE^(((q^2) - 1) / 3) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0x3350c88e13e80b9c, - 0x7dce557cdb5e56b9, - 0x6001b4b8b615564a, - 0x2682e617020217e0, - ])), - field_new!(Fq, BigInteger256([0x0, 0x0, 0x0, 0x0])), + field_new!(Fq2, + field_new!(Fq, "21888242871839275220042445260109153167277707414472061641714758635765020556616"), + field_new!(Fq, "0"), ), // Fp2::NONRESIDUE^(((q^3) - 1) / 3) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0xc9af22f716ad6bad, - 0xb311782a4aa662b2, - 0x19eeaf64e248c7f4, - 0x20273e77e3439f82, - ])), - field_new!(Fq, BigInteger256([ - 0xacc02860f7ce93ac, - 0x3933d5817ba76b4c, - 0x69e6188b446c8467, - 0xa46036d4417cc55, - ])), + field_new!(Fq2, + field_new!(Fq, "3772000881919853776433695186713858239009073593817195771773381919316419345261"), + field_new!(Fq, "2236595495967245188281701248203181795121068902605861227855261137820944008926"), ), // Fp2::NONRESIDUE^(((q^4) - 1) / 3) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0x71930c11d782e155, - 0xa6bb947cffbe3323, - 0xaa303344d4741444, - 0x2c3b3f0d26594943, - ])), - field_new!(Fq, BigInteger256([0x0, 0x0, 0x0, 0x0])), + field_new!(Fq2, + field_new!(Fq, "2203960485148121921418603742825762020974279258880205651966"), + field_new!(Fq, "0"), ), // Fp2::NONRESIDUE^(((q^5) - 1) / 3) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0xf91aba2654e8e3b1, - 0x4771cb2fdc92ce12, - 0xdcb16ae0fc8bdf35, - 0x274aa195cd9d8be4, - ])), - field_new!(Fq, BigInteger256([ - 0x5cfc50ae18811f8b, - 0x4bb28433cb43988c, - 0x4fd35f13c3b56219, - 0x301949bd2fc8883a, - ])), + field_new!(Fq2, + field_new!(Fq, "18429021223477853657660792034369865839114504446431234726392080002137598044644"), + field_new!(Fq, "9344045779998320333812420223237981029506012124075525679208581902008406485703"), ), ]; #[rustfmt::skip] const FROBENIUS_COEFF_FP6_C2: &'static [Fq2] = &[ // Fp2::NONRESIDUE^((2*(q^0) - 2) / 3) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0xd35d438dc58f0d9d, - 0x0a78eb28f5c70b3d, - 0x666ea36f7879462c, - 0xe0a77c19a07df2f, - ])), - field_new!(Fq, BigInteger256([0x0, 0x0, 0x0, 0x0])), + field_new!(Fq2, + field_new!(Fq, "1"), + field_new!(Fq, "0"), ), // Fp2::NONRESIDUE^((2*(q^1) - 2) / 3) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0x7361d77f843abe92, - 0xa5bb2bd3273411fb, - 0x9c941f314b3e2399, - 0x15df9cddbb9fd3ec, - ])), - field_new!(Fq, BigInteger256([ - 0x5dddfd154bd8c949, - 0x62cb29a5a4445b60, - 0x37bc870a0c7dd2b9, - 0x24830a9d3171f0fd, - ])), + field_new!(Fq2, + field_new!(Fq, "2581911344467009335267311115468803099551665605076196740867805258568234346338"), + field_new!(Fq, "19937756971775647987995932169929341994314640652964949448313374472400716661030"), ), // Fp2::NONRESIDUE^((2*(q^2) - 2) / 3) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0x71930c11d782e155, - 0xa6bb947cffbe3323, - 0xaa303344d4741444, - 0x2c3b3f0d26594943, - ])), - field_new!(Fq, BigInteger256([0x0, 0x0, 0x0, 0x0])), + field_new!(Fq2, + field_new!(Fq, "2203960485148121921418603742825762020974279258880205651966"), + field_new!(Fq, "0"), ), // Fp2::NONRESIDUE^((2*(q^3) - 2) / 3) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0x448a93a57b6762df, - 0xbfd62df528fdeadf, - 0xd858f5d00e9bd47a, - 0x6b03d4d3476ec58, - ])), - field_new!(Fq, BigInteger256([ - 0x2b19daf4bcc936d1, - 0xa1a54e7a56f4299f, - 0xb533eee05adeaef1, - 0x170c812b84dda0b2, - ])), + field_new!(Fq2, + field_new!(Fq, "5324479202449903542726783395506214481928257762400643279780343368557297135718"), + field_new!(Fq, "16208900380737693084919495127334387981393726419856888799917914180988844123039"), ), // Fp2::NONRESIDUE^((2*(q^4) - 2) / 3) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0x3350c88e13e80b9c, - 0x7dce557cdb5e56b9, - 0x6001b4b8b615564a, - 0x2682e617020217e0, - ])), - field_new!(Fq, BigInteger256([0x0, 0x0, 0x0, 0x0])), + field_new!(Fq2, + field_new!(Fq, "21888242871839275220042445260109153167277707414472061641714758635765020556616"), + field_new!(Fq, "0"), ), // Fp2::NONRESIDUE^((2*(q^5) - 2) / 3) - field_new!(Fq2, - field_new!(Fq, BigInteger256([ - 0x843420f1d8dadbd6, - 0x31f010c9183fcdb2, - 0x436330b527a76049, - 0x13d47447f11adfe4, - ])), - field_new!(Fq, BigInteger256([ - 0xef494023a857fa74, - 0x2a925d02d5ab101a, - 0x83b015829ba62f10, - 0x2539111d0c13aea3, - ])), + field_new!(Fq2, + field_new!(Fq, "13981852324922362344252311234282257507216387789820983642040889267519694726527"), + field_new!(Fq, "7629828391165209371577384193250820201684255241773809077146787135900891633097"), ), ];