atob 或者btoa 方法是浏览器实现的而非 js 自带,需要需要使用这两个方法需要自己实现 最前面加上这段js 就可以使用了
global.Buffer = global.Buffer || require('buffer').Buffer; if (typeof btoa === 'undefined') { global.btoa = function (str) { return new Buffer.from(str, "binary").toString('base64'); }; } if (typeof atob === 'undefined') { global.atob = function (b64Encoded) { return new Buffer.from(b64Encoded, 'base64').toString("binary"); }; } (function(a) { var a = atob(a); var b = []; for (var i = 0; i < 32; i++) { b.push(a[i].charCodeAt()) } var c = []; for (var i = 0; i < 16; i++) { c.push(0) } var d = (b[0] % 8) * 2 - 1; if (d < 0) { d = 5 } for (var i = 0; i < 16; i++) { var j = (((i + 1) % 16) * d) % 16; c[j] = b[i] ^ b[16 + i] } var a = ''; for (var i = 0; i < 16; i++) { a += String.fromCharCode(c[i]) } console.log(btoa(a)) } )("SZZ0XDbSPf3OdgwIM2axNScLRZjRvmgmcr7S6J/d9dA=");