Update MNT4-753

This commit is contained in:
Pratyush Mishra
2020-12-09 00:00:30 -08:00
parent 5f62fab169
commit 4b050b1aae
6 changed files with 30 additions and 264 deletions

View File

@@ -1,6 +1,5 @@
use crate::{Fq, FQ_ONE};
use ark_ff::{
biginteger::BigInteger768 as BigInteger,
field_new,
fields::fp2::{Fp2, Fp2Parameters},
};
@@ -14,64 +13,16 @@ impl Fp2Parameters for Fq2Parameters {
// non_residue = 13
#[rustfmt::skip]
const NONRESIDUE: Fq = field_new!(Fq, BigInteger([
11881297496860141143,
13588356353764843511,
9969398190777826186,
17325157081734070311,
16341533986183788031,
8322434028726676858,
13631157743146294957,
8365783422740577875,
3010239015809771096,
11776256826687733591,
7214251687253691272,
268626707558702
]));
const NONRESIDUE: Fq = field_new!(Fq, "13");
// qnr = (8, 1)
const QUADRATIC_NONRESIDUE: (Self::Fp, Self::Fp) = (
field_new!(
Fq,
BigInteger([
587330122779359758,
14352661462510473462,
17802452401246596498,
18018663494943049411,
17948754733747257098,
10253180574146027531,
6683223122694781837,
13573468617269213174,
5059368039312883748,
950479668716233863,
9936591501985804621,
88719447132658
])
),
FQ_ONE,
);
const QUADRATIC_NONRESIDUE: (Self::Fp, Self::Fp) = (field_new!(Fq, "8"), FQ_ONE);
// Coefficients:
// [1, 41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888253786114353726529584385201591605722013126468931404347949840543007986327743462853720628051692141265303114721689600]
// see https://github.com/o1-labs/snarky/blob/2cf5ef3a14989e57c17518832b3c52590068fc48/src/camlsnark_c/libsnark-caml/depends/libff/libff/algebra/curves/mnt753/mnt4753/mnt4753_init.cpp
const FROBENIUS_COEFF_FP2_C1: &'static [Self::Fp] = &[
FQ_ONE,
field_new!(
Fq,
BigInteger([
14260497802974073023,
5895249896161266456,
14682908860938702530,
17222385991615618722,
14621060510943733448,
10594887362868996148,
7477357615964975684,
12570239403004322603,
2180620924574446161,
12129628062772479841,
8853285699251153944,
362282887012814
])
),
field_new!(Fq, "41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888253786114353726529584385201591605722013126468931404347949840543007986327743462853720628051692141265303114721689600"),
];
}

View File

@@ -1,6 +1,5 @@
use crate::{Fq, Fq2, Fq2Parameters, FQ_ONE, FQ_ZERO};
use ark_ff::{
biginteger::BigInteger768 as BigInteger,
field_new,
fields::fp4::{Fp4, Fp4Parameters},
};
@@ -22,47 +21,8 @@ impl Fp4Parameters for Fq4Parameters {
#[rustfmt::skip]
const FROBENIUS_COEFF_FP4_C1: &'static [Fq] = &[
FQ_ONE,
field_new!(Fq, BigInteger([
2732208433323581659,
2172983777736624684,
14351170316343013496,
6345300643186282385,
3197292113538174065,
1887663496013421009,
16627860175048929982,
1842296636815120666,
13463717484107308085,
721000253033730237,
1214767992212094798,
163570781165682,
])),
field_new!(Fq, BigInteger([
14260497802974073023,
5895249896161266456,
14682908860938702530,
17222385991615618722,
14621060510943733448,
10594887362868996148,
7477357615964975684,
12570239403004322603,
2180620924574446161,
12129628062772479841,
8853285699251153944,
362282887012814,
])),
field_new!(Fq, BigInteger([
4081847608632041254,
14228374352133326707,
11267574244067947896,
1174247187748832530,
10065542319823237575,
10873259071217986508,
12902564573729719519,
17180267336735511666,
11808206507871910973,
12535793096497356591,
18394626215023595103,
334259642706846,
])),
field_new!(Fq, "18691656569803771296244054523431852464958959799019013859007259692542121208304602539555350517075508287829753932558576476751900235650227380562700444433662761577027341858128610410779088384480737679672900770810745291515010467307990"),
field_new!(Fq, "41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888253786114353726529584385201591605722013126468931404347949840543007986327743462853720628051692141265303114721689600"),
field_new!(Fq, "23206834398115182106100160267808784663211750120934935212776243228483231604266504233503543246714830633588317039329677309362453490879357004638891167538350364891904062489821230132228897943262725174047727280881395973788104254381611"),
];
}