@Test public void testQuarterRound1() { int buf[] = {0x11111111, 0x01020304, 0x9b8d6f43, 0x01234567}; int expected[] = {0xea2a92f4, 0xcb1cf8ce, 0x4581472e, 0x5881c4bb}; ChaCha20.quarterRound(buf, 0, 1, 2, 3); assertTrue(Arrays.equals(buf, expected)); }
protected static void quarterRound(int[] x, int a, int b, int c, int d) { x[a] += x[b]; x[d] = ROTATE(x[d] ^ x[a], 16); x[c] += x[d]; x[b] = ROTATE(x[b] ^ x[c], 12); x[a] += x[b]; x[d] = ROTATE(x[d] ^ x[a], 8); x[c] += x[d]; x[b] = ROTATE(x[b] ^ x[c], 7); }
ChaCha20 { protected static void quarterRound(int[] x, int a, int b, int c, int d) { x[a] += x[b]; x[d] = ROTATE(x[d] ^ x[a], 16); x[c] += x[d]; x[b] = ROTATE(x[b] ^ x[c], 12); x[a] += x[b]; x[d] = ROTATE(x[d] ^ x[a], 8); x[c] += x[d]; x[b] = ROTATE(x[b] ^ x[c], 7); } }
ChaCha20 { protected static void quarterRound(int[] x, int a, int b, int c, int d) { x[a] += x[b]; x[d] = ROTATE(x[d] ^ x[a], 16); x[c] += x[d]; x[b] = ROTATE(x[b] ^ x[c], 12); x[a] += x[b]; x[d] = ROTATE(x[d] ^ x[a], 8); x[c] += x[d]; x[b] = ROTATE(x[b] ^ x[c], 7); } ChaCha20(byte[] key, byte[] nonce, int counter); }
ChaCha20 { protected static void quarterRound(int[] x, int a, int b, int c, int d) { x[a] += x[b]; x[d] = ROTATE(x[d] ^ x[a], 16); x[c] += x[d]; x[b] = ROTATE(x[b] ^ x[c], 12); x[a] += x[b]; x[d] = ROTATE(x[d] ^ x[a], 8); x[c] += x[d]; x[b] = ROTATE(x[b] ^ x[c], 7); } ChaCha20(byte[] key, byte[] nonce, int counter); void encrypt(byte[] dst, byte[] src, int len); void decrypt(byte[] dst, byte[] src, int len); }
ChaCha20 { protected static void quarterRound(int[] x, int a, int b, int c, int d) { x[a] += x[b]; x[d] = ROTATE(x[d] ^ x[a], 16); x[c] += x[d]; x[b] = ROTATE(x[b] ^ x[c], 12); x[a] += x[b]; x[d] = ROTATE(x[d] ^ x[a], 8); x[c] += x[d]; x[b] = ROTATE(x[b] ^ x[c], 7); } ChaCha20(byte[] key, byte[] nonce, int counter); void encrypt(byte[] dst, byte[] src, int len); void decrypt(byte[] dst, byte[] src, int len); static final int KEY_SIZE; static final int NONCE_SIZE_REF; static final int NONCE_SIZE_IETF; }