ark-curves-cherry-picked/mnt4_753/src/fields/fq4.rs
mnt4_753/src/fields/fq4.rsRaw
1use ark_ff::{
2 fields::fp4::{Fp4, Fp4Config},
3 AdditiveGroup, Field, MontFp,
4};
5
6use crate::{Fq, Fq2, Fq2Config};
7
8pub type Fq4 = Fp4<Fq4Config>;
9
10pub struct Fq4Config;
11
12impl Fp4Config for Fq4Config {
13 type Fp2Config = Fq2Config;
14
15 const NONRESIDUE: Fq2 = Fq2::new(Fq::ZERO, Fq::ONE);
16
17 // Coefficients for the Frobenius automorphism.
18 // c1[0] = 1,
19 // c1[1] = 18691656569803771296244054523431852464958959799019013859007259692542121208304602539555350517075508287829753932558576476751900235650227380562700444433662761577027341858128610410779088384480737679672900770810745291515010467307990
20 // c1[2] = 41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888253786114353726529584385201591605722013126468931404347949840543007986327743462853720628051692141265303114721689600
21 // c1[3] = 23206834398115182106100160267808784663211750120934935212776243228483231604266504233503543246714830633588317039329677309362453490879357004638891161288350364891904062489821230132228897943262725174047727280881395973788104254381611
22 //
23 // These are calculated as `FROBENIUS_COEFF_FP4_C1[i] =
24 // Fp2Config::NONRESIDUE^((q^i - 1) / 4)`.
25 const FROBENIUS_COEFF_FP4_C1: &'static [Fq] = &[
26 Fq::ONE,
27 MontFp!("18691656569803771296244054523431852464958959799019013859007259692542121208304602539555350517075508287829753932558576476751900235650227380562700444433662761577027341858128610410779088384480737679672900770810745291515010467307990"),
28 MontFp!("41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888253786114353726529584385201591605722013126468931404347949840543007986327743462853720628051692141265303114721689600"),
29 MontFp!("23206834398115182106100160267808784663211750120934935212776243228483231604266504233503543246714830633588317039329677309362453490879357004638891161288350364891904062489821230132228897943262725174047727280881395973788104254381611"),
30 ];
31}