26 #ifndef CRYPTO3_ALGEBRA_PAIRING_EDWARDS_183_FINAL_EXPONENTIATION_HPP
27 #define CRYPTO3_ALGEBRA_PAIRING_EDWARDS_183_FINAL_EXPONENTIATION_HPP
38 template<std::
size_t Version = 183>
51 static typename gt_type::value_type
52 final_exponentiation_last_chunk(
const typename gt_type::value_type &elt,
53 const typename gt_type::value_type &elt_inv) {
55 const typename gt_type::value_type elt_q = elt.Frobenius_map(1);
57 typename gt_type::value_type w1_part =
58 elt_q.cyclotomic_exp(params_type::final_exponent_last_chunk_w1);
59 typename gt_type::value_type w0_part = gt_type::value_type::zero();
61 if (params_type::final_exponent_last_chunk_is_w0_neg) {
62 w0_part = elt_inv.cyclotomic_exp(params_type::final_exponent_last_chunk_abs_of_w0);
64 w0_part = elt.cyclotomic_exp(params_type::final_exponent_last_chunk_abs_of_w0);
67 return w1_part * w0_part;
70 static typename gt_type::value_type
71 final_exponentiation_first_chunk(
const typename gt_type::value_type &elt,
72 const typename gt_type::value_type &elt_inv) {
77 const typename gt_type::value_type elt_q3 = elt.Frobenius_map(3);
79 const typename gt_type::value_type elt_q3_over_elt = elt_q3 * elt_inv;
81 const typename gt_type::value_type alpha = elt_q3_over_elt.Frobenius_map(1);
83 const typename gt_type::value_type beta = alpha * elt_q3_over_elt;
89 static typename gt_type::value_type
process(
const typename gt_type::value_type &elt) {
91 const typename gt_type::value_type elt_inv = elt.inversed();
92 const typename gt_type::value_type elt_to_first_chunk =
93 final_exponentiation_first_chunk(elt, elt_inv);
94 const typename gt_type::value_type elt_inv_to_first_chunk =
95 final_exponentiation_first_chunk(elt_inv, elt);
96 return final_exponentiation_last_chunk(elt_to_first_chunk, elt_inv_to_first_chunk);
Definition: pairing/detail/alt_bn128/params.hpp:38
Definition: pairing/detail/edwards/183/types.hpp:38
static gt_type::value_type process(const typename gt_type::value_type &elt)
Definition: algebra/include/nil/crypto3/algebra/pairing/edwards/183/final_exponentiation.hpp:89
Definition: algebra/include/nil/crypto3/algebra/pairing/edwards/183/final_exponentiation.hpp:39
A struct representing a Edwards curve, providing 128 bits of security.
Definition: curves/edwards.hpp:51
policy_type::gt_field_type gt_type
Definition: curves/edwards.hpp:69
IETF IPsec groups.
Definition: edwards/base_field.hpp:46