Different results with Blowfish between java 6 and java 8

Viewed 139
public class Main {

public static void main(String[] args) {
    String result = blowfish("123123");
    System.out.println(result);
}

public static String blowfish(String source) {
    final String BLOWFISH_KEY = "22ddba9832444234";

    try {
        Cipher cipher = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");

        cipher.init(
                Cipher.ENCRYPT_MODE,
                new SecretKeySpec(BLOWFISH_KEY.getBytes("UTF-8"), "Blowfish")
        );
        return new String(cipher.doFinal(source.getBytes("UTF-8")));

    } catch (Exception e) {
        e.printStackTrace(System.out);
        return null;
     }
   }
}

If I run this code with java 6 oracle and then run with java 8 openJdk gives me different outputs, Why?

1 Answers
Related