pairing/detail/mnt6/298/params.hpp
Go to the documentation of this file.
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2020-2021 Mikhail Komarov <nemo@nil.foundation>
3 // Copyright (c) 2020-2021 Nikita Kaskov <nbering@nil.foundation>
4 //
5 // MIT License
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a copy
8 // of this software and associated documentation files (the "Software"), to deal
9 // in the Software without restriction, including without limitation the rights
10 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 // copies of the Software, and to permit persons to whom the Software is
12 // furnished to do so, subject to the following conditions:
13 //
14 // The above copyright notice and this permission notice shall be included in all
15 // copies or substantial portions of the Software.
16 //
17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 // SOFTWARE.
24 //---------------------------------------------------------------------------//
25 
26 #ifndef CRYPTO3_ALGEBRA_PAIRING_MNT6_298_PAIRING_PARAMS_HPP
27 #define CRYPTO3_ALGEBRA_PAIRING_MNT6_298_PAIRING_PARAMS_HPP
28 
30 
31 namespace nil {
32  namespace crypto3 {
33  namespace algebra {
34  namespace pairing {
35  namespace detail {
36 
37  template<typename CurveType>
38  class pairing_params;
39 
40  template<>
41  class pairing_params<curves::mnt6<298>> {
43 
44  public:
45  using integral_type = typename curve_type::base_field_type::integral_type;
46  using extended_integral_type = typename curve_type::base_field_type::extended_integral_type;
47 
48  constexpr static const std::size_t integral_type_max_bits =
49  curve_type::base_field_type::modulus_bits;
50 
51  constexpr static const integral_type ate_loop_count =
52  0x1EEF5546609756BEC2A33F0DC9A1B671660000_cppui149;
53  constexpr static const bool ate_is_loop_count_neg = true;
54  constexpr static const extended_integral_type final_exponent = extended_integral_type(
55  0x2D9F068E10293574745C62CB0EE7CF1D27F98BA7E8F16BB1CB498038B1B0B4D7EA28C42575093726D5E360818F2DD5B39038CFF6405359561DD2F2F0627F9264724E069A7198C17873F7F54D8C7CE3D5DAED1AC5E87C26C03B1F481813BB668B6FEDC7C2AAA83936D8BC842F74C66E7A13921F7D91474B3981D3A3B3B40537720C84FE27E3E90BB29DB12DFFE17A286C150EF5071B3087765F9454046ECBDD3B014FF91A1C18D55DB868E841DBF82BCCEFB4233833BD800000000_cppui1490);
56 
57  constexpr static const integral_type final_exponent_last_chunk_abs_of_w0 =
58  0x1EEF5546609756BEC2A33F0DC9A1B671660000_cppui149; // same as ate_loop_count?
59  constexpr static const bool final_exponent_last_chunk_is_w0_neg = true;
60  constexpr static const integral_type final_exponent_last_chunk_w1 = integral_type(0x1);
61 
62  using g2_field_type_value = typename curve_type::template g2_type<>::field_type::value_type;
63 
64  constexpr static const g2_field_type_value twist =
65  g2_field_type_value(g2_field_type_value::underlying_type::zero(),
66  g2_field_type_value::underlying_type::one(),
67  g2_field_type_value::underlying_type::zero());
68 
69  constexpr static const g2_field_type_value twist_coeff_a =
70  curve_type::template g2_type<>::params_type::a;
71  constexpr static const g2_field_type_value twist_coeff_b =
72  curve_type::template g2_type<>::params_type::b;
73  };
74 
75  constexpr typename pairing_params<curves::mnt6<298>>::integral_type const
76  pairing_params<curves::mnt6<298>>::ate_loop_count;
77  constexpr typename pairing_params<curves::mnt6<298>>::integral_type const
78  pairing_params<curves::mnt6<298>>::final_exponent_last_chunk_abs_of_w0;
79  constexpr typename pairing_params<curves::mnt6<298>>::integral_type const
80  pairing_params<curves::mnt6<298>>::final_exponent_last_chunk_w1;
81  constexpr typename pairing_params<curves::mnt6<298>>::extended_integral_type const
82  pairing_params<curves::mnt6<298>>::final_exponent;
83 
84  constexpr typename pairing_params<curves::mnt6<298>>::g2_field_type_value const
86  constexpr typename pairing_params<curves::mnt6<298>>::g2_field_type_value const
87  pairing_params<curves::mnt6<298>>::twist_coeff_a;
88  constexpr typename pairing_params<curves::mnt6<298>>::g2_field_type_value const
89  pairing_params<curves::mnt6<298>>::twist_coeff_b;
90 
91  constexpr bool const pairing_params<curves::mnt6<298>>::ate_is_loop_count_neg;
92  constexpr bool const pairing_params<curves::mnt6<298>>::final_exponent_last_chunk_is_w0_neg;
93 
94  } // namespace detail
95  } // namespace pairing
96  } // namespace algebra
97  } // namespace crypto3
98 } // namespace nil
99 
100 #endif // CRYPTO3_ALGEBRA_PAIRING_MNT6_298_PAIRING_PARAMS_HPP
typename curve_type::base_field_type::extended_integral_type extended_integral_type
Definition: pairing/detail/mnt6/298/params.hpp:46
typename curve_type::base_field_type::integral_type integral_type
Definition: pairing/detail/mnt6/298/params.hpp:45
typename curve_type::template g2_type<>::field_type::value_type g2_field_type_value
Definition: pairing/detail/mnt6/298/params.hpp:62
Definition: pairing/detail/alt_bn128/params.hpp:38
mnt6_base_field< Version > mnt6
Definition: mnt6/base_field.hpp:86
Definition: pair.hpp:31
A struct representing a mnt6 curve.
Definition: algebra/include/nil/crypto3/algebra/curves/mnt6.hpp:46