Why is AES encrypted cipher of the same string with the same key always different?

后端 未结 4 1203
我寻月下人不归
我寻月下人不归 2021-01-21 14:21

I have a file called plain.txt. Inside the file I have:

Hello Hello Hello Hello

I am using this command to encrypt it:

openssl          


        
4条回答
  •  既然无缘
    2021-01-21 14:47

    You get different outputs on each run because new salt is generated each time you run the command. In order to provide the same salt for each consecutive run use -S salt option, i.e.

    openssl enc -aes-128-cbc -salt -S "Salt" -k "Hello" -in plain.txt -out encrypted.bin
    

提交回复
热议问题