Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
fq6.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: Completed, auditors: [Federico], commit: }
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6
7#pragma once
8
9#include "../../fields/field6.hpp"
10#include "./fq.hpp"
11#include "./fq2.hpp"
12
13namespace bb {
14
38
39#if defined(__SIZEOF_INT128__) && !defined(__wasm__)
40 static constexpr fq2 frobenius_coeffs_c1_1{
41 { 0xb5773b104563ab30UL, 0x347f91c8a9aa6454UL, 0x7a007127242e0991UL, 0x1956bcd8118214ecUL },
42 { 0x6e849f1ea0aa4757UL, 0xaa1c7b6d89f89141UL, 0xb6e713cdfae0ca3aUL, 0x26694fbb4e82ebc3UL }
43 };
44
45 static constexpr fq2 frobenius_coeffs_c1_2{
46 { 0x3350c88e13e80b9cUL, 0x7dce557cdb5e56b9UL, 0x6001b4b8b615564aUL, 0x2682e617020217e0UL },
47 { 0UL, 0UL, 0UL, 0UL }
48 };
49
50 static constexpr fq2 frobenius_coeffs_c1_3{
51 { 0xc9af22f716ad6badUL, 0xb311782a4aa662b2UL, 0x19eeaf64e248c7f4UL, 0x20273e77e3439f82UL },
52 { 0xacc02860f7ce93acUL, 0x3933d5817ba76b4cUL, 0x69e6188b446c8467UL, 0x0a46036d4417cc55UL }
53 };
54
55 static constexpr fq2 frobenius_coeffs_c2_1{
56 { 0x7361d77f843abe92UL, 0xa5bb2bd3273411fbUL, 0x9c941f314b3e2399UL, 0x15df9cddbb9fd3ecUL },
57 { 0x5dddfd154bd8c949UL, 0x62cb29a5a4445b60UL, 0x37bc870a0c7dd2b9UL, 0x24830a9d3171f0fdUL }
58 };
59
60 static constexpr fq2 frobenius_coeffs_c2_2{
61 { 0x71930c11d782e155UL, 0xa6bb947cffbe3323UL, 0xaa303344d4741444UL, 0x2c3b3f0d26594943UL },
62 { 0UL, 0UL, 0UL, 0UL }
63 };
64
65 static constexpr fq2 frobenius_coeffs_c2_3{
66 { 0x448a93a57b6762dfUL, 0xbfd62df528fdeadfUL, 0xd858f5d00e9bd47aUL, 0x06b03d4d3476ec58UL },
67 { 0x2b19daf4bcc936d1UL, 0xa1a54e7a56f4299fUL, 0xb533eee05adeaef1UL, 0x170c812b84dda0b2UL }
68 };
69#else
70 static constexpr fq2 frobenius_coeffs_c1_1{
71 { 0xecdea09b24a59190UL, 0x17db8ffeae2fe1c2UL, 0xbb09c97c6dabac4dUL, 0x2492b3d41d289af3UL },
72 { 0xf1663598f1142ef1UL, 0x77ec057e0bf56062UL, 0xdd0baaecb677a631UL, 0x135e4e31d284d463UL }
73 };
74
75 static constexpr fq2 frobenius_coeffs_c1_2{
76 { 0x8aeb638758ccb791UL, 0xee27476838ae0f5bUL, 0x5fc8441d09282bUL, 0x169119a8426a57f9UL }, { 0UL, 0UL, 0UL, 0UL }
77 };
78
79 static constexpr fq2 frobenius_coeffs_c1_3{
80 { 0x4738e103136caecdUL, 0xf491475bc376b8c3UL, 0x1f4034a3a97cbee8UL, 0xcad5f8fef61ccd7UL },
81 { 0x2f41c395e6e485d6UL, 0x997230c70242aa46UL, 0xeae16f2184887ab5UL, 0x266696f73bcfc9b2UL }
82 };
83
84 static constexpr fq2 frobenius_coeffs_c2_1{
85 { 0x227346b0b081f85eUL, 0x6e51a67130492bb5UL, 0x7e20162e52b19e16UL, 0x1677516f2343bb4bUL },
86 { 0x18b280852f616a78UL, 0x25433712bde06eceUL, 0xb00a58256b9a0e66UL, 0x6f9f8e111971bbdUL }
87 };
88
89 static constexpr fq2 frobenius_coeffs_c2_2{
90 { 0x62b1a3a46a337995UL, 0xadc97d2722e2726eUL, 0x64ee82ede2db85faUL, 0xc0afea1488a03bbUL },
91 { 0UL, 0UL, 0UL, 0UL }
92 };
93
94 static constexpr fq2 frobenius_coeffs_c2_3{
95 { 0xa0d044540af866c4UL, 0x9cc0145f7df631b3UL, 0x29dda327cd752de1UL, 0x14766fdb0a170a74UL },
96 { 0xdd532940e9d402f7UL, 0x541490c5bfda559eUL, 0xd9c9c659c541b0b8UL, 0xbaf8cb569cbb3e4UL }
97 };
98#endif
99
100 static inline constexpr fq2 mul_by_non_residue(const fq2& a)
101 {
102 // non_residue = 9 + u
103 // (a + bu) * (9 + u) = (9a - b) + (9b + a)u
104
105 // 9a
106 fq T0 = a.c0 + a.c0;
107 T0 += T0;
108 T0 += T0;
109 T0 += a.c0;
110
111 // 9b
112 fq T1 = a.c1 + a.c1;
113 T1 += T1;
114 T1 += T1;
115 T1 += a.c1;
116
117 return { T0 - a.c1, T1 + a.c0 };
118 }
119};
120
122} // namespace bb
FF a
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
Sextic extension of the base field of BN254.
Definition fq6.hpp:37
static constexpr fq2 frobenius_coeffs_c1_2
Definition fq6.hpp:75
static constexpr fq2 frobenius_coeffs_c2_2
Definition fq6.hpp:89
static constexpr fq2 frobenius_coeffs_c2_1
Definition fq6.hpp:84
static constexpr fq2 frobenius_coeffs_c1_3
Definition fq6.hpp:79
static constexpr fq2 mul_by_non_residue(const fq2 &a)
Definition fq6.hpp:100
static constexpr fq2 frobenius_coeffs_c2_3
Definition fq6.hpp:94
static constexpr fq2 frobenius_coeffs_c1_1
Definition fq6.hpp:70