Clearmatics Libff
0.1
C++ library for Finite Fields and Elliptic Curves
|
#include <mnt6_g2.hpp>
Definition at line 26 of file mnt6_g2.hpp.
◆ base_field
◆ scalar_field
◆ twist_field
◆ mnt6_G2() [1/2]
libff::mnt6_G2::mnt6_G2 |
( |
| ) |
|
◆ mnt6_G2() [2/2]
◆ add()
Definition at line 275 of file mnt6_g2.cpp.
282 if (other.is_zero()) {
290 if (this->
operator==(other)) {
294 #ifdef PROFILE_OP_COUNTS
301 const mnt6_Fq3 Y1Z2 = (this->
Y) * (other.Z);
303 const mnt6_Fq3 X1Z2 = (this->
X) * (other.Z);
305 const mnt6_Fq3 Z1Z2 = (this->
Z) * (other.Z);
307 const mnt6_Fq3 u = (other.Y) * (this->
Z) - Y1Z2;
311 const mnt6_Fq3 v = (other.X) * (this->
Z) - X1Z2;
319 const mnt6_Fq3 A = uu * Z1Z2 - (vvv + R + R);
323 const mnt6_Fq3 Y3 = u * (R - A) - vvv * Y1Z2;
◆ base_field_char()
◆ batch_to_special_all_non_zeros()
void libff::mnt6_G2::batch_to_special_all_non_zeros |
( |
std::vector< mnt6_G2 > & |
vec | ) |
|
|
static |
Definition at line 558 of file mnt6_g2.cpp.
560 std::vector<mnt6_Fq3> Z_vec;
561 Z_vec.reserve(vec.size());
563 for (
auto &el : vec) {
564 Z_vec.emplace_back(el.Z);
566 batch_invert<mnt6_Fq3>(Z_vec);
570 for (
size_t i = 0; i < vec.size(); ++i) {
571 vec[i] =
mnt6_G2(vec[i].
X * Z_vec[i], vec[i].
Y * Z_vec[i],
one);
◆ dbl()
mnt6_G2 libff::mnt6_G2::dbl |
( |
| ) |
const |
Definition at line 391 of file mnt6_g2.cpp.
393 #ifdef PROFILE_OP_COUNTS
422 const mnt6_Fq3 h = w.squared() - (B + B);
426 const mnt6_Fq3 Y3 = w * (B -
h) - (RR + RR);
◆ is_in_safe_subgroup()
bool libff::mnt6_G2::is_in_safe_subgroup |
( |
| ) |
const |
◆ is_special()
bool libff::mnt6_G2::is_special |
( |
| ) |
const |
◆ is_well_formed()
bool libff::mnt6_G2::is_well_formed |
( |
| ) |
const |
◆ is_zero()
bool libff::mnt6_G2::is_zero |
( |
| ) |
const |
◆ mixed_add()
Definition at line 330 of file mnt6_g2.cpp.
332 #ifdef PROFILE_OP_COUNTS
343 if (other.is_zero()) {
348 assert(other.is_special());
354 const mnt6_Fq3 X2Z1 = (this->
Z) * (other.X);
361 const mnt6_Fq3 Y2Z1 = (this->
Z) * (other.Y);
363 if (X1Z2 == X2Z1 && Y1Z2 == Y2Z1) {
380 const mnt6_Fq3 A = uu * this->
Z - vvv - R - R;
384 const mnt6_Fq3 Y3 = u * (R - A) - vvv * this->Y;
◆ mul_by_a()
◆ mul_by_b()
◆ mul_by_cofactor()
mnt6_G2 libff::mnt6_G2::mul_by_cofactor |
( |
| ) |
const |
◆ mul_by_q()
mnt6_G2 libff::mnt6_G2::mul_by_q |
( |
| ) |
const |
Definition at line 434 of file mnt6_g2.cpp.
439 (this->
Z).Frobenius_map(1));
◆ one()
const mnt6_G2 & libff::mnt6_G2::one |
( |
| ) |
|
|
static |
◆ operator!=()
bool libff::mnt6_G2::operator!= |
( |
const mnt6_G2 & |
other | ) |
const |
◆ operator+()
Definition at line 166 of file mnt6_g2.cpp.
173 if (other.is_zero()) {
194 const mnt6_Fq3 X1Z2 = (this->
X) * (other.Z);
196 const mnt6_Fq3 X2Z1 = (this->
Z) * (other.X);
201 const mnt6_Fq3 Y1Z2 = (this->
Y) * (other.Z);
203 const mnt6_Fq3 Y2Z1 = (this->
Z) * (other.Y);
205 if (X1Z2 == X2Z1 && Y1Z2 == Y2Z1) {
227 const mnt6_Fq3 h = w.squared() - (B + B);
231 const mnt6_Fq3 Y3 = w * (B -
h) - (RR + RR);
240 const mnt6_Fq3 Z1Z2 = (this->
Z) * (other.Z);
254 const mnt6_Fq3 A = uu * Z1Z2 - (vvv + R + R);
258 const mnt6_Fq3 Y3 = u * (R - A) - vvv * Y1Z2;
◆ operator-() [1/2]
mnt6_G2 libff::mnt6_G2::operator- |
( |
| ) |
const |
◆ operator-() [2/2]
Definition at line 270 of file mnt6_g2.cpp.
272 return (*
this) + (-other);
◆ operator==()
bool libff::mnt6_G2::operator== |
( |
const mnt6_G2 & |
other | ) |
const |
Definition at line 136 of file mnt6_g2.cpp.
139 return other.is_zero();
142 if (other.is_zero()) {
149 if ((this->
X * other.Z) != (other.X * this->Z)) {
154 if ((this->
Y * other.Z) != (other.Y * this->Z)) {
◆ order()
◆ print()
void libff::mnt6_G2::print |
( |
| ) |
const |
Definition at line 56 of file mnt6_g2.cpp.
62 copy.to_affine_coordinates();
64 "(%Nd*z^2 + %Nd*z + %Nd , %Nd*z^2 + %Nd*z + %Nd)\n",
65 copy.X.coeffs[2].as_bigint().data,
67 copy.X.coeffs[1].as_bigint().data,
69 copy.X.coeffs[0].as_bigint().data,
71 copy.Y.coeffs[2].as_bigint().data,
73 copy.Y.coeffs[1].as_bigint().data,
75 copy.Y.coeffs[0].as_bigint().data,
◆ print_coordinates()
void libff::mnt6_G2::print_coordinates |
( |
| ) |
const |
Definition at line 80 of file mnt6_g2.cpp.
86 "(%Nd*z^2 + %Nd*z + %Nd : %Nd*z^2 + %Nd*z + %Nd : %Nd*z^2 + %Nd*z "
90 this->X.coeffs[1].as_bigint().data,
92 this->X.coeffs[0].as_bigint().data,
94 this->Y.coeffs[2].as_bigint().data,
96 this->Y.coeffs[1].as_bigint().data,
98 this->Y.coeffs[0].as_bigint().data,
100 this->Z.coeffs[2].as_bigint().data,
102 this->Z.coeffs[1].as_bigint().data,
104 this->Z.coeffs[0].as_bigint().data,
◆ random_element()
mnt6_G2 libff::mnt6_G2::random_element |
( |
| ) |
|
|
static |
◆ read_compressed()
void libff::mnt6_G2::read_compressed |
( |
std::istream & |
in, |
|
|
mnt6_G2 & |
g |
|
) |
| |
|
static |
Definition at line 520 of file mnt6_g2.cpp.
533 in.read((
char *)&Y_lsb, 1);
543 if ((tY.coeffs[0].as_bigint().data[0] & 1) != Y_lsb) {
◆ read_uncompressed()
void libff::mnt6_G2::read_uncompressed |
( |
std::istream & |
in, |
|
|
mnt6_G2 & |
g |
|
) |
| |
|
static |
◆ size_in_bits()
static size_t libff::mnt6_G2::size_in_bits |
( |
| ) |
|
|
inlinestatic |
◆ to_affine_coordinates()
void libff::mnt6_G2::to_affine_coordinates |
( |
| ) |
|
Definition at line 109 of file mnt6_g2.cpp.
117 this->
X = this->
X * Z_inv;
118 this->
Y = this->
Y * Z_inv;
◆ to_special()
void libff::mnt6_G2::to_special |
( |
| ) |
|
◆ write_compressed()
void libff::mnt6_G2::write_compressed |
( |
std::ostream & |
out | ) |
const |
Definition at line 491 of file mnt6_g2.cpp.
494 copy.to_affine_coordinates();
499 << (copy.Y.coeffs[0].as_bigint().data[0] & 1);
◆ write_uncompressed()
void libff::mnt6_G2::write_uncompressed |
( |
std::ostream & |
out | ) |
const |
Definition at line 482 of file mnt6_g2.cpp.
485 copy.to_affine_coordinates();
◆ zero()
const mnt6_G2 & libff::mnt6_G2::zero |
( |
| ) |
|
|
static |
◆ coeff_a
◆ coeff_b
◆ fixed_base_exp_window_table
std::vector< size_t > libff::mnt6_G2::fixed_base_exp_window_table |
|
static |
◆ G2_one
◆ G2_zero
◆ h_bitcount
const mp_size_t libff::mnt6_G2::h_bitcount = 596 |
|
static |
◆ h_limbs
const mp_size_t libff::mnt6_G2::h_limbs |
|
static |
◆ twist
◆ wnaf_window_table
std::vector< size_t > libff::mnt6_G2::wnaf_window_table |
|
static |
The documentation for this class was generated from the following files:
- /home/runner/work/libff/libff/libff/algebra/curves/mnt/mnt6/mnt6_g2.hpp
- /home/runner/work/libff/libff/libff/algebra/curves/mnt/mnt6/mnt6_g2.cpp
mnt6_Fq mnt6_twist_mul_by_a_c0
mnt6_Fq mnt6_twist_mul_by_b_c2
static Fp_model< n, modulus > random_element()
returns random element of Fp_model
static const mnt6_G2 & one()
static Fp3_model< n, modulus > one()
mnt6_Fq mnt6_twist_mul_by_b_c1
mnt6_Fq mnt6_twist_mul_by_q_Y
mnt6_Fq mnt6_twist_mul_by_a_c1
mnt6_Fq mnt6_twist_mul_by_q_X
mnt6_Fq3 mnt6_twist_coeff_b
static const mp_size_t h_bitcount
mnt6_Fq3 mnt6_twist_coeff_a
bool operator==(const mnt6_G2 &other) const
void consume_OUTPUT_SEPARATOR(std::istream &in)
static const mp_size_t num_limbs
Fp3_model< mnt6_q_limbs, mnt6_modulus_q > mnt6_Fq3
static const mnt6_G2 & zero()
static const bigint< n > & field_char()
mnt6_Fq mnt6_twist_mul_by_a_c2
bigint< n > as_bigint() const
static mnt6_Fq3 mul_by_a(const mnt6_Fq3 &elt)
static bigint< h_limbs > h
Fp3_model inverse() const
Fp3_model sqrt() const
HAS TO BE A SQUARE (else does not terminate)
static size_t size_in_bits()
static const constexpr bigint< n > & mod
Fp3_model squared() const
void to_affine_coordinates()
static Fp3_model< n, modulus > zero()
mnt6_Fq mnt6_twist_mul_by_b_c0