ark_bls12_377/fields/
fq6.rs1use ark_ff::{fields::*, MontFp};
2
3use crate::*;
4
5pub type Fq6 = Fp6<Fq6Config>;
6
7#[derive(Clone, Copy)]
8pub struct Fq6Config;
9
10impl Fp6Config for Fq6Config {
11 type Fp2Config = Fq2Config;
12
13 const NONRESIDUE: Fq2 = Fq2::new(Fq::ZERO, Fq::ONE);
15
16 const FROBENIUS_COEFF_FP6_C1: &'static [Fq2] = &[
17 Fq2::new(Fq::ONE, Fq::ZERO),
19 Fq2::new(
21 MontFp!("80949648264912719408558363140637477264845294720710499478137287262712535938301461879813459410946"),
22 Fq::ZERO,
23 ),
24 Fq2::new(
26 MontFp!("80949648264912719408558363140637477264845294720710499478137287262712535938301461879813459410945"),
27 Fq::ZERO,
28 ),
29 Fq2::new(MontFp!("-1"), Fq::ZERO),
31 Fq2::new(
33 MontFp!("258664426012969093929703085429980814127835149614277183275038967946009968870203535512256352201271898244626862047231"),
34 Fq::ZERO,
35 ),
36 Fq2::new(
38 MontFp!("258664426012969093929703085429980814127835149614277183275038967946009968870203535512256352201271898244626862047232"),
39 Fq::ZERO,
40 ),
41 ];
42
43 const FROBENIUS_COEFF_FP6_C2: &'static [Fq2] = &[
44 Fq2::new(Fq::ONE, Fq::ZERO),
46 Fq2::new(
48 MontFp!("80949648264912719408558363140637477264845294720710499478137287262712535938301461879813459410945"),
49 Fq::ZERO
50 ),
51 Fq2::new(
53 MontFp!("258664426012969093929703085429980814127835149614277183275038967946009968870203535512256352201271898244626862047231"),
54 Fq::ZERO,
55 ),
56 Fq2::new(Fq::ONE, Fq::ZERO),
58 Fq2::new(
60 MontFp!("80949648264912719408558363140637477264845294720710499478137287262712535938301461879813459410945"),
61 Fq::ZERO,
62 ),
63 Fq2::new(
65 MontFp!("258664426012969093929703085429980814127835149614277183275038967946009968870203535512256352201271898244626862047231"),
66 Fq::ZERO,
67 ),
68 ];
69
70 #[inline(always)]
71 fn mul_fp2_by_nonresidue_in_place(fe: &mut Fq2) -> &mut Fq2 {
72 let old_c0 = fe.c0;
74 fe.c0 = fe.c1;
75 Fq2Config::mul_fp_by_nonresidue_in_place(&mut fe.c0);
76 fe.c1 = old_c0;
77 fe
78 }
79}