fp4.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_FP4_EXTENSION_HPP
27 #define CRYPTO3_ALGEBRA_FIELDS_FP4_EXTENSION_HPP
28 
30 //#include <nil/crypto3/algebra/fields/detail/extension_params/frp_v1.hpp>
31 //#include <nil/crypto3/algebra/fields/detail/extension_params/gost_A.hpp>
33 /*#include <nil/crypto3/algebra/fields/detail/extension_params/secp.hpp>
34 #include <nil/crypto3/algebra/fields/detail/extension_params/sm2p_v1.hpp>
35 #include <nil/crypto3/algebra/fields/detail/extension_params/x962_p.hpp>*/
36 
38 
39 namespace nil {
40  namespace crypto3 {
41  namespace algebra {
42  namespace fields {
43 
48  template<typename BaseField>
49  struct fp4 {
50  typedef BaseField base_field_type;
53  typedef typename extension_policy::underlying_field_type underlying_field_type;
54 
55  constexpr static const std::size_t modulus_bits = policy_type::modulus_bits;
56  typedef typename policy_type::integral_type integral_type;
57 
58  typedef typename policy_type::extended_integral_type extended_integral_type;
59 
60  constexpr static const std::size_t number_bits = policy_type::number_bits;
61  typedef typename policy_type::modular_type modular_type;
62  typedef typename policy_type::modular_backend modular_backend;
63 
64  constexpr static const integral_type modulus = policy_type::modulus;
65 
67 
68  constexpr static const std::size_t arity = 4;
69  constexpr static const std::size_t value_bits = arity * modulus_bits;
70  };
71 
72  template<typename BaseField>
74 
75  template<typename BaseField>
76  constexpr typename std::size_t const fp4<BaseField>::arity;
77 
78  } // namespace fields
79  } // namespace algebra
80  } // namespace crypto3
81 } // namespace nil
82 
83 #endif // CRYPTO3_ALGEBRA_FIELDS_FP4_EXTENSION_HPP
Definition: detail/element/fp4.hpp:41
Definition: pair.hpp:31
Definition: detail/extension_params/mnt4/fp4.hpp:42
policy_type::modular_type modular_type
Definition: fp4.hpp:61
policy_type::extended_integral_type extended_integral_type
Definition: fp4.hpp:58
policy_type::integral_type integral_type
Definition: fp4.hpp:56
constexpr static const std::size_t modulus_bits
Definition: fp4.hpp:55
constexpr static const integral_type modulus
Definition: fp4.hpp:64
constexpr static const std::size_t arity
Definition: fp4.hpp:68
BaseField base_field_type
Definition: fp4.hpp:50
detail::fp4_extension_params< policy_type > extension_policy
Definition: fp4.hpp:52
base_field_type policy_type
Definition: fp4.hpp:51
policy_type::modular_backend modular_backend
Definition: fp4.hpp:62
constexpr static const std::size_t value_bits
Definition: fp4.hpp:69
constexpr static const std::size_t number_bits
Definition: fp4.hpp:60
extension_policy::underlying_field_type underlying_field_type
Definition: fp4.hpp:53
detail::element_fp4< extension_policy > value_type
Definition: fp4.hpp:66