algebra/include/nil/crypto3/algebra/fields/arithmetic_params/mnt4.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_ARITHMETIC_PARAMS_HPP
27 #define CRYPTO3_ALGEBRA_FIELDS_MNT4_ARITHMETIC_PARAMS_HPP
28 
31 
35 
37 
38 namespace nil {
39  namespace crypto3 {
40  namespace algebra {
41  namespace fields {
42 
43  template<>
44  struct arithmetic_params<mnt4_base_field<298>> : public params<mnt4_base_field<298>> {
45  private:
47 
48  public:
52 
53  constexpr static const std::size_t s = 0x11;
54  constexpr static const integral_type t =
55  0x1DE7BDE6A39D133124ED3D82A47657764B1AE89987520D4F1AF2890070964866B2D38B3_cppui281;
56  constexpr static const integral_type t_minus_1_over_2 =
57  0xEF3DEF351CE899892769EC1523B2BBB258D744CC3A906A78D794480384B24335969C59_cppui280;
58  constexpr static const integral_type arithmetic_generator = 0x01;
59  constexpr static const integral_type geometric_generator = 0x02;
60  constexpr static const integral_type multiplicative_generator = 0x11;
61  constexpr static const integral_type root_of_unity =
62  0x214431121152176339675F00F9D465A3C037F18735DB28205F2A5F57D155F151CEC101EEC43_cppui298;
63  constexpr static const integral_type nqr = 0x11;
64  constexpr static const integral_type nqr_to_t =
65  0x214431121152176339675F00F9D465A3C037F18735DB28205F2A5F57D155F151CEC101EEC43_cppui298;
66  constexpr static const integral_type Rsquared =
67  0x224F0918A341F32E014AD38D47B66BD7673318850E1A266A1ADBF2BC8930065ACEC5613D220_cppui298;
68  constexpr static const integral_type Rcubed =
69  0x35B329C5C21DB492B899FB731B0626C4C908A5073171DE648C893BA7447A3FE093A2C77F995_cppui298;
70 
71  constexpr static const integral_type modulus = policy_type::modulus;
72  constexpr static const integral_type group_order =
73  0x1DE7BDE6A39D133124ED3D82A47657764B1AE89987520D4F1AF2890070964866B2D38B30000_cppui297;
74  };
75 
76  template<>
77  struct arithmetic_params<fp2<mnt4_base_field<298>>> : public params<mnt4_base_field<298>> {
78  private:
80 
81  public:
86 
87  constexpr static const std::size_t s = 0x12;
88  constexpr static const extended_integral_type t =
89  0x37E52CE842B39321A34D7BA62E2C735153C68D35F7A312CDB18451030CB297F3B772167A8487033D5772A0EF6BEA9BCA60190FFE1CDB642F88A0FF2EFF7A6A3A80FD00203385638B3_cppui578;
90  constexpr static const extended_integral_type t_minus_1_over_2 =
91  0x1BF296742159C990D1A6BDD3171639A8A9E3469AFBD18966D8C2288186594BF9DBB90B3D4243819EABB95077B5F54DE5300C87FF0E6DB217C4507F977FBD351D407E801019C2B1C59_cppui577;
92  constexpr static const std::array<integral_type, 2> nqr = {0x08, 0x01};
93  constexpr static const std::array<integral_type, 2> nqr_to_t = {
94  0x00, 0x3B1F45391287A9CB585B8E5504C24BF1EC2010553885078C85899ACD708205080134A9BE6A_cppui294};
95 
96  constexpr static const integral_type modulus = policy_type::modulus;
97  constexpr static const extended_integral_type group_order =
98  0x6FCA59D085672643469AF74C5C58E6A2A78D1A6BEF46259B6308A20619652FE76EE42CF5090E067AAEE541DED7D53794C0321FFC39B6C85F1141FE5DFEF4D47501FA0040670AC71660000_cppui595;
99  };
100 
101  constexpr std::size_t const arithmetic_params<mnt4_base_field<298>>::s;
102  constexpr std::size_t const arithmetic_params<fp2<mnt4_base_field<298>>>::s;
103 
104  constexpr typename arithmetic_params<mnt4_base_field<298>>::integral_type const
106  constexpr typename arithmetic_params<fp2<mnt4_base_field<298>>>::extended_integral_type const
108 
109  constexpr typename arithmetic_params<mnt4_base_field<298>>::integral_type const
110  arithmetic_params<mnt4_base_field<298>>::t_minus_1_over_2;
111  constexpr typename arithmetic_params<fp2<mnt4_base_field<298>>>::extended_integral_type const
112  arithmetic_params<fp2<mnt4_base_field<298>>>::t_minus_1_over_2;
113 
114  constexpr typename arithmetic_params<mnt4_base_field<298>>::integral_type const
115  arithmetic_params<mnt4_base_field<298>>::arithmetic_generator;
116 
117  constexpr typename arithmetic_params<mnt4_base_field<298>>::integral_type const
118  arithmetic_params<mnt4_base_field<298>>::geometric_generator;
119 
120  constexpr typename arithmetic_params<mnt4_base_field<298>>::integral_type const
121  arithmetic_params<mnt4_base_field<298>>::multiplicative_generator;
122 
123  constexpr typename arithmetic_params<mnt4_base_field<298>>::integral_type const
125 
126  constexpr typename arithmetic_params<mnt4_base_field<298>>::integral_type const
128  constexpr std::array<typename arithmetic_params<fp2<mnt4_base_field<298>>>::integral_type, 2> const
130 
131  constexpr typename arithmetic_params<mnt4_base_field<298>>::integral_type const
133  constexpr std::array<typename arithmetic_params<fp2<mnt4_base_field<298>>>::integral_type, 2> const
135 
136  constexpr typename arithmetic_params<mnt4_base_field<298>>::integral_type const
138 
139  constexpr typename arithmetic_params<mnt4_base_field<298>>::integral_type const
141 
142  constexpr typename arithmetic_params<mnt4_base_field<298>>::integral_type const
144  constexpr typename arithmetic_params<fp2<mnt4_base_field<298>>>::integral_type const
146 
147  constexpr typename arithmetic_params<mnt4_base_field<298>>::integral_type const
149  constexpr typename arithmetic_params<fp2<mnt4_base_field<298>>>::extended_integral_type const
151 
152  } // namespace fields
153  } // namespace algebra
154  } // namespace crypto3
155 } // namespace nil
156 
157 #endif // CRYPTO3_ALGEBRA_FIELDS_MNT4_ARITHMETIC_PARAMS_HPP
Definition: pair.hpp:31
policy_type::extended_integral_type extended_integral_type
Definition: algebra/include/nil/crypto3/algebra/fields/arithmetic_params/mnt4.hpp:85
policy_type::integral_type integral_type
Definition: algebra/include/nil/crypto3/algebra/fields/arithmetic_params/mnt4.hpp:84
policy_type::modular_type modular_type
Definition: algebra/include/nil/crypto3/algebra/fields/arithmetic_params/mnt4.hpp:82
policy_type::modular_backend modular_backend
Definition: algebra/include/nil/crypto3/algebra/fields/arithmetic_params/mnt4.hpp:83
policy_type::modular_type modular_type
Definition: algebra/include/nil/crypto3/algebra/fields/arithmetic_params/mnt4.hpp:49
policy_type::integral_type integral_type
Definition: algebra/include/nil/crypto3/algebra/fields/arithmetic_params/mnt4.hpp:51
policy_type::modular_backend modular_backend
Definition: algebra/include/nil/crypto3/algebra/fields/arithmetic_params/mnt4.hpp:50
Definition: fields/params.hpp:58
IETF IPsec groups.
Definition: mnt4/base_field.hpp:46
Definition: fields/params.hpp:35
field_type::modular_backend modular_backend
Definition: fields/params.hpp:38
field_type::integral_type integral_type
Definition: fields/params.hpp:42
field_type::modular_type modular_type
Definition: fields/params.hpp:37
field_type::extended_integral_type extended_integral_type
Definition: fields/params.hpp:44