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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -