detail/extension_params/mnt4/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_MNT4_FP4_EXTENSION_PARAMS_HPP
27 #define CRYPTO3_ALGEBRA_FIELDS_MNT4_FP4_EXTENSION_PARAMS_HPP
28 
32 
34 
35 namespace nil {
36  namespace crypto3 {
37  namespace algebra {
38  namespace fields {
39  namespace detail {
40 
41  template<typename BaseField>
43 
44  /************************* MNT4 ***********************************/
45 
46  template<std::size_t Version>
47  class fp4_extension_params<fields::mnt4_base_field<Version>>
48  : public params<fields::mnt4_base_field<Version>> {
49 
52 
53  public:
55 
56  constexpr static const integral_type modulus = policy_type::modulus;
57 
59  typedef typename non_residue_field_type::value_type non_residue_type;
62  // typedef element_fp2<fp2_extension_params<field_type>> underlying_type;
63 
64  /*constexpr static const std::array<non_residue_type, 4> Frobenius_coeffs_c1 =
65  {non_residue_type(0x01),
66  non_residue_type(0xF73779FE09916DFDCC2FD1F968D534BEB17DAF7518CD9FAE5C1F7BDCF94DD5D7DEF6980C4_cppui292),
67  non_residue_type(0x3BCF7BCD473A266249DA7B0548ECAEEC9635D1330EA41A9E35E51200E12C90CD65A71660000_cppui298),
68  non_residue_type(0x3AD84453493094F44C0E4B334F83D9B7D7845383998B4CFE8788F285043342F78DC81FC7F3D_cppui298)};*/
69 
70  constexpr static const std::array<integral_type, 4> Frobenius_coeffs_c1 = {
71  0x01, 0xF73779FE09916DFDCC2FD1F968D534BEB17DAF7518CD9FAE5C1F7BDCF94DD5D7DEF6980C4_cppui292,
72  0x3BCF7BCD473A266249DA7B0548ECAEEC9635D1330EA41A9E35E51200E12C90CD65A71660000_cppui298,
73  0x3AD84453493094F44C0E4B334F83D9B7D7845383998B4CFE8788F285043342F78DC81FC7F3D_cppui298};
74 
75  constexpr static const non_residue_type non_residue = non_residue_type(0x11);
76  };
77 
78  template<std::size_t Version>
79  constexpr typename fp4_extension_params<mnt4_base_field<Version>>::non_residue_type const
81 
82  template<std::size_t Version>
83  constexpr typename fp4_extension_params<mnt4_base_field<Version>>::integral_type const
85 
86  template<std::size_t Version>
87  constexpr std::array<typename fp4_extension_params<mnt4_base_field<Version>>::integral_type,
88  4> const fp4_extension_params<mnt4_base_field<Version>>::Frobenius_coeffs_c1;
89 
90  } // namespace detail
91  } // namespace fields
92  } // namespace algebra
93  } // namespace crypto3
94 } // namespace nil
95 
96 #endif // CRYPTO3_ALGEBRA_FIELDS_MNT4_FP4_EXTENSION_PARAMS_HPP
Definition: detail/element/fp2.hpp:39
underlying_field_type::value_type underlying_type
Definition: detail/extension_params/mnt4/fp4.hpp:61
base_field_type non_residue_field_type
Definition: detail/extension_params/mnt4/fp4.hpp:58
non_residue_field_type::value_type non_residue_type
Definition: detail/extension_params/mnt4/fp4.hpp:59
policy_type::integral_type integral_type
Definition: detail/extension_params/mnt4/fp4.hpp:54
fields::fp2< base_field_type > underlying_field_type
Definition: detail/extension_params/mnt4/fp4.hpp:60
Definition: pair.hpp:31
Definition: detail/extension_params/mnt4/fp4.hpp:42
IETF IPsec groups.
Definition: mnt4/base_field.hpp:46
Definition: fields/params.hpp:35
field_type::integral_type integral_type
Definition: fields/params.hpp:42