for(unsigned i=16; i<Constants::N_ROUNDS; ++i)
{
WordType *block = message_blocks+i;
- WordType s1 = (rotate_right(block[-2], sigma[9]) ^ rotate_right(block[-2], sigma[10]) ^ (block[-2]>>sigma[11]));
- WordType s0 = (rotate_right(block[-15], sigma[6]) ^ rotate_right(block[-15], sigma[7]) ^ (block[-15]>>sigma[8]));
+ WordType s1 = rotate_right(block[-2], sigma[9]) ^ rotate_right(block[-2], sigma[10]) ^ (block[-2]>>sigma[11]);
+ WordType s0 = rotate_right(block[-15], sigma[6]) ^ rotate_right(block[-15], sigma[7]) ^ (block[-15]>>sigma[8]);
*block = s1+block[-7]+s0+block[-16];
}
for(unsigned i=0; i<Constants::N_ROUNDS; ++i)
{
- WordType s1 = (rotate_right(values[4], sigma[3]) ^ rotate_right(values[4], sigma[4]) ^ rotate_right(values[4], sigma[5]));
- WordType ch = ((values[4]&values[5]) ^ (~values[4]&values[6]));
- WordType temp1 = values[7]+s1+ch+Constants::round_constants[i]+message_blocks[i];
- WordType s0 = (rotate_right(values[0], sigma[0]) ^ rotate_right(values[0], sigma[1]) ^ rotate_right(values[0], sigma[2]));
- WordType maj = ((values[0]&values[1]) ^ (values[0]&values[2]) ^ (values[1]&values[2]));
+ const WordType &a = values[(88-i)&7];
+ const WordType &b = values[(89-i)&7];
+ const WordType &c = values[(90-i)&7];
+ WordType &d = values[(91-i)&7];
+ const WordType &e = values[(92-i)&7];
+ const WordType &f = values[(93-i)&7];
+ const WordType &g = values[(94-i)&7];
+ WordType &h = values[(95-i)&7];
+
+ WordType s1 = rotate_right(e, sigma[3]) ^ rotate_right(e, sigma[4]) ^ rotate_right(e, sigma[5]);
+ WordType ch = (e&f) ^ (~e&g);
+ WordType temp1 = h+s1+ch+Constants::round_constants[i]+message_blocks[i];
+ WordType s0 = rotate_right(a, sigma[0]) ^ rotate_right(a, sigma[1]) ^ rotate_right(a, sigma[2]);
+ WordType maj = (a&b) ^ (a&c) ^ (b&c);
WordType temp2 = s0+maj;
- values[7] = values[6];
- values[6] = values[5];
- values[5] = values[4];
- values[4] = values[3]+temp1;
- values[3] = values[2];
- values[2] = values[1];
- values[1] = values[0];
- values[0] = temp1+temp2;
+
+ d += temp1; // Will be e next round
+ h = temp1+temp2; // Will be a next round
}
for(unsigned i=0; i<8; ++i)