Skip to content

Commit

Permalink
fixed example when encrypting in JS and decrypting in PHP
Browse files Browse the repository at this point in the history
  • Loading branch information
brainfoolong authored Jul 6, 2020
1 parent e0f3fbc commit e770b23
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ You need the file `dist/cryptojs-aes.min.js` and `dist/cryptojs-aes-format.js`
// encrypt value
let valueToEncrypt = 'foobar' // this could also be object/array/whatever
let password = '123456'
let encrypted = CryptoJS.AES.encrypt(valueToEncrypt, password, { format: CryptoJSAesJson }).toString()
let encrypted = CryptoJS.AES.encrypt(JSON.stringify(valueToEncrypt), password, { format: CryptoJSAesJson }).toString()
console.log('Encrypted: ' + encrypted)
// something like: {"ct":"NJzdx9GyvW6RglcNeldSng==","iv":"ad4bdf7f5a89ec335083bedaff34e851","s":"9a607051e0f4517e"}
})()
Expand Down

0 comments on commit e770b23

Please sign in to comment.