I use crypto-js
to encrypt data in javascript. The code is:
const ps = CryptoJS.AES.encrypt('789', 'qwertyuiopasdfghjklzxcvbnmQWERTY', {
iv: 'qwertyuiopasdfgh',
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});
console.log(ps.toString());
That 789
is my string and qwertyuiopasdfghjklzxcvbnmQWERTY
is secret key.
Output is:
U2FsdGVkX1/7qI5ivsfqwo1/2ta6br74JjchhUxOL9Y=
But in online crypto websites, result is not the same as mine. for example https://anycript.com/crypto
or https://www.javainuse.com/aesgenerator
have same result with 256 bits for key size:
rTCEJwv7cF51UeuIVOqgxA==
That is different from mine. I examined different values for padding parameters but the result is not as expected result yet. What is wrong with crypto-js
?