MersenneTwister random = new MersenneTwister(mt.nextLong());
int ptr = 0;
System.arraycopy(plaintext, 0, output, 0, plaintext.length);
while (ptr < plaintext.length) {
int max = plaintext.length - ptr;
int count = (max == 1) ? 1 : (random.nextInt(max - 1) + 1);
//ctr.blockEncipher(plaintext, ptr, count, output, ptr);
ctr.blockEncipher(output, ptr, count);
ptr += count;
}
assertTrue(Arrays.equals(output, ciphertext));