Page 1 of 1

Question about encrypt

Posted: Tue Nov 18, 2014 7:54 am
by name
Hi. Your program working very good. but...
if i encrypt some *.txt file with password "123456" and if i encrypt this *.txt file with password "123456" again then i will see two different files! Why? I must see two equal files, because passwords is equal and content of files is equal and name of files equal too. I hope what you give me answer. Thank you.

Re: Question about encrypt

Posted: Wed Nov 19, 2014 5:19 am
by paulej
No two files are ever encrypted exactly the same. I assume you might be looking at the hash of the files using sha-1 or similar? With that, they'll always be different.

The reason is that the password is used to encrypt a session key that is a random 256-bit key. It is the session key that is used to encrypt the bulk of the file.

AES Crypt also uses CBC, which uses an IV of 16 bytes. That is not a secret value, but is is randomly generated.

That's why you'll never see the same file encrypted with the same password result in an identical file.