title: AES-128-ECB - Inconsistent encryption result of node js and java
body: <p>node js code：</p>
  
  <pre><code>function AES_encrypt(){
  
    var bKey = new Buffer('24Qn9974h50D9DNi', 'utf-8');
  
    var bInput = new Buffer(‘test’, 'utf-8');
  
    console.log(bKey.length);
  
    var cipher = crypto.createCipher('AES-128-ECB',bKey);
  
    //cipher.setAutoPadding(auto_padding=false);
  
    var crypted = cipher.update(bInput,null,'base64');
  
    crypted+=cipher.final('base64');
  
    console.log(crypted);
  
    return crypted;
  }
  </code></pre>
  
  <p>get Result：57b6b7oulw7eO5h7efZ9/w==</p>
  
  <p>java code：</p>
  
  <p>main java：</p>
  
  <pre><code>String data = AES.encryptToBase64("test","24Qn9974h50D9DNi");
  </code></pre>
  
  <p>AES java：</p>
  
  <pre><code>public static String encryptToBase64(String data, String key){
      try {
          byte[] valueByte = encrypt(data.getBytes("utf-8"), key.getBytes("utf-8");
          return new String(Base64.encode(valueByte));
      } catch (UnsupportedEncodingException e) {
          throw new RuntimeException("encrypt fail!", e);
      }
  
  }
  
   public static byte[] encrypt(byte[] data, byte[] key) {
  
      if(key.length!=16){
          throw new RuntimeException("Invalid AES key length (must be 16 bytes)");
      }
      try {
          SecretKeySpec secretKey = new SecretKeySpec(key, "AES"); 
          byte[] enCodeFormat = secretKey.getEncoded();
          SecretKeySpec seckey = new SecretKeySpec(enCodeFormat,"AES");
          Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
          cipher.init(Cipher.ENCRYPT_MODE, seckey);// 初始化
          byte[] result = cipher.doFinal(data);
          return result; // 加密
      } catch (Exception e){
          throw new RuntimeException("encrypt fail!", e);
      }
  }
  </code></pre>
  
  <p>get Result：wA1JU6VxMaVl8Ck8pBrX8A==</p>