ark-curves-cherry-picked/mnt4_298/src/fields/fq2.rs
mnt4_298/src/fields/fq2.rsRaw
1use crate::{Fq, FQ_ONE};
2use ark_ff::{
3 field_new,
4 fields::fp2::{Fp2, Fp2Parameters},
5};
6
7pub type Fq2 = Fp2<Fq2Parameters>;
8
9pub struct Fq2Parameters;
10
11impl Fp2Parameters for Fq2Parameters {
12 type Fp = Fq;
13
14 /// The quadratic non-residue (17) used to construct the extension is
15 /// the same as that used in [`libff`](https://github.com/scipr-lab/libff/blob/c927821ebe02e0a24b5e0f9170cec5e211a35f08/libff/algebra/curves/mnt/mnt4/mnt4_init.cpp#L102).
16 #[rustfmt::skip]
17 const NONRESIDUE: Fq = field_new!(Fq, "17");
18
19 /// The quadratic non-residue in F<sub>p</sub><sup>2</sup> that is used
20 /// in the computation of square roots is (8, 1), the same as that in
21 /// [`libff`](https://github.com/scipr-lab/libff/blob/c927821ebe02e0a24b5e0f9170cec5e211a35f08/libff/algebra/curves/mnt/mnt4/mnt4_init.cpp#L103)
22 const QUADRATIC_NONRESIDUE: (Self::Fp, Self::Fp) = (
23 field_new!(Fq, "8"),
24 FQ_ONE,
25 );
26
27 /// Precomputed coefficients:
28 /// `[1, 475922286169261325753349249653048451545124879242694725395555128576210262817955800483758080]`
29 const FROBENIUS_COEFF_FP2_C1: &'static [Self::Fp] = &[
30 FQ_ONE,
31 field_new!(Fq, "475922286169261325753349249653048451545124879242694725395555128576210262817955800483758080"),
32 ];
33}