27 #ifndef CRYPTO3_MERKLE_DAMGARD_PADDING_HPP
28 #define CRYPTO3_MERKLE_DAMGARD_PADDING_HPP
30 #include <nil/crypto3/detail/inject.hpp>
31 #include <nil/crypto3/detail/pack.hpp>
32 #include <nil/crypto3/detail/octet.hpp>
38 template<
typename Hash>
40 typedef Hash policy_type;
42 typedef typename policy_type::digest_endian endian_type;
44 constexpr
static const std::size_t word_bits = policy_type::word_bits;
45 typedef typename policy_type::word_type word_type;
47 constexpr
static const std::size_t state_bits = policy_type::state_bits;
48 constexpr
static const std::size_t state_words = policy_type::state_words;
49 typedef typename policy_type::state_type state_type;
51 constexpr
static const std::size_t block_bits = policy_type::block_bits;
52 constexpr
static const std::size_t block_words = policy_type::block_words;
53 typedef typename policy_type::block_type block_type;
55 constexpr
static const std::size_t digest_bits = policy_type::digest_bits;
56 typedef typename policy_type::digest_type digest_type;
58 typedef ::nil::crypto3::detail::injector<endian_type, word_bits, block_words, block_bits>
65 block_type block_of_zeros;
66 std::size_t seen_copy = block_seen;
67 std::fill(block_of_zeros.begin(), block_of_zeros.end(), 0);
71 std::array<
octet_type, word_bits / octet_bits> bit_one = {{0x80}};
72 std::array<word_type, 1> bit_one_word {};
73 pack<stream_endian::big_octet_big_bit, endian_type, octet_bits, word_bits>(
74 bit_one.begin(), bit_one.end(), bit_one_word.begin());
Definition: merkle_damgard_padding.hpp:39
void operator()(block_type &block, std::size_t &block_seen)
Definition: merkle_damgard_padding.hpp:62
constexpr matrix< T, N, M > fill(T value)
generates a matrix containing a single value
Definition: matrix/utility.hpp:102
Definition: algebra/include/nil/crypto3/detail/make_array.hpp:33
boost::uint_t< octet_bits >::least octet_type
Definition: algebra/include/nil/crypto3/detail/octet.hpp:33
Definition: block/include/nil/crypto3/detail/inject.hpp:260
static void inject(const block_type &b_src, std::size_t b_src_seen, block_type &b_dst, std::size_t &b_dst_seen, std::size_t block_shift=0)
Definition: block/include/nil/crypto3/detail/inject.hpp:267