hash/include/nil/crypto3/hash/detail/md4/md4_policy.hpp
Go to the documentation of this file.
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2018-2020 Mikhail Komarov <nemo@nil.foundation>
3 // Copyright (c) 2020 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_HASH_DETAIL_MD4_POLICY_HPP
27 #define CRYPTO3_HASH_DETAIL_MD4_POLICY_HPP
28 
30 
31 #include <nil/crypto3/detail/static_digest.hpp>
32 
33 namespace nil {
34  namespace crypto3 {
35  namespace hashes {
36  namespace detail {
37  struct md4_policy {
39 
40  constexpr static const std::size_t word_bits = block_cipher_type::word_bits;
42 
43  constexpr static const std::size_t state_bits = block_cipher_type::block_bits;
44  constexpr static const std::size_t state_words = block_cipher_type::block_words;
46 
47  constexpr static const std::size_t block_bits = block_cipher_type::key_bits;
48  constexpr static const std::size_t block_words = block_cipher_type::key_words;
50 
51  constexpr static const std::size_t length_bits = word_bits * 2;
52 
54 
55  constexpr static const std::size_t digest_bits = state_bits;
57 
58  struct iv_generator {
59  state_type const &operator()() const {
60  static state_type const H0 = {{0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476}};
61  return H0;
62  }
63  };
64  };
65 
66  } // namespace detail
67  } // namespace hashes
68  } // namespace crypto3
69 } // namespace nil
70 
71 #endif // CRYPTO3_HASH_DETAIL_MD4_POLICY_HPP
MD4 block cipher. Stands as a foundation for MD4 hashes.
Definition: block/include/nil/crypto3/block/md4.hpp:57
policy_type::key_type key_type
Definition: block/include/nil/crypto3/block/md4.hpp:68
policy_type::word_type word_type
Definition: block/include/nil/crypto3/block/md4.hpp:64
policy_type::block_type block_type
Definition: block/include/nil/crypto3/block/md4.hpp:72
constexpr static const std::size_t block_words
Definition: block/include/nil/crypto3/block/md4.hpp:71
constexpr static const std::size_t block_bits
Definition: block/include/nil/crypto3/block/md4.hpp:70
constexpr static const std::size_t word_bits
Definition: block/include/nil/crypto3/block/md4.hpp:63
constexpr static const std::size_t key_bits
Definition: block/include/nil/crypto3/block/md4.hpp:66
constexpr static const std::size_t key_words
Definition: block/include/nil/crypto3/block/md4.hpp:67
Definition: block/include/nil/crypto3/detail/static_digest.hpp:72
Definition: pair.hpp:31
Definition: hash/include/nil/crypto3/hash/detail/md4/md4_policy.hpp:58
state_type const & operator()() const
Definition: hash/include/nil/crypto3/hash/detail/md4/md4_policy.hpp:59
Definition: hash/include/nil/crypto3/hash/detail/md4/md4_policy.hpp:37
block::md4 block_cipher_type
Definition: hash/include/nil/crypto3/hash/detail/md4/md4_policy.hpp:38
block_cipher_type::key_type block_type
Definition: hash/include/nil/crypto3/hash/detail/md4/md4_policy.hpp:49
constexpr static const std::size_t state_words
Definition: hash/include/nil/crypto3/hash/detail/md4/md4_policy.hpp:44
constexpr static const std::size_t digest_bits
Definition: hash/include/nil/crypto3/hash/detail/md4/md4_policy.hpp:55
block_cipher_type::word_type word_type
Definition: hash/include/nil/crypto3/hash/detail/md4/md4_policy.hpp:41
stream_endian::little_octet_big_bit digest_endian
Definition: hash/include/nil/crypto3/hash/detail/md4/md4_policy.hpp:53
constexpr static const std::size_t length_bits
Definition: hash/include/nil/crypto3/hash/detail/md4/md4_policy.hpp:51
constexpr static const std::size_t word_bits
Definition: hash/include/nil/crypto3/hash/detail/md4/md4_policy.hpp:40
constexpr static const std::size_t block_bits
Definition: hash/include/nil/crypto3/hash/detail/md4/md4_policy.hpp:47
block_cipher_type::block_type state_type
Definition: hash/include/nil/crypto3/hash/detail/md4/md4_policy.hpp:45
constexpr static const std::size_t state_bits
Definition: hash/include/nil/crypto3/hash/detail/md4/md4_policy.hpp:43
constexpr static const std::size_t block_words
Definition: hash/include/nil/crypto3/hash/detail/md4/md4_policy.hpp:48
static_digest< digest_bits > digest_type
Definition: hash/include/nil/crypto3/hash/detail/md4/md4_policy.hpp:56
Definition: algebra/include/nil/crypto3/detail/stream_endian.hpp:45