`const crypto = require('crypto');
// 支付宝接口返回
var data = "4m4HcVZR14pvTtmNbqgkH3qtmLhJpCZx6oi6u2stmGUo2Z3OmKhtHF/VaiFQ023pKJvhXwSRVjC3IBaotOduxO/zIrIqfg+xnvBWY2zYC/UDLPbsm66yz8omvQLRBGsP8MHYLaOFEgFUgREOCa8AKH7u9v6YlnTIdp1XZGGZnKydissMwTiU4xrM5quZnFwqgTSXmCzSEfeHfjr4qTO+pLGRfY/0J/U932FCq012udkj0pA1UspfCnUU4LY8z3AiPr63TKS4ZEj5Pxz5x7beTf5pGQDrrFHaB87/dbbo8V/143RalmWsyNTiKlAA6S8OO4uXtL6tkYXCddyYQnk6waYqrZOgJLnVS5o9PLzzChU="
// 支付小程序配置
var aes = 'Lj59Ubk1ZyzlUZGTKgTl6A==';
var response = Buffer.from(data,'base64') ;
var aes1 = Buffer.from(aes,'base64');
`const crypto = require('crypto'); // 支付宝接口返回 var data = "4m4HcVZR14pvTtmNbqgkH3qtmLhJpCZx6oi6u2stmGUo2Z3OmKhtHF/VaiFQ023pKJvhXwSRVjC3IBaotOduxO/zIrIqfg+xnvBWY2zYC/UDLPbsm66yz8omvQLRBGsP8MHYLaOFEgFUgREOCa8AKH7u9v6YlnTIdp1XZGGZnKydissMwTiU4xrM5quZnFwqgTSXmCzSEfeHfjr4qTO+pLGRfY/0J/U932FCq012udkj0pA1UspfCnUU4LY8z3AiPr63TKS4ZEj5Pxz5x7beTf5pGQDrrFHaB87/dbbo8V/143RalmWsyNTiKlAA6S8OO4uXtL6tkYXCddyYQnk6waYqrZOgJLnVS5o9PLzzChU=" // 支付小程序配置 var aes = 'Lj59Ubk1ZyzlUZGTKgTl6A=='; var response = Buffer.from(data,'base64') ; var aes1 = Buffer.from(aes,'base64');
console.log('aes1 :', aes1); var iv = Buffer.alloc(aes1.length, '\0'); const aesDecode = function (data, key) { let src = ''; const decipher = crypto.createCipheriv('aes-128-cbc', key, iv); src += decipher.update(data); src += decipher.final('utf8'); return src; }; // ascii utf8 utf16le base64 latin1 hex console.log('encode_aes128(response) :',aesDecode(response,aes1)); `