arnaucube
arnaucube/ark-curves-cherry-pickedPublic Self-hosted repository
ark-curves-cherry-picked/mnt4_753/src/fields/fq2.rs
mnt4_753/src/fields/fq2.rsRaw
 1use crate::{Fq, FQ_ONE};
 2use ark_ff::{
 3    biginteger::BigInteger768 as BigInteger,
 4    field_new,
 5    fields::fp2::{Fp2, Fp2Parameters},
 6};
 7
 8pub type Fq2 = Fp2<Fq2Parameters>;
 9
10pub struct Fq2Parameters;
11
12impl Fp2Parameters for Fq2Parameters {
13    type Fp = Fq;
14
15    // non_residue = 13
16    #[rustfmt::skip]
17    const NONRESIDUE: Fq = field_new!(Fq, BigInteger([
18            11881297496860141143,
19            13588356353764843511,
20            9969398190777826186,
21            17325157081734070311,
22            16341533986183788031,
23            8322434028726676858,
24            13631157743146294957,
25            8365783422740577875,
26            3010239015809771096,
27            11776256826687733591,
28            7214251687253691272,
29            268626707558702
30    ]));
31
32    // qnr = (8, 1)
33    const QUADRATIC_NONRESIDUE: (Self::Fp, Self::Fp) = (
34        field_new!(
35            Fq,
36            BigInteger([
37                587330122779359758,
38                14352661462510473462,
39                17802452401246596498,
40                18018663494943049411,
41                17948754733747257098,
42                10253180574146027531,
43                6683223122694781837,
44                13573468617269213174,
45                5059368039312883748,
46                950479668716233863,
47                9936591501985804621,
48                88719447132658
49            ])
50        ),
51        FQ_ONE,
52    );
53
54    // Coefficients:
55    // [1, 41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888253786114353726529584385201591605722013126468931404347949840543007986327743462853720628051692141265303114721689600]
56    // see https://github.com/o1-labs/snarky/blob/2cf5ef3a14989e57c17518832b3c52590068fc48/src/camlsnark_c/libsnark-caml/depends/libff/libff/algebra/curves/mnt753/mnt4753/mnt4753_init.cpp
57    const FROBENIUS_COEFF_FP2_C1: &'static [Self::Fp] = &[
58        FQ_ONE,
59        field_new!(
60            Fq,
61            BigInteger([
62                14260497802974073023,
63                5895249896161266456,
64                14682908860938702530,
65                17222385991615618722,
66                14621060510943733448,
67                10594887362868996148,
68                7477357615964975684,
69                12570239403004322603,
70                2180620924574446161,
71                12129628062772479841,
72                8853285699251153944,
73                362282887012814
74            ])
75        ),
76    ];
77}