在 Node 中解码 base64 编码的密码.js该密码是用 PHP 编码的



如何在 Node 中解码一个 base64 字符串.js它是用 PHP 编码的,如下所示:

base64_encode(openssl_encrypt ('password', "AES-256-CBC",  'keyforthepassword',  OPENSSL_RAW_DATA, '6114'))

6114 是一个人的 ID。

要在 PHP 中解码它,我将运行:

openssl_decrypt(base64_decode ('encoded_password'), "AES-256-CBC", 'keyforthepassword', OPENSSL_RAW_DATA, '6114')

如何在 Node.js 中进行上述解密?

var string=<get your string here>;
new Buffer(string,'base64').toString('ascii');

最新更新