Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AES CBC is producing different result when encrypting the same string with the same key #234

Closed
ionutale opened this issue Oct 1, 2019 · 3 comments

Comments

@ionutale
Copy link

ionutale commented Oct 1, 2019

AES CBC is producing different result when encrypting the same string-data with the same key (password):

{ "password": "secretkey", "data": "very important data" }

run 1: U2FsdGVkX19FrkhtU0z3wgHQ7wawStvpe2onu4LbT0g7RcUejKS714z34a6lONOE

run 2: U2FsdGVkX1+fli14tUL6NurpYVRW4Cp6PUqhUOEBOrSxMYgMVRTbc5vwmYO5TwX/

run 3: U2FsdGVkX18xpwj2RIt3Qz7qtS0kNv4ZF/XRoDCRDsC1JgzNSAfGZsUNt1/bjkvM

run 4: U2FsdGVkX19fi+SOVjcO/2bR5VqjhOyvJS1B+z/xJ5DVDnnqby+6/6kEaM+n6Vmz

run 5: U2FsdGVkX18toNL/PAiClfBW3C8xa+41IiSL5b0Vi4HD2it1ExyeDGfyTyZu2yuG

is this the way it suppose to work?

@TobiasWen
Copy link

I don't have any knowledge about the implementation in crypto-js but normally each AES CBC encryption starts with a randomly generated initialization vector for the first block encryption. The result is then used as initialization vector for the next block. So in fact the ciphertexts never should be the same.

@blankey1337
Copy link

This is due to it having a salt, totally expected.

@max-lai
Copy link

max-lai commented Jan 9, 2020

Duplicate of #217

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants