?? tigerdigest.java
字號:
inOff += 8; len -= 8; byteCount += 8; } // // load in the remainder. // while (len > 0) { update(in[inOff]); inOff++; len--; } } private void roundABC( long x, long mul) { c ^= x ; a -= t1[(int)c & 0xff] ^ t2[(int)(c >> 16) & 0xff] ^ t3[(int)(c >> 32) & 0xff] ^ t4[(int)(c >> 48) & 0xff]; b += t4[(int)(c >> 8) & 0xff] ^ t3[(int)(c >> 24) & 0xff] ^ t2[(int)(c >> 40) & 0xff] ^ t1[(int)(c >> 56) & 0xff]; b *= mul; } private void roundBCA( long x, long mul) { a ^= x ; b -= t1[(int)a & 0xff] ^ t2[(int)(a >> 16) & 0xff] ^ t3[(int)(a >> 32) & 0xff] ^ t4[(int)(a >> 48) & 0xff]; c += t4[(int)(a >> 8) & 0xff] ^ t3[(int)(a >> 24) & 0xff] ^ t2[(int)(a >> 40) & 0xff] ^ t1[(int)(a >> 56) & 0xff]; c *= mul; } private void roundCAB( long x, long mul) { b ^= x ; c -= t1[(int)b & 0xff] ^ t2[(int)(b >> 16) & 0xff] ^ t3[(int)(b >> 32) & 0xff] ^ t4[(int)(b >> 48) & 0xff]; a += t4[(int)(b >> 8) & 0xff] ^ t3[(int)(b >> 24) & 0xff] ^ t2[(int)(b >> 40) & 0xff] ^ t1[(int)(b >> 56) & 0xff]; a *= mul; } private void keySchedule() { x[0] -= x[7] ^ 0xA5A5A5A5A5A5A5A5L; x[1] ^= x[0]; x[2] += x[1]; x[3] -= x[2] ^ ((~x[1]) << 19); x[4] ^= x[3]; x[5] += x[4]; x[6] -= x[5] ^ ((~x[4]) >>> 23); x[7] ^= x[6]; x[0] += x[7]; x[1] -= x[0] ^ ((~x[7]) << 19); x[2] ^= x[1]; x[3] += x[2]; x[4] -= x[3] ^ ((~x[2]) >>> 23); x[5] ^= x[4]; x[6] += x[5]; x[7] -= x[6] ^ 0x0123456789ABCDEFL; } private void processBlock() { // // save abc // long aa = a; long bb = b; long cc = c; // // rounds and schedule // roundABC(x[0], 5); roundBCA(x[1], 5); roundCAB(x[2], 5); roundABC(x[3], 5); roundBCA(x[4], 5); roundCAB(x[5], 5); roundABC(x[6], 5); roundBCA(x[7], 5); keySchedule(); roundCAB(x[0], 7); roundABC(x[1], 7); roundBCA(x[2], 7); roundCAB(x[3], 7); roundABC(x[4], 7); roundBCA(x[5], 7); roundCAB(x[6], 7); roundABC(x[7], 7); keySchedule(); roundBCA(x[0], 9); roundCAB(x[1], 9); roundABC(x[2], 9); roundBCA(x[3], 9); roundCAB(x[4], 9); roundABC(x[5], 9); roundBCA(x[6], 9); roundCAB(x[7], 9); // // feed forward // a ^= aa; b -= bb; c += cc; // // clear the x buffer // xOff = 0; for (int i = 0; i != x.length; i++) { x[i] = 0; } } public void unpackWord( long r, byte[] out, int outOff) { out[outOff + 7] = (byte)(r >> 56); out[outOff + 6] = (byte)(r >> 48); out[outOff + 5] = (byte)(r >> 40); out[outOff + 4] = (byte)(r >> 32); out[outOff + 3] = (byte)(r >> 24); out[outOff + 2] = (byte)(r >> 16); out[outOff + 1] = (byte)(r >> 8); out[outOff] = (byte)r; } private void processLength( long bitLength) { x[7] = bitLength; } private void finish() { long bitLength = (byteCount << 3); update((byte)0x01); while (bOff != 0) { update((byte)0); } processLength(bitLength); processBlock(); } public int doFinal( byte[] out, int outOff) { finish(); unpackWord(a, out, outOff); unpackWord(b, out, outOff + 8); unpackWord(c, out, outOff + 16); reset(); return DIGEST_LENGTH; } /** * reset the chaining variables */ public void reset() { a = 0x0123456789ABCDEFL; b = 0xFEDCBA9876543210L; c = 0xF096A5B4C3B2E187L; xOff = 0; for (int i = 0; i != x.length; i++) { x[i] = 0; } bOff = 0; for (int i = 0; i != buf.length; i++) { buf[i] = 0; } byteCount = 0; } public int getByteLength() { return BYTE_LENGTH; }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -