private void gHASH(byte[] Y, byte[] b, int len) { for (int pos = 0; pos < len; pos += BLOCK_SIZE) { int num = Math.min(len - pos, BLOCK_SIZE); gHASHPartial(Y, b, pos, num); } }
private void initCipher() { if (atLength > 0) { System.arraycopy(S_at, 0, S_atPre, 0, BLOCK_SIZE); atLengthPre = atLength; } // Finish hash for partial AAD block if (atBlockPos > 0) { gHASHPartial(S_atPre, atBlock, 0, atBlockPos); atLengthPre += atBlockPos; } if (atLengthPre > 0) { System.arraycopy(S_atPre, 0, S, 0, BLOCK_SIZE); } }
private void gCTRPartial(byte[] buf, int off, int len, byte[] out, int outOff) { byte[] tmp = getNextCounterBlock(); GCMUtil.xor(tmp, buf, off, len); System.arraycopy(tmp, 0, out, outOff, len); gHASHPartial(S, forEncryption ? tmp : buf, 0, len); totalLength += len; }
gHASHPartial(S_at, atBlock, 0, atBlockPos);