public void processAADByte(byte in) { atBlock[atBlockPos] = in; if (++atBlockPos == BLOCK_SIZE) { // Hash each block as it fills gHASHBlock(S_at, atBlock); atBlockPos = 0; atLength += BLOCK_SIZE; } }
public void processAADBytes(byte[] in, int inOff, int len) { for (int i = 0; i < len; ++i) { atBlock[atBlockPos] = in[inOff + i]; if (++atBlockPos == BLOCK_SIZE) { // Hash each block as it fills gHASHBlock(S_at, atBlock); atBlockPos = 0; atLength += BLOCK_SIZE; } } }
public void processAADByte(byte in) { checkStatus(); atBlock[atBlockPos] = in; if (++atBlockPos == BLOCK_SIZE) { // Hash each block as it fills gHASHBlock(S_at, atBlock); atBlockPos = 0; atLength += BLOCK_SIZE; } }
public void processAADBytes(byte[] in, int inOff, int len) { checkStatus(); for (int i = 0; i < len; ++i) { atBlock[atBlockPos] = in[inOff + i]; if (++atBlockPos == BLOCK_SIZE) { // Hash each block as it fills gHASHBlock(S_at, atBlock); atBlockPos = 0; atLength += BLOCK_SIZE; } } }
private void gCTRBlock(byte[] block, byte[] out, int outOff) { byte[] tmp = getNextCounterBlock(); GCMUtil.xor(tmp, block); System.arraycopy(tmp, 0, out, outOff, BLOCK_SIZE); gHASHBlock(S, forEncryption ? tmp : block); totalLength += BLOCK_SIZE; }
private void processBlock(byte[] buf, int bufOff, byte[] out, int outOff) { if ((out.length - outOff) < BLOCK_SIZE) { throw new OutputLengthException("Output buffer too short"); } if (totalLength == 0) { initCipher(); } byte[] ctrBlock = new byte[BLOCK_SIZE]; getNextCTRBlock(ctrBlock); if (forEncryption) { GCMUtil.xor(ctrBlock, buf, bufOff); gHASHBlock(S, ctrBlock); System.arraycopy(ctrBlock, 0, out, outOff, BLOCK_SIZE); } else { gHASHBlock(S, buf, bufOff); GCMUtil.xor(ctrBlock, 0, buf, bufOff, out, outOff); } totalLength += BLOCK_SIZE; }
byte[] X = new byte[BLOCK_SIZE]; Pack.longToBigEndian((long)nonce.length * 8, X, 8); gHASHBlock(J0, X);
byte[] X = new byte[BLOCK_SIZE]; Pack.longToBigEndian((long)nonce.length * 8, X, 8); gHASHBlock(J0, X);
Pack.longToBigEndian(totalLength * 8, X, 8); gHASHBlock(S, X);
Pack.longToBigEndian(totalLength * 8, X, 8); gHASHBlock(S, X);