24 #ifndef INC_WHIRLPOOL_HPP_6E1F0061_4A5D_41A1_A6BE_82379C71A72D
25 #define INC_WHIRLPOOL_HPP_6E1F0061_4A5D_41A1_A6BE_82379C71A72D
60 #define WHIRLPOOL_DIGESTBYTES 64
61 #define WHIRLPOOL_DIGESTBITS (8*WHIRLPOOL_DIGESTBYTES)
62 #define WHIRLPOOL_DIGESTQUADWORDS (WHIRLPOOL_DIGESTBYTES/8)
64 #define WHIRLPOOL_WBLOCKBYTES 64
65 #define WHIRLPOOL_WBLOCKBITS (8*WHIRLPOOL_WBLOCKBYTES)
67 #define WHIRLPOOL_LENGTHBYTES 32
68 #define WHIRLPOOL_LENGTHBITS (8*WHIRLPOOL_LENGTHBYTES)
77 static const uint64_t
C0[];
78 static const uint64_t
C1[];
79 static const uint64_t
C2[];
80 static const uint64_t
C3[];
81 static const uint64_t
C4[];
82 static const uint64_t
C5[];
83 static const uint64_t
C6[];
84 static const uint64_t
C7[];
87 static const unsigned int R;
88 static const uint64_t
rc[];
99 void reset()
override;
128 void update(
const uint8_t* buf,
size_t len)
override;
137 void finish(uint8_t*
const result);
190 return ChecksumAlgoId::Whirlpool;
Add some utilities to Checksum class.
Computes a hash from a byte stream.
Computes a checksum from a byte stream.
Computes the Whirlpool hash from a byte stream.
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the hash algorithm.
static const unsigned int R
The number of rounds of the internal dedicated block cipher.
int bufferBits
Current number of bits on the buffer.
uint8_t bitLength[WHIRLPOOL_LENGTHBYTES]
Global number of hashed bits (256-bit counter).
size_t getSize() const override
Returns the minimal size to allocate in memory to store the hash with the getValue(buffer) method.
void update(const uint8_t *buf, size_t len) override
Updates the Whirlpool hash with specified array of bytes.
static const uint64_t rc[]
Table used to compute the Whirlpool hash.
static const uint64_t C0[]
Table used to compute the Whirlpool hash.
static const uint64_t C5[]
Table used to compute the Whirlpool hash.
Whirlpool()
Default constructor.
uint8_t buffer[WHIRLPOOL_WBLOCKBYTES]
Buffer of data to hash.
uint8_t * getValue(uint8_t *buffer) const override
Returns the Whirlpool hash value in the first 64 bytes of the given address.
void process_buffer()
The core Whirlpool transform.
static const uint64_t C4[]
Table used to compute the Whirlpool hash.
static const uint64_t C6[]
Table used to compute the Whirlpool hash.
std::string getName() const override
Returns the name of the checksum or the hash algorithm.
static std::string getHashName()
Returns the name of the hash algorithm.
void reset() override
Resets the Whirlpool hash to initial state of computation.
static Checksum * getNewInstance()
Gets a new instance of this class.
uint64_t hash[WHIRLPOOL_DIGESTQUADWORDS]
The hashing state.
static const uint64_t C3[]
Table used to compute the Whirlpool hash.
static const uint64_t C7[]
Table used to compute the Whirlpool hash.
void finish(uint8_t *const result)
Process the remaining bytes in the internal buffer and the usual prolog according to the standard.
static const uint64_t C1[]
Table used to compute the Whirlpool hash.
static const uint64_t C2[]
Table used to compute the Whirlpool hash.
ChecksumAlgoId getID() const override
Returns an unique identifier for the checksum or the hash algorithm.
int bufferPos
Current (possibly incomplete) byte slot on the buffer.
ChecksumAlgoId
Ids of algorithms of checksums.
#define WHIRLPOOL_DIGESTBYTES
Size of the message digest in bytes.
#define WHIRLPOOL_DIGESTQUADWORDS
Size of the message digest in quad words.
#define WHIRLPOOL_LENGTHBYTES
Number of hashed bytes.
#define WHIRLPOOL_WBLOCKBYTES
Size of the buffer of data for hashing in bytes.