**********************************************************************************
FUNCTION: CMD5Checksum::Update
DETAILS: protected
DESCRIPTION: Implementation of main MD5 checksum algorithm
RETURNS: void
ARGUMENTS: BYTE* Input : input block
UINT nInputLen : length of input block
NOTES: Computes the partial MD5 checksum for ''''nInputLen'''' bytes of data in ''''Input''''
*****************************************************************************************/
void CMD5Checksum::Update( BYTE* Input, ULONG nInputLen )
{
//Compute number of bytes mod 64
UINT nIndex = (UINT)((m_nCount[0] >> 3) & 0x3F);
//Update number of bits
if ( ( m_nCount[0] += nInputLen << 3 ) < ( nInputLen << 3) )
{
m_nCount++;
}
m_nCount += (nInputLen >> 29);
//Transform as many times as possible.
UINT i=0;
UINT nPartLen = 64 - nIndex;
if (nInputLen >= nPartLen)
{
memcpy( &m_lpszBuffer[nIndex], Input, nPartLen );
Transform( m_lpszBuffer );
for (i = nPartLen; i + 63 < nInputLen; i += 64)
{
Transform( &Input[i] );
}
nIndex = 0;
}
else
{
i = 0;
}
// Buffer remaining input
memcpy( &m_lpszBuffer[nIndex], &Input[i], nInputLen-i);
}