shacal_policy.hpp
Go to the documentation of this file.
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2018-2020 Mikhail Komarov <nemo@nil.foundation>
3 //
4 // MIT License
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in all
14 // copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 // SOFTWARE.
23 //---------------------------------------------------------------------------//
24 
25 #ifndef CRYPTO3_BLOCK_CIPHERS_DETAIL_SHACAL_POLICY_HPP
26 #define CRYPTO3_BLOCK_CIPHERS_DETAIL_SHACAL_POLICY_HPP
27 
28 #include <array>
29 
31 
32 namespace nil {
33  namespace crypto3 {
34  namespace block {
35  namespace detail {
36 
37  struct shacal_policy : public shacal_functions {
38 
39  constexpr static const std::size_t block_words = 5;
40  constexpr static const std::size_t block_bits = block_words * word_bits;
41  typedef std::array<word_type, block_words> block_type;
42 
43  constexpr static const std::size_t key_words = 16;
44  constexpr static const std::size_t key_bits = key_words * word_bits;
45  typedef std::array<word_type, key_words> key_type;
46 
47  static const std::size_t rounds = 80;
48  typedef std::array<word_type, rounds> schedule_type;
49  typedef std::array<word_type, rounds> constants_type;
50 
51  constexpr static constants_type const constants = {{
52  0x5a827999, 0x5a827999, 0x5a827999, 0x5a827999, 0x5a827999, 0x5a827999, 0x5a827999,
53  0x5a827999, 0x5a827999, 0x5a827999, 0x5a827999, 0x5a827999, 0x5a827999, 0x5a827999,
54  0x5a827999, 0x5a827999, 0x5a827999, 0x5a827999, 0x5a827999, 0x5a827999,
55 
56  0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1,
57  0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1,
58  0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1,
59 
60  0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc,
61  0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc,
62  0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc,
63 
64  0xca62c1d6, 0xca62c1d6, 0xca62c1d6, 0xca62c1d6, 0xca62c1d6, 0xca62c1d6, 0xca62c1d6,
65  0xca62c1d6, 0xca62c1d6, 0xca62c1d6, 0xca62c1d6, 0xca62c1d6, 0xca62c1d6, 0xca62c1d6,
66  0xca62c1d6, 0xca62c1d6, 0xca62c1d6, 0xca62c1d6, 0xca62c1d6, 0xca62c1d6,
67  }};
68  };
69 
71 
73 
74  } // namespace detail
75  } // namespace block
76  } // namespace crypto3
77 } // namespace nil
78 
79 #endif // CRYPTO3_BLOCK_CIPHERS_DETAIL_SHACAL_POLICY_HPP
boost::mpl::apply< AccumulatorSet, tag::block< Mode > >::type::result_type block(const AccumulatorSet &acc)
Definition: accumulators/block.hpp:259
shacal_policy shacal0_policy
Definition: shacal_policy.hpp:72
Definition: pair.hpp:31
Definition: shacal_functions.hpp:56
Definition: shacal_policy.hpp:37
std::array< word_type, block_words > block_type
Definition: shacal_policy.hpp:41
std::array< word_type, rounds > constants_type
Definition: shacal_policy.hpp:49
std::array< word_type, key_words > key_type
Definition: shacal_policy.hpp:45
std::array< word_type, rounds > schedule_type
Definition: shacal_policy.hpp:48
constexpr static const std::size_t block_words
Definition: shacal_policy.hpp:39
constexpr static const std::size_t block_bits
Definition: shacal_policy.hpp:40
constexpr static const std::size_t key_words
Definition: shacal_policy.hpp:43
static const std::size_t rounds
Definition: shacal_policy.hpp:47
constexpr static const std::size_t key_bits
Definition: shacal_policy.hpp:44
constexpr static constants_type const constants
Definition: shacal_policy.hpp:51
constexpr static const std::size_t word_bits
Definition: block/include/nil/crypto3/detail/basic_functions.hpp:41