Encryption function returns different output every time
cryptography, encryption, jasypt, java
Solution
It is probably using random IVs or random padding. This is actually important for security under some attacks but it will result in different ciphertexts for the same message.
Problem
I have following code - ``` import org.jasypt.util.text.BasicTextEncryptor; public static void main(String[] args) { BasicTextEncryptor textEncryptor = new BasicTextEncryptor(); textEncryptor.setPassword("kshitiz"); String cipherText = textEncryptor.encrypt("my_secret"); System.out.println(cipherText); } ``` Every time I run it the output is different - 1st run - `7vZzcsVFortOUf4yLyQ9xSEUM2pKSXAs` 2nd run - `Z3YDxfPpubGAQMpr+5MAKR5P09mAJ7Wd` 3rd run - `kVGIGcCEXZDFJnV/n0lxyFN5WW7dWMT7` All the outputs are correct as decrypting them gives me `my_secret`. How is this so?