fp2.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_FIELDS_FP2_EXTENSION_HPP
27 #define CRYPTO3_ALGEBRA_FIELDS_FP2_EXTENSION_HPP
28 
33 /*#include <nil/crypto3/algebra/fields/detail/extension_params/frp_v1.hpp>
34 #include <nil/crypto3/algebra/fields/detail/extension_params/gost_A.hpp>*/
36 /*#include <nil/crypto3/algebra/fields/detail/extension_params/secp.hpp>
37 #include <nil/crypto3/algebra/fields/detail/extension_params/sm2p_v1.hpp>
38 #include <nil/crypto3/algebra/fields/detail/extension_params/x962_p.hpp>*/
39 
41 
42 namespace nil {
43  namespace crypto3 {
44  namespace algebra {
45  namespace fields {
46 
51  template<typename BaseField>
52  struct fp2 {
53  typedef BaseField base_field_type;
56  typedef typename extension_policy::underlying_field_type underlying_field_type;
57 
58  constexpr static const std::size_t modulus_bits = policy_type::modulus_bits;
59  typedef typename policy_type::integral_type integral_type;
60 
61  typedef typename policy_type::extended_integral_type extended_integral_type;
62 
63  constexpr static const std::size_t number_bits = policy_type::number_bits;
64  typedef typename policy_type::modular_type modular_type;
65  typedef typename policy_type::modular_backend modular_backend;
66 
67  constexpr static const integral_type modulus = policy_type::modulus;
68 
70 
71  constexpr static const std::size_t arity = 2;
72  constexpr static const std::size_t value_bits = arity * modulus_bits;
73  };
74 
75  template<typename BaseField>
77 
78  template<typename BaseField>
79  constexpr typename std::size_t const fp2<BaseField>::arity;
80 
81  } // namespace fields
82  } // namespace algebra
83  } // namespace crypto3
84 } // namespace nil
85 
86 #endif // CRYPTO3_ALGEBRA_FIELDS_FP2_EXTENSION_HPP
Definition: detail/element/fp2.hpp:39
Definition: pair.hpp:31
Definition: detail/extension_params/alt_bn128/fp2.hpp:44
constexpr static const std::size_t modulus_bits
Definition: fp2.hpp:58
extension_policy::underlying_field_type underlying_field_type
Definition: fp2.hpp:56
base_field_type policy_type
Definition: fp2.hpp:54
policy_type::extended_integral_type extended_integral_type
Definition: fp2.hpp:61
constexpr static const std::size_t number_bits
Definition: fp2.hpp:63
constexpr static const integral_type modulus
Definition: fp2.hpp:67
constexpr static const std::size_t arity
Definition: fp2.hpp:71
detail::fp2_extension_params< policy_type > extension_policy
Definition: fp2.hpp:55
policy_type::integral_type integral_type
Definition: fp2.hpp:59
detail::element_fp2< extension_policy > value_type
Definition: fp2.hpp:69
policy_type::modular_type modular_type
Definition: fp2.hpp:64
BaseField base_field_type
Definition: fp2.hpp:53
policy_type::modular_backend modular_backend
Definition: fp2.hpp:65
constexpr static const std::size_t value_bits
Definition: fp2.hpp:72