in common.cpp [267:330]
void DoMd5Big(const uint8_t* poolIn, const uint64_t inputBytesNum, uint8_t hash[16])
{
struct Md5Block block;
uint8_t tempBlock[64];
///initialize hash value
uint32_t h[4];
h[0] = 0x67452301;
h[1] = 0xEFCDAB89;
h[2] = 0x98BADCFE;
h[3] = 0x10325476;
///padding and divide input data into blocks
uint64_t fullLen = (inputBytesNum >> 6) << 6;
uint64_t partLen = inputBytesNum & 0x3F;
uint32_t i;
for (i = 0; i < fullLen; i += 64)
{
///copy input data into block, in little endian
CopyBytesToBlock(&(poolIn[i]), block);
///calculate Md5
CalMd5(block, h);
}
///append two more blocks
if (partLen > 55)
{
///put input data into a temporary block
memcpy(tempBlock, &(poolIn[i]), partLen);
memcpy(&(tempBlock[partLen]), gPadding, (64 - partLen));
///copy temporary data into block, in little endian
CopyBytesToBlock(tempBlock, block);
///calculate Md5
CalMd5(block, h);
memset(tempBlock, 0x0, 64);
}
///append one more block
else
{
memcpy(tempBlock, &(poolIn[i]), partLen);
memcpy( &(tempBlock[partLen]), gPadding, (64 - partLen));
}
///append length (bits)
uint64_t bitsNum = inputBytesNum * 8;
memcpy(&(tempBlock[56]), &bitsNum, 8);
///copy temporary data into block, in little endian
CopyBytesToBlock(tempBlock, block);
///calculate Md5
CalMd5(block, h);
///clear sensitive information
memset(block.word, 0, 64);
memset(tempBlock, 0, 64);
///fill hash value
memcpy(&(hash[0]), &(h[0]), 16);
}///DoMd5Big