ark-curves-cherry-picked/mnt6_753/src/fields/fq3.rs
mnt6_753/src/fields/fq3.rsRaw
1use ark_ff::{
2 fields::fp3::{Fp3, Fp3Config},
3 AdditiveGroup, Field, MontFp,
4};
5
6use crate::fq::Fq;
7
8pub type Fq3 = Fp3<Fq3Config>;
9
10pub struct Fq3Config;
11
12impl Fp3Config for Fq3Config {
13 type Fp = Fq;
14
15 const NONRESIDUE: Fq = MontFp!("11");
16
17 const TWO_ADICITY: u32 = 30;
18
19 #[rustfmt::skip]
20 const TRACE_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 const QUADRATIC_NONRESIDUE_TO_T: Fq3 = Fq3::new(
60 MontFp!("22168644070733283197994897338612733221095941481265408161807376791727499343083607817089033595478370212662133368413166734396127674284827734481031659015434501966360165723728649019457855887066657739809176476252080335185730833468062"),
61 Fq::ZERO,
62 Fq::ZERO,
63 );
64
65 // Coefficients for the Frobenius automorphism.
66 // c1[0] = 1,
67 // c1[1] = 24129022407817241407134263419936114379815707076943508280977368156625538709102831814843582780138963119807143081677569721953561801075623741378629346409604471234573396989178424163772589090105392407118197799904755622897541183052132
68 // c1[2] = 17769468560101711995209951371304522748355002843010440790806134764399814103468274958215310983651375801610927890210888755369611256415970113691066895445191924931148019336171640277697829047741006062493737919155152541323243293107868,
69 const FROBENIUS_COEFF_FP3_C1: &'static [Fq] = &[
70 Fq::ONE,
71 MontFp!("24129022407817241407134263419936114379815707076943508280977368156625538709102831814843582780138963119807143081677569721953561801075623741378629346409604471234573396989178424163772589090105392407118197799904755622897541183052132"),
72 MontFp!("17769468560101711995209951371304522748355002843010440790806134764399814103468274958215310983651375801610927890210888755369611256415970113691066895445191924931148019336171640277697829047741006062493737919155152541323243293107868"),
73 ];
74
75 // c2 = {c1[0], c1[2], c1[1]}
76 const FROBENIUS_COEFF_FP3_C2: &'static [Fq] = &[
77 Fq::ONE,
78 Self::FROBENIUS_COEFF_FP3_C1[2],
79 Self::FROBENIUS_COEFF_FP3_C1[1],
80 ];
81}