Crypto++ 8.7
Free C++ class library of cryptographic schemes
|
Iterated hash base class. More...
#include <iterhash.h>
Public Types | |
typedef T | HashWordType |
Public Member Functions | |
IteratedHashBase () | |
Construct an IteratedHashBase. More... | |
unsigned int | OptimalBlockSize () const |
Provides the input block size most efficient for this cipher. More... | |
unsigned int | OptimalDataAlignment () const |
Provides input and output data alignment for optimal performance. More... | |
void | Update (const byte *input, size_t length) |
Updates a hash with additional input. More... | |
byte * | CreateUpdateSpace (size_t &size) |
Requests space which can be written into by the caller. More... | |
void | Restart () |
Restart the hash. More... | |
void | TruncatedFinal (byte *digest, size_t digestSize) |
Computes the hash of the current message. More... | |
virtual std::string | AlgorithmProvider () const |
Retrieve the provider of this algorithm. More... | |
Iterated hash base class.
T | Hash word type |
BASE | HashTransformation derived class |
IteratedHashBase provides an interface for block-based iterated hashes
Definition at line 38 of file iterhash.h.
typedef T IteratedHashBase< T, BASE >::HashWordType |
Definition at line 41 of file iterhash.h.
|
inlinevirtual |
Definition at line 43 of file iterhash.h.
|
inline |
Construct an IteratedHashBase.
Definition at line 46 of file iterhash.h.
|
inline |
Provides the input block size most efficient for this cipher.
The base class implementation returns MandatoryBlockSize().
n * OptimalBlockSize() - GetOptimalBlockSizeUsed()
for any n > 0
. Definition at line 53 of file iterhash.h.
|
inline |
Provides input and output data alignment for optimal performance.
OptimalDataAlignment returns the natural alignment of the hash word.
Definition at line 58 of file iterhash.h.
void IteratedHashBase< T, BASE >::Update | ( | const byte * | input, |
size_t | length | ||
) |
Updates a hash with additional input.
input | the additional input as a buffer |
length | the size of the buffer, in bytes |
Definition at line 13 of file iterhash.cpp.
byte * IteratedHashBase< T, BASE >::CreateUpdateSpace | ( | size_t & | size | ) |
Requests space which can be written into by the caller.
size | the requested size of the buffer |
The purpose of this method is to help avoid extra memory allocations.
size is an IN and OUT parameter and used as a hint. When the call is made, size is the requested size of the buffer. When the call returns, size is the size of the array returned to the caller.
The base class implementation sets size to 0 and returns NULL.
Definition at line 85 of file iterhash.cpp.
void IteratedHashBase< T, BASE >::Restart |
Restart the hash.
Discards the current state, and restart for a new message
Definition at line 159 of file iterhash.cpp.
void IteratedHashBase< T, BASE >::TruncatedFinal | ( | byte * | digest, |
size_t | digestSize | ||
) |
Computes the hash of the current message.
digest | a pointer to the buffer to receive the hash |
digestSize | the size of the truncated digest, in bytes |
TruncatedFinal() calls Final() and then copies digestSize bytes to digest. The hash is restarted the hash for the next message.
Reimplemented in Weak::PanamaHash< LittleEndian >.
Definition at line 165 of file iterhash.cpp.
|
inlinevirtual |
Retrieve the provider of this algorithm.
The algorithm provider can be a name like "C++", "SSE", "NEON", "AESNI", "ARMv8" and "Power8". C++ is standard C++ code. Other labels, like SSE, usually indicate a specialized implementation using instructions from a higher instruction set architecture (ISA). Future labels may include external hardware like a hardware security module (HSM).
Reimplemented in Weak::PanamaHash< B >, Weak::PanamaHash< LittleEndian >, SHA1, SHA256, SHA224, SHA512, SHA384, Tiger, VMAC_Base, and Whirlpool.
Definition at line 94 of file iterhash.h.