Domanda

I have java code that use jasypt (Java Simplified Encryption) library:

    StandardStringDigester digester = new StandardStringDigester();
    digester.setAlgorithm("MD5");
    digester.setIterations(1);

    FixedStringSaltGenerator saltGenerator = new FixedStringSaltGenerator();
    saltGenerator.setSalt("justAnotherSalt");

    digester.setSaltGenerator(saltGenerator);
    digester.setSaltSizeBytes(5);

    String digest = digester.digest("my_password");

    System.out.println(digest);

You can see that I used MD5 algorithm with salt.

The result in console is:

I9uMOxDiImtxMXKXkt2EUw==

I want to know why there are "==" characters in the end of result string? It's only exist if I used Salt.

È stato utile?

Soluzione

StandardStringDigester.digest API says The result is encoded in BASE64 (default) or HEXADECIMAL and returned as an ASCII String. In your case this is BASE64

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top