entronad / crypto-es

A cryptography algorithms library
Other
272 stars 30 forks source link

TripleDes / Des encrypt & decrypt result are not same as crypto-js #22

Closed tonyfung99 closed 1 year ago

tonyfung99 commented 3 years ago

CryptoES.TripleDES.encrypt(DATA, CryptoES.enc.Utf8.parse(KEY), { mode: CryptoES.mode.ECB, format: CryptoES.format.OpenSSL });

As title, seems crypto-es is unable to produce the same output in both encrypt and decrypt as crypto-js. The output seems incorrect.

brownsugar commented 2 years ago

Same here. DES decryption got different results, in CryptoJS I got the correct result, in CryptoES I need to split the encrypted HEX string to get the correct result.

With CryptoJS https://codepen.io/brownsugar/pres/OJjJPYY?editors=0012

With CryptoES https://codesandbox.io/s/cryptoes-des-decryption-zt4cs

akashraj9828 commented 2 years ago

@entronad is there any update on this?

entronad commented 1 year ago

This issue has been fixed in v2.0.0;

The blockSize should be an instance field not a static field so that it can be correctly overridden and called. this matters in ES6 class so the definition should differ from CryptoJS.

This issue only affected TripleDes / Des.