title: java aes encryption , output has one block more than the input , and without padding
body: <p>so i am working on this assignement where i'm suppposed to make my own CBC and CTR algorithms using the predefined aes functions, for now i seem to have a problem, the output's Size is always a Block more than the input (input 64 ,output 80 , and so on ) here's the code i'm using, with hexadecimal to bytes conversion and bytes to hex : </p>
  
  <pre><code>public static String encrypt(String PT,String skey) throws Exception, NoSuchPaddingException {
        Cipher cipher = Cipher.getInstance("AES");
          SecretKeySpec key = new SecretKeySpec(skey.getBytes("ascii"), "AES");
          cipher.init(Cipher.ENCRYPT_MODE, key);
          byte[] val = hexToBytes(PT);
          byte[] encVal = cipher.doFinal(val);
  
          return byteToString(encVal);
  }
  </code></pre>
  
  <p>the conversion functions are perfectly working, the val size is n * 16 bytes and the encVal size is (n+1) * 16 bytes </p>