5#ifndef DIGESTPP_PROVIDERS_WHIRLPOOL_HPP
6#define DIGESTPP_PROVIDERS_WHIRLPOOL_HPP
19namespace whirlpool_functions
22 static inline uint64_t
G(
const uint64_t* ll)
53 memset(&h[0], 0,
sizeof(uint64_t)*8);
56 inline void update(
const unsigned char* data,
size_t len)
59 [
this](
const unsigned char* data,
size_t len) { transform(data, len); });
62 inline void final(
unsigned char*
hash)
70 memset(&m[pos], 0, 64 - pos);
71 transform(m.data(), 1);
74 memset(&m[pos], 0, 56 - pos);
75 memcpy(&m[64 - 8], &mlen, 64 / 8);
76 transform(m.data(), 1);
89 inline void transform(
const unsigned char* mp,
size_t num_blks)
91 for (uint64_t b = 0; b < num_blks; b++)
93 uint64_t K[8], state[8];
95 memcpy(K, h.data(),
sizeof(K));
96 for (
int i = 0; i < 8; ++i)
97 state[i] = h[i] ^ (
reinterpret_cast<const uint64_t*
>(mp)[i]);
99 for (
int r = 0; r < 10; ++r)
112 memcpy(K, L,
sizeof(L));
123 memcpy(state, L,
sizeof(L));
126 for (
int i = 0; i < 8; ++i)
127 h[i] ^= state[i] ^
reinterpret_cast<const uint64_t*
>(mp)[i];
132 std::array<uint64_t, 8> h;
133 std::array<unsigned char, 64> m;
Definition whirlpool_provider.hpp:36
whirlpool_provider()
Definition whirlpool_provider.hpp:40
size_t hash_size() const
Definition whirlpool_provider.hpp:86
void clear()
Definition whirlpool_provider.hpp:80
void init()
Definition whirlpool_provider.hpp:49
~whirlpool_provider()
Definition whirlpool_provider.hpp:44
void update(const unsigned char *data, size_t len)
Definition whirlpool_provider.hpp:56
static uint64_t G(const uint64_t *ll)
Definition whirlpool_provider.hpp:22
uint16_t byteswap(uint16_t val)
Definition functions.hpp:16
void zero_memory(void *v, size_t n)
Definition functions.hpp:85
void absorb_bytes(const unsigned char *data, size_t len, size_t bs, size_t bschk, unsigned char *m, size_t &pos, T &total, TF transform)
Definition absorb_data.hpp:16
digestpp namespace
Definition ascon.hpp:14
Definition whirlpool_constants.hpp:16