crypto-es icon indicating copy to clipboard operation
crypto-es copied to clipboard

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

Open tonyfung99 opened this issue 3 years ago • 2 comments

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.

tonyfung99 avatar Sep 13 '21 02:09 tonyfung99

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

brownsugar avatar Oct 09 '21 10:10 brownsugar

@entronad is there any update on this?

akashraj9828 avatar Aug 11 '22 06:08 akashraj9828

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.

entronad avatar Jul 11 '23 01:07 entronad