Fabcoin Core
0.16.2
P2P Digital Currency
|
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... | |
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 |
Private Attributes | |
T | m_countLo |
T | m_countHi |
Iterated hash base class.
T | Hash word type |
BASE | HashTransformation derived class |
IteratedHashBase provides an interface for block-based iterated hashes
Definition at line 27 of file iterhash.h.
typedef T IteratedHashBase< T, BASE >::HashWordType |
Definition at line 30 of file iterhash.h.
|
inline |
Construct an IteratedHashBase.
Definition at line 33 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 75 of file iterhash.cpp.
|
protectedpure virtual |
Implemented in IteratedHash< T_HashWordType, T_Endianness, T_BlockSize, T_Base >, IteratedHash< word64, LittleEndian, T_BlockSize >, IteratedHash< T_HashWordType, T_Endianness, T_BlockSize >, IteratedHash< word32, LittleEndian, T_BlockSize >, IteratedHash< word32, LittleEndian, 64, MessageAuthenticationCode >, IteratedHash< word32, BigEndian, T_BlockSize >, IteratedHash< word32, NativeByteOrder, 32 >, IteratedHash< word64, BigEndian, T_BlockSize >, and VMAC_Base.
|
inlineprotected |
Definition at line 74 of file iterhash.h.
|
inlineprotected |
Definition at line 75 of file iterhash.h.
|
protectedpure virtual |
Implemented in IteratedHash< T_HashWordType, T_Endianness, T_BlockSize, T_Base >, IteratedHash< word64, LittleEndian, T_BlockSize >, IteratedHash< T_HashWordType, T_Endianness, T_BlockSize >, IteratedHash< word32, LittleEndian, T_BlockSize >, IteratedHash< word32, LittleEndian, 64, MessageAuthenticationCode >, IteratedHash< word32, BigEndian, T_BlockSize >, IteratedHash< word32, NativeByteOrder, 32 >, IteratedHash< word64, BigEndian, T_BlockSize >, and VMAC_Base.
|
inlineprotected |
Definition at line 83 of file iterhash.h.
|
protectedpure virtual |
Implemented in IteratedHashWithStaticTransform< T_HashWordType, T_Endianness, T_BlockSize, T_StateSize, T_Transform, T_DigestSize, T_StateAligned >, IteratedHashWithStaticTransform< word32, LittleEndian, 64, 32, RIPEMD256 >, IteratedHashWithStaticTransform< word64, BigEndian, 128, 64, SHA512, 64,(CRYPTOPP_BOOL_X86|CRYPTOPP_BOOL_X32)>, IteratedHashWithStaticTransform< word32, LittleEndian, 64, 16, MD5 >, IteratedHashWithStaticTransform< word32, LittleEndian, 64, 16, MD4 >, IteratedHashWithStaticTransform< word32, LittleEndian, 64, 40, RIPEMD320 >, IteratedHashWithStaticTransform< word32, BigEndian, 64, 20, SHA1 >, IteratedHashWithStaticTransform< word64, BigEndian, 128, 64, SHA384, 48,(CRYPTOPP_BOOL_X86|CRYPTOPP_BOOL_X32)>, IteratedHashWithStaticTransform< word32, LittleEndian, 64, 16, RIPEMD128 >, IteratedHashWithStaticTransform< word32, BigEndian, 64, 32, SHA224, 28, true >, IteratedHashWithStaticTransform< word32, BigEndian, 64, 32, SHA256, 32, true >, IteratedHashWithStaticTransform< word32, LittleEndian, 64, 20, RIPEMD160 >, IteratedHashWithStaticTransform< word64, LittleEndian, 64, 24, Tiger >, IteratedHashWithStaticTransform< word64, BigEndian, 64, 64, Whirlpool >, Weak::PanamaHash< B >, VMAC_Base, and TTMAC_Base.
|
protectedvirtual |
Reimplemented in Weak::PanamaHash< B >, and VMAC_Base.
Definition at line 83 of file iterhash.cpp.
|
protectedpure virtual |
Implemented in IteratedHashWithStaticTransform< T_HashWordType, T_Endianness, T_BlockSize, T_StateSize, T_Transform, T_DigestSize, T_StateAligned >, IteratedHashWithStaticTransform< word32, LittleEndian, 64, 32, RIPEMD256 >, IteratedHashWithStaticTransform< word64, BigEndian, 128, 64, SHA512, 64,(CRYPTOPP_BOOL_X86|CRYPTOPP_BOOL_X32)>, IteratedHashWithStaticTransform< word32, LittleEndian, 64, 16, MD5 >, IteratedHashWithStaticTransform< word32, LittleEndian, 64, 16, MD4 >, IteratedHashWithStaticTransform< word32, LittleEndian, 64, 40, RIPEMD320 >, IteratedHashWithStaticTransform< word32, BigEndian, 64, 20, SHA1 >, IteratedHashWithStaticTransform< word64, BigEndian, 128, 64, SHA384, 48,(CRYPTOPP_BOOL_X86|CRYPTOPP_BOOL_X32)>, IteratedHashWithStaticTransform< word32, LittleEndian, 64, 16, RIPEMD128 >, IteratedHashWithStaticTransform< word32, BigEndian, 64, 32, SHA224, 28, true >, IteratedHashWithStaticTransform< word32, BigEndian, 64, 32, SHA256, 32, true >, IteratedHashWithStaticTransform< word32, LittleEndian, 64, 20, RIPEMD160 >, IteratedHashWithStaticTransform< word64, LittleEndian, 64, 24, Tiger >, IteratedHashWithStaticTransform< word64, BigEndian, 64, 64, Whirlpool >, Weak::PanamaHash< B >, VMAC_Base, and TTMAC_Base.
|
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 40 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 45 of file iterhash.h.
|
protected |
void IteratedHashBase< T, BASE >::Restart | ( | ) |
Restart the hash.
Discards the current state, and restart for a new message
Definition at line 125 of file iterhash.cpp.
|
protectedpure virtual |
Implemented in IteratedHashWithStaticTransform< T_HashWordType, T_Endianness, T_BlockSize, T_StateSize, T_Transform, T_DigestSize, T_StateAligned >, IteratedHashWithStaticTransform< word32, LittleEndian, 64, 32, RIPEMD256 >, IteratedHashWithStaticTransform< word64, BigEndian, 128, 64, SHA512, 64,(CRYPTOPP_BOOL_X86|CRYPTOPP_BOOL_X32)>, IteratedHashWithStaticTransform< word32, LittleEndian, 64, 16, MD5 >, IteratedHashWithStaticTransform< word32, LittleEndian, 64, 16, MD4 >, IteratedHashWithStaticTransform< word32, LittleEndian, 64, 40, RIPEMD320 >, IteratedHashWithStaticTransform< word32, BigEndian, 64, 20, SHA1 >, IteratedHashWithStaticTransform< word64, BigEndian, 128, 64, SHA384, 48,(CRYPTOPP_BOOL_X86|CRYPTOPP_BOOL_X32)>, IteratedHashWithStaticTransform< word32, LittleEndian, 64, 16, RIPEMD128 >, IteratedHashWithStaticTransform< word32, BigEndian, 64, 32, SHA224, 28, true >, IteratedHashWithStaticTransform< word32, BigEndian, 64, 32, SHA256, 32, true >, IteratedHashWithStaticTransform< word32, LittleEndian, 64, 20, RIPEMD160 >, IteratedHashWithStaticTransform< word64, LittleEndian, 64, 24, Tiger >, IteratedHashWithStaticTransform< word64, BigEndian, 64, 64, Whirlpool >, Weak::PanamaHash< B >, VMAC_Base, and TTMAC_Base.
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() call Final() and then copies digestSize bytes to digest. The hash is restarted the hash for the next message.
Definition at line 131 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 12 of file iterhash.cpp.
|
private |
Definition at line 89 of file iterhash.h.
|
private |
Definition at line 89 of file iterhash.h.