Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for Encrypt with PHP, Decrypt with Javascript (cryptojs)

Current License: CC BY-SA 4.0

13 events
when toggle format what by license comment
Jun 28, 2019 at 22:21 comment added Jim Flood Stop editing my answer for frivolous reasons or I will delete it. Sign your graffiti.
Jun 28, 2019 at 22:19 history edited Jim Flood CC BY-SA 4.0
added 48 characters in body
May 3, 2019 at 20:36 history rollback Braiam
Rollback to Revision 2
Jun 1, 2018 at 17:47 history edited Jim Flood CC BY-SA 4.0
added 54 characters in body
Jun 1, 2018 at 13:55 comment added Braiam The updates to your answer are visible from the revisions link.
Jun 1, 2018 at 13:55 history rollback Braiam
Rollback to Revision 2
Dec 29, 2017 at 21:11 history edited Jim Flood CC BY-SA 3.0
added 213 characters in body
Dec 29, 2017 at 5:50 history edited Scott Arciszewski CC BY-SA 3.0
Add necessary crypto warnings.
May 12, 2015 at 12:08 comment added Scott Arciszewski MCRYPT_RAND is not a CSPRNG. You want a CSPRNG for IVs in CBC mode. Also, tonyarcieri.com/…
Jun 22, 2014 at 18:06 comment added Jim Flood Each \u0000 is adding a zero byte 0x00, or two zero bytes if the string is UTF-16. Mcrypt must be padding the key to 16, 24, or 32 bytes. If this is ASCII or UTF-8, it would be 16 bytes. If UTF-16, then 32 bytes. You should be using a stronger key. Pick a key size of 16, 24, or 32 bytes and make it from cryptographically strong random data.
Jun 22, 2014 at 18:03 comment added Jim Flood "this is the text here" encoded in UTF-16 would be 42 bytes, which would be padded to 48 for encryption. Those extra 6 bytes would appear as three UTF-16 chars at the end, which would explain three funny chars. Try CryptoJS.pad.NoPadding, and look at the binary value of those last bytes. Are they all 0x00, or all 0x06?
Jun 22, 2014 at 17:20 comment added user2769 Thanks! I wasn't able to get your example working unfortunately. When I removed the "padding: CryptoJS.pad.ZeroPadding", It would sortof work -- but adds "���" to the end of string. Also, I was wondering how to change the encrpytion key in your example. What does "\u0000\u0000\u0000" mean and how do I determine how much I need?
Jun 21, 2014 at 22:16 history answered Jim Flood CC BY-SA 3.0

AltStyle によって変換されたページ (->オリジナル) /