nodejs base64编码/解码

来源:互联网 发布:河北三金网络 编辑:程序博客网 时间:2024/06/04 01:21
e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function aaa(r) {    var o = String(r).replace(/=+$/, "");    if (o.length % 4 == 1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");    for (var n, a, i = 0, c = 0, d = ""; a = o.charAt(c++); ~a && (n = i % 4 ? 64 * n + a : a, i++ % 4) ? d += String.fromCharCode(255 & n >> (-2 * i & 6)) : 0)a = e.indexOf(a);    return d}function bbb(r) {    for (var o, n, a = String(r), i = 0, c = e, d = ""; a.charAt(0 | i) || (c = "=", i % 1); d += c.charAt(63 & o >> 8 - i % 1 * 8)) {        if (n = a.charCodeAt(i += .75), n > 255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");        o = o << 8 | n    }    return d}
0 0
原创粉丝点击