BASE64DecoderStream.decode returns different values on different computers

Viewed 81

I have this java function that receives a string (str) and decodes it:

public static String decrypt(String str) {
    try {
        byte[] decodedKey = Base64.getDecoder().decode("seluR/beWhR=");
        key = new SecretKeySpec(decodedKey, 0, decodedKey.length, "DES");
        dcipher = Cipher.getInstance("DES");
        dcipher.init(Cipher.DECRYPT_MODE, key);
        byte[] dec = BASE64DecoderStream.decode(str.getBytes());
        byte[] utf8 = dcipher.update(dec, 0, dec.length);
        return new String(utf8, "UTF8");
    } catch (Exception e) {
        System.out.println(e);
    }
    return null;
}

When the function receives this value: JLMcNWcDwNJS1MVO3Urhgco2ZQzk2EBc

Returns this from my computer: 29/07/2022 16:19

Returns this from my client's computer: 29/07/2022 16:19:10.12

As you can see, values are very similar but they're different (the latter has 6 extra characters)

I don't understand why is this happening. The values should be exactly the same, isn't it? Both computers use the same JDK version (1.8). Both computers have Windows (I don't know if they're different, but it should matter).

Any help will be really appreciated.

0 Answers
Related