unsigned int a = h[0];
unsigned int b = h[1];
unsigned int c = h[2];
unsigned int d = h[3];
unsigned int i, j, t, temp;
unsigned __int64 x;
x = SizeInBit / 512; // SizeInBit为末尾补齐后数据的长度,x则为数据分块数
for (psh = (unsigned int*)p; x--; psh += 16) // p指向源数据(已经过末尾补齐),psh是临时unsigned int指针,psh += 16 则指向下一个512bit块:
{
for (i = 0; i < 64; i++)
{
if (0 <= i && i <= 15)
{
t = (b & c) | ((~b) & d);
j = i;
}
else if (16 <= i && i <= 31)
{
t = (d & b) | ((~d) & c);
j = (5*i + 1) % 16;
}
else if (32 <= i && i <= 47)
{
t = b ^ c ^ d;
j = (3*i + 5) % 16;
}
else if (48 <= i && i <= 63)
{
t = c ^ (b | (~d));
j = (7*i) % 16;
}
temp = d;
d = c;
c = b;
b = CROL(a + t + k[i] + *(psh+j), r[i]) + b;
a = temp;
}
//Add this chunk's hash to result so far:
h[0] += a;
h[1] += b;
h[2] += c;
h[3] += d;
}