ark-curves-cherry-picked/mnt4_298/src/fields/fq4.rs
mnt4_298/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] = 7684163245453501615621351552473337069301082060976805004625011694147890954040864167002308
20 // c1[2] = 475922286169261325753349249653048451545124879242694725395555128576210262817955800483758080
21 // c1[3] = 468238122923807824137727898100575114475823797181717920390930116882062371863914936316755773
22 //
23 // These are calculated as
24 // `FROBENIUS_COEFF_FP4_C1[i] = Fp2Config::NONRESIDUE^((q^i - 1) / 4)`.
25 const FROBENIUS_COEFF_FP4_C1: &'static [Fq] = &[
26 Fq::ONE,
27 MontFp!("7684163245453501615621351552473337069301082060976805004625011694147890954040864167002308"),
28 MontFp!("475922286169261325753349249653048451545124879242694725395555128576210262817955800483758080"),
29 MontFp!("468238122923807824137727898100575114475823797181717920390930116882062371863914936316755773"),
30 ];
31}