This class :
import org.jasypt.util.text.BasicTextEncryptor;
public class TestSame {
public static void main(String args[]){
BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
textEncryptor.setPassword("test");
System.out.println(textEncryptor.encrypt("test"));
System.out.println(textEncryptor.encrypt("test"));
System.out.println(textEncryptor.decrypt("Nv4nMcuVwsvWVuYD7Av44Q=="));
System.out.println(textEncryptor.decrypt("bjU82X18p9gAivwomA+NpQ=="));
}
}
Generates this output :
n3G0M4YH8QjPU+YMYsfTmw==
ftokGN7dMKyLtKBaim2RTQ==
test
test
Why are the encrypted texts different? The decrypted texts are the same so how is able to decrypt the password since each encrypted text is different ?
I would expect that the same text using the same password and same encryption would generate the same encrypted text, but this does not seem to be the case ?
From the documentation: