4 #define CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES 14 HashWordType oldCountLo = m_countLo, oldCountHi = m_countHi;
15 if ((m_countLo = oldCountLo +
HashWordType(len)) < oldCountLo)
21 const unsigned int blockSize = this->BlockSize();
22 unsigned int num =
ModPowerOf2(oldCountLo, blockSize);
24 T* dataBuf = this->DataBuf();
30 if (num+len >= blockSize)
32 if (data && input) {
memcpy(data+num, input, blockSize-num);}
34 input += (blockSize-num);
35 len -= (blockSize-num);
41 if (data && input && len) {
memcpy(data+num, input, len);}
55 else if (IsAligned<T>(input))
57 size_t leftOver = HashMultipleBlocks((T *)(
void*)input, len);
58 input += (len - leftOver);
64 if (data && input)
memcpy(data, input, blockSize);
68 }
while (len >= blockSize);
71 if (data && input && len && data != input)
77 unsigned int blockSize = this->BlockSize();
78 unsigned int num =
ModPowerOf2(m_countLo, blockSize);
79 size = blockSize - num;
80 return (
byte *)DataBuf() + num;
88 unsigned int blockSize = this->BlockSize();
90 T* dataBuf = this->DataBuf();
94 this->HashEndianCorrectedBlock(input);
98 this->HashEndianCorrectedBlock(dataBuf);
101 input += blockSize/
sizeof(
T);
104 while (length >= blockSize);
110 unsigned int blockSize = this->BlockSize();
111 unsigned int num =
ModPowerOf2(m_countLo, blockSize);
112 T* dataBuf = this->DataBuf();
114 data[num++] = padFirst;
115 if (num <= lastBlockSize)
116 memset(data+num, 0, lastBlockSize-num);
119 memset(data+num, 0, blockSize-num);
121 memset(data, 0, lastBlockSize);
127 m_countLo = m_countHi = 0;
133 this->ThrowIfInvalidTruncatedSize(size);
135 T* dataBuf = this->DataBuf();
136 T* stateBuf = this->StateBuf();
137 unsigned int blockSize = this->BlockSize();
146 if (IsAligned<HashWordType>(digest) && size%
sizeof(
HashWordType)==0)
147 ConditionalByteReverse<HashWordType>(order, (
HashWordType *)(
void*)digest, stateBuf,
size);
150 ConditionalByteReverse<HashWordType>(order, stateBuf, stateBuf, this->DigestSize());
151 memcpy(digest, stateBuf, size);
bool NativeByteOrderIs(ByteOrder order)
Determines whether order follows native byte ordering.
Utility functions for the Crypto++ library.
ByteOrder
Provides the byte ordering.
T2 ModPowerOf2(const T1 &a, const T2 &b)
Reduces a value to a power of 2.
#define NAMESPACE_BEGIN(x)
T ConditionalByteReverse(ByteOrder order, T value)
Reverses bytes in a value depending upon endianness.
void TruncatedFinal(byte *digest, size_t digestSize)
Computes the hash of the current message.
Safely right shift values when undefined behavior could occur.
#define CRYPTOPP_ASSERT(exp)
void Restart()
Restart the hash.
void PadLastBlock(unsigned int lastBlockSize, byte padFirst=0x80)
uint8_t const size_t const size
void * memcpy(void *a, const void *b, size_t c)
Iterated hash base class.
virtual size_t HashMultipleBlocks(const T *input, size_t length)
byte ByteReverse(byte value)
Reverses bytes in a 8-bit value.
byte * CreateUpdateSpace(size_t &size)
Requests space which can be written into by the caller.