Last active
August 29, 2015 14:01
-
-
Save loufq/6bc7d2118868cfa3c1f1 to your computer and use it in GitHub Desktop.
nodejs aes-256-cbc Decrypt pair2C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//require cyrpto module | |
var crypto=require('crypto'); | |
//key and iv should be same as the one in encrypt.php | |
var decipher=crypto.createDecipheriv('aes-256-cbc','12345678901234561234567890123456','1234567890123456'); | |
//since we have already added padding while encrypting, we will set autopadding of node js to false. | |
decipher.setAutoPadding(false); | |
// copy the output of encrypt.php and paste it below | |
var cipherHexText256="lLQaaOH/C0YiHTpl2FsBag=="; | |
var dec = decipher.update(cipherHexText256,'base64','utf8'); | |
//decrypted data is stored in dec | |
dec += decipher.final('utf8'); | |
console.log(dec); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment