ark-curves-cherry-picked/mnt6_753/src/fields/fq3.rs
mnt6_753/src/fields/fq3.rsRaw
1use crate::{fq::Fq, FQ_ONE};
2use ark_ff::{
3 biginteger::BigInteger768 as BigInteger,
4 field_new,
5 fields::fp3::{Fp3, Fp3Parameters},
6};
7
8pub type Fq3 = Fp3<Fq3Parameters>;
9
10pub struct Fq3Parameters;
11
12impl Fp3Parameters for Fq3Parameters {
13 type Fp = Fq;
14
15 #[rustfmt::skip]
16 const NONRESIDUE: Fq = field_new!(Fq, BigInteger([
17 5145524327033718740,
18 14149824967095184544,
19 5159730833497260295,
20 3902941467692815387,
21 15830098551216085679,
22 8665641533746801158,
23 17502192300007146323,
24 14483698255198590748,
25 546300946688995976,
26 4331975528992054828,
27 5311428878520309260,
28 495362057711802,
29 ]));
30
31 const TWO_ADICITY: u32 = 30;
32
33 #[rustfmt::skip]
34 const T_MINUS_ONE_DIV_TWO: &'static [u64] = &[
35 15439605736802142541,
36 18190868848461853149,
37 6220121510046940818,
38 10310485528612680366,
39 5032137869959796540,
40 3943048799800510054,
41 1971151279016362045,
42 6096644900171872841,
43 12908407994230849218,
44 4163225373804228290,
45 10382959950522770522,
46 9008828410264446883,
47 18411821899404157689,
48 12386199240837247984,
49 13370099281150720481,
50 11909278545073807560,
51 5964354403900302648,
52 15347506722065009035,
53 7045354120681109597,
54 14294096902719509929,
55 6180325033003959541,
56 14381489272445870003,
57 18159920240207503954,
58 17487026929061632528,
59 12314108197538755669,
60 12116872703077811769,
61 3401400733784294722,
62 13905351619889935522,
63 10972472942574358218,
64 6104159581753028261,
65 4690139121547787552,
66 4880965491878697414,
67 1926648890365125214,
68 13532564555356297305,
69 3114545746551080,
70 0,
71 ];
72
73 #[rustfmt::skip]
74 const QUADRATIC_NONRESIDUE_TO_T: (Fq, Fq, Fq) = (
75 field_new!(Fq, BigInteger([
76 2456656400918202012,
77 7503386575313625620,
78 1014314685003569848,
79 10473903647598823719,
80 15893393002146336511,
81 8418203974290622500,
82 9017296731996077946,
83 2923126592994124774,
84 9368756030960215800,
85 17344552888362241070,
86 10938255746876359306,
87 107029542386399,
88 ])),
89 field_new!(Fq, BigInteger([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])),
90 field_new!(Fq, BigInteger([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])),
91 );
92
93 // Coefficients for the Frobenius automorphism.
94 // c1[0] = 1,
95 // c1[1] = 24129022407817241407134263419936114379815707076943508280977368156625538709102831814843582780138963119807143081677569721953561801075623741378629346409604471234573396989178424163772589090105392407118197799904755622897541183052132
96 // c1[2] = 17769468560101711995209951371304522748355002843010440790806134764399814103468274958215310983651375801610927890210888755369611256415970113691066895445191924931148019336171640277697829047741006062493737919155152541323243293107868,
97 #[rustfmt::skip]
98 const FROBENIUS_COEFF_FP3_C1: &'static [Fq] = &[
99 FQ_ONE,
100 field_new!(Fq, BigInteger([
101 7739145380395648640,
102 1403348385939055902,
103 11220424057264707228,
104 4567962295300549271,
105 5929583493640677751,
106 17618207486530478833,
107 16600462137977359741,
108 16551719371247820635,
109 12057922785354578416,
110 13022559182829558162,
111 13308285686168533250,
112 313705269181021,
113 ])),
114 field_new!(Fq, BigInteger([
115 12973180669431253567,
116 17038664486452692616,
117 11034024317238370177,
118 7712681843988565810,
119 4725787734130647531,
120 2175028350442404679,
121 9323639551697167751,
122 14465264105466053583,
123 8569442212929419360,
124 17553812953652473294,
125 13991744086792172309,
126 48577617831792,
127 ])),
128 ];
129
130 // c2 = {c1[0], c1[2], c1[1]}
131 #[rustfmt::skip]
132 const FROBENIUS_COEFF_FP3_C2: &'static [Fq] = &[
133 FQ_ONE,
134 Self::FROBENIUS_COEFF_FP3_C1[2],
135 Self::FROBENIUS_COEFF_FP3_C1[1],
136 ];
137}