algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.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_EDWARDS_BASIC_POLICY_HPP
27 #define CRYPTO3_ALGEBRA_CURVES_EDWARDS_BASIC_POLICY_HPP
28 
31 
34 
36 
37 namespace nil {
38  namespace crypto3 {
39  namespace algebra {
40  namespace curves {
41  namespace detail {
42 
43  using namespace algebra;
48  template<std::size_t Version = 183>
54  template<>
55  struct edwards_basic_policy<183> {
56  constexpr static const std::size_t version = 183;
61 
62  typedef typename base_field_type::integral_type integral_type;
63  typedef typename base_field_type::extended_integral_type extended_integral_type;
64 
65  constexpr static const integral_type base_field_modulus =
66  base_field_type::modulus;
67 
69  constexpr static const integral_type scalar_field_modulus =
70  scalar_field_type::modulus;
72 
73  constexpr static const integral_type p =
74  base_field_modulus;
75  constexpr static const integral_type q =
76  scalar_field_modulus;
78 
79  constexpr static const integral_type a =
80  0x01;
81  constexpr static const integral_type d =
82  0x64536D55979879327CF1306BB5A6277D254EF9776CE70_cppui179;
85  constexpr static const std::array<typename g1_field_type::value_type, 3> g1_zero_fill = {
86  g1_field_type::value_type::one(), g1_field_type::value_type::zero(),
87  g1_field_type::value_type::zero()};
88 
89  constexpr static const std::array<typename g1_field_type::value_type, 3> g1_one_fill = {
90  typename g1_field_type::value_type(
91  0x32d83d8aaa0c500f57b15fda90b1ad111067f812c7dd27_cppui182),
92  typename g1_field_type::value_type(
93  0x26c5df4587aa6a5d345efc9f2d47f8b1656517ef618f7a_cppui182),
94  typename g1_field_type::value_type(
95  0x3c6395f7eeafc1d930f0234a46e4a4806b953f0c3374ac_cppui182)};
96 
97  constexpr static const std::array<typename g2_field_type::value_type, 3> g2_zero_fill = {
98  g2_field_type::value_type::one(), g2_field_type::value_type::zero(),
99  g2_field_type::value_type::zero()};
100 
101  constexpr static const std::array<typename g2_field_type::value_type, 3> g2_one_fill = {
102  typename g2_field_type::value_type(
103  0x3CE954C85AD30F53B1BB4C4F87029780F4141927FEB19_cppui178,
104  0x2214EB976DE3A4D9DF9C8D5F7AEDFEC337E03A20B32FFF_cppui182,
105  0x249774AB0EDC7FE2E665DDBFE08594F3071E0B3AC994C3_cppui182),
106  typename g2_field_type::value_type(
107  0x2F501F9482C0D0D6E80AC55A79FD4D4594CAF187952660_cppui182,
108  0x37BF8F1B1CDA11A81E8BB8F41B5FF462C9A13DC7DE1578_cppui182,
109  0x2962F0DA0C7928B2CFBBACE3D0354652B6922A764C12D8_cppui182),
110  typename g2_field_type::value_type(
111  0x3b6ad5c355d8b231b16e97b5c6f635357993efdc248101_cppui182,
112  0x2e8b3daf5fa18f9d9c6fa2ca0603fd0c9b09eeece8fd0d_cppui182,
113  0x3c3baf061e62a04a4e9d1db335b8779c70384ae2933a73_cppui182)};
114  };
115 
116  constexpr typename edwards_basic_policy<183>::integral_type const
118  constexpr typename edwards_basic_policy<183>::integral_type const
120 
123 
126 
127  constexpr std::array<typename edwards_basic_policy<183>::g1_field_type::value_type, 3> const
129  constexpr std::array<typename edwards_basic_policy<183>::g1_field_type::value_type, 3> const
131  constexpr std::array<typename edwards_basic_policy<183>::g2_field_type::value_type, 3> const
133  constexpr std::array<typename edwards_basic_policy<183>::g2_field_type::value_type, 3> const
135 
136  } // namespace detail
137  } // namespace curves
138  } // namespace algebra
139  } // namespace crypto3
140 } // namespace nil
141 
142 #endif // CRYPTO3_ALGEBRA_CURVES_EDWARDS_BASIC_POLICY_HPP
Definition: detail/element/fp3.hpp:39
Definition: pair.hpp:31
constexpr static const std::array< typename g2_field_type::value_type, 3 > g2_zero_fill
Definition: algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.hpp:97
constexpr static const std::array< typename g1_field_type::value_type, 3 > g1_one_fill
Definition: algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.hpp:89
constexpr static const integral_type q
Definition: algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.hpp:75
base_field_type::extended_integral_type extended_integral_type
Definition: algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.hpp:63
fields::edwards_fr< version > scalar_field_type
Definition: algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.hpp:68
fields::fp6_2over3< base_field_type > gt_field_type
Definition: algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.hpp:60
constexpr static const integral_type d
Definition: algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.hpp:81
constexpr static const integral_type base_field_modulus
characteristic of the base field
Definition: algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.hpp:65
constexpr static const integral_type scalar_field_modulus
Definition: algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.hpp:69
base_field_type::integral_type integral_type
Definition: algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.hpp:62
constexpr static const std::array< typename g1_field_type::value_type, 3 > g1_zero_fill
Definition: algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.hpp:85
constexpr static const std::array< typename g2_field_type::value_type, 3 > g2_one_fill
Definition: algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.hpp:101
constexpr static const integral_type p
characteristic of the base field
Definition: algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.hpp:73
fields::edwards_fq< version > g1_field_type
Definition: algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.hpp:57
g1_field_type base_field_type
Definition: algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.hpp:58
fields::fp3< base_field_type > g2_field_type
Definition: algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.hpp:59
constexpr static const integral_type a
coefficient of short Weierstrass curve $y^2=x^3+a*x+b$
Definition: algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.hpp:79
A struct representing details about base and scalar fields.
Definition: algebra/include/nil/crypto3/algebra/curves/detail/edwards/basic_policy.hpp:49
IETF IPsec groups.
Definition: edwards/base_field.hpp:46
IETF IPsec groups.
Definition: edwards/scalar_field.hpp:46
Definition: fp6_2over3.hpp:50