V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
bestehen
V2EX  ›  Node.js

js 加密 运行报错

  •  
  •   bestehen · 2018-07-22 00:41:07 +08:00 · 3485 次点击
    这是一个创建于 2321 天前的主题,其中的信息可能已经有所发展或是发生改变。

    https://www.v2ex.com/t/471332#reply29 原帖 因为算法内容太多,所以只保留小部分

    if (1 === o) { var D = N.length, j = 0; D && (j = N.charCodeAt(D - 1)), j<=8 && (N = N.substring(0, D - j)) }

    N ==decodeURIComponent(escape(N)) } return N }

    /home/shenjianlin/js/code.js:42 N ==decodeURIComponent(escape(N)) ^

    URIError: URI malformed at decodeURIComponent (native) at a (/home/shenjianlin/js/code.js:42:6) at n (/home/shenjianlin/js/code.js:57:19) at Object.<anonymous> (/home/shenjianlin/js/code.js:64:13) at Module._compile (module.js:577:32) at Object.Module._extensions..js (module.js:586:10) at Module.load (module.js:494:32) at tryModuleLoad (module.js:453:12) at Function.Module._load (module.js:445:3) at Module.runMain (module.js:611:10)

    3 条回复    2018-07-23 01:00:08 +08:00
    skinny
        1
    skinny  
       2018-07-22 09:20:32 +08:00
    你应该好好学英语。
    airdge
        2
    airdge  
       2018-07-22 20:38:49 +08:00
    atob 换成这个
    function atob(a) {
    var b, c, e, d, f, g = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1];
    d = a.length;
    e = 0;
    for (f = ""; e < d;) {
    do b = g[a.charCodeAt(e++) & 255]; while (e < d && -1 == b);
    if (-1 == b) break;
    do c = g[a.charCodeAt(e++) & 255]; while (e < d && -1 == c);
    if (-1 == c) break;
    f += String.fromCharCode(b << 2 | (c & 48) >> 4);
    do {
    b = a.charCodeAt(e++) & 255;
    if (61 == b) return f;
    b = g[b]
    } while (e < d && -1 == b);
    if (-1 == b) break;
    f += String.fromCharCode((c & 15) << 4 | (b & 60) >> 2);
    do {
    c = a.charCodeAt(e++) & 255;
    if (61 == c) return f;
    c = g[c]
    } while (e < d && -1 == c);
    if (-1 == c) break;
    f += String.fromCharCode((b & 3) << 6 | c)
    }
    return f
    }
    bestehen
        3
    bestehen  
    OP
       2018-07-23 01:00:08 +08:00
    @airdge 已经解决,谢谢,主要原因是字符串太长,被隐藏了!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1293 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 17:55 · PVG 01:55 · LAX 09:55 · JFK 12:55
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.