dsa_botan.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_DSA_BOTAN_HPP
27 #define CRYPTO3_ALGEBRA_FIELDS_DSA_BOTAN_HPP
28 
30 
33 
35 
36 namespace nil {
37  namespace crypto3 {
38  namespace algebra {
39  namespace fields {
40 
45  template<std::size_t Version>
46  struct dsa_botan : public field<Version> { };
47 
48  template<>
49  struct dsa_botan<2048> : public field<2048> {
51 
52  constexpr static const std::size_t modulus_bits = policy_type::modulus_bits;
54 
56 
57  constexpr static const std::size_t number_bits = policy_type::number_bits;
58 
59  constexpr static const integral_type modulus =
60  0x91C48A4FDFBCF7C02AE95E7DA126122B5DD2864F559B87E8E74A286D52F59BD1DE68DFD645D0E00C60C080031891980374EEB594A532BFD67B9A09EAC4B8663A07910E68F39465FB7040D25DF13932EBAC4347A530ECBA61C854F9B880D3C0C3660080587C45566DADE26BD5A394BE093B4C0F24B5AFFEF8EC6C5B3E57FB89025A9BC16769932131E16D3C94EFCAB18D0DF061203CC53E6103BC72D5594BFD40CA65380F44A9A851DCB075495FC033A8A58071A1BD78FE052F66555648EB4B719D2AFE8B4880F8DAD6F15818BA178F89274C870BE9B96EB08C46C40040CC2EFE1DFB1B1868DD319DE3C34A32A63AB6EB1224209A419680CC7902D1728D4DF9E1_cppui2048;
61 
63  constexpr static const modular_params_type modulus_params = modulus;
64  typedef nil::crypto3::multiprecision::number<
65  nil::crypto3::multiprecision::backends::modular_adaptor<modular_backend, nil::crypto3::multiprecision::backends::modular_params_ct<modular_backend, modulus_params>>>
67 
69 
70  constexpr static const std::size_t value_bits = modulus_bits;
71  constexpr static const std::size_t arity = 1;
72  };
73 
74  template<>
75  struct dsa_botan<3072> : public field<3072> {
77 
78  constexpr static const std::size_t modulus_bits = policy_type::modulus_bits;
80 
81  constexpr static const integral_type modulus =
82  0xE4B50880759663585E142460CA2D9DFF132F8AE4C840DDA3A2666889124FE5638B84E8A29B7AF3FA1209BE6BFC4B5072ED3B2B7387BAF3F857F478A80228EF3600B76B3DCFB61D20D34465B2506D2CAF87DF6E7DC0CE91BD2D167A46F6ADCC31C531E4F9C7ABBDB92ADDF35B0A806C66292A5F5E17E964DD099903733AC428AB35D80EA6F685BFBA8BE4068E5418AE5ECAD9E8FF073DE2B63E4E7EAD35C8A9B70B5BD47CFB88D373B66F37931939B0AB71BD5595809086DA0155337D185A0E4FB36A519B1B6202B8591E6002449CF1CD3A66384F6D2073B1CD73BECA93BAF1E1A6117D0238F222AE1ED7FED185A890E7F67FAB8FEB9753CC134A5183DFE87AE2595F7B5C2D9FBB42249FDD59513E1D3396B3EB2FD86684F285A8448FE757A029881C40760B94EF919BDF9740C38389599EC51A6E9BB519A8E068491E9CE0A2FCFE3CB60D66CF0DFAD20A8EC684048684A61444575BD1724D7352B44A760077B3BD6BD385CE5B0A7250CC0BF768DA82923806EB9CFBB138843731B618208C759B_cppui3072;
83 
85 
86  constexpr static const std::size_t value_bits = modulus_bits;
87  constexpr static const std::size_t arity = 1;
88  };
89 
92  } // namespace fields
93  } // namespace algebra
94  } // namespace crypto3
95 } // namespace nil
96 
97 #endif // CRYPTO3_ALGEBRA_FIELDS_DSA_BOTAN_HPP
Definition: pair.hpp:31
detail::element_fp< params< dsa_botan< modulus_bits > > > value_type
Definition: dsa_botan.hpp:68
policy_type::extended_integral_type extended_integral_type
Definition: dsa_botan.hpp:55
policy_type::integral_type integral_type
Definition: dsa_botan.hpp:53
nil::crypto3::multiprecision::number< nil::crypto3::multiprecision::backends::modular_adaptor< modular_backend, nil::crypto3::multiprecision::backends::modular_params_ct< modular_backend, modulus_params > > > modular_type
Definition: dsa_botan.hpp:66
field< 2048 > policy_type
Definition: dsa_botan.hpp:50
policy_type::modular_backend modular_backend
Definition: dsa_botan.hpp:62
field< 3072 > policy_type
Definition: dsa_botan.hpp:76
policy_type::integral_type integral_type
Definition: dsa_botan.hpp:79
detail::element_fp< params< dsa_botan< modulus_bits > > > value_type
Definition: dsa_botan.hpp:84
DSA group.
Definition: dsa_botan.hpp:46
Definition: field.hpp:47
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
nil::crypto3::multiprecision::modular_params< modular_backend > modular_params_type
Definition: field.hpp:72
constexpr static const std::size_t modulus_bits
Definition: field.hpp:49
nil::crypto3::multiprecision::backends::cpp_int_backend< modulus_bits, modulus_bits, nil::crypto3::multiprecision::signed_magnitude, nil::crypto3::multiprecision::unchecked, void > modular_backend
Definition: field.hpp:66
nil::crypto3::multiprecision::number< nil::crypto3::multiprecision::backends::cpp_int_backend< 16 *modulus_bits, 16 *modulus_bits, nil::crypto3::multiprecision::unsigned_magnitude, nil::crypto3::multiprecision::unchecked, void > > extended_integral_type
Definition: field.hpp:60
constexpr static const std::size_t number_bits
Definition: field.hpp:62