marcobellaccini/pyAesCrypt

Different output for the same password

aorandexiaohai opened this issue · 2 comments

password="123456"
pyAesCrypt.encryptFile("data.txt", "output1.aes", password)
pyAesCrypt.encryptFile("data.txt", "output2.aes", password)

"output1.aes" and "output2.aes" will have different md5 values.

What I need is that "output1.aes" and "output2.aes" should be the same.

Hi,
this is by design.
Every time a file is encrypted, a fresh, random "session-key" is generated and used to encrypt it.
The session-key, in turn, is encrypted with a key derived from the provided passphrase.
So, if you encrypt the same file twice with the same passphrase, you'll end up with two different files.
This is correct and it's a desired security feature.

Cheers

Marco

All right.

I developed a version based on pycropto by myself.