ark_bls12_381/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::ONE, Fq::ONE);
15
16 const FROBENIUS_COEFF_FP6_C1: &'static [Fq2] = &[
17 Fq2::new(
19 Fq::ONE,
20 Fq::ZERO,
21 ),
22 Fq2::new(
24 Fq::ZERO,
25 MontFp!("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436"),
26 ),
27 Fq2::new(
29 MontFp!("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350"),
30 Fq::ZERO,
31 ),
32 Fq2::new(
34 Fq::ZERO,
35 Fq::ONE,
36 ),
37 Fq2::new(
39 MontFp!("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436"),
40 Fq::ZERO,
41 ),
42 Fq2::new(
44 Fq::ZERO,
45 MontFp!("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350"),
46 ),
47];
48
49 #[rustfmt::skip]
50 const FROBENIUS_COEFF_FP6_C2: &'static [Fq2] = &[
51 Fq2::new(
53 Fq::ONE,
54 Fq::ZERO,
55 ),
56 Fq2::new(
58 MontFp!("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437"),
59 Fq::ZERO,
60 ),
61 Fq2::new(
63 MontFp!("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436"),
64 Fq::ZERO,
65 ),
66 Fq2::new(
68 MontFp!("-1"),
69 Fq::ZERO,
70 ),
71 Fq2::new(
73 MontFp!("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350"),
74 Fq::ZERO,
75 ),
76 Fq2::new(
78 MontFp!("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351"),
79 Fq::ZERO,
80 ),
81 ];
82
83 fn mul_fp2_by_nonresidue_in_place(fe: &mut Fq2) -> &mut Fq2 {
86 let t0 = fe.c0;
87 fe.c0 -= &fe.c1;
88 fe.c1 += &t0;
89 fe
90 }
91}