detail/extension_params/bls12/fp6_3over2.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_BLS12_FP6_3OVER2_EXTENSION_PARAMS_HPP
27 #define CRYPTO3_ALGEBRA_FIELDS_BLS12_FP6_3OVER2_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>
42  struct fp6_3over2_extension_params;
43 
44  /************************* BLS12-381 ***********************************/
45 
46  template<>
47  class fp6_3over2_extension_params<fields::bls12<381>> : public params<fields::bls12<381>> {
48 
51 
52  public:
54 
55  constexpr static const integral_type modulus = policy_type::modulus;
56 
61  // typedef element_fp2<fp2_extension_params<field_type>> underlying_type;
62 
63  /*constexpr static const std::array<non_residue_type, 6> Frobenius_coeffs_c1 =
64  {non_residue_type(0x01, 0x00), non_residue_type(0x00,
65  0x1A0111EA397FE699EC02408663D4DE85AA0D857D89759AD4897D29650FB85F9B409427EB4F49FFFD8BFD00000000AAAC_cppui381),
66  non_residue_type(0x5F19672FDF76CE51BA69C6076A0F77EADDB3A93BE6F89688DE17D813620A00022E01FFFFFFFEFFFE_cppui319,
67  0x00), non_residue_type(0x00, 0x01),
68  non_residue_type(0x1A0111EA397FE699EC02408663D4DE85AA0D857D89759AD4897D29650FB85F9B409427EB4F49FFFD8BFD00000000AAAC_cppui381,
69  0x00), non_residue_type(0x00,
70  0x5F19672FDF76CE51BA69C6076A0F77EADDB3A93BE6F89688DE17D813620A00022E01FFFFFFFEFFFE_cppui319)};
71 
72  constexpr static const std::array<non_residue_type, 6> Frobenius_coeffs_c2 =
73  {non_residue_type(0x01, 0x00),
74  non_residue_type(0x1A0111EA397FE699EC02408663D4DE85AA0D857D89759AD4897D29650FB85F9B409427EB4F49FFFD8BFD00000000AAAD_cppui381,
75  0x00),
76  non_residue_type(0x1A0111EA397FE699EC02408663D4DE85AA0D857D89759AD4897D29650FB85F9B409427EB4F49FFFD8BFD00000000AAAC_cppui381,
77  0x00),
78  non_residue_type(0x1A0111EA397FE69A4B1BA7B6434BACD764774B84F38512BF6730D2A0F6B0F6241EABFFFEB153FFFFB9FEFFFFFFFFAAAA_cppui381,
79  0x00),
80  non_residue_type(0x5F19672FDF76CE51BA69C6076A0F77EADDB3A93BE6F89688DE17D813620A00022E01FFFFFFFEFFFE_cppui319,
81  0x00),
82  non_residue_type(0x5F19672FDF76CE51BA69C6076A0F77EADDB3A93BE6F89688DE17D813620A00022E01FFFFFFFEFFFF_cppui319,
83  0x00)};*/
84 
85  constexpr static const std::array<integral_type, 6 * 2> Frobenius_coeffs_c1 = {
86  0x01,
87  0x00,
88  0x00,
89  0x1A0111EA397FE699EC02408663D4DE85AA0D857D89759AD4897D29650FB85F9B409427EB4F49FFFD8BFD00000000AAAC_cppui381,
90  0x5F19672FDF76CE51BA69C6076A0F77EADDB3A93BE6F89688DE17D813620A00022E01FFFFFFFEFFFE_cppui319,
91  0x00,
92  0x00,
93  0x01,
94  0x1A0111EA397FE699EC02408663D4DE85AA0D857D89759AD4897D29650FB85F9B409427EB4F49FFFD8BFD00000000AAAC_cppui381,
95  0x00,
96  0x00,
97  0x5F19672FDF76CE51BA69C6076A0F77EADDB3A93BE6F89688DE17D813620A00022E01FFFFFFFEFFFE_cppui319};
98 
99  constexpr static const std::array<integral_type, 6 * 2> Frobenius_coeffs_c2 = {
100  0x01,
101  0x00,
102  0x1A0111EA397FE699EC02408663D4DE85AA0D857D89759AD4897D29650FB85F9B409427EB4F49FFFD8BFD00000000AAAD_cppui381,
103  0x00,
104  0x1A0111EA397FE699EC02408663D4DE85AA0D857D89759AD4897D29650FB85F9B409427EB4F49FFFD8BFD00000000AAAC_cppui381,
105  0x00,
106  0x1A0111EA397FE69A4B1BA7B6434BACD764774B84F38512BF6730D2A0F6B0F6241EABFFFEB153FFFFB9FEFFFFFFFFAAAA_cppui381,
107  0x00,
108  0x5F19672FDF76CE51BA69C6076A0F77EADDB3A93BE6F89688DE17D813620A00022E01FFFFFFFEFFFE_cppui319,
109  0x00,
110  0x5F19672FDF76CE51BA69C6076A0F77EADDB3A93BE6F89688DE17D813620A00022E01FFFFFFFEFFFF_cppui319,
111  0x00};
112 
113  constexpr static const non_residue_type non_residue = non_residue_type(0x01, 0x01);
114  };
115 
116  /************************* BLS12-377 ***********************************/
117 
118  template<>
119  class fp6_3over2_extension_params<fields::bls12<377>> : public params<fields::bls12<377>> {
120 
123 
124  public:
126 
127  constexpr static const integral_type modulus = policy_type::modulus;
128 
133  // typedef element_fp2<fp2_extension_params<field_type>> underlying_type;
134 
135  /*constexpr static const std::array<non_residue_type, 6> Frobenius_coeffs_c1 =
136  {non_residue_type(0x01, 0x00),
137  non_residue_type(0x9B3AF05DD14F6EC619AAF7D34594AABC5ED1347970DEC00452217CC900000008508C00000000002_cppui316,
138  0x00),
139  non_residue_type(0x9B3AF05DD14F6EC619AAF7D34594AABC5ED1347970DEC00452217CC900000008508C00000000001_cppui316,
140  0x00),
141  non_residue_type(0x1AE3A4617C510EAC63B05C06CA1493B1A22D9F300F5138F1EF3622FBA094800170B5D44300000008508C00000000000_cppui377,
142  0x00),
143  non_residue_type(0x1AE3A4617C510EABC8756BA8F8C524EB8882A75CC9BC8E359064EE822FB5BFFD1E945779FFFFFFFFFFFFFFFFFFFFFFF_cppui377,
144  0x00),
145  non_residue_type(0x1AE3A4617C510EABC8756BA8F8C524EB8882A75CC9BC8E359064EE822FB5BFFD1E94577A00000000000000000000000_cppui377,
146  0x00)};
147 
148  constexpr static const std::array<non_residue_type, 6> Frobenius_coeffs_c2 =
149  {non_residue_type(0x01, 0x00),
150  non_residue_type(0x9B3AF05DD14F6EC619AAF7D34594AABC5ED1347970DEC00452217CC900000008508C00000000001_cppui316,
151  0x00),
152  non_residue_type(0x1AE3A4617C510EABC8756BA8F8C524EB8882A75CC9BC8E359064EE822FB5BFFD1E945779FFFFFFFFFFFFFFFFFFFFFFF_cppui377,
153  0x00), non_residue_type(0x01, 0x00),
154  non_residue_type(0x9B3AF05DD14F6EC619AAF7D34594AABC5ED1347970DEC00452217CC900000008508C00000000001_cppui316,
155  0x00),
156  non_residue_type(0x1AE3A4617C510EABC8756BA8F8C524EB8882A75CC9BC8E359064EE822FB5BFFD1E945779FFFFFFFFFFFFFFFFFFFFFFF_cppui377,
157  0x00)};*/
158 
159  constexpr static const std::array<integral_type, 6 * 2> Frobenius_coeffs_c1 = {
160  0x01,
161  0x00,
162  0x9B3AF05DD14F6EC619AAF7D34594AABC5ED1347970DEC00452217CC900000008508C00000000002_cppui316,
163  0x00,
164  0x9B3AF05DD14F6EC619AAF7D34594AABC5ED1347970DEC00452217CC900000008508C00000000001_cppui316,
165  0x00,
166  0x1AE3A4617C510EAC63B05C06CA1493B1A22D9F300F5138F1EF3622FBA094800170B5D44300000008508C00000000000_cppui377,
167  0x00,
168  0x1AE3A4617C510EABC8756BA8F8C524EB8882A75CC9BC8E359064EE822FB5BFFD1E945779FFFFFFFFFFFFFFFFFFFFFFF_cppui377,
169  0x00,
170  0x1AE3A4617C510EABC8756BA8F8C524EB8882A75CC9BC8E359064EE822FB5BFFD1E94577A00000000000000000000000_cppui377,
171  0x00};
172 
173  constexpr static const std::array<integral_type, 6 * 2> Frobenius_coeffs_c2 = {
174  0x01,
175  0x00,
176  0x9B3AF05DD14F6EC619AAF7D34594AABC5ED1347970DEC00452217CC900000008508C00000000001_cppui316,
177  0x00,
178  0x1AE3A4617C510EABC8756BA8F8C524EB8882A75CC9BC8E359064EE822FB5BFFD1E945779FFFFFFFFFFFFFFFFFFFFFFF_cppui377,
179  0x00,
180  0x01,
181  0x00,
182  0x9B3AF05DD14F6EC619AAF7D34594AABC5ED1347970DEC00452217CC900000008508C00000000001_cppui316,
183  0x00,
184  0x1AE3A4617C510EABC8756BA8F8C524EB8882A75CC9BC8E359064EE822FB5BFFD1E945779FFFFFFFFFFFFFFFFFFFFFFF_cppui377,
185  0x00};
186 
187  constexpr static const non_residue_type non_residue = non_residue_type(0x00, 0x01);
188  };
189 
190  constexpr typename fp6_3over2_extension_params<bls12_base_field<381>>::non_residue_type const
192  constexpr typename fp6_3over2_extension_params<bls12_base_field<377>>::non_residue_type const
194 
195  constexpr std::array<typename fp6_3over2_extension_params<bls12_base_field<381>>::integral_type,
196  6 * 2> const
198  constexpr std::array<typename fp6_3over2_extension_params<bls12_base_field<381>>::integral_type,
199  6 * 2> const
201 
202  constexpr std::array<typename fp6_3over2_extension_params<bls12_base_field<377>>::integral_type,
203  6 * 2> const
205  constexpr std::array<typename fp6_3over2_extension_params<bls12_base_field<377>>::integral_type,
206  6 * 2> const
208 
209  } // namespace detail
210  } // namespace fields
211  } // namespace algebra
212  } // namespace crypto3
213 } // namespace nil
214 
215 #endif // CRYPTO3_ALGEBRA_FIELDS_BLS12_FP6_3OVER2_EXTENSION_PARAMS_HPP
Definition: detail/element/fp2.hpp:39
fields::fp2< base_field_type > underlying_field_type
Definition: detail/extension_params/bls12/fp6_3over2.hpp:131
policy_type::integral_type integral_type
Definition: detail/extension_params/bls12/fp6_3over2.hpp:125
underlying_field_type::value_type underlying_type
Definition: detail/extension_params/bls12/fp6_3over2.hpp:132
fields::fp2< base_field_type > non_residue_field_type
Definition: detail/extension_params/bls12/fp6_3over2.hpp:129
non_residue_field_type::value_type non_residue_type
Definition: detail/extension_params/bls12/fp6_3over2.hpp:130
underlying_field_type::value_type underlying_type
Definition: detail/extension_params/bls12/fp6_3over2.hpp:60
policy_type::integral_type integral_type
Definition: detail/extension_params/bls12/fp6_3over2.hpp:53
non_residue_field_type::value_type non_residue_type
Definition: detail/extension_params/bls12/fp6_3over2.hpp:58
fields::fp2< base_field_type > underlying_field_type
Definition: detail/extension_params/bls12/fp6_3over2.hpp:59
fields::fp2< base_field_type > non_residue_field_type
Definition: detail/extension_params/bls12/fp6_3over2.hpp:57
Definition: pair.hpp:31
IETF IPsec groups.
Definition: bls12/base_field.hpp:46
Definition: detail/extension_params/alt_bn128/fp6_3over2.hpp:42
Definition: fields/params.hpp:35
field_type::integral_type integral_type
Definition: fields/params.hpp:42