detail/extension_params/alt_bn128/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_ALT_BN128_FP6_3OVER2_EXTENSION_PARAMS_HPP
27 #define CRYPTO3_ALGEBRA_FIELDS_ALT_BN128_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>
43 
44  /************************* ALT_BN128 ***********************************/
45 
46  template<std::size_t Version>
47  class fp6_3over2_extension_params<fields::alt_bn128<Version>>
48  : public params<fields::alt_bn128<Version>> {
49 
52 
53  public:
55 
56  constexpr static const integral_type modulus = policy_type::modulus;
57 
62 
63  /*constexpr static const std::array<non_residue_type, 6> Frobenius_coeffs_c1 =
64  {non_residue_type(0x01, 0x00),
65  non_residue_type(0x2FB347984F7911F74C0BEC3CF559B143B78CC310C2C3330C99E39557176F553D_cppui254,
66  0x16C9E55061EBAE204BA4CC8BD75A079432AE2A1D0B7C9DCE1665D51C640FCBA2_cppui253),
67  non_residue_type(0x30644E72E131A0295E6DD9E7E0ACCCB0C28F069FBB966E3DE4BD44E5607CFD48_cppui254,
68  0x00),
69  non_residue_type(0x856E078B755EF0ABAFF1C77959F25AC805FFD3D5D6942D37B746EE87BDCFB6D_cppui252,
70  0x4F1DE41B3D1766FA9F30E6DEC26094F0FDF31BF98FF2631380CAB2BAAA586DE_cppui251),
71  non_residue_type(0x59E26BCEA0D48BACD4F263F1ACDB5C4F5763473177FFFFFE_cppui191, 0x00),
72  non_residue_type(0x28BE74D4BB943F51699582B87809D9CAF71614D4B0B71F3A62E913EE1DADA9E4_cppui254,
73  0x14A88AE0CB747B99C2B86ABCBE01477A54F40EB4C3F6068DEDAE0BCEC9C7AAC7_cppui253)};
74 
75  constexpr static const std::array<non_residue_type, 6> Frobenius_coeffs_c2 =
76  {non_residue_type(0x01, 0x00),
77  non_residue_type(0x5B54F5E64EEA80180F3C0B75A181E84D33365F7BE94EC72848A1F55921EA762_cppui251,
78  0x2C145EDBE7FD8AEE9F3A80B03B0B1C923685D2EA1BDEC763C13B4711CD2B8126_cppui254),
79  non_residue_type(0x59E26BCEA0D48BACD4F263F1ACDB5C4F5763473177FFFFFE_cppui191, 0x00),
80  non_residue_type(0xBC58C6611C08DAB19BEE0F7B5B2444EE633094575B06BCB0E1A92BC3CCBF066_cppui252,
81  0x23D5E999E1910A12FEB0F6EF0CD21D04A44A9E08737F96E55FE3ED9D730C239F_cppui254),
82  non_residue_type(0x30644E72E131A0295E6DD9E7E0ACCCB0C28F069FBB966E3DE4BD44E5607CFD48_cppui254,
83  0x00),
84  non_residue_type(0x1EE972AE6A826A7D1D9DA40771B6F589DE1AFB54342C724FA97BDA050992657F_cppui253,
85  0x10DE546FF8D4AB51D2B513CDBB25772454326430418536D15721E37E70C255C9_cppui253)};*/
86 
87  constexpr static const std::array<integral_type, 6 * 2> Frobenius_coeffs_c1 = {
88  0x01,
89  0x00,
90  0x2FB347984F7911F74C0BEC3CF559B143B78CC310C2C3330C99E39557176F553D_cppui254,
91  0x16C9E55061EBAE204BA4CC8BD75A079432AE2A1D0B7C9DCE1665D51C640FCBA2_cppui253,
92  0x30644E72E131A0295E6DD9E7E0ACCCB0C28F069FBB966E3DE4BD44E5607CFD48_cppui254,
93  0x00,
94  0x856E078B755EF0ABAFF1C77959F25AC805FFD3D5D6942D37B746EE87BDCFB6D_cppui252,
95  0x4F1DE41B3D1766FA9F30E6DEC26094F0FDF31BF98FF2631380CAB2BAAA586DE_cppui251,
96  0x59E26BCEA0D48BACD4F263F1ACDB5C4F5763473177FFFFFE_cppui191,
97  0x00,
98  0x28BE74D4BB943F51699582B87809D9CAF71614D4B0B71F3A62E913EE1DADA9E4_cppui254,
99  0x14A88AE0CB747B99C2B86ABCBE01477A54F40EB4C3F6068DEDAE0BCEC9C7AAC7_cppui253};
100 
101  constexpr static const std::array<integral_type, 6 * 2> Frobenius_coeffs_c2 = {
102  0x01,
103  0x00,
104  0x5B54F5E64EEA80180F3C0B75A181E84D33365F7BE94EC72848A1F55921EA762_cppui251,
105  0x2C145EDBE7FD8AEE9F3A80B03B0B1C923685D2EA1BDEC763C13B4711CD2B8126_cppui254,
106  0x59E26BCEA0D48BACD4F263F1ACDB5C4F5763473177FFFFFE_cppui191,
107  0x00,
108  0xBC58C6611C08DAB19BEE0F7B5B2444EE633094575B06BCB0E1A92BC3CCBF066_cppui252,
109  0x23D5E999E1910A12FEB0F6EF0CD21D04A44A9E08737F96E55FE3ED9D730C239F_cppui254,
110  0x30644E72E131A0295E6DD9E7E0ACCCB0C28F069FBB966E3DE4BD44E5607CFD48_cppui254,
111  0x00,
112  0x1EE972AE6A826A7D1D9DA40771B6F589DE1AFB54342C724FA97BDA050992657F_cppui253,
113  0x10DE546FF8D4AB51D2B513CDBB25772454326430418536D15721E37E70C255C9_cppui253};
114 
115  constexpr static const non_residue_type non_residue = non_residue_type(0x09, 0x01);
116  };
117 
118  template<std::size_t Version>
119  constexpr
120  typename fp6_3over2_extension_params<alt_bn128_base_field<Version>>::non_residue_type const
122 
123  template<std::size_t Version>
124  constexpr std::array<
125  typename fp6_3over2_extension_params<alt_bn128_base_field<Version>>::integral_type, 6 * 2> const
127  template<std::size_t Version>
128  constexpr std::array<
129  typename fp6_3over2_extension_params<alt_bn128_base_field<Version>>::integral_type, 6 * 2> const
130 
132  } // namespace detail
133  } // namespace fields
134  } // namespace algebra
135  } // namespace crypto3
136 } // namespace nil
137 
138 #endif // CRYPTO3_ALGEBRA_FIELDS_ALT_BN128_FP6_3OVER2_EXTENSION_PARAMS_HPP
Definition: detail/element/fp2.hpp:39
non_residue_field_type::value_type non_residue_type
Definition: detail/extension_params/alt_bn128/fp6_3over2.hpp:59
underlying_field_type::value_type underlying_type
Definition: detail/extension_params/alt_bn128/fp6_3over2.hpp:61
fields::fp2< base_field_type > underlying_field_type
Definition: detail/extension_params/alt_bn128/fp6_3over2.hpp:60
policy_type::integral_type integral_type
Definition: detail/extension_params/alt_bn128/fp6_3over2.hpp:54
fields::fp2< base_field_type > non_residue_field_type
Definition: detail/extension_params/alt_bn128/fp6_3over2.hpp:58
Definition: pair.hpp:31
IETF IPsec groups.
Definition: alt_bn128/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