arnaucube
arnaucube/ark-curves-cherry-pickedPublic Self-hosted repository
ark-curves-cherry-picked/mnt6_753/src/fields/fq3.rs
mnt6_753/src/fields/fq3.rsRaw
 1use crate::{fq::Fq, FQ_ONE, FQ_ZERO};
 2use ark_ff::{
 3    field_new,
 4    fields::fp3::{Fp3, Fp3Parameters},
 5};
 6
 7pub type Fq3 = Fp3<Fq3Parameters>;
 8
 9pub struct Fq3Parameters;
10
11impl Fp3Parameters for Fq3Parameters {
12    type Fp = Fq;
13
14    #[rustfmt::skip]
15    const NONRESIDUE: Fq = field_new!(Fq, "11");
16
17    const TWO_ADICITY: u32 = 30;
18
19    #[rustfmt::skip]
20    const T_MINUS_ONE_DIV_TWO: &'static [u64] = &[
21        15439605736802142541,
22        18190868848461853149,
23        6220121510046940818,
24        10310485528612680366,
25        5032137869959796540,
26        3943048799800510054,
27        1971151279016362045,
28        6096644900171872841,
29        12908407994230849218,
30        4163225373804228290,
31        10382959950522770522,
32        9008828410264446883,
33        18411821899404157689,
34        12386199240837247984,
35        13370099281150720481,
36        11909278545073807560,
37        5964354403900302648,
38        15347506722065009035,
39        7045354120681109597,
40        14294096902719509929,
41        6180325033003959541,
42        14381489272445870003,
43        18159920240207503954,
44        17487026929061632528,
45        12314108197538755669,
46        12116872703077811769,
47        3401400733784294722,
48        13905351619889935522,
49        10972472942574358218,
50        6104159581753028261,
51        4690139121547787552,
52        4880965491878697414,
53        1926648890365125214,
54        13532564555356297305,
55        3114545746551080,
56    ];
57
58    /// (11^T, 0, 0)
59    #[rustfmt::skip]
60    const QUADRATIC_NONRESIDUE_TO_T: (Fq, Fq, Fq) = (
61        field_new!(Fq, "22168644070733283197994897338612733221095941481265408161807376791727499343083607817089033595478370212662133368413166734396127674284827734481031659015434501966360165723728649019457855887066657739809176476252080335185730833468062"),
62        FQ_ZERO,
63        FQ_ZERO,
64    );
65
66    // Coefficients for the Frobenius automorphism.
67    // c1[0] = 1,
68    // c1[1] = 24129022407817241407134263419936114379815707076943508280977368156625538709102831814843582780138963119807143081677569721953561801075623741378629346409604471234573396989178424163772589090105392407118197799904755622897541183052132
69    // c1[2] = 17769468560101711995209951371304522748355002843010440790806134764399814103468274958215310983651375801610927890210888755369611256415970113691066895445191924931148019336171640277697829047741006062493737919155152541323243293107868,
70    #[rustfmt::skip]
71    const FROBENIUS_COEFF_FP3_C1: &'static [Fq] = &[
72        FQ_ONE,
73        field_new!(Fq, "24129022407817241407134263419936114379815707076943508280977368156625538709102831814843582780138963119807143081677569721953561801075623741378629346409604471234573396989178424163772589090105392407118197799904755622897541183052132"),
74        field_new!(Fq, "17769468560101711995209951371304522748355002843010440790806134764399814103468274958215310983651375801610927890210888755369611256415970113691066895445191924931148019336171640277697829047741006062493737919155152541323243293107868"),
75    ];
76
77    // c2 = {c1[0], c1[2], c1[1]}
78    #[rustfmt::skip]
79    const FROBENIUS_COEFF_FP3_C2: &'static [Fq] = &[
80        FQ_ONE,
81        Self::FROBENIUS_COEFF_FP3_C1[2],
82        Self::FROBENIUS_COEFF_FP3_C1[1],
83    ];
84}