diff options
author | weidai <weidai11@users.noreply.github.com> | 2003-03-20 01:24:12 +0000 |
---|---|---|
committer | weidai <weidai11@users.noreply.github.com> | 2003-03-20 01:24:12 +0000 |
commit | 538de80a91da74598ba2449fbbec6de37376a4ce (patch) | |
tree | f85b3bed971083e90e5f3dbb84539ea4ba0359e9 /iterhash.cpp | |
parent | 21955e23ec9697d1cd47ff91f91b08af382b8a6d (diff) | |
download | cryptopp-git-538de80a91da74598ba2449fbbec6de37376a4ce.tar.gz |
various changes for 5.1
Diffstat (limited to 'iterhash.cpp')
-rw-r--r-- | iterhash.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/iterhash.cpp b/iterhash.cpp index 08f76261..00cc12bc 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()) |