processBlock method
Process a whole block of data in extender digest.
Implementation
@override
void processBlock() {
int i;
// [REF1] 5.3.2 消息扩展
// [REF2] 3.3.2 Message Extension
_W.setAll(0, buffer);
for (i = 16; i < 68; ++i) {
_W[i] = _P1(_W[i - 16] ^ _W[i - 9] ^ rotl32(_W[i - 3], 15)) ^
rotl32(_W[i - 13], 7) ^
_W[i - 6];
}
// [REF1] 5.3.3 压缩函数
// [REF2] 3.3.3 Compression Function
var A = state[0];
var B = state[1];
var C = state[2];
var D = state[3];
var E = state[4];
var F = state[5];
var G = state[6];
var H = state[7];
int SS1, SS2, TT1, TT2, Tj;
for (i = 0; i < 16; ++i) {
Tj = 0x79cc4519;
SS1 = rotl32(clip32(rotl32(A, 12) + E + rotl32(Tj, i)), 7);
SS2 = SS1 ^ rotl32(A, 12);
TT1 = clip32(_FF1(A, B, C) + D + SS2 + (_W[i] ^ _W[i + 4]));
TT2 = clip32(_GG1(E, F, G) + H + SS1 + _W[i]);
D = C;
C = rotl32(B, 9);
B = A;
A = TT1;
H = G;
G = rotl32(F, 19);
F = E;
E = _P0(TT2);
}
for (i = 16; i < 64; ++i) {
Tj = 0x7a879d8a;
SS1 = rotl32(clip32(rotl32(A, 12) + E + rotl32(Tj, i)), 7);
SS2 = SS1 ^ rotl32(A, 12);
TT1 = clip32(_FF2(A, B, C) + D + SS2 + (_W[i] ^ _W[i + 4]));
TT2 = clip32(_GG2(E, F, G) + H + SS1 + _W[i]);
D = C;
C = rotl32(B, 9);
B = A;
A = TT1;
H = G;
G = rotl32(F, 19);
F = E;
E = _P0(TT2);
}
state[0] ^= A;
state[1] ^= B;
state[2] ^= C;
state[3] ^= D;
state[4] ^= E;
state[5] ^= F;
state[6] ^= G;
state[7] ^= H;
}