summaryrefslogtreecommitdiff
path: root/iterhash.cpp
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2003-03-20 01:24:12 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2003-03-20 01:24:12 +0000
commitd23a489940499bd6c634a1cb0a9875f094f8a850 (patch)
treef85b3bed971083e90e5f3dbb84539ea4ba0359e9 /iterhash.cpp
parentb3517523a738277cfe22428bd757833e69abb66e (diff)
downloadcryptopp-d23a489940499bd6c634a1cb0a9875f094f8a850.tar.gz
various changes for 5.1
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@38 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'iterhash.cpp')
-rw-r--r--iterhash.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/iterhash.cpp b/iterhash.cpp
index 08f7626..00cc12b 100644
--- a/iterhash.cpp
+++ b/iterhash.cpp
@@ -17,13 +17,13 @@ template <class T, class BASE> void IteratedHashBase<T, BASE>::Update(const byte
{
HashWordType tmp = m_countLo;
if ((m_countLo = tmp + len) < tmp)
- m_countHi++; // Carry from low to high
+ m_countHi++; // carry from low to high
m_countHi += SafeRightShift<8*sizeof(HashWordType)>(len);
unsigned int blockSize = BlockSize();
- unsigned int num = (unsigned int)(tmp & (blockSize-1));
+ unsigned int num = ModPowerOf2(tmp, blockSize);
- if (num != 0)
+ if (num != 0) // process left over data
{
if ((num+len) >= blockSize)
{
@@ -41,8 +41,7 @@ template <class T, class BASE> void IteratedHashBase<T, BASE>::Update(const byte
}
}
- // we now can process the input data in blocks of blockSize
- // chars and save the leftovers to this->data.
+ // now process the input data in blocks of blockSize bytes and save the leftovers to m_data
if (len >= blockSize)
{
if (input == (byte *)m_data.begin())