mirror of
https://github.com/arnaucube/ark-curves-cherry-picked.git
synced 2026-01-09 07:21:30 +01:00
Catch up with algebra (#106)
Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
use ark_ec::models::{ModelParameters, SWModelParameters};
|
||||
use ark_ff::{MontFp, Zero};
|
||||
use ark_ec::{
|
||||
models::{short_weierstrass::SWCurveConfig, CurveConfig},
|
||||
short_weierstrass::Affine,
|
||||
};
|
||||
use ark_ff::{Field, MontFp, Zero};
|
||||
|
||||
use crate::{Fq, Fr};
|
||||
|
||||
#[derive(Clone, Default, PartialEq, Eq)]
|
||||
pub struct Parameters;
|
||||
|
||||
impl ModelParameters for Parameters {
|
||||
pub type G1Affine = Affine<Parameters>;
|
||||
|
||||
impl CurveConfig for Parameters {
|
||||
type BaseField = Fq;
|
||||
type ScalarField = Fr;
|
||||
|
||||
@@ -14,19 +19,18 @@ impl ModelParameters for Parameters {
|
||||
const COFACTOR: &'static [u64] = &[0x1];
|
||||
|
||||
/// COFACTOR_INV = COFACTOR^{-1} mod r = 1
|
||||
const COFACTOR_INV: Fr = MontFp!(Fr, "1");
|
||||
const COFACTOR_INV: Fr = Fr::ONE;
|
||||
}
|
||||
|
||||
impl SWModelParameters for Parameters {
|
||||
impl SWCurveConfig for Parameters {
|
||||
/// COEFF_A = 0
|
||||
const COEFF_A: Fq = MontFp!(Fq, "0");
|
||||
const COEFF_A: Fq = Fq::ZERO;
|
||||
|
||||
/// COEFF_B = 3
|
||||
const COEFF_B: Fq = MontFp!(Fq, "3");
|
||||
const COEFF_B: Fq = MontFp!("3");
|
||||
|
||||
/// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
|
||||
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
|
||||
(G1_GENERATOR_X, G1_GENERATOR_Y);
|
||||
const GENERATOR: G1Affine = G1Affine::new_unchecked(G1_GENERATOR_X, G1_GENERATOR_Y);
|
||||
|
||||
#[inline(always)]
|
||||
fn mul_by_a(_: &Self::BaseField) -> Self::BaseField {
|
||||
@@ -35,7 +39,7 @@ impl SWModelParameters for Parameters {
|
||||
}
|
||||
|
||||
/// G1_GENERATOR_X = 1
|
||||
pub const G1_GENERATOR_X: Fq = MontFp!(Fq, "1");
|
||||
pub const G1_GENERATOR_X: Fq = Fq::ONE;
|
||||
|
||||
/// G1_GENERATOR_Y = 2
|
||||
pub const G1_GENERATOR_Y: Fq = MontFp!(Fq, "2");
|
||||
pub const G1_GENERATOR_Y: Fq = MontFp!("2");
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
use ark_ec::models::{ModelParameters, SWModelParameters};
|
||||
use ark_ff::{MontFp, QuadExt, Zero};
|
||||
use ark_ec::{
|
||||
models::{short_weierstrass::SWCurveConfig, CurveConfig},
|
||||
short_weierstrass::Affine,
|
||||
};
|
||||
use ark_ff::{Field, MontFp, Zero};
|
||||
|
||||
use crate::{Fq, Fq2, Fr};
|
||||
|
||||
pub type G2Affine = Affine<Parameters>;
|
||||
|
||||
#[derive(Clone, Default, PartialEq, Eq)]
|
||||
pub struct Parameters;
|
||||
|
||||
impl ModelParameters for Parameters {
|
||||
impl CurveConfig for Parameters {
|
||||
type BaseField = Fq2;
|
||||
type ScalarField = Fr;
|
||||
|
||||
@@ -21,32 +26,23 @@ impl ModelParameters for Parameters {
|
||||
];
|
||||
|
||||
/// COFACTOR_INV = COFACTOR^{-1} mod r
|
||||
const COFACTOR_INV: Fr = MontFp!(
|
||||
Fr,
|
||||
"10944121435919637613327163357776759465618812564592884533313067514031822496649"
|
||||
);
|
||||
const COFACTOR_INV: Fr =
|
||||
MontFp!("10944121435919637613327163357776759465618812564592884533313067514031822496649");
|
||||
}
|
||||
|
||||
impl SWModelParameters for Parameters {
|
||||
impl SWCurveConfig for Parameters {
|
||||
/// COEFF_A = [0, 0]
|
||||
const COEFF_A: Fq2 = QuadExt!(MontFp!(Fq, "0"), MontFp!(Fq, "0"));
|
||||
const COEFF_A: Fq2 = Fq2::ZERO;
|
||||
|
||||
/// COEFF_B = 3/(u+9)
|
||||
/// (19485874751759354771024239261021720505790618469301721065564631296452457478373, 266929791119991161246907387137283842545076965332900288569378510910307636690)
|
||||
const COEFF_B: Fq2 = QuadExt!(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"19485874751759354771024239261021720505790618469301721065564631296452457478373"
|
||||
),
|
||||
MontFp!(
|
||||
Fq,
|
||||
"266929791119991161246907387137283842545076965332900288569378510910307636690"
|
||||
),
|
||||
const COEFF_B: Fq2 = Fq2::new(
|
||||
MontFp!("19485874751759354771024239261021720505790618469301721065564631296452457478373"),
|
||||
MontFp!("266929791119991161246907387137283842545076965332900288569378510910307636690"),
|
||||
);
|
||||
|
||||
/// AFFINE_GENERATOR_COEFFS = (G2_GENERATOR_X, G2_GENERATOR_Y)
|
||||
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
|
||||
(G2_GENERATOR_X, G2_GENERATOR_Y);
|
||||
const GENERATOR: G2Affine = G2Affine::new_unchecked(G2_GENERATOR_X, G2_GENERATOR_Y);
|
||||
|
||||
#[inline(always)]
|
||||
fn mul_by_a(_: &Self::BaseField) -> Self::BaseField {
|
||||
@@ -54,33 +50,25 @@ impl SWModelParameters for Parameters {
|
||||
}
|
||||
}
|
||||
|
||||
pub const G2_GENERATOR_X: Fq2 = QuadExt!(G2_GENERATOR_X_C0, G2_GENERATOR_X_C1);
|
||||
pub const G2_GENERATOR_Y: Fq2 = QuadExt!(G2_GENERATOR_Y_C0, G2_GENERATOR_Y_C1);
|
||||
pub const G2_GENERATOR_X: Fq2 = Fq2::new(G2_GENERATOR_X_C0, G2_GENERATOR_X_C1);
|
||||
pub const G2_GENERATOR_Y: Fq2 = Fq2::new(G2_GENERATOR_Y_C0, G2_GENERATOR_Y_C1);
|
||||
|
||||
/// G2_GENERATOR_X_C0 =
|
||||
/// 10857046999023057135944570762232829481370756359578518086990519993285655852781
|
||||
pub const G2_GENERATOR_X_C0: Fq = MontFp!(
|
||||
Fq,
|
||||
"10857046999023057135944570762232829481370756359578518086990519993285655852781"
|
||||
);
|
||||
pub const G2_GENERATOR_X_C0: Fq =
|
||||
MontFp!("10857046999023057135944570762232829481370756359578518086990519993285655852781");
|
||||
|
||||
/// G2_GENERATOR_X_C1 =
|
||||
/// 11559732032986387107991004021392285783925812861821192530917403151452391805634
|
||||
pub const G2_GENERATOR_X_C1: Fq = MontFp!(
|
||||
Fq,
|
||||
"11559732032986387107991004021392285783925812861821192530917403151452391805634"
|
||||
);
|
||||
pub const G2_GENERATOR_X_C1: Fq =
|
||||
MontFp!("11559732032986387107991004021392285783925812861821192530917403151452391805634");
|
||||
|
||||
/// G2_GENERATOR_Y_C0 =
|
||||
/// 8495653923123431417604973247489272438418190587263600148770280649306958101930
|
||||
pub const G2_GENERATOR_Y_C0: Fq = MontFp!(
|
||||
Fq,
|
||||
"8495653923123431417604973247489272438418190587263600148770280649306958101930"
|
||||
);
|
||||
pub const G2_GENERATOR_Y_C0: Fq =
|
||||
MontFp!("8495653923123431417604973247489272438418190587263600148770280649306958101930");
|
||||
|
||||
/// G2_GENERATOR_Y_C1 =
|
||||
/// 4082367875863433681332203403145435568316851327593401208105741076214120093531
|
||||
pub const G2_GENERATOR_Y_C1: Fq = MontFp!(
|
||||
Fq,
|
||||
"4082367875863433681332203403145435568316851327593401208105741076214120093531"
|
||||
);
|
||||
pub const G2_GENERATOR_Y_C1: Fq =
|
||||
MontFp!("4082367875863433681332203403145435568316851327593401208105741076214120093531");
|
||||
|
||||
@@ -2,7 +2,7 @@ use ark_ec::{
|
||||
bn,
|
||||
bn::{Bn, BnParameters, TwistType},
|
||||
};
|
||||
use ark_ff::{MontFp, QuadExt};
|
||||
use ark_ff::MontFp;
|
||||
|
||||
use crate::*;
|
||||
|
||||
@@ -24,25 +24,13 @@ impl BnParameters for Parameters {
|
||||
-1, 0, 0, 1, 0, 1, 1,
|
||||
];
|
||||
|
||||
const TWIST_MUL_BY_Q_X: Fq2 = QuadExt!(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"21575463638280843010398324269430826099269044274347216827212613867836435027261"
|
||||
),
|
||||
MontFp!(
|
||||
Fq,
|
||||
"10307601595873709700152284273816112264069230130616436755625194854815875713954"
|
||||
),
|
||||
const TWIST_MUL_BY_Q_X: Fq2 = Fq2::new(
|
||||
MontFp!("21575463638280843010398324269430826099269044274347216827212613867836435027261"),
|
||||
MontFp!("10307601595873709700152284273816112264069230130616436755625194854815875713954"),
|
||||
);
|
||||
const TWIST_MUL_BY_Q_Y: Fq2 = QuadExt!(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"2821565182194536844548159561693502659359617185244120367078079554186484126554"
|
||||
),
|
||||
MontFp!(
|
||||
Fq,
|
||||
"3505843767911556378687030309984248845540243509899259641013678093033130930403"
|
||||
),
|
||||
const TWIST_MUL_BY_Q_Y: Fq2 = Fq2::new(
|
||||
MontFp!("2821565182194536844548159561693502659359617185244120367078079554186484126554"),
|
||||
MontFp!("3505843767911556378687030309984248845540243509899259641013678093033130930403"),
|
||||
);
|
||||
const TWIST_TYPE: TwistType = TwistType::D;
|
||||
type Fp = Fq;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use ark_algebra_test_templates::{
|
||||
curves::*, generate_bilinearity_test, generate_g1_test, generate_g2_test, groups::*, msm::*,
|
||||
curves::*, generate_bilinearity_test, generate_g1_test, generate_g2_test, msm::*,
|
||||
};
|
||||
use ark_ec::{AffineCurve, PairingEngine};
|
||||
use ark_ff::{
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
use ark_ff::fields::{Fp256, MontBackend, MontConfig, MontFp};
|
||||
use ark_ff::fields::{Fp256, MontBackend, MontConfig};
|
||||
|
||||
#[derive(MontConfig)]
|
||||
#[modulus = "21888242871839275222246405745257275088696311157297823662689037894645226208583"]
|
||||
#[generator = "3"]
|
||||
pub struct FqConfig;
|
||||
pub type Fq = Fp256<MontBackend<FqConfig, 4>>;
|
||||
|
||||
pub const FQ_ONE: Fq = MontFp!(Fq, "1");
|
||||
pub const FQ_ZERO: Fq = MontFp!(Fq, "0");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use ark_ff::{fields::*, CubicExt, MontFp, QuadExt};
|
||||
use ark_ff::{fields::*, MontFp};
|
||||
|
||||
use crate::*;
|
||||
|
||||
@@ -10,108 +10,78 @@ pub struct Fq12Config;
|
||||
impl Fp12Config for Fq12Config {
|
||||
type Fp6Config = Fq6Config;
|
||||
|
||||
const NONRESIDUE: Fq6 = CubicExt!(FQ2_ZERO, FQ2_ONE, FQ2_ZERO);
|
||||
const NONRESIDUE: Fq6 = Fq6::new(Fq2::ZERO, Fq2::ONE, Fq2::ZERO);
|
||||
|
||||
const FROBENIUS_COEFF_FP12_C1: &'static [Fq2] = &[
|
||||
// Fp2::NONRESIDUE^(((q^0) - 1) / 6)
|
||||
QuadExt!(MontFp!(Fq, "1"), MontFp!(Fq, "0"),),
|
||||
Fq2::new(Fq::ONE, Fq::ZERO),
|
||||
// Fp2::NONRESIDUE^(((q^1) - 1) / 6)
|
||||
QuadExt!(
|
||||
Fq2::new(
|
||||
MontFp!("8376118865763821496583973867626364092589906065868298776909617916018768340080"),
|
||||
MontFp!(
|
||||
Fq,
|
||||
"8376118865763821496583973867626364092589906065868298776909617916018768340080"
|
||||
),
|
||||
MontFp!(
|
||||
Fq,
|
||||
"16469823323077808223889137241176536799009286646108169935659301613961712198316"
|
||||
),
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^2) - 1) / 6)
|
||||
QuadExt!(
|
||||
Fq2::new(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"21888242871839275220042445260109153167277707414472061641714758635765020556617"
|
||||
),
|
||||
MontFp!(Fq, "0"),
|
||||
Fq::ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^3) - 1) / 6)
|
||||
QuadExt!(
|
||||
Fq2::new(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"11697423496358154304825782922584725312912383441159505038794027105778954184319"
|
||||
),
|
||||
MontFp!(
|
||||
Fq,
|
||||
"303847389135065887422783454877609941456349188919719272345083954437860409601"
|
||||
),
|
||||
MontFp!("303847389135065887422783454877609941456349188919719272345083954437860409601"),
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^4) - 1) / 6)
|
||||
QuadExt!(
|
||||
Fq2::new(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"21888242871839275220042445260109153167277707414472061641714758635765020556616"
|
||||
),
|
||||
MontFp!(Fq, "0"),
|
||||
Fq::ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^5) - 1) / 6)
|
||||
QuadExt!(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"3321304630594332808241809054958361220322477375291206261884409189760185844239"
|
||||
),
|
||||
MontFp!(
|
||||
Fq,
|
||||
"5722266937896532885780051958958348231143373700109372999374820235121374419868"
|
||||
),
|
||||
Fq2::new(
|
||||
MontFp!("3321304630594332808241809054958361220322477375291206261884409189760185844239"),
|
||||
MontFp!("5722266937896532885780051958958348231143373700109372999374820235121374419868"),
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^6) - 1) / 6)
|
||||
QuadExt!(MontFp!(Fq, "-1"), MontFp!(Fq, "0"),),
|
||||
Fq2::new(MontFp!("-1"), Fq::ZERO),
|
||||
// Fp2::NONRESIDUE^(((q^7) - 1) / 6)
|
||||
QuadExt!(
|
||||
Fq2::new(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"13512124006075453725662431877630910996106405091429524885779419978626457868503"
|
||||
),
|
||||
MontFp!(
|
||||
Fq,
|
||||
"5418419548761466998357268504080738289687024511189653727029736280683514010267"
|
||||
),
|
||||
MontFp!("5418419548761466998357268504080738289687024511189653727029736280683514010267"),
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^8) - 1) / 6)
|
||||
QuadExt!(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"2203960485148121921418603742825762020974279258880205651966"
|
||||
),
|
||||
MontFp!(Fq, "0"),
|
||||
Fq2::new(
|
||||
MontFp!("2203960485148121921418603742825762020974279258880205651966"),
|
||||
Fq::ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^9) - 1) / 6)
|
||||
QuadExt!(
|
||||
Fq2::new(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"10190819375481120917420622822672549775783927716138318623895010788866272024264"
|
||||
),
|
||||
MontFp!(
|
||||
Fq,
|
||||
"21584395482704209334823622290379665147239961968378104390343953940207365798982"
|
||||
),
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^10) - 1) / 6)
|
||||
QuadExt!(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"2203960485148121921418603742825762020974279258880205651967"
|
||||
),
|
||||
MontFp!(Fq, "0"),
|
||||
Fq2::new(
|
||||
MontFp!("2203960485148121921418603742825762020974279258880205651967"),
|
||||
Fq::ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^11) - 1) / 6)
|
||||
QuadExt!(
|
||||
Fq2::new(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"18566938241244942414004596690298913868373833782006617400804628704885040364344"
|
||||
),
|
||||
MontFp!(
|
||||
Fq,
|
||||
"16165975933942742336466353786298926857552937457188450663314217659523851788715"
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use ark_ff::{fields::*, MontFp, QuadExt};
|
||||
use ark_ff::{fields::*, MontFp};
|
||||
|
||||
use crate::*;
|
||||
|
||||
@@ -10,14 +10,14 @@ impl Fp2Config for Fq2Config {
|
||||
type Fp = Fq;
|
||||
|
||||
/// NONRESIDUE = -1
|
||||
const NONRESIDUE: Fq = MontFp!(Fq, "-1");
|
||||
const NONRESIDUE: Fq = MontFp!("-1");
|
||||
|
||||
/// Coefficients for the Frobenius automorphism.
|
||||
const FROBENIUS_COEFF_FP2_C1: &'static [Fq] = &[
|
||||
// NONRESIDUE**(((q^0) - 1) / 2)
|
||||
MontFp!(Fq, "1"),
|
||||
Fq::ONE,
|
||||
// NONRESIDUE**(((q^1) - 1) / 2)
|
||||
MontFp!(Fq, "-1"),
|
||||
MontFp!("-1"),
|
||||
];
|
||||
|
||||
#[inline(always)]
|
||||
@@ -25,6 +25,3 @@ impl Fp2Config for Fq2Config {
|
||||
-(*fe)
|
||||
}
|
||||
}
|
||||
|
||||
pub const FQ2_ZERO: Fq2 = QuadExt!(FQ_ZERO, FQ_ZERO);
|
||||
pub const FQ2_ONE: Fq2 = QuadExt!(FQ_ONE, FQ_ZERO);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use ark_ff::{fields::*, MontFp, QuadExt};
|
||||
use ark_ff::{fields::*, MontFp};
|
||||
|
||||
use crate::*;
|
||||
|
||||
@@ -11,113 +11,81 @@ impl Fp6Config for Fq6Config {
|
||||
type Fp2Config = Fq2Config;
|
||||
|
||||
/// NONRESIDUE = U+9
|
||||
const NONRESIDUE: Fq2 = QuadExt!(MontFp!(Fq, "9"), MontFp!(Fq, "1"));
|
||||
const NONRESIDUE: Fq2 = Fq2::new(MontFp!("9"), Fq::ONE);
|
||||
|
||||
const FROBENIUS_COEFF_FP6_C1: &'static [Fq2] = &[
|
||||
// Fp2::NONRESIDUE^(((q^0) - 1) / 3)
|
||||
QuadExt!(MontFp!(Fq, "1"), MontFp!(Fq, "0"),),
|
||||
Fq2::new(Fq::ONE, Fq::ZERO),
|
||||
// Fp2::NONRESIDUE^(((q^1) - 1) / 3)
|
||||
QuadExt!(
|
||||
Fq2::new(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"21575463638280843010398324269430826099269044274347216827212613867836435027261"
|
||||
),
|
||||
MontFp!(
|
||||
Fq,
|
||||
"10307601595873709700152284273816112264069230130616436755625194854815875713954"
|
||||
),
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^2) - 1) / 3)
|
||||
QuadExt!(
|
||||
Fq2::new(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"21888242871839275220042445260109153167277707414472061641714758635765020556616"
|
||||
),
|
||||
MontFp!(Fq, "0"),
|
||||
Fq::ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^3) - 1) / 3)
|
||||
QuadExt!(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"3772000881919853776433695186713858239009073593817195771773381919316419345261"
|
||||
),
|
||||
MontFp!(
|
||||
Fq,
|
||||
"2236595495967245188281701248203181795121068902605861227855261137820944008926"
|
||||
),
|
||||
Fq2::new(
|
||||
MontFp!("3772000881919853776433695186713858239009073593817195771773381919316419345261"),
|
||||
MontFp!("2236595495967245188281701248203181795121068902605861227855261137820944008926"),
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^4) - 1) / 3)
|
||||
QuadExt!(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"2203960485148121921418603742825762020974279258880205651966"
|
||||
),
|
||||
MontFp!(Fq, "0"),
|
||||
Fq2::new(
|
||||
MontFp!("2203960485148121921418603742825762020974279258880205651966"),
|
||||
Fq::ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^(((q^5) - 1) / 3)
|
||||
QuadExt!(
|
||||
Fq2::new(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"18429021223477853657660792034369865839114504446431234726392080002137598044644"
|
||||
),
|
||||
MontFp!(
|
||||
Fq,
|
||||
"9344045779998320333812420223237981029506012124075525679208581902008406485703"
|
||||
),
|
||||
MontFp!("9344045779998320333812420223237981029506012124075525679208581902008406485703"),
|
||||
),
|
||||
];
|
||||
|
||||
const FROBENIUS_COEFF_FP6_C2: &'static [Fq2] = &[
|
||||
// Fp2::NONRESIDUE^((2*(q^0) - 2) / 3)
|
||||
QuadExt!(MontFp!(Fq, "1"), MontFp!(Fq, "0"),),
|
||||
Fq2::new(Fq::ONE, Fq::ZERO),
|
||||
// Fp2::NONRESIDUE^((2*(q^1) - 2) / 3)
|
||||
QuadExt!(
|
||||
Fq2::new(
|
||||
MontFp!("2581911344467009335267311115468803099551665605076196740867805258568234346338"),
|
||||
MontFp!(
|
||||
Fq,
|
||||
"2581911344467009335267311115468803099551665605076196740867805258568234346338"
|
||||
),
|
||||
MontFp!(
|
||||
Fq,
|
||||
"19937756971775647987995932169929341994314640652964949448313374472400716661030"
|
||||
),
|
||||
),
|
||||
// Fp2::NONRESIDUE^((2*(q^2) - 2) / 3)
|
||||
QuadExt!(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"2203960485148121921418603742825762020974279258880205651966"
|
||||
),
|
||||
MontFp!(Fq, "0"),
|
||||
Fq2::new(
|
||||
MontFp!("2203960485148121921418603742825762020974279258880205651966"),
|
||||
Fq::ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^((2*(q^3) - 2) / 3)
|
||||
QuadExt!(
|
||||
Fq2::new(
|
||||
MontFp!("5324479202449903542726783395506214481928257762400643279780343368557297135718"),
|
||||
MontFp!(
|
||||
Fq,
|
||||
"5324479202449903542726783395506214481928257762400643279780343368557297135718"
|
||||
),
|
||||
MontFp!(
|
||||
Fq,
|
||||
"16208900380737693084919495127334387981393726419856888799917914180988844123039"
|
||||
),
|
||||
),
|
||||
// Fp2::NONRESIDUE^((2*(q^4) - 2) / 3)
|
||||
QuadExt!(
|
||||
Fq2::new(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"21888242871839275220042445260109153167277707414472061641714758635765020556616"
|
||||
),
|
||||
MontFp!(Fq, "0"),
|
||||
Fq::ZERO,
|
||||
),
|
||||
// Fp2::NONRESIDUE^((2*(q^5) - 2) / 3)
|
||||
QuadExt!(
|
||||
Fq2::new(
|
||||
MontFp!(
|
||||
Fq,
|
||||
"13981852324922362344252311234282257507216387789820983642040889267519694726527"
|
||||
),
|
||||
MontFp!(
|
||||
Fq,
|
||||
"7629828391165209371577384193250820201684255241773809077146787135900891633097"
|
||||
),
|
||||
MontFp!("7629828391165209371577384193250820201684255241773809077146787135900891633097"),
|
||||
),
|
||||
];
|
||||
|
||||
@@ -128,6 +96,6 @@ impl Fp6Config for Fq6Config {
|
||||
f.double_in_place().double_in_place().double_in_place();
|
||||
let c0 = f.c0 + fe.c0 + Fq2Config::mul_fp_by_nonresidue(&fe.c1);
|
||||
let c1 = f.c1 + fe.c1 + fe.c0;
|
||||
QuadExt!(c0, c1)
|
||||
Fq2::new(c0, c1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ use ark_algebra_test_templates::{
|
||||
};
|
||||
use ark_ff::{
|
||||
biginteger::{BigInt, BigInteger, BigInteger256},
|
||||
fields::{FftField, Field, Fp6Config, PrimeField, SquareRootField},
|
||||
fields::{FftField, Field, Fp6Config, PrimeField},
|
||||
One, UniformRand, Zero,
|
||||
};
|
||||
use ark_serialize::{buffer_bit_byte_size, CanonicalSerialize};
|
||||
|
||||
Reference in New Issue
Block a user