sm2p_v1.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_SM2P_V1_HPP
27 #define CRYPTO3_ALGEBRA_CURVES_SM2P_V1_HPP
28 
31 
33 
34 namespace nil {
35  namespace crypto3 {
36  namespace algebra {
37  namespace curves {
38 
39  template<std::size_t PBits>
40  struct sm2p_v1 { };
41 
42  template<>
43  struct sm2p_v1<256> {
44  constexpr static const std::size_t base_field_bits = 256;
47  constexpr static const integral_type base_field_modulus = base_field_type::modulus;
48 
49  constexpr static const std::size_t scalar_field_bits = 256;
51  constexpr static const integral_type scalar_field_modulus = scalar_field_type::modulus;
52 
53  constexpr static const integral_type p = base_field_modulus;
54  constexpr static const integral_type q = scalar_field_modulus;
55 
56  constexpr static const integral_type a =
57  0xFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC_cppui256;
58  constexpr static const integral_type b =
59  0x28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93_cppui256;
60  constexpr static const integral_type x =
61  0x32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7_cppui256;
62  constexpr static const integral_type y =
63  0xBC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0_cppui256;
64  };
65 
67  } // namespace curves
68  } // namespace algebra
69  } // namespace crypto3
70 } // namespace nil
71 
72 #endif // CRYPTO3_ALGEBRA_CURVES_SM2P_V1_HPP
sm2p_v1< 256 > sm2p256v1
Definition: sm2p_v1.hpp:66
Definition: pair.hpp:31
fields::sm2p_v1_fq< base_field_bits > base_field_type
Definition: sm2p_v1.hpp:45
fields::sm2p_v1_fr< scalar_field_bits > scalar_field_type
Definition: sm2p_v1.hpp:50
base_field_type::integral_type integral_type
Definition: sm2p_v1.hpp:46
Definition: sm2p_v1.hpp:40
nil::crypto3::multiprecision::number< nil::crypto3::multiprecision::backends::cpp_int_backend< modulus_bits, modulus_bits, nil::crypto3::multiprecision::unsigned_magnitude, nil::crypto3::multiprecision::unchecked, void > > integral_type
Definition: field.hpp:54
IETF IPsec groups.
Definition: sm2p_v1/base_field.hpp:46
IETF IPsec groups.
Definition: sm2p_v1/scalar_field.hpp:46