Cryptographic test diverging from class execution


I made my java class for encryption using AES. But I went to test her on this site here: link


java class: text : test key : abcdefghijklmno1 result : 5brjBUDRtK7OzHLZf / Pv9A ==

but the result of the site was different: 9rHpDdonevdWy+1PnTSweA==

public String encrypt(String Data, String pKey) throws Exception
    Key key = generateKey(pKey);
    Cipher c = Cipher.getInstance(ALGO);
    c.init(Cipher.ENCRYPT_MODE, key);
    byte[] encVal = c.doFinal(Data.getBytes("UTF-8"));
    return new BASE64Encoder().encode(encVal);

The question is, which one of the 2 encryptions is correct?

asked by anonymous 26.09.2016 / 15:54

1 answer


I resolved by changing the following line:

Cipher c = Cipher.getInstance("AES/ECB/NoPadding");
26.09.2016 / 17:02