|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include <field12.hpp>
Classes | |
| struct | ell_coeffs |
Public Member Functions | |
| constexpr | field12 (const base_field &a=base_field::zero(), const base_field &b=base_field::zero()) |
| constexpr | field12 (const field12 &other) |
| constexpr | field12 (field12 &&other) noexcept |
| constexpr field12 & | operator= (const field12 &other) noexcept |
| constexpr field12 & | operator= (field12 &&other) noexcept |
| constexpr | ~field12 () noexcept=default |
| constexpr field12 | operator+ (const field12 &other) const |
| constexpr field12 | operator- (const field12 &other) const |
| constexpr field12 | operator- () const |
| constexpr field12 | operator* (const field12 &other) const |
| constexpr field12 | operator/ (const field12 &other) const |
| constexpr field12 | operator+= (const field12 &other) |
| constexpr field12 | operator-= (const field12 &other) |
| constexpr field12 | operator*= (const field12 &other) |
| constexpr field12 | operator/= (const field12 &other) |
| constexpr void | self_neg () |
| constexpr void | self_sqr () |
| constexpr void | self_sparse_mul (const ell_coeffs &ell) |
| Multiply the element by a sparse element of the form ell.o + ell.w * w + ell.vw * wv. | |
| constexpr field12 | sqr () const |
| constexpr field12 | invert () const |
| constexpr field12 | frobenius_map_three () const |
| constexpr field12 | frobenius_map_two () const |
| constexpr field12 | frobenius_map_one () const |
| constexpr field12 | cyclotomic_squared () const |
| constexpr field12 | unitary_inverse () const |
| constexpr field12 | to_montgomery_form () |
| constexpr field12 | from_montgomery_form () const |
| constexpr bool | is_zero () const |
| constexpr bool | operator== (const field12 &other) const |
Static Public Member Functions | |
| static constexpr field12 | zero () |
| static constexpr field12 | one () |
| static constexpr base_field | mul_by_non_residue (const base_field &a) |
| static constexpr field12 | random_element (numeric::RNG *engine=nullptr) |
Public Attributes | |
| base_field | c0 |
| base_field | c1 |
Definition at line 11 of file field12.hpp.
|
inlineconstexpr |
Definition at line 13 of file field12.hpp.
|
inlineconstexpr |
Definition at line 18 of file field12.hpp.
|
inlineconstexprnoexcept |
Definition at line 23 of file field12.hpp.
|
constexprdefaultnoexcept |
|
inlineconstexpr |
Definition at line 223 of file field12.hpp.
|
inlineconstexpr |
Definition at line 215 of file field12.hpp.
|
inlineconstexpr |
Definition at line 199 of file field12.hpp.
|
inlineconstexpr |
Definition at line 207 of file field12.hpp.
|
inlineconstexpr |
Definition at line 250 of file field12.hpp.
|
inlineconstexpr |
Definition at line 188 of file field12.hpp.
|
inlineconstexpr |
Definition at line 258 of file field12.hpp.
|
inlinestaticconstexpr |
Definition at line 59 of file field12.hpp.
|
inlinestaticconstexpr |
Definition at line 57 of file field12.hpp.
|
inlineconstexpr |
Definition at line 86 of file field12.hpp.
|
inlineconstexpr |
Definition at line 115 of file field12.hpp.
|
inlineconstexpr |
Definition at line 68 of file field12.hpp.
|
inlineconstexpr |
Definition at line 101 of file field12.hpp.
|
inlineconstexpr |
Definition at line 84 of file field12.hpp.
|
inlineconstexpr |
Definition at line 76 of file field12.hpp.
|
inlineconstexpr |
Definition at line 108 of file field12.hpp.
|
inlineconstexpr |
Definition at line 99 of file field12.hpp.
|
inlineconstexpr |
Definition at line 121 of file field12.hpp.
|
inlineconstexprnoexcept |
Definition at line 28 of file field12.hpp.
|
inlineconstexprnoexcept |
Definition at line 38 of file field12.hpp.
|
inlineconstexpr |
Definition at line 260 of file field12.hpp.
|
inlinestaticconstexpr |
Definition at line 233 of file field12.hpp.
|
inlineconstexpr |
Definition at line 127 of file field12.hpp.
|
inlineconstexpr |
Multiply the element by a sparse element of the form ell.o + ell.w * w + ell.vw * wv.
Algorithm 5 from https://cacr.uwaterloo.ca/techreports/2012/cacr2012-17.pdf
Tower structure: Fq12 = Fq6[w]/(w² - v), so an Fq12 element is (c0 + c1·w) with c0, c1 in Fq6. The sparse element is s = (s0 + s1·w) where s0 = {ell.o, 0, 0} and s1 = {ell.w, ell.vw, 0} in Fq6.
Generic multiplication gives: result.c0 = c0·s0 + c1·s1·v (since w² = v) result.c1 = c0·s1 + c1·s0 (cross terms)
We use Karatsuba to compute the cross terms with one fewer Fq6 multiplication: A = c0·s0 (computed directly: s0 = {ell.o,0,0}, so A = {ell.o·c0.c0, ell.o·c0.c1, ell.o·c0.c2}) B = c1·s1 (via field6::sparse_mul, since s1 = {ell.w, ell.vw, 0} = ell.w + ell.vw·v) E = (c0+c1)·(s0+s1) (via field6::sparse_mul, since s0+s1 = {ell.o+ell.w, ell.vw, 0}) F = E - A - B = c0·s1 + c1·s0 (Karatsuba cross term = result.c1) G = v·B (constructed inline as {ξ·B.c2, B.c0, B.c1}, since v·(b0+b1·v+b2·v²) = ξ·b2 + b0·v + b1·v²; uses Fq6::mul_by_non_residue on B.c2 to get ξ·B.c2) H = A + G = c0·s0 + c1·s1·v (= result.c0)
| ell |
Definition at line 158 of file field12.hpp.
|
inlineconstexpr |
Definition at line 133 of file field12.hpp.
|
inlineconstexpr |
Definition at line 174 of file field12.hpp.
|
inlineconstexpr |
Definition at line 242 of file field12.hpp.
|
inlineconstexpr |
Definition at line 225 of file field12.hpp.
|
inlinestaticconstexpr |
Definition at line 56 of file field12.hpp.
| base_field bb::field12< quadratic_field, base_field, Fq12Params >::c0 |
Definition at line 47 of file field12.hpp.
| base_field bb::field12< quadratic_field, base_field, Fq12Params >::c1 |
Definition at line 48 of file field12.hpp.