private void prepareBlock() throws EncryptionError { System.arraycopy(nonce, 0, source, 0, blockSize); counterBytes[0] = (byte) (counter >> 24); counterBytes[1] = (byte) (counter >> 16); counterBytes[2] = (byte) (counter >> 8); counterBytes[3] = (byte) counter; applyXor(source, blockSize - 4, counterBytes); synchronized (cipher) { source = cipher.transformBlock(source); } counter++; index = 0; }