brix / crypto-js

JavaScript library of crypto standards.
Other
15.83k stars 2.39k forks source link

Different Result between php openssl_encryp #361

Open Amazing1974 opened 3 years ago

Amazing1974 commented 3 years ago

hi everybody

let key = "FbcCY2yCFBwVCUE9R+6kJ4fAL4BJxxaa"
let iv = "e16ce913a20dadb8"
let data = "13940289470"
let encrypted = CryptoJS.AES.encrypt(
  data,
  CryptoJS.enc.Utf8.parse(key),
  {
    iv: CryptoJS.enc.Utf8.parse(iv),
    mode: CrypoJS.mode.CBC,
    padding: CryptoJS.pad.Pkcs7,
    blockSize: 256 / 32
  }
)

the result of this is difference from php openssl_encrypt(data, "AES-256-CBC", $key, 0, $iv);

Can you help me to make them the same? please help me. Thanks

polypixeldev commented 3 years ago

Sorry, I don't completely understand what the issue is. Could you please clarify what's wrong? If you need help with how to use crypto-js, the docs are at https://cryptojs.gitbook.io/docs/. AES is described at https://cryptojs.gitbook.io/docs/#ciphers.