ark-curves-cherry-picked/mnt4_298/src/fields/fq4.rs
mnt4_298/src/fields/fq4.rsRaw
1use crate::{Fq, Fq2, Fq2Parameters, FQ_ONE, FQ_ZERO};
2use ark_ff::{
3 field_new,
4 fields::fp4::{Fp4, Fp4Parameters},
5};
6
7pub type Fq4 = Fp4<Fq4Parameters>;
8
9pub struct Fq4Parameters;
10
11impl Fp4Parameters for Fq4Parameters {
12 type Fp2Params = Fq2Parameters;
13
14 const NONRESIDUE: Fq2 = field_new!(Fq2, FQ_ZERO, FQ_ONE);
15
16 // Coefficients for the Frobenius automorphism.
17 // c1[0] = 1,
18 // c1[1] = 7684163245453501615621351552473337069301082060976805004625011694147890954040864167002308
19 // c1[2] = 475922286169261325753349249653048451545124879242694725395555128576210262817955800483758080
20 // c1[3] = 468238122923807824137727898100575114475823797181717920390930116882062371863914936316755773
21 //
22 // These are calculated as `FROBENIUS_COEFF_FP4_C1[i] = Fp2Params::NONRESIDUE^((q^i - 1) / 4)`.
23 #[rustfmt::skip]
24 const FROBENIUS_COEFF_FP4_C1: &'static [Fq] = &[
25 FQ_ONE,
26 field_new!(Fq, "7684163245453501615621351552473337069301082060976805004625011694147890954040864167002308"),
27 field_new!(Fq, "475922286169261325753349249653048451545124879242694725395555128576210262817955800483758080"),
28 field_new!(Fq, "468238122923807824137727898100575114475823797181717920390930116882062371863914936316755773"),
29 ];
30}