@Test public void padBasicTest() { byte[] r = AesUtil.cmacPad(EMPTY); assertEquals((byte) 0x80, r[0]); assertEquals((byte) 0x00, r[1]); assertEquals((byte) 0x00, r[15]); assertEquals(16, r.length); r = AesUtil.cmacPad(ONE_ONE); assertEquals((byte) 0x01, r[0]); assertEquals((byte) 0x80, r[1]); assertEquals((byte) 0x00, r[2]); assertEquals((byte) 0x00, r[15]); assertEquals(16, r.length); }
static byte[] cmacPad(final byte[] x) { if (x.length >= BLOCK_SIZE) { throw new IllegalArgumentException("x must be smaller than a block."); } byte[] result = Arrays.copyOf(x, 16); result[x.length] = (byte) 0x80; return result; }
AesUtil { static byte[] cmacPad(final byte[] x) { if (x.length >= BLOCK_SIZE) { throw new IllegalArgumentException("x must be smaller than a block."); } byte[] result = Arrays.copyOf(x, 16); result[x.length] = (byte) 0x80; return result; } }
AesUtil { static byte[] cmacPad(final byte[] x) { if (x.length >= BLOCK_SIZE) { throw new IllegalArgumentException("x must be smaller than a block."); } byte[] result = Arrays.copyOf(x, 16); result[x.length] = (byte) 0x80; return result; }  }
AesUtil { static byte[] cmacPad(final byte[] x) { if (x.length >= BLOCK_SIZE) { throw new IllegalArgumentException("x must be smaller than a block."); } byte[] result = Arrays.copyOf(x, 16); result[x.length] = (byte) 0x80; return result; }   }
AesUtil { static byte[] cmacPad(final byte[] x) { if (x.length >= BLOCK_SIZE) { throw new IllegalArgumentException("x must be smaller than a block."); } byte[] result = Arrays.copyOf(x, 16); result[x.length] = (byte) 0x80; return result; }   static final int BLOCK_SIZE; }