Clearmatics Libff
0.1
C++ library for Finite Fields and Elliptic Curves
|
#include <mnt4_g2.hpp>
Definition at line 26 of file mnt4_g2.hpp.
◆ base_field
◆ scalar_field
◆ twist_field
◆ mnt4_G2() [1/2]
libff::mnt4_G2::mnt4_G2 |
( |
| ) |
|
◆ mnt4_G2() [2/2]
◆ add()
Definition at line 262 of file mnt4_g2.cpp.
269 if (other.is_zero()) {
277 if (this->
operator==(other)) {
281 #ifdef PROFILE_OP_COUNTS
288 const mnt4_Fq2 Y1Z2 = (this->
Y) * (other.Z);
290 const mnt4_Fq2 X1Z2 = (this->
X) * (other.Z);
292 const mnt4_Fq2 Z1Z2 = (this->
Z) * (other.Z);
294 const mnt4_Fq2 u = (other.Y) * (this->
Z) - Y1Z2;
298 const mnt4_Fq2 v = (other.X) * (this->
Z) - X1Z2;
306 const mnt4_Fq2 A = uu * Z1Z2 - (vvv + R + R);
310 const mnt4_Fq2 Y3 = u * (R - A) - vvv * Y1Z2;
◆ base_field_char()
◆ batch_to_special_all_non_zeros()
void libff::mnt4_G2::batch_to_special_all_non_zeros |
( |
std::vector< mnt4_G2 > & |
vec | ) |
|
|
static |
Definition at line 541 of file mnt4_g2.cpp.
543 std::vector<mnt4_Fq2> Z_vec;
544 Z_vec.reserve(vec.size());
546 for (
auto &el : vec) {
547 Z_vec.emplace_back(el.Z);
549 batch_invert<mnt4_Fq2>(Z_vec);
553 for (
size_t i = 0; i < vec.size(); ++i) {
554 vec[i] =
mnt4_G2(vec[i].
X * Z_vec[i], vec[i].
Y * Z_vec[i],
one);
◆ dbl()
mnt4_G2 libff::mnt4_G2::dbl |
( |
| ) |
const |
Definition at line 378 of file mnt4_g2.cpp.
380 #ifdef PROFILE_OP_COUNTS
409 const mnt4_Fq2 h = w.squared() - (B + B);
413 const mnt4_Fq2 Y3 = w * (B -
h) - (RR + RR);
◆ is_in_safe_subgroup()
bool libff::mnt4_G2::is_in_safe_subgroup |
( |
| ) |
const |
◆ is_special()
bool libff::mnt4_G2::is_special |
( |
| ) |
const |
◆ is_well_formed()
bool libff::mnt4_G2::is_well_formed |
( |
| ) |
const |
◆ is_zero()
bool libff::mnt4_G2::is_zero |
( |
| ) |
const |
◆ mixed_add()
Definition at line 317 of file mnt4_g2.cpp.
319 #ifdef PROFILE_OP_COUNTS
330 if (other.is_zero()) {
335 assert(other.is_special());
341 const mnt4_Fq2 X2Z1 = (this->
Z) * (other.X);
348 const mnt4_Fq2 Y2Z1 = (this->
Z) * (other.Y);
350 if (X1Z2 == X2Z1 && Y1Z2 == Y2Z1) {
367 const mnt4_Fq2 A = uu * this->
Z - vvv - R - R;
371 const mnt4_Fq2 Y3 = u * (R - A) - vvv * this->Y;
◆ mul_by_a()
◆ mul_by_b()
◆ mul_by_cofactor()
mnt4_G2 libff::mnt4_G2::mul_by_cofactor |
( |
| ) |
const |
◆ mul_by_q()
mnt4_G2 libff::mnt4_G2::mul_by_q |
( |
| ) |
const |
Definition at line 421 of file mnt4_g2.cpp.
426 (this->
Z).Frobenius_map(1));
◆ one()
const mnt4_G2 & libff::mnt4_G2::one |
( |
| ) |
|
|
static |
◆ operator!=()
bool libff::mnt4_G2::operator!= |
( |
const mnt4_G2 & |
other | ) |
const |
◆ operator+()
Definition at line 152 of file mnt4_g2.cpp.
159 if (other.is_zero()) {
181 const mnt4_Fq2 X1Z2 = (this->
X) * (other.Z);
183 const mnt4_Fq2 X2Z1 = (this->
Z) * (other.X);
188 const mnt4_Fq2 Y1Z2 = (this->
Y) * (other.Z);
190 const mnt4_Fq2 Y2Z1 = (this->
Z) * (other.Y);
192 if (X1Z2 == X2Z1 && Y1Z2 == Y2Z1) {
214 const mnt4_Fq2 h = w.squared() - (B + B);
218 const mnt4_Fq2 Y3 = w * (B -
h) - (RR + RR);
227 const mnt4_Fq2 Z1Z2 = (this->
Z) * (other.Z);
241 const mnt4_Fq2 A = uu * Z1Z2 - (vvv + R + R);
245 const mnt4_Fq2 Y3 = u * (R - A) - vvv * Y1Z2;
◆ operator-() [1/2]
mnt4_G2 libff::mnt4_G2::operator- |
( |
| ) |
const |
◆ operator-() [2/2]
Definition at line 257 of file mnt4_g2.cpp.
259 return (*
this) + (-other);
◆ operator==()
bool libff::mnt4_G2::operator== |
( |
const mnt4_G2 & |
other | ) |
const |
Definition at line 122 of file mnt4_g2.cpp.
125 return other.is_zero();
128 if (other.is_zero()) {
135 if ((this->
X * other.Z) != (other.X * this->Z)) {
140 if ((this->
Y * other.Z) != (other.Y * this->Z)) {
◆ order()
◆ print()
void libff::mnt4_G2::print |
( |
| ) |
const |
Definition at line 54 of file mnt4_g2.cpp.
60 copy.to_affine_coordinates();
62 "(%Nd*z + %Nd , %Nd*z + %Nd)\n",
63 copy.X.coeffs[1].as_bigint().data,
65 copy.X.coeffs[0].as_bigint().data,
67 copy.Y.coeffs[1].as_bigint().data,
69 copy.Y.coeffs[0].as_bigint().data,
◆ print_coordinates()
void libff::mnt4_G2::print_coordinates |
( |
| ) |
const |
Definition at line 74 of file mnt4_g2.cpp.
80 "(%Nd*z + %Nd : %Nd*z + %Nd : %Nd*z + %Nd)\n",
83 this->X.coeffs[0].as_bigint().data,
85 this->Y.coeffs[1].as_bigint().data,
87 this->Y.coeffs[0].as_bigint().data,
89 this->Z.coeffs[1].as_bigint().data,
91 this->Z.coeffs[0].as_bigint().data,
◆ random_element()
mnt4_G2 libff::mnt4_G2::random_element |
( |
| ) |
|
|
static |
◆ read_compressed()
void libff::mnt4_G2::read_compressed |
( |
std::istream & |
in, |
|
|
mnt4_G2 & |
g |
|
) |
| |
|
static |
Definition at line 505 of file mnt4_g2.cpp.
517 in.read((
char *)&Y_lsb, 1);
526 if ((tY.coeffs[0].as_bigint().data[0] & 1) != Y_lsb) {
◆ read_uncompressed()
void libff::mnt4_G2::read_uncompressed |
( |
std::istream & |
in, |
|
|
mnt4_G2 & |
g |
|
) |
| |
|
static |
◆ size_in_bits()
static size_t libff::mnt4_G2::size_in_bits |
( |
| ) |
|
|
inlinestatic |
◆ to_affine_coordinates()
void libff::mnt4_G2::to_affine_coordinates |
( |
| ) |
|
◆ to_special()
void libff::mnt4_G2::to_special |
( |
| ) |
|
◆ write_compressed()
void libff::mnt4_G2::write_compressed |
( |
std::ostream & |
out | ) |
const |
Definition at line 477 of file mnt4_g2.cpp.
480 copy.to_affine_coordinates();
485 << (copy.Y.coeffs[0].as_bigint().data[0] & 1);
◆ write_uncompressed()
void libff::mnt4_G2::write_uncompressed |
( |
std::ostream & |
out | ) |
const |
Definition at line 468 of file mnt4_g2.cpp.
471 copy.to_affine_coordinates();
◆ zero()
const mnt4_G2 & libff::mnt4_G2::zero |
( |
| ) |
|
|
static |
◆ coeff_a
◆ coeff_b
◆ fixed_base_exp_window_table
std::vector< size_t > libff::mnt4_G2::fixed_base_exp_window_table |
|
static |
◆ G2_one
◆ G2_zero
◆ h_bitcount
const mp_size_t libff::mnt4_G2::h_bitcount = 298 |
|
static |
◆ h_limbs
const mp_size_t libff::mnt4_G2::h_limbs |
|
static |
◆ twist
◆ wnaf_window_table
std::vector< size_t > libff::mnt4_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/mnt4/mnt4_g2.hpp
- /home/runner/work/libff/libff/libff/algebra/curves/mnt/mnt4/mnt4_g2.cpp
mnt4_Fq mnt4_twist_mul_by_b_c1
mnt4_Fq2 mnt4_twist_coeff_b
mnt4_Fq mnt4_twist_mul_by_a_c1
static Fp_model< n, modulus > random_element()
returns random element of Fp_model
static const mp_size_t h_bitcount
static const Fp2_model< n, modulus > & one()
static bigint< h_limbs > h
static size_t size_in_bits()
mnt4_Fq2 mnt4_twist_coeff_a
mnt4_Fq mnt4_twist_mul_by_q_X
Fp2_model inverse() const
void to_affine_coordinates()
void consume_OUTPUT_SEPARATOR(std::istream &in)
static const mp_size_t num_limbs
Fp2_model< mnt4_q_limbs, mnt4_modulus_q > mnt4_Fq2
static const bigint< n > & field_char()
bigint< n > as_bigint() const
mnt4_Fq mnt4_twist_mul_by_b_c0
static const mnt4_G2 & one()
mnt4_Fq mnt4_twist_mul_by_q_Y
Fp2_model squared() const
default is squared_complex
static mnt4_Fq2 mul_by_a(const mnt4_Fq2 &elt)
static const constexpr bigint< n > & mod
bool operator==(const mnt4_G2 &other) const
Fp2_model sqrt() const
HAS TO BE A SQUARE (else does not terminate)
mnt4_Fq mnt4_twist_mul_by_a_c0
static const Fp2_model< n, modulus > & zero()
static const mnt4_G2 & zero()