Security Scol plugin
|
Iterated hash base class. More...
#include <iterhash.h>
Public Types | |
typedef T | HashWordType |
Public Member Functions | |
IteratedHashBase () | |
Construct an IteratedHashBase. | |
unsigned int | OptimalBlockSize () const |
Provides the input block size most efficient for this cipher. | |
unsigned int | OptimalDataAlignment () const |
Provides input and output data alignment for optimal performance. | |
void | Update (const byte *input, size_t length) |
Updates a hash with additional input. | |
byte * | CreateUpdateSpace (size_t &size) |
Requests space which can be written into by the caller. | |
void | Restart () |
Restart the hash. | |
void | TruncatedFinal (byte *digest, size_t digestSize) |
Computes the hash of the current message. | |
virtual std::string | AlgorithmProvider () const |
Retrieve the provider of this algorithm. | |
Protected Member Functions | |
T | GetBitCountHi () const |
T | GetBitCountLo () const |
void | PadLastBlock (unsigned int lastBlockSize, byte padFirst=0x80) |
virtual void | Init ()=0 |
virtual ByteOrder | GetByteOrder () const =0 |
virtual void | HashEndianCorrectedBlock (const HashWordType *data)=0 |
virtual size_t | HashMultipleBlocks (const T *input, size_t length) |
void | HashBlock (const HashWordType *input) |
virtual T * | DataBuf ()=0 |
virtual T * | StateBuf ()=0 |
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.
|
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 VMAC_Base.
Definition at line 94 of file iterhash.h.
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.
|
inlineprotected |
Definition at line 97 of file iterhash.h.
|
inlineprotected |
Definition at line 99 of file iterhash.h.
|
protectedpure virtual |
Implemented in IteratedHash< T_HashWordType, T_Endianness, T_BlockSize, T_Base >, IteratedHash< word32, BigEndian, T_BlockSize >, IteratedHash< word32, LittleEndian, 64, MessageAuthenticationCode >, IteratedHash< word32, LittleEndian, T_BlockSize >, IteratedHash< word32, NativeByteOrder, 32 >, IteratedHash< word64, BigEndian, T_BlockSize >, and IteratedHash< word64, LittleEndian, T_BlockSize >.
|
inlineprotected |
Definition at line 108 of file iterhash.h.
|
protectedvirtual |
Definition at line 93 of file iterhash.cpp.
|
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.
Reimplemented in VMAC_Base.
Definition at line 58 of file iterhash.h.
|
protected |
Definition at line 141 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 VMAC_Base.
Definition at line 165 of file iterhash.cpp.
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.