java - Encryption function returns different output everytime -
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 run output different -
1st run - 7vzzcsvfortouf4ylyq9xseum2pksxas
2nd run - z3ydxfppubgaqmpr+5makr5p09maj7wd
3rd run - kvgigccexzdfjnv/n0lxyfn5ww7dwmt7
all outputs correct decrypting them gives me my_secret
.
how so?
it using random ivs or random padding. important security under attacks result in different ciphertexts same message.
Comments
Post a Comment