curves/params/wnaf/bls12.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_BLS12_WNAF_PARAMS_HPP
27 #define CRYPTO3_ALGEBRA_CURVES_BLS12_WNAF_PARAMS_HPP
28 
30 
32 
33 namespace nil {
34  namespace crypto3 {
35  namespace algebra {
36  namespace curves {
37 
38  template<typename GroupType>
39  struct wnaf_params;
40 
41  /************************* BLS12-381 ***********************************/
42 
43  template<>
44  struct wnaf_params<typename bls12<381>::g1_type<>> {
45 
46  constexpr static const std::array<std::size_t, 4> wnaf_window_table = {11, 24, 60, 127};
47  };
48 
49  template<>
50  struct wnaf_params<typename bls12<381>::g2_type<>> {
51 
52  constexpr static const std::array<std::size_t, 4> wnaf_window_table = {5, 15, 39, 109};
53  };
54 
55  /************************* BLS12-377 ***********************************/
56 
57  template<>
58  struct wnaf_params<typename bls12<377>::g1_type<>> {
59 
60  constexpr static const std::array<std::size_t, 4> wnaf_window_table = {11, 24, 60, 127};
61  };
62 
63  template<>
64  struct wnaf_params<typename bls12<377>::g2_type<>> {
65 
66  constexpr static const std::array<std::size_t, 4> wnaf_window_table = {5, 15, 39, 109};
67  };
68 
69  /************************* BLS12-381 definitions ***********************************/
70 
71  constexpr std::array<std::size_t, 4> const
72  wnaf_params<typename bls12<381>::g1_type<>>::wnaf_window_table;
73  constexpr std::array<std::size_t, 4> const
74  wnaf_params<typename bls12<381>::g2_type<>>::wnaf_window_table;
75 
76  /************************* BLS12-377 definitions ***********************************/
77 
78  constexpr std::array<std::size_t, 4> const
79  wnaf_params<typename bls12<377>::g1_type<>>::wnaf_window_table;
80  constexpr std::array<std::size_t, 4> const
81  wnaf_params<typename bls12<377>::g2_type<>>::wnaf_window_table;
82 
83  } // namespace curves
84  } // namespace algebra
85  } // namespace crypto3
86 } // namespace nil
87 
88 #endif // CRYPTO3_ALGEBRA_CURVES_BLS12_WNAF_PARAMS_HPP
A struct representing a BLS12-381 and BLS12-377 curve.
Definition: curves/bls12.hpp:49
Definition: pair.hpp:31
Definition: curves/params/wnaf/alt_bn128.hpp:39