Skip to content
Advertisement

Convert Javascript encryption logic to PHP (Probably AES Method)

I’m having issue to convert following javascript encryption logic to PHP, this javascript library cannot be found on internet so there is no documentation or clue where to start.

It seem the encryption is using AES method but it weird because AES only accept input string and secret, the iv didn’t match the variable s on the javascript (not 16bits)

JavaScript

https://jsfiddle.net/8swegkv6/3/

Thanks

Advertisement

Answer

The following code is simple AES CBC en-/decryption without any proper exception handling and for educational purposes only.

All credits go to @Topaco who examined the algorithm & mode, key and iv.

Please don’t use this code in production as it uses static key & iv!

result:

JavaScript

code:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement