mnt6/298/short_weierstrass_params.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_CURVES_MNT6_298_SHORT_WEIERSTRASS_PARAMS_HPP
27 #define CRYPTO3_ALGEBRA_CURVES_MNT6_298_SHORT_WEIERSTRASS_PARAMS_HPP
28 
31 
33 
34 namespace nil {
35  namespace crypto3 {
36  namespace algebra {
37  namespace curves {
38  namespace detail {
39 
40  template<>
41  struct mnt6_params<298, forms::short_weierstrass> {
42 
45 
46  constexpr static const typename mnt6_types<298>::integral_type a =
48  0x0B);
49  constexpr static const typename mnt6_types<298>::integral_type b =
51  0xD68C7B1DC5DD042E957B71C44D3D6C24E683FC09B420B1A2D263FDE47DDBA59463D0C65282_cppui296);
52  };
53 
54  template<>
55  struct mnt6_g1_params<298, forms::short_weierstrass>
56  : public mnt6_params<298, forms::short_weierstrass> {
57 
59 
60  template<typename Coordinates>
62 
63  constexpr static const std::array<typename field_type::value_type, 3> zero_fill = {
64  field_type::value_type::zero(), field_type::value_type::one()};
65 
66  constexpr static const std::array<typename field_type::value_type, 3> one_fill = {
67  typename field_type::value_type(
68  0x2A4FEEE24FD2C69D1D90471B2BA61ED56F9BAD79B57E0B4C671392584BDADEBC01ABBC0447D_cppui298),
69  typename field_type::value_type(
70  0x32986C245F6DB2F82F4E037BF7AFD69CBFCBFF07FC25D71E9C75E1B97208A333D73D91D3028_cppui298)};
71  };
72 
73  template<>
74  struct mnt6_g2_params<298, forms::short_weierstrass>
75  : public mnt6_params<298, forms::short_weierstrass> {
76 
78 
79  template<typename Coordinates>
81 
82  private:
83  using g1_field_type = typename mnt6_types<298>::g1_field_type;
84 
85  constexpr static const typename g1_field_type::value_type g1_a = g1_field_type::value_type(a);
86  constexpr static const typename g1_field_type::value_type g1_b = g1_field_type::value_type(b);
87 
88  public:
89  constexpr static const typename field_type::value_type a =
90  typename field_type::value_type(g1_field_type::value_type::zero(),
91  g1_field_type::value_type::zero(),
92  g1_a);
93 
94  constexpr static const typename field_type::value_type b =
95  typename field_type::value_type(g1_b * field_type::value_type::non_residue,
96  g1_field_type::value_type::zero(),
97  g1_field_type::value_type::zero());
98 
99  constexpr static const std::array<typename field_type::value_type, 3> zero_fill = {
100  field_type::value_type::zero(), field_type::value_type::one()};
101 
102  constexpr static const std::array<typename field_type::value_type, 3> one_fill = {
103  typename field_type::value_type(
104  0x34F7320A12B56CE532BCCB3B44902CBAA723CD60035ADA7404B743AD2E644AD76257E4C6813_cppui298,
105  0xCF41620BAA52EEC50E61A70AB5B45F681952E0109340FEC84F1B2890ABA9B15CAC5A0C80FA_cppui296,
106  0x11F99170E10E326433CCCB8032FB48007CA3C4E105CF31B056AC767E2CB01258391BD4917CE_cppui297),
107  typename field_type::value_type(
108  0x3A65968F03CC64D62AD05C79C415E07EBD38B363EC48309487C0B83E1717A582C1B60FECC91_cppui298,
109  0xCA5E8427E5DB1506C1A24CEFC2451AB3ACCAEA5DB82DCB0C7117CC74402FAA5B2C37685C6E_cppui296,
110  0xF75D2DD88302C9A4EF941307629A1B3E197277D83ABB715F647C2E55A27BAF782F5C60E7F7_cppui296)};
111  };
112 
113  constexpr
115  constexpr
117 
118  constexpr typename mnt6_g2_params<298, forms::short_weierstrass>::field_type::value_type const
120  constexpr typename mnt6_g2_params<298, forms::short_weierstrass>::field_type::value_type const
122 
123  constexpr std::array<typename mnt6_g1_params<298, forms::short_weierstrass>::field_type::value_type,
125  constexpr std::array<typename mnt6_g1_params<298, forms::short_weierstrass>::field_type::value_type,
127 
128  constexpr std::array<typename mnt6_g2_params<298, forms::short_weierstrass>::field_type::value_type,
130  constexpr std::array<typename mnt6_g2_params<298, forms::short_weierstrass>::field_type::value_type,
132 
133  } // namespace detail
134  } // namespace curves
135  } // namespace algebra
136  } // namespace crypto3
137 } // namespace nil
138 
139 #endif // CRYPTO3_ALGEBRA_CURVES_MNT6_298_SHORT_WEIERSTRASS_PARAMS_HPP
Definition: pair.hpp:31
constexpr static const std::array< typename field_type::value_type, 3 > zero_fill
Definition: mnt6/298/short_weierstrass_params.hpp:63
typename mnt6_types< 298 >::g1_field_type field_type
Definition: mnt6/298/short_weierstrass_params.hpp:58
mnt6_types< 298 >::g1_type< forms::short_weierstrass, Coordinates > group_type
Definition: mnt6/298/short_weierstrass_params.hpp:61
constexpr static const std::array< typename field_type::value_type, 3 > one_fill
Definition: mnt6/298/short_weierstrass_params.hpp:66
Definition: curves/detail/mnt6/types.hpp:51
constexpr static const field_type::value_type b
Definition: mnt6/298/short_weierstrass_params.hpp:94
constexpr static const field_type::value_type a
Definition: mnt6/298/short_weierstrass_params.hpp:89
mnt6_types< 298 >::g2_type< forms::short_weierstrass, Coordinates > group_type
Definition: mnt6/298/short_weierstrass_params.hpp:80
typename mnt6_types< 298 >::g2_field_type field_type
Definition: mnt6/298/short_weierstrass_params.hpp:77
constexpr static const std::array< typename field_type::value_type, 3 > one_fill
Definition: mnt6/298/short_weierstrass_params.hpp:102
constexpr static const std::array< typename field_type::value_type, 3 > zero_fill
Definition: mnt6/298/short_weierstrass_params.hpp:99
Definition: curves/detail/mnt6/types.hpp:54
typename mnt6_types< 298 >::scalar_field_type scalar_field_type
Definition: mnt6/298/short_weierstrass_params.hpp:44
constexpr static const mnt6_types< 298 >::integral_type a
coefficient of short Weierstrass curve $y^2=x^3+a*x+b$
Definition: mnt6/298/short_weierstrass_params.hpp:46
typename mnt6_types< 298 >::base_field_type base_field_type
Definition: mnt6/298/short_weierstrass_params.hpp:43
constexpr static const mnt6_types< 298 >::integral_type b
coefficient of short Weierstrass curve $y^2=x^3+a*x+b$
Definition: mnt6/298/short_weierstrass_params.hpp:49
Definition: curves/detail/mnt6/types.hpp:48
A struct representing details about base and scalar fields.
Definition: curves/detail/mnt6/types.hpp:61
typename base_field_type::integral_type integral_type
Definition: curves/detail/mnt6/types.hpp:69
Definition: forms.hpp:34