ehristoforu commited on
Commit
e07524c
1 Parent(s): eb71323

Upload 2 files

Browse files
Files changed (2) hide show
  1. encrypt.html +1392 -0
  2. sw.js +40 -0
encrypt.html ADDED
@@ -0,0 +1,1392 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
+ <title>加密HTML</title>
9
+ <style>
10
+ .main {
11
+ width: 60%;
12
+ margin: 0 auto;
13
+ }
14
+
15
+ .main>* {
16
+ margin-top: 10px;
17
+ }
18
+
19
+ textarea {
20
+ border-radius: 3px;
21
+ width: 100%;
22
+ height: 200px;
23
+ }
24
+
25
+ #passData {
26
+ width: 100%;
27
+ }
28
+ </style>
29
+ </head>
30
+
31
+ <body>
32
+ <div class="main">
33
+ <div>请输入密码</div>
34
+ <input id="passData" placeholder="密码(越复杂安全性越好)" />
35
+ <div>
36
+ <label for="enableCompress">是否压缩</label>
37
+ <input type="checkbox" id="enableCompress" checked="true">
38
+ </div>
39
+ <div>
40
+ <label for="enableRemember">允许记住密码</label>
41
+ <input type="checkbox" id="enableRemember" checked="true">
42
+ </div>
43
+ <div id="expireRemember">
44
+ <span>记住密码有效期(单位:天)</span>
45
+ <input id="expireDays" placeholder="默认:0(永不过期)" />
46
+ </div>
47
+ <div>请输入要加密的HTML内容</div>
48
+ <textarea id="inputData" placeholder="<html><head>..."></textarea>
49
+ <button id="genHTML">生成加密HTML</button>
50
+ <textarea id="outputData" style="display: none;"></textarea>
51
+ <button id="downHTML" style="display: none;">下载加密HTML文件</button>
52
+ </div>
53
+ <script>
54
+ var n = Uint8Array, r = Uint16Array, e = Int32Array, i = new n([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0]), o = new n([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0]), s = new n([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), a = function (n, f) {for (var a = new r(31), t = 0; t < 31; ++t)a[t] = f += 1 << n[t - 1]; var o = new e(a[30]); for (t = 1; t < 30; ++t)for (var i = a[t]; i < a[t + 1]; ++i)o[i] = i - a[t] << 5 | t; return {b: a, r: o}}, u = a(i, 2), h = u.b, f = u.r; h[28] = 258, f[258] = 28; for (var c = a(o, 0), p = c.r, v = new r(32768), d = 0; d < 32768; ++d) {var g = (43690 & d) >> 1 | (21845 & d) << 1; v[d] = ((65280 & (g = (61680 & (g = (52428 & g) >> 2 | (13107 & g) << 2)) >> 4 | (3855 & g) << 4)) >> 8 | (255 & g) << 8) >> 1} var y = function (n, f, e) {for (var a = n.length, t = 0, o = new r(f); t < a; ++t)n[t] && ++o[n[t] - 1]; var i, l = new r(f); for (t = 1; t < f; ++t)l[t] = l[t - 1] + o[t - 1] << 1; if (e) {i = new r(1 << f); var u = 15 - f; for (t = 0; t < a; ++t)if (n[t]) for (var s = t << 4 | n[t], h = f - n[t], w = l[n[t] - 1]++ << h, c = w | (1 << h) - 1; w <= c; ++w)i[v[w] >> u] = s} else for (i = new r(a), t = 0; t < a; ++t)n[t] && (i[t] = v[l[n[t] - 1]++] >> 15 - n[t]); return i}, m = new n(288); for (d = 0; d < 144; ++d)m[d] = 8; for (d = 144; d < 256; ++d)m[d] = 9; for (d = 256; d < 280; ++d)m[d] = 7; for (d = 280; d < 288; ++d)m[d] = 8; var b = new n(32); for (d = 0; d < 32; ++d)b[d] = 5; var w = y(m, 9, 0), z = y(b, 5, 0), T = function (r) {return (r + 7) / 8 | 0}, D = function (r, f, e) {(null == f || f < 0) && (f = 0), (null == e || e > r.length) && (e = r.length); var a = new n(e - f); return a.set(r.subarray(f, e)), a}, F = function (r, n, f) {var e = n / 8 | 0; r[e] |= f <<= 7 & n, r[e + 1] |= f >> 8}, E = function (r, n, f) {var e = n / 8 | 0; r[e] |= f <<= 7 & n, r[e + 1] |= f >> 8, r[e + 2] |= f >> 16}, Z = function (f, e) {for (var a = [], t = 0; t < f.length; ++t)f[t] && a.push({s: t, f: f[t]}); var o = a.length, i = a.slice(); if (!o) return {t: N, l: 0}; if (1 == o) {var v = new n(a[0].s + 1); return v[a[0].s] = 1, {t: v, l: 1}} a.sort((function (r, n) {return r.f - n.f})), a.push({s: -1, f: 25001}); var l = a[0], u = a[1], s = 0, h = 1, w = 2; for (a[0] = {s: -1, f: l.f + u.f, l: l, r: u}; h != o - 1;)l = a[a[s].f < a[w].f ? s++ : w++], u = a[s != h && a[s].f < a[w].f ? s++ : w++], a[h++] = {s: -1, f: l.f + u.f, l: l, r: u}; var c = i[0].s; for (t = 1; t < o; ++t)i[t].s > c && (c = i[t].s); var d = new r(c + 1), g = O(a[h - 1], d, 0); if (g > e) {t = 0; var m = 0, y = g - e, b = 1 << y; for (i.sort((function (r, n) {return d[n.s] - d[r.s] || r.f - n.f})); t < o; ++t) {var M = i[t].s; if (!(d[M] > e)) break; m += b - (1 << g - d[M]), d[M] = e} for (m >>= y; m > 0;) {var F = i[t].s; d[F] < e ? m -= 1 << e - d[F]++ - 1 : ++t} for (; t >= 0 && m; --t) {var p = i[t].s; d[p] == e && (--d[p], ++m)} g = e} return {t: new n(d), l: g}}, O = function (r, n, f) {return -1 == r.s ? Math.max(O(r.l, n, f + 1), O(r.r, n, f + 1)) : n[r.s] = f}, G = function (n) {for (var f = n.length; f && !n[--f];); for (var e = new r(++f), a = 0, t = n[0], o = 1, i = function (r) {e[a++] = r}, v = 1; v <= f; ++v)if (n[v] == t && v != f) ++o; else {if (!t && o > 2) {for (; o > 138; o -= 138)i(32754); o > 2 && (i(o > 10 ? o - 11 << 5 | 28690 : o - 3 << 5 | 12305), o = 0)} else if (o > 3) {for (i(t), --o; o > 6; o -= 6)i(8304); o > 2 && (i(o - 3 << 5 | 8208), o = 0)} for (; o--;)i(t); o = 1, t = n[v]} return {c: e.subarray(0, a), n: f}}, L = function (r, n) {for (var f = 0, e = 0; e < n.length; ++e)f += r[e] * n[e]; return f}, q = function (r, n, f) {var e = f.length, a = T(n + 2); r[a] = 255 & e, r[a + 1] = e >> 8, r[a + 2] = 255 ^ r[a], r[a + 3] = 255 ^ r[a + 1]; for (var t = 0; t < e; ++t)r[a + t + 4] = f[t]; return 8 * (a + 4 + e)}, H = function (n, f, e, a, t, v, l, u, h, c, d) {F(f, d++, e), ++t[256]; for (var g = Z(t, 15), M = g.t, p = g.l, O = Z(v, 15), x = O.t, A = O.l, H = G(M), T = H.c, j = H.n, k = G(x), D = k.c, K = k.n, N = new r(19), P = 0; P < T.length; ++P)++N[31 & T[P]]; for (P = 0; P < D.length; ++P)++N[31 & D[P]]; for (var U = Z(N, 7), I = U.t, S = U.l, B = 19; B > 4 && !I[s[B - 1]]; --B); var C, J, Q, R, V = c + 5 << 3, W = L(t, m) + L(v, b) + l, X = L(t, M) + L(v, x) + l + 14 + 3 * B + L(N, I) + 2 * N[16] + 3 * N[17] + 7 * N[18]; if (h >= 0 && V <= W && V <= X) return q(f, d, n.subarray(h, h + c)); if (F(f, d, 1 + (X < W)), d += 2, X < W) {C = y(M, p, 0), J = M, Q = y(x, A, 0), R = x; var Y = y(I, S, 0); for (F(f, d, j - 257), F(f, d + 5, K - 1), F(f, d + 10, B - 4), d += 14, P = 0; P < B; ++P)F(f, d + 3 * P, I[s[P]]); d += 3 * B; for (var $ = [T, D], _ = 0; _ < 2; ++_) {var rr = $[_]; for (P = 0; P < rr.length; ++P)F(f, d, Y[fr = 31 & rr[P]]), d += I[fr], fr > 15 && (F(f, d, rr[P] >> 5 & 127), d += rr[P] >> 12)} } else C = w, J = m, Q = z, R = b; for (P = 0; P < u; ++P) {var nr = a[P]; if (nr > 255) {var fr; E(f, d, C[257 + (fr = nr >> 18 & 31)]), d += J[fr + 257], fr > 7 && (F(f, d, nr >> 23 & 31), d += i[fr]); var er = 31 & nr; E(f, d, Q[er]), d += R[er], er > 3 && (E(f, d, nr >> 5 & 8191), d += o[er])} else E(f, d, C[nr]), d += J[nr]} return E(f, d, C[256]), d + J[256]}, j = new e([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]), N = new n(0), P = function (a, t, v, l, u, s) {var h = s.z || a.length, w = new n(l + h + 5 * (1 + Math.ceil(h / 7e3)) + u), c = w.subarray(l, w.length - u), d = s.l, g = 7 & (s.r || 0); if (t) {g && (c[0] = s.r >> 3); for (var m = j[t - 1], y = m >> 13, b = 8191 & m, M = (1 << v) - 1, F = s.p || new r(32768), E = s.h || new r(M + 1), L = Math.ceil(v / 3), O = 2 * L, Z = function (r) {return (a[r] ^ a[r + 1] << L ^ a[r + 2] << O) & M}, x = new e(25e3), z = new r(288), A = new r(32), G = 0, k = 0, K = s.i || 0, N = 0, P = s.w || 0, U = 0; K + 2 < h; ++K) {var I = Z(K), S = 32767 & K, B = E[I]; if (F[S] = B, E[I] = S, P <= K) {var C = h - K; if ((G > 7e3 || N > 24576) && (C > 423 || !d)) {g = H(a, c, 0, x, z, A, k, N, U, K - U, g), N = G = k = 0, U = K; for (var J = 0; J < 286; ++J)z[J] = 0; for (J = 0; J < 30; ++J)A[J] = 0} var Q = 2, R = 0, V = b, W = S - B & 32767; if (C > 2 && I == Z(K - W)) for (var X = Math.min(y, C) - 1, Y = Math.min(32767, K), $ = Math.min(258, C); W <= Y && --V && S != B;) {if (a[K + Q] == a[K + Q - W]) {for (var _ = 0; _ < $ && a[K + _] == a[K + _ - W]; ++_); if (_ > Q) {if (Q = _, R = W, _ > X) break; var rr = Math.min(W, _ - 2), nr = 0; for (J = 0; J < rr; ++J) {var fr = K - W + J & 32767, er = fr - F[fr] & 32767; er > nr && (nr = er, B = fr)} } } W += (S = B) - (B = F[S]) & 32767} if (R) {x[N++] = 268435456 | f[Q] << 18 | p[R]; var ar = 31 & f[Q], tr = 31 & p[R]; k += i[ar] + o[tr], ++z[257 + ar], ++A[tr], P = K + Q, ++G} else x[N++] = a[K], ++z[a[K]]} } for (K = Math.max(K, P); K < h; ++K)x[N++] = a[K], ++z[a[K]]; g = H(a, c, d, x, z, A, k, N, U, K - U, g), d || (s.r = 7 & g | c[g / 8 | 0] << 3, g -= 7, s.h = E, s.p = F, s.i = K, s.w = P)} else {for (K = s.w || 0; K < h + d; K += 65535) {var or = K + 65535; or >= h && (c[g / 8 | 0] = d, or = h), g = q(c, g + 1, a.subarray(K, or))} s.i = h} return D(w, 0, l + T(g) + u)}, K = function (r, f, e, a, t) {if (!t && (t = {l: 1}, f.dictionary)) {var o = f.dictionary.subarray(-32768), i = new n(o.length + r.length); i.set(o), i.set(r, o.length), r = i, t.w = o.length} return P(r, null == f.level ? 6 : f.level, null == f.mem ? Math.ceil(1.5 * Math.max(8, Math.min(13, Math.log(r.length)))) : 12 + f.mem, e, a, t)}; function deflateSync(r, n) {return K(r, n || {}, 0, 0)}
55
+ </script>
56
+ <script>
57
+ const sjcl = {
58
+ cipher: {},
59
+ hash: {},
60
+ keyexchange: {},
61
+ mode: {},
62
+ misc: {},
63
+ codec: {},
64
+ exception: {
65
+ corrupt: function (message) {
66
+ this.toString = function () {return "CORRUPT: " + this.message;};
67
+ this.message = message;
68
+ },
69
+ invalid: function (message) {
70
+ this.toString = function () {return "INVALID: " + this.message;};
71
+ this.message = message;
72
+ },
73
+ bug: function (message) {
74
+ this.toString = function () {return "BUG: " + this.message;};
75
+ this.message = message;
76
+ },
77
+ notReady: function (message) {
78
+ this.toString = function () {return "NOT READY: " + this.message;};
79
+ this.message = message;
80
+ }
81
+ }
82
+ };
83
+ sjcl.bitArray = {
84
+ bitSlice: function (a, bstart, bend) {
85
+ a = sjcl.bitArray._shiftRight(a.slice(bstart / 32), 32 - (bstart & 31)).slice(1);
86
+ return (bend === undefined) ? a : sjcl.bitArray.clamp(a, bend - bstart);
87
+ },
88
+ concat: function (a1, a2) {
89
+ if (a1.length === 0 || a2.length === 0) {
90
+ return a1.concat(a2);
91
+ }
92
+ let last = a1[a1.length - 1], shift = sjcl.bitArray.getPartial(last);
93
+ if (shift === 32) {
94
+ return a1.concat(a2);
95
+ } else {
96
+ return sjcl.bitArray._shiftRight(a2, shift, last | 0, a1.slice(0, a1.length - 1));
97
+ }
98
+ },
99
+ bitLength: function (a) {
100
+ let l = a.length, x;
101
+ if (l === 0) {return 0;}
102
+ x = a[l - 1];
103
+ return (l - 1) * 32 + sjcl.bitArray.getPartial(x);
104
+ },
105
+ clamp: function (a, len) {
106
+ if (a.length * 32 < len) {return a;}
107
+ a = a.slice(0, Math.ceil(len / 32));
108
+ let l = a.length;
109
+ len = len & 31;
110
+ if (l > 0 && len) {
111
+ a[l - 1] = sjcl.bitArray.partial(len, a[l - 1] & 0x80000000 >> (len - 1), 1);
112
+ }
113
+ return a;
114
+ },
115
+ partial: function (len, x, _end) {
116
+ if (len === 32) {return x;}
117
+ return (_end ? x | 0 : x << (32 - len)) + len * 0x10000000000;
118
+ },
119
+ getPartial: function (x) {
120
+ return Math.round(x / 0x10000000000) || 32;
121
+ },
122
+ equal: function (a, b) {
123
+ if (sjcl.bitArray.bitLength(a) !== sjcl.bitArray.bitLength(b)) {
124
+ return false;
125
+ }
126
+ let x = 0, i;
127
+ for (i = 0; i < a.length; i++) {
128
+ x |= a[i] ^ b[i];
129
+ }
130
+ return (x === 0);
131
+ },
132
+ _shiftRight: function (a, shift, carry, out) {
133
+ let i, last2 = 0, shift2;
134
+ if (out === undefined) {out = [];}
135
+ for (; shift >= 32; shift -= 32) {
136
+ out.push(carry);
137
+ carry = 0;
138
+ }
139
+ if (shift === 0) {
140
+ return out.concat(a);
141
+ }
142
+ for (i = 0; i < a.length; i++) {
143
+ out.push(carry | a[i] >>> shift);
144
+ carry = a[i] << (32 - shift);
145
+ }
146
+ last2 = a.length ? a[a.length - 1] : 0;
147
+ shift2 = sjcl.bitArray.getPartial(last2);
148
+ out.push(sjcl.bitArray.partial(shift + shift2 & 31, (shift + shift2 > 32) ? carry : out.pop(), 1));
149
+ return out;
150
+ }
151
+ };
152
+ sjcl.codec.bytes = {
153
+ fromBits: function (arr) {
154
+ let out = [], bl = sjcl.bitArray.bitLength(arr), i, tmp;
155
+ for (i = 0; i < bl / 8; i++) {
156
+ if ((i & 3) === 0) {
157
+ tmp = arr[i / 4];
158
+ }
159
+ out.push(tmp >>> 24);
160
+ tmp <<= 8;
161
+ }
162
+ return out;
163
+ },
164
+ toBits: function (bytes) {
165
+ let out = [], i, tmp = 0;
166
+ for (i = 0; i < bytes.length; i++) {
167
+ tmp = tmp << 8 | bytes[i];
168
+ if ((i & 3) === 3) {
169
+ out.push(tmp);
170
+ tmp = 0;
171
+ }
172
+ }
173
+ if (i & 3) {
174
+ out.push(sjcl.bitArray.partial(8 * (i & 3), tmp));
175
+ }
176
+ return out;
177
+ }
178
+ };
179
+ sjcl.codec.utf8String = {
180
+ fromBits: function (arr) {
181
+ let out = "", bl = sjcl.bitArray.bitLength(arr), i, tmp;
182
+ for (i = 0; i < bl / 8; i++) {
183
+ if ((i & 3) === 0) {
184
+ tmp = arr[i / 4];
185
+ }
186
+ out += String.fromCharCode(tmp >>> 8 >>> 8 >>> 8);
187
+ tmp <<= 8;
188
+ }
189
+ return decodeURIComponent(escape(out));
190
+ },
191
+ toBits: function (str) {
192
+ str = unescape(encodeURIComponent(str));
193
+ let out = [], i, tmp = 0;
194
+ for (i = 0; i < str.length; i++) {
195
+ tmp = tmp << 8 | str.charCodeAt(i);
196
+ if ((i & 3) === 3) {
197
+ out.push(tmp);
198
+ tmp = 0;
199
+ }
200
+ }
201
+ if (i & 3) {
202
+ out.push(sjcl.bitArray.partial(8 * (i & 3), tmp));
203
+ }
204
+ return out;
205
+ }
206
+ };
207
+ sjcl.hash.sha1 = function (hash) {
208
+ if (hash) {
209
+ this._h = hash._h.slice(0);
210
+ this._buffer = hash._buffer.slice(0);
211
+ this._length = hash._length;
212
+ } else {
213
+ this.reset();
214
+ }
215
+ };
216
+ sjcl.hash.sha1.hash = function (data) {
217
+ return (new sjcl.hash.sha1()).update(data).finalize();
218
+ };
219
+ sjcl.hash.sha1.prototype = {
220
+ blockSize: 512,
221
+ reset: function () {
222
+ this._h = this._init.slice(0);
223
+ this._buffer = [];
224
+ this._length = 0;
225
+ return this;
226
+ },
227
+ update: function (data) {
228
+ if (typeof data === "string") {
229
+ data = sjcl.codec.utf8String.toBits(data);
230
+ }
231
+ let i, b = this._buffer = sjcl.bitArray.concat(this._buffer, data),
232
+ ol = this._length,
233
+ nl = this._length = ol + sjcl.bitArray.bitLength(data);
234
+ if (nl > 9007199254740991) {
235
+ throw new sjcl.exception.invalid("Cannot hash more than 2^53 - 1 bits");
236
+ }
237
+ if (typeof Uint32Array !== "undefined") {
238
+ let c = new Uint32Array(b);
239
+ let j = 0;
240
+ for (i = this.blockSize + ol - ((this.blockSize + ol) & (this.blockSize - 1)); i <= nl;
241
+ i += this.blockSize) {
242
+ this._block(c.subarray(16 * j, 16 * (j + 1)));
243
+ j += 1;
244
+ }
245
+ b.splice(0, 16 * j);
246
+ } else {
247
+ for (i = this.blockSize + ol - ((this.blockSize + ol) & (this.blockSize - 1)); i <= nl;
248
+ i += this.blockSize) {
249
+ this._block(b.splice(0, 16));
250
+ }
251
+ }
252
+ return this;
253
+ },
254
+ finalize: function () {
255
+ let i, b = this._buffer, h = this._h;
256
+ b = sjcl.bitArray.concat(b, [sjcl.bitArray.partial(1, 1)]);
257
+ for (i = b.length + 2; i & 15; i++) {
258
+ b.push(0);
259
+ }
260
+ b.push(Math.floor(this._length / 0x100000000));
261
+ b.push(this._length | 0);
262
+ while (b.length) {
263
+ this._block(b.splice(0, 16));
264
+ }
265
+ this.reset();
266
+ return h;
267
+ },
268
+ _init: [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0],
269
+ _key: [0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6],
270
+ _f: function (t, b, c, d) {
271
+ if (t <= 19) {
272
+ return (b & c) | (~b & d);
273
+ } else if (t <= 39) {
274
+ return b ^ c ^ d;
275
+ } else if (t <= 59) {
276
+ return (b & c) | (b & d) | (c & d);
277
+ } else if (t <= 79) {
278
+ return b ^ c ^ d;
279
+ }
280
+ },
281
+ _S: function (n, x) {
282
+ return (x << n) | (x >>> 32 - n);
283
+ },
284
+ _block: function (words) {
285
+ let t, tmp, a, b, c, d, e,
286
+ h = this._h;
287
+ let w;
288
+ if (typeof Uint32Array !== "undefined") {
289
+ w = Array(80);
290
+ for (let j = 0; j < 16; j++) {
291
+ w[j] = words[j];
292
+ }
293
+ } else {
294
+ w = words;
295
+ }
296
+ a = h[0]; b = h[1]; c = h[2]; d = h[3]; e = h[4];
297
+ for (t = 0; t <= 79; t++) {
298
+ if (t >= 16) {
299
+ w[t] = this._S(1, w[t - 3] ^ w[t - 8] ^ w[t - 14] ^ w[t - 16]);
300
+ }
301
+ tmp = (this._S(5, a) + this._f(t, b, c, d) + e + w[t] +
302
+ this._key[Math.floor(t / 20)]) | 0;
303
+ e = d;
304
+ d = c;
305
+ c = this._S(30, b);
306
+ b = a;
307
+ a = tmp;
308
+ }
309
+ h[0] = (h[0] + a) | 0;
310
+ h[1] = (h[1] + b) | 0;
311
+ h[2] = (h[2] + c) | 0;
312
+ h[3] = (h[3] + d) | 0;
313
+ h[4] = (h[4] + e) | 0;
314
+ }
315
+ };
316
+ sjcl.cipher.aes = function (key) {
317
+ if (!this._tables[0][0][0]) {
318
+ this._precompute();
319
+ }
320
+ let i, j, tmp,
321
+ encKey, decKey,
322
+ sbox = this._tables[0][4], decTable = this._tables[1],
323
+ keyLen = key.length, rcon = 1;
324
+ if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) {
325
+ throw new sjcl.exception.invalid("invalid aes key size");
326
+ }
327
+ this._key = [encKey = key.slice(0), decKey = []];
328
+ for (i = keyLen; i < 4 * keyLen + 28; i++) {
329
+ tmp = encKey[i - 1];
330
+ if (i % keyLen === 0 || (keyLen === 8 && i % keyLen === 4)) {
331
+ tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255];
332
+ if (i % keyLen === 0) {
333
+ tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24;
334
+ rcon = rcon << 1 ^ (rcon >> 7) * 283;
335
+ }
336
+ }
337
+ encKey[i] = encKey[i - keyLen] ^ tmp;
338
+ }
339
+ for (j = 0; i; j++, i--) {
340
+ tmp = encKey[j & 3 ? i : i - 4];
341
+ if (i <= 4 || j < 4) {
342
+ decKey[j] = tmp;
343
+ } else {
344
+ decKey[j] = decTable[0][sbox[tmp >>> 24]] ^
345
+ decTable[1][sbox[tmp >> 16 & 255]] ^
346
+ decTable[2][sbox[tmp >> 8 & 255]] ^
347
+ decTable[3][sbox[tmp & 255]];
348
+ }
349
+ }
350
+ };
351
+ sjcl.cipher.aes.prototype = {
352
+ encrypt: function (data) {return this._crypt(data, 0);},
353
+ decrypt: function (data) {return this._crypt(data, 1);},
354
+ _tables: [[[], [], [], [], []], [[], [], [], [], []]],
355
+ _precompute: function () {
356
+ let encTable = this._tables[0], decTable = this._tables[1],
357
+ sbox = encTable[4], sboxInv = decTable[4],
358
+ i, x, xInv, d = [], th = [], x2, x4, x8, s, tEnc, tDec;
359
+ for (i = 0; i < 256; i++) {
360
+ th[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i;
361
+ }
362
+ for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {
363
+ s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4;
364
+ s = s >> 8 ^ s & 255 ^ 99;
365
+ sbox[x] = s;
366
+ sboxInv[s] = x;
367
+ x8 = d[x4 = d[x2 = d[x]]];
368
+ tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100;
369
+ tEnc = d[s] * 0x101 ^ s * 0x1010100;
370
+ for (i = 0; i < 4; i++) {
371
+ encTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8;
372
+ decTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8;
373
+ }
374
+ }
375
+ for (i = 0; i < 5; i++) {
376
+ encTable[i] = encTable[i].slice(0);
377
+ decTable[i] = decTable[i].slice(0);
378
+ }
379
+ },
380
+ _crypt: function (input, dir) {
381
+ if (input.length !== 4) {
382
+ throw new sjcl.exception.invalid("invalid aes block size");
383
+ }
384
+ let key = this._key[dir],
385
+ a = input[0] ^ key[0],
386
+ b = input[dir ? 3 : 1] ^ key[1],
387
+ c = input[2] ^ key[2],
388
+ d = input[dir ? 1 : 3] ^ key[3],
389
+ a2, b2, c2,
390
+ nInnerRounds = key.length / 4 - 2,
391
+ i,
392
+ kIndex = 4,
393
+ out = [0, 0, 0, 0],
394
+ table = this._tables[dir],
395
+ t0 = table[0],
396
+ t1 = table[1],
397
+ t2 = table[2],
398
+ t3 = table[3],
399
+ sbox = table[4];
400
+ for (i = 0; i < nInnerRounds; i++) {
401
+ a2 = t0[a >>> 24] ^ t1[b >> 16 & 255] ^ t2[c >> 8 & 255] ^ t3[d & 255] ^ key[kIndex];
402
+ b2 = t0[b >>> 24] ^ t1[c >> 16 & 255] ^ t2[d >> 8 & 255] ^ t3[a & 255] ^ key[kIndex + 1];
403
+ c2 = t0[c >>> 24] ^ t1[d >> 16 & 255] ^ t2[a >> 8 & 255] ^ t3[b & 255] ^ key[kIndex + 2];
404
+ d = t0[d >>> 24] ^ t1[a >> 16 & 255] ^ t2[b >> 8 & 255] ^ t3[c & 255] ^ key[kIndex + 3];
405
+ kIndex += 4;
406
+ a = a2; b = b2; c = c2;
407
+ }
408
+ for (i = 0; i < 4; i++) {
409
+ out[dir ? 3 & -i : i] =
410
+ sbox[a >>> 24] << 24 ^
411
+ sbox[b >> 16 & 255] << 16 ^
412
+ sbox[c >> 8 & 255] << 8 ^
413
+ sbox[d & 255] ^
414
+ key[kIndex++];
415
+ a2 = a; a = b; b = c; c = d; d = a2;
416
+ }
417
+ return out;
418
+ }
419
+ };
420
+ sjcl.misc.hmac = function (key, Hash) {
421
+ this._hash = Hash = Hash || sjcl.hash.sha1;
422
+ let exKey = [[], []], i,
423
+ bs = Hash.prototype.blockSize / 32;
424
+ this._baseHash = [new Hash(), new Hash()];
425
+ if (key.length > bs) {
426
+ key = Hash.hash(key);
427
+ }
428
+ for (i = 0; i < bs; i++) {
429
+ exKey[0][i] = key[i] ^ 0x36363636;
430
+ exKey[1][i] = key[i] ^ 0x5C5C5C5C;
431
+ }
432
+ this._baseHash[0].update(exKey[0]);
433
+ this._baseHash[1].update(exKey[1]);
434
+ this._resultHash = new Hash(this._baseHash[0]);
435
+ };
436
+ sjcl.misc.hmac.prototype.encrypt = sjcl.misc.hmac.prototype.mac = function (data) {
437
+ if (!this._updated) {
438
+ this.update(data);
439
+ return this.digest(data);
440
+ } else {
441
+ throw new sjcl.exception.invalid("encrypt on already updated hmac called!");
442
+ }
443
+ };
444
+ sjcl.misc.hmac.prototype.reset = function () {
445
+ this._resultHash = new this._hash(this._baseHash[0]);
446
+ this._updated = false;
447
+ };
448
+ sjcl.misc.hmac.prototype.update = function (data) {
449
+ this._updated = true;
450
+ this._resultHash.update(data);
451
+ };
452
+ sjcl.misc.hmac.prototype.digest = function () {
453
+ let w = this._resultHash.finalize(), result = new (this._hash)(this._baseHash[1]).update(w).finalize();
454
+ this.reset();
455
+ return result;
456
+ };
457
+ sjcl.misc.pbkdf2 = function (password, salt, count, length, Prff) {
458
+ count = count || 10000;
459
+ if (length < 0 || count < 0) {
460
+ throw new sjcl.exception.invalid("invalid params to pbkdf2");
461
+ }
462
+ if (typeof password === "string") {
463
+ password = sjcl.codec.utf8String.toBits(password);
464
+ }
465
+ if (typeof salt === "string") {
466
+ salt = sjcl.codec.utf8String.toBits(salt);
467
+ }
468
+ Prff = Prff || sjcl.misc.hmac;
469
+ let prf = new Prff(password),
470
+ u, ui, i, j, k, out = [], b = sjcl.bitArray;
471
+ for (k = 1; 32 * out.length < (length || 1); k++) {
472
+ u = ui = prf.encrypt(b.concat(salt, [k]));
473
+ for (i = 1; i < count; i++) {
474
+ ui = prf.encrypt(ui);
475
+ for (j = 0; j < ui.length; j++) {
476
+ u[j] ^= ui[j];
477
+ }
478
+ }
479
+ out = out.concat(u);
480
+ }
481
+ if (length) {out = b.clamp(out, length);}
482
+ return out;
483
+ };
484
+ sjcl.random = {
485
+ randomWords: function (nbytes) {
486
+ function getCryptoModule() {
487
+ try {
488
+ return require("crypto");
489
+ }
490
+ catch (e) {
491
+ return null;
492
+ }
493
+ }
494
+ let crypto;
495
+ if (typeof window !== "undefined") {
496
+ if (window.crypto) {
497
+ crypto = window.crypto;
498
+ } else if (window.msCrypto) {
499
+ crypto = window.msCrypto;
500
+ }
501
+ } else if (typeof self !== "undefined" && self.crypto) {
502
+ crypto = self.crypto;
503
+ } else if (typeof module !== "undefined" && module.exports) {
504
+ crypto = getCryptoModule();
505
+ } else if (typeof global !== "undefined" && global.crypto) {
506
+ crypto = global.crypto;
507
+ }
508
+ try {
509
+ if (crypto) {
510
+ if (crypto.getRandomValues) {
511
+ return sjcl.codec.bytes.toBits(crypto.getRandomValues(new Uint8Array(nbytes)));
512
+ }
513
+ if (crypto.randomBytes) {
514
+ return sjcl.codec.bytes.toBits(new Uint8Array(crypto.randomBytes(nbytes)));
515
+ }
516
+ } else {
517
+ return getRandomValues(nbytes);
518
+ }
519
+ } catch (e) {
520
+ return getRandomValues(nbytes);
521
+ }
522
+ },
523
+ getRandomValues: function (nbytes) {
524
+ let words = [];
525
+ let r = function (m_w) {
526
+ let m_z = 0x3ade68b1;
527
+ let mask = 0xffffffff;
528
+ return function () {
529
+ m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;
530
+ m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;
531
+ let result = ((m_z << 0x10) + m_w) & mask;
532
+ result /= 0x100000000;
533
+ result += 0.5;
534
+ return result * (Math.random() > .5 ? 1 : -1);
535
+ };
536
+ };
537
+ for (let i = 0, rcache; i < nbytes; i += 4) {
538
+ let _r = r((rcache || Math.random()) * 0x100000000);
539
+ rcache = _r() * 0x3ade67b7;
540
+ words.push((_r() * 0x100000000) | 0);
541
+ }
542
+ return words;
543
+ }
544
+ };
545
+ sjcl.mode.ctr = {
546
+ name: "ctr",
547
+ encrypt: function (prf, plaintext, iv) {
548
+ return sjcl.mode.ctr._calculate(prf, plaintext, iv);
549
+ },
550
+ decrypt: function (prf, ciphertext, iv) {
551
+ return sjcl.mode.ctr._calculate(prf, ciphertext, iv);
552
+ },
553
+ _calculate: function (prf, data, iv) {
554
+ let l, bl, res, c, d, e, i;
555
+ if (sjcl.bitArray.bitLength(iv) !== 128) {
556
+ throw new sjcl.exception.invalid("ctr iv must be 128 bits");
557
+ }
558
+ if (!(l = data.length)) {
559
+ return [];
560
+ }
561
+ c = iv.slice(0);
562
+ d = data.slice(0);
563
+ bl = sjcl.bitArray.bitLength(d);
564
+ for (i = 0; i < l; i += 4) {
565
+ e = prf.encrypt(c);
566
+ d[i] ^= e[0];
567
+ d[i + 1] ^= e[1];
568
+ d[i + 2] ^= e[2];
569
+ d[i + 3] ^= e[3];
570
+ for (let carry = 3; carry >= 0; carry--) {
571
+ if (++c[carry]) break;
572
+ }
573
+ }
574
+ return sjcl.bitArray.clamp(d, bl);
575
+ }
576
+ };
577
+ </script>
578
+ <script>
579
+ enableRemember.onchange = () => {
580
+ expireRemember.style.display = enableRemember.checked ? "block" : "none";
581
+ }
582
+ genHTML.onclick = () => {
583
+ downHTML.style.display = outputData.style.display = "none";
584
+ if (!passData.value) {
585
+ alert("密码不能为空!");
586
+ return;
587
+ }
588
+ if (!inputData.value) {
589
+ alert("HTML不能为空!");
590
+ return;
591
+ }
592
+ encryptString(inputData.value, passData.value);
593
+ }
594
+ downHTML.onclick = () => {
595
+ let a = document.createElement("a");
596
+ a.download = "encrypted_index.html";
597
+ a.href = URL.createObjectURL(new Blob([outputData.value]));
598
+ a.click();
599
+ }
600
+ const encoder = new TextEncoder();
601
+ const decoder = new TextDecoder();
602
+ const passwordVerifierLen = 4;
603
+ const aesKeyLen = 16;
604
+ const saltLen = 8;
605
+ function encryptString(data, password) {
606
+ const salt = sjcl.random.randomWords(saltLen);
607
+ const derivedKey = sjcl.misc.pbkdf2(password, salt, 1000, (aesKeyLen + passwordVerifierLen) * 8);
608
+ const aesKey = sjcl.bitArray.bitSlice(derivedKey, 0, aesKeyLen * 8);
609
+ const derivedPassVerifier = sjcl.bitArray.bitSlice(derivedKey, aesKeyLen * 8);
610
+ const preData = sjcl.bitArray.concat(salt, derivedPassVerifier);
611
+ let uint8Data = encoder.encode(data);
612
+ if (enableCompress.checked) {
613
+ uint8Data = deflateSync(uint8Data);
614
+ }
615
+ const result = sjcl.mode.ctr.encrypt(new sjcl.cipher.aes(aesKey), sjcl.codec.bytes.toBits(uint8Data), [0, 0, 0, 0]);
616
+ const reader = new FileReader()
617
+ reader.onload = () => {
618
+ let baseRes = reader.result.substring(reader.result.indexOf(',') + 1);
619
+ let htmlRes = `<!DOCTYPE html>
620
+ <html lang="zh-CN">
621
+
622
+ <head>
623
+ <meta charset="UTF-8">
624
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
625
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
626
+ <title>加密页面</title>
627
+ <style>
628
+ * {
629
+ box-sizing: border-box;
630
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji" !important;
631
+ }
632
+
633
+ #loadMask {
634
+ position: fixed;
635
+ top: 0;
636
+ left: 0;
637
+ right: 0;
638
+ bottom: 0;
639
+ z-index: 100;
640
+ background-color: #edeff2;
641
+ display: flex;
642
+ justify-content: center;
643
+ align-items: center;
644
+ }
645
+
646
+ #loadMask>div {
647
+ text-align: center;
648
+ }
649
+
650
+ #loadMask>div>div {
651
+ font-size: 40px;
652
+ color: #909090;
653
+ }
654
+
655
+ #loadMask svg {
656
+ width: 160px;
657
+ height: 80px;
658
+ }
659
+
660
+ .passArea {
661
+ width: 200px;
662
+ }
663
+
664
+ #passData {
665
+ height: 40px;
666
+ display: block;
667
+ outline: none;
668
+ border: none;
669
+ width: 100%;
670
+ padding-left: 10px;
671
+ font-size: 18px;
672
+ border-radius: 3px;
673
+ -webkit-text-security: disc;
674
+ }
675
+
676
+ .activeBtn {
677
+ background: #99c959 !important;
678
+ }
679
+
680
+ label {
681
+ margin-top: 8px;
682
+ font-size: 16px;
683
+ display: flex;
684
+ color: #909090;
685
+ align-items: center;
686
+ line-height: 20px;
687
+ height: 20px;
688
+ }
689
+
690
+ #rememberMe {
691
+ -webkit-appearance: none;
692
+ appearance: none;
693
+ width: 20px;
694
+ height: 20px;
695
+ border: 2px solid #909090;
696
+ border-radius: 2px;
697
+ margin: 0 8px 0 0;
698
+ }
699
+
700
+ #rememberMe::before {
701
+ content: "";
702
+ display: block;
703
+ /* margin: 1px; */
704
+ width: 16px;
705
+ height: 16px;
706
+ transform: scale(0);
707
+ background: #99c959;
708
+ clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
709
+ }
710
+
711
+ #rememberMe:checked::before {
712
+ transform: scale(1);
713
+ }
714
+
715
+ #goChat {
716
+ margin-top: 8px;
717
+ font-size: 18px;
718
+ background: #b8da8b;
719
+ border-radius: 3px;
720
+ height: 100%;
721
+ color: white;
722
+ padding: 0 15px;
723
+ text-align: center;
724
+ line-height: 40px;
725
+ cursor: pointer;
726
+ }
727
+ </style>
728
+ </head>
729
+
730
+ <body>
731
+ <div id="loadMask">
732
+ <div>
733
+ <div>ChatGPT</div>
734
+ <svg viewBox="0 0 200 100" preserveAspectRatio="xMidYMid">
735
+ <g transform="translate(50 50)">
736
+ <circle cx="0" cy="0" r="15" fill="#e15b64">
737
+ <animateTransform attributeName="transform" type="scale" begin="-0.3333333333333333s"
738
+ calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1"
739
+ dur="1s" repeatCount="indefinite"></animateTransform>
740
+ </circle>
741
+ </g>
742
+ <g transform="translate(100 50)">
743
+ <circle cx="0" cy="0" r="15" fill="#f8b26a">
744
+ <animateTransform attributeName="transform" type="scale" begin="-0.16666666666666666s"
745
+ calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1"
746
+ dur="1s" repeatCount="indefinite"></animateTransform>
747
+ </circle>
748
+ </g>
749
+ <g transform="translate(150 50)">
750
+ <circle cx="0" cy="0" r="15" fill="#99c959">
751
+ <animateTransform attributeName="transform" type="scale" begin="0s" calcMode="spline"
752
+ keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s"
753
+ repeatCount="indefinite"></animateTransform>
754
+ </circle>
755
+ </g>
756
+ </svg>
757
+ <div class="passArea">
758
+ <input id="passData" type="text" placeholder="请输入密码" autocomplete="off" />
759
+ `+(enableRemember.checked ?`<label for="rememberMe">
760
+ <input type="checkbox" id="rememberMe" checked="true">
761
+ 记住密码
762
+ </label>`:"") +
763
+ `<div id="goChat">开始</div>
764
+ </div>
765
+ </div>
766
+ </div>
767
+ ` + (enableCompress.checked ? `<script>
768
+ {const t=Uint8Array,n=Uint16Array,e=Int32Array,r=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),o=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),l=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=(t,r)=>{const o=new n(31);for(let n=0;n<31;++n)o[n]=r+=1<<t[n-1];const l=new e(o[30]);for(let t=1;t<30;++t)for(let n=o[t];n<o[t+1];++n)l[n]=n-o[t]<<5|t;return{b:o,r:l}},{b:c,r:i}=s(r,2);c[28]=258,i[258]=28;const{b:f}=s(o,0),a=new n(32768);for(let t=0;t<32768;++t){let n=(43690&t)>>1|(21845&t)<<1;n=(52428&n)>>2|(13107&n)<<2,n=(61680&n)>>4|(3855&n)<<4,a[t]=((65280&n)>>8|(255&n)<<8)>>1}const u=(t,e,r)=>{const o=t.length;let l=0;const s=new n(e);for(;l<o;++l)t[l]&&++s[t[l]-1];const c=new n(e);for(l=1;l<e;++l)c[l]=c[l-1]+s[l-1]<<1;let i;if(r){i=new n(1<<e);const r=15-e;for(l=0;l<o;++l)if(t[l]){const n=l<<4|t[l],o=e-t[l];let s=c[t[l]-1]++<<o;for(const t=s|(1<<o)-1;s<=t;++s)i[a[s]>>r]=n}}else for(i=new n(o),l=0;l<o;++l)t[l]&&(i[l]=a[c[t[l]-1]++]>>15-t[l]);return i},w=new t(288);for(let t=0;t<144;++t)w[t]=8;for(let t=144;t<256;++t)w[t]=9;for(let t=256;t<280;++t)w[t]=7;for(let t=280;t<288;++t)w[t]=8;const d=new t(32);for(let t=0;t<32;++t)d[t]=5;const b=u(w,9,1),h=u(d,5,1),g=t=>{let n=t[0];for(let e=1;e<t.length;++e)t[e]>n&&(n=t[e]);return n},y=(t,n,e)=>{const r=n/8|0;return(t[r]|t[r+1]<<8)>>(7&n)&e},k=(t,n)=>{const e=n/8|0;return(t[e]|t[e+1]<<8|t[e+2]<<16)>>(7&n)},m=t=>(t+7)/8|0,p=(n,e,r)=>{(null==e||e<0)&&(e=0),(null==r||r>n.length)&&(r=n.length);const o=new t(r-e);return o.set(n.subarray(e,r)),o},v=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=(t,n,e)=>{const r=new Error(n||v[t]);if(r.code=t,Error.captureStackTrace&&Error.captureStackTrace(r,E),!e)throw r;return r},x=(n,e,s,i)=>{const a=n.length,w=i?i.length:0;if(!a||e.f&&!e.l)return s||new t(0);const d=!s||2!=e.i,v=e.i;s||(s=new t(3*a));const x=n=>{let e=s.length;if(n>e){const r=new t(Math.max(2*e,n));r.set(s),s=r}};let A=e.f||0,S=e.p||0,T=e.b||0,U=e.l,F=e.d,M=e.m,z=e.n;const I=8*a;do{if(!U){A=y(n,S,1);const r=y(n,S+1,3);if(S+=3,!r){const t=m(S)+4,r=n[t-4]|n[t-3]<<8,o=t+r;if(o>a){v&&E(0);break}d&&x(T+r),s.set(n.subarray(t,o),T),e.b=T+=r,e.p=S=8*o,e.f=A;continue}if(1==r)U=b,F=h,M=9,z=5;else if(2==r){const e=y(n,S,31)+257,r=y(n,S+10,15)+4,o=e+y(n,S+5,31)+1;S+=14;const s=new t(o),c=new t(19);for(let t=0;t<r;++t)c[l[t]]=y(n,S+3*t,7);S+=3*r;const i=g(c),f=(1<<i)-1,a=u(c,i,1);for(let t=0;t<o;){const e=a[y(n,S,f)];S+=15&e;const r=e>>4;if(r<16)s[t++]=r;else{let e=0,o=0;for(16==r?(o=3+y(n,S,3),S+=2,e=s[t-1]):17==r?(o=3+y(n,S,7),S+=3):18==r&&(o=11+y(n,S,127),S+=7);o--;)s[t++]=e}}const w=s.subarray(0,e),d=s.subarray(e);M=g(w),z=g(d),U=u(w,M,1),F=u(d,z,1)}else E(1);if(S>I){v&&E(0);break}}d&&x(T+131072);const p=(1<<M)-1,O=(1<<z)-1;let j=S;for(;;j=S){const t=U[k(n,S)&p],e=t>>4;if(S+=15&t,S>I){v&&E(0);break}if(t||E(2),e<256)s[T++]=e;else{if(256==e){j=S,U=null;break}{let t=e-254;if(e>264){const o=e-257,l=r[o];t=y(n,S,(1<<l)-1)+c[o],S+=l}const l=F[k(n,S)&O],a=l>>4;l||E(3),S+=15&l;let u=f[a];if(a>3){const t=o[a];u+=k(n,S)&(1<<t)-1,S+=t}if(S>I){v&&E(0);break}d&&x(T+131072);const b=T+t;if(T<u){const t=w-u,n=Math.min(u,b);for(t+T<0&&E(3);T<n;++T)s[T]=i[t+T]}for(;T<b;T+=4)s[T]=s[T-u],s[T+1]=s[T+1-u],s[T+2]=s[T+2-u],s[T+3]=s[T+3-u];T=b}}}e.l=U,e.p=j,e.b=T,e.f=A,U&&(A=1,e.m=M,e.d=F,e.n=z)}while(!A);return T==s.length?s:p(s,0,T)};self.inflateSync=(t,n)=>x(t,{i:2},n&&n.out,n&&n.dictionary)}
769
+ <\/script>` : "") +
770
+ `<script>
771
+ const sjcl = {
772
+ cipher: {},
773
+ hash: {},
774
+ keyexchange: {},
775
+ mode: {},
776
+ misc: {},
777
+ codec: {},
778
+ exception: {
779
+ corrupt: function (message) {
780
+ this.toString = function () {return "CORRUPT: " + this.message;};
781
+ this.message = message;
782
+ },
783
+ invalid: function (message) {
784
+ this.toString = function () {return "INVALID: " + this.message;};
785
+ this.message = message;
786
+ },
787
+ bug: function (message) {
788
+ this.toString = function () {return "BUG: " + this.message;};
789
+ this.message = message;
790
+ },
791
+ notReady: function (message) {
792
+ this.toString = function () {return "NOT READY: " + this.message;};
793
+ this.message = message;
794
+ }
795
+ }
796
+ };
797
+ sjcl.bitArray = {
798
+ bitSlice: function (a, bstart, bend) {
799
+ a = sjcl.bitArray._shiftRight(a.slice(bstart / 32), 32 - (bstart & 31)).slice(1);
800
+ return (bend === undefined) ? a : sjcl.bitArray.clamp(a, bend - bstart);
801
+ },
802
+ concat: function (a1, a2) {
803
+ if (a1.length === 0 || a2.length === 0) {
804
+ return a1.concat(a2);
805
+ }
806
+ let last = a1[a1.length - 1], shift = sjcl.bitArray.getPartial(last);
807
+ if (shift === 32) {
808
+ return a1.concat(a2);
809
+ } else {
810
+ return sjcl.bitArray._shiftRight(a2, shift, last | 0, a1.slice(0, a1.length - 1));
811
+ }
812
+ },
813
+ bitLength: function (a) {
814
+ let l = a.length, x;
815
+ if (l === 0) {return 0;}
816
+ x = a[l - 1];
817
+ return (l - 1) * 32 + sjcl.bitArray.getPartial(x);
818
+ },
819
+ clamp: function (a, len) {
820
+ if (a.length * 32 < len) {return a;}
821
+ a = a.slice(0, Math.ceil(len / 32));
822
+ let l = a.length;
823
+ len = len & 31;
824
+ if (l > 0 && len) {
825
+ a[l - 1] = sjcl.bitArray.partial(len, a[l - 1] & 0x80000000 >> (len - 1), 1);
826
+ }
827
+ return a;
828
+ },
829
+ partial: function (len, x, _end) {
830
+ if (len === 32) {return x;}
831
+ return (_end ? x | 0 : x << (32 - len)) + len * 0x10000000000;
832
+ },
833
+ getPartial: function (x) {
834
+ return Math.round(x / 0x10000000000) || 32;
835
+ },
836
+ equal: function (a, b) {
837
+ if (sjcl.bitArray.bitLength(a) !== sjcl.bitArray.bitLength(b)) {
838
+ return false;
839
+ }
840
+ let x = 0, i;
841
+ for (i = 0; i < a.length; i++) {
842
+ x |= a[i] ^ b[i];
843
+ }
844
+ return (x === 0);
845
+ },
846
+ _shiftRight: function (a, shift, carry, out) {
847
+ let i, last2 = 0, shift2;
848
+ if (out === undefined) {out = [];}
849
+ for (; shift >= 32; shift -= 32) {
850
+ out.push(carry);
851
+ carry = 0;
852
+ }
853
+ if (shift === 0) {
854
+ return out.concat(a);
855
+ }
856
+ for (i = 0; i < a.length; i++) {
857
+ out.push(carry | a[i] >>> shift);
858
+ carry = a[i] << (32 - shift);
859
+ }
860
+ last2 = a.length ? a[a.length - 1] : 0;
861
+ shift2 = sjcl.bitArray.getPartial(last2);
862
+ out.push(sjcl.bitArray.partial(shift + shift2 & 31, (shift + shift2 > 32) ? carry : out.pop(), 1));
863
+ return out;
864
+ }
865
+ };
866
+ sjcl.codec.bytes = {
867
+ fromBits: function (arr) {
868
+ let out = [], bl = sjcl.bitArray.bitLength(arr), i, tmp;
869
+ for (i = 0; i < bl / 8; i++) {
870
+ if ((i & 3) === 0) {
871
+ tmp = arr[i / 4];
872
+ }
873
+ out.push(tmp >>> 24);
874
+ tmp <<= 8;
875
+ }
876
+ return out;
877
+ },
878
+ toBits: function (bytes) {
879
+ let out = [], i, tmp = 0;
880
+ for (i = 0; i < bytes.length; i++) {
881
+ tmp = tmp << 8 | bytes[i];
882
+ if ((i & 3) === 3) {
883
+ out.push(tmp);
884
+ tmp = 0;
885
+ }
886
+ }
887
+ if (i & 3) {
888
+ out.push(sjcl.bitArray.partial(8 * (i & 3), tmp));
889
+ }
890
+ return out;
891
+ }
892
+ };
893
+ sjcl.codec.utf8String = {
894
+ fromBits: function (arr) {
895
+ let out = "", bl = sjcl.bitArray.bitLength(arr), i, tmp;
896
+ for (i = 0; i < bl / 8; i++) {
897
+ if ((i & 3) === 0) {
898
+ tmp = arr[i / 4];
899
+ }
900
+ out += String.fromCharCode(tmp >>> 8 >>> 8 >>> 8);
901
+ tmp <<= 8;
902
+ }
903
+ return decodeURIComponent(escape(out));
904
+ },
905
+ toBits: function (str) {
906
+ str = unescape(encodeURIComponent(str));
907
+ let out = [], i, tmp = 0;
908
+ for (i = 0; i < str.length; i++) {
909
+ tmp = tmp << 8 | str.charCodeAt(i);
910
+ if ((i & 3) === 3) {
911
+ out.push(tmp);
912
+ tmp = 0;
913
+ }
914
+ }
915
+ if (i & 3) {
916
+ out.push(sjcl.bitArray.partial(8 * (i & 3), tmp));
917
+ }
918
+ return out;
919
+ }
920
+ };
921
+ sjcl.hash.sha1 = function (hash) {
922
+ if (hash) {
923
+ this._h = hash._h.slice(0);
924
+ this._buffer = hash._buffer.slice(0);
925
+ this._length = hash._length;
926
+ } else {
927
+ this.reset();
928
+ }
929
+ };
930
+ sjcl.hash.sha1.hash = function (data) {
931
+ return (new sjcl.hash.sha1()).update(data).finalize();
932
+ };
933
+ sjcl.hash.sha1.prototype = {
934
+ blockSize: 512,
935
+ reset: function () {
936
+ this._h = this._init.slice(0);
937
+ this._buffer = [];
938
+ this._length = 0;
939
+ return this;
940
+ },
941
+ update: function (data) {
942
+ if (typeof data === "string") {
943
+ data = sjcl.codec.utf8String.toBits(data);
944
+ }
945
+ let i, b = this._buffer = sjcl.bitArray.concat(this._buffer, data),
946
+ ol = this._length,
947
+ nl = this._length = ol + sjcl.bitArray.bitLength(data);
948
+ if (nl > 9007199254740991) {
949
+ throw new sjcl.exception.invalid("Cannot hash more than 2^53 - 1 bits");
950
+ }
951
+ if (typeof Uint32Array !== "undefined") {
952
+ let c = new Uint32Array(b);
953
+ let j = 0;
954
+ for (i = this.blockSize + ol - ((this.blockSize + ol) & (this.blockSize - 1)); i <= nl;
955
+ i += this.blockSize) {
956
+ this._block(c.subarray(16 * j, 16 * (j + 1)));
957
+ j += 1;
958
+ }
959
+ b.splice(0, 16 * j);
960
+ } else {
961
+ for (i = this.blockSize + ol - ((this.blockSize + ol) & (this.blockSize - 1)); i <= nl;
962
+ i += this.blockSize) {
963
+ this._block(b.splice(0, 16));
964
+ }
965
+ }
966
+ return this;
967
+ },
968
+ finalize: function () {
969
+ let i, b = this._buffer, h = this._h;
970
+ b = sjcl.bitArray.concat(b, [sjcl.bitArray.partial(1, 1)]);
971
+ for (i = b.length + 2; i & 15; i++) {
972
+ b.push(0);
973
+ }
974
+ b.push(Math.floor(this._length / 0x100000000));
975
+ b.push(this._length | 0);
976
+ while (b.length) {
977
+ this._block(b.splice(0, 16));
978
+ }
979
+ this.reset();
980
+ return h;
981
+ },
982
+ _init: [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0],
983
+ _key: [0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6],
984
+ _f: function (t, b, c, d) {
985
+ if (t <= 19) {
986
+ return (b & c) | (~b & d);
987
+ } else if (t <= 39) {
988
+ return b ^ c ^ d;
989
+ } else if (t <= 59) {
990
+ return (b & c) | (b & d) | (c & d);
991
+ } else if (t <= 79) {
992
+ return b ^ c ^ d;
993
+ }
994
+ },
995
+ _S: function (n, x) {
996
+ return (x << n) | (x >>> 32 - n);
997
+ },
998
+ _block: function (words) {
999
+ let t, tmp, a, b, c, d, e,
1000
+ h = this._h;
1001
+ let w;
1002
+ if (typeof Uint32Array !== "undefined") {
1003
+ w = Array(80);
1004
+ for (let j = 0; j < 16; j++) {
1005
+ w[j] = words[j];
1006
+ }
1007
+ } else {
1008
+ w = words;
1009
+ }
1010
+ a = h[0]; b = h[1]; c = h[2]; d = h[3]; e = h[4];
1011
+ for (t = 0; t <= 79; t++) {
1012
+ if (t >= 16) {
1013
+ w[t] = this._S(1, w[t - 3] ^ w[t - 8] ^ w[t - 14] ^ w[t - 16]);
1014
+ }
1015
+ tmp = (this._S(5, a) + this._f(t, b, c, d) + e + w[t] +
1016
+ this._key[Math.floor(t / 20)]) | 0;
1017
+ e = d;
1018
+ d = c;
1019
+ c = this._S(30, b);
1020
+ b = a;
1021
+ a = tmp;
1022
+ }
1023
+ h[0] = (h[0] + a) | 0;
1024
+ h[1] = (h[1] + b) | 0;
1025
+ h[2] = (h[2] + c) | 0;
1026
+ h[3] = (h[3] + d) | 0;
1027
+ h[4] = (h[4] + e) | 0;
1028
+ }
1029
+ };
1030
+ sjcl.cipher.aes = function (key) {
1031
+ if (!this._tables[0][0][0]) {
1032
+ this._precompute();
1033
+ }
1034
+ let i, j, tmp,
1035
+ encKey, decKey,
1036
+ sbox = this._tables[0][4], decTable = this._tables[1],
1037
+ keyLen = key.length, rcon = 1;
1038
+ if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) {
1039
+ throw new sjcl.exception.invalid("invalid aes key size");
1040
+ }
1041
+ this._key = [encKey = key.slice(0), decKey = []];
1042
+ for (i = keyLen; i < 4 * keyLen + 28; i++) {
1043
+ tmp = encKey[i - 1];
1044
+ if (i % keyLen === 0 || (keyLen === 8 && i % keyLen === 4)) {
1045
+ tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255];
1046
+ if (i % keyLen === 0) {
1047
+ tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24;
1048
+ rcon = rcon << 1 ^ (rcon >> 7) * 283;
1049
+ }
1050
+ }
1051
+ encKey[i] = encKey[i - keyLen] ^ tmp;
1052
+ }
1053
+ for (j = 0; i; j++, i--) {
1054
+ tmp = encKey[j & 3 ? i : i - 4];
1055
+ if (i <= 4 || j < 4) {
1056
+ decKey[j] = tmp;
1057
+ } else {
1058
+ decKey[j] = decTable[0][sbox[tmp >>> 24]] ^
1059
+ decTable[1][sbox[tmp >> 16 & 255]] ^
1060
+ decTable[2][sbox[tmp >> 8 & 255]] ^
1061
+ decTable[3][sbox[tmp & 255]];
1062
+ }
1063
+ }
1064
+ };
1065
+ sjcl.cipher.aes.prototype = {
1066
+ encrypt: function (data) {return this._crypt(data, 0);},
1067
+ decrypt: function (data) {return this._crypt(data, 1);},
1068
+ _tables: [[[], [], [], [], []], [[], [], [], [], []]],
1069
+ _precompute: function () {
1070
+ let encTable = this._tables[0], decTable = this._tables[1],
1071
+ sbox = encTable[4], sboxInv = decTable[4],
1072
+ i, x, xInv, d = [], th = [], x2, x4, x8, s, tEnc, tDec;
1073
+ for (i = 0; i < 256; i++) {
1074
+ th[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i;
1075
+ }
1076
+ for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {
1077
+ s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4;
1078
+ s = s >> 8 ^ s & 255 ^ 99;
1079
+ sbox[x] = s;
1080
+ sboxInv[s] = x;
1081
+ x8 = d[x4 = d[x2 = d[x]]];
1082
+ tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100;
1083
+ tEnc = d[s] * 0x101 ^ s * 0x1010100;
1084
+ for (i = 0; i < 4; i++) {
1085
+ encTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8;
1086
+ decTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8;
1087
+ }
1088
+ }
1089
+ for (i = 0; i < 5; i++) {
1090
+ encTable[i] = encTable[i].slice(0);
1091
+ decTable[i] = decTable[i].slice(0);
1092
+ }
1093
+ },
1094
+ _crypt: function (input, dir) {
1095
+ if (input.length !== 4) {
1096
+ throw new sjcl.exception.invalid("invalid aes block size");
1097
+ }
1098
+ let key = this._key[dir],
1099
+ a = input[0] ^ key[0],
1100
+ b = input[dir ? 3 : 1] ^ key[1],
1101
+ c = input[2] ^ key[2],
1102
+ d = input[dir ? 1 : 3] ^ key[3],
1103
+ a2, b2, c2,
1104
+ nInnerRounds = key.length / 4 - 2,
1105
+ i,
1106
+ kIndex = 4,
1107
+ out = [0, 0, 0, 0],
1108
+ table = this._tables[dir],
1109
+ t0 = table[0],
1110
+ t1 = table[1],
1111
+ t2 = table[2],
1112
+ t3 = table[3],
1113
+ sbox = table[4];
1114
+ for (i = 0; i < nInnerRounds; i++) {
1115
+ a2 = t0[a >>> 24] ^ t1[b >> 16 & 255] ^ t2[c >> 8 & 255] ^ t3[d & 255] ^ key[kIndex];
1116
+ b2 = t0[b >>> 24] ^ t1[c >> 16 & 255] ^ t2[d >> 8 & 255] ^ t3[a & 255] ^ key[kIndex + 1];
1117
+ c2 = t0[c >>> 24] ^ t1[d >> 16 & 255] ^ t2[a >> 8 & 255] ^ t3[b & 255] ^ key[kIndex + 2];
1118
+ d = t0[d >>> 24] ^ t1[a >> 16 & 255] ^ t2[b >> 8 & 255] ^ t3[c & 255] ^ key[kIndex + 3];
1119
+ kIndex += 4;
1120
+ a = a2; b = b2; c = c2;
1121
+ }
1122
+ for (i = 0; i < 4; i++) {
1123
+ out[dir ? 3 & -i : i] =
1124
+ sbox[a >>> 24] << 24 ^
1125
+ sbox[b >> 16 & 255] << 16 ^
1126
+ sbox[c >> 8 & 255] << 8 ^
1127
+ sbox[d & 255] ^
1128
+ key[kIndex++];
1129
+ a2 = a; a = b; b = c; c = d; d = a2;
1130
+ }
1131
+ return out;
1132
+ }
1133
+ };
1134
+ sjcl.misc.hmac = function (key, Hash) {
1135
+ this._hash = Hash = Hash || sjcl.hash.sha1;
1136
+ let exKey = [[], []], i,
1137
+ bs = Hash.prototype.blockSize / 32;
1138
+ this._baseHash = [new Hash(), new Hash()];
1139
+ if (key.length > bs) {
1140
+ key = Hash.hash(key);
1141
+ }
1142
+ for (i = 0; i < bs; i++) {
1143
+ exKey[0][i] = key[i] ^ 0x36363636;
1144
+ exKey[1][i] = key[i] ^ 0x5C5C5C5C;
1145
+ }
1146
+ this._baseHash[0].update(exKey[0]);
1147
+ this._baseHash[1].update(exKey[1]);
1148
+ this._resultHash = new Hash(this._baseHash[0]);
1149
+ };
1150
+ sjcl.misc.hmac.prototype.encrypt = sjcl.misc.hmac.prototype.mac = function (data) {
1151
+ if (!this._updated) {
1152
+ this.update(data);
1153
+ return this.digest(data);
1154
+ } else {
1155
+ throw new sjcl.exception.invalid("encrypt on already updated hmac called!");
1156
+ }
1157
+ };
1158
+ sjcl.misc.hmac.prototype.reset = function () {
1159
+ this._resultHash = new this._hash(this._baseHash[0]);
1160
+ this._updated = false;
1161
+ };
1162
+ sjcl.misc.hmac.prototype.update = function (data) {
1163
+ this._updated = true;
1164
+ this._resultHash.update(data);
1165
+ };
1166
+ sjcl.misc.hmac.prototype.digest = function () {
1167
+ let w = this._resultHash.finalize(), result = new (this._hash)(this._baseHash[1]).update(w).finalize();
1168
+ this.reset();
1169
+ return result;
1170
+ };
1171
+ sjcl.misc.pbkdf2 = function (password, salt, count, length, Prff) {
1172
+ count = count || 10000;
1173
+ if (length < 0 || count < 0) {
1174
+ throw new sjcl.exception.invalid("invalid params to pbkdf2");
1175
+ }
1176
+ if (typeof password === "string") {
1177
+ password = sjcl.codec.utf8String.toBits(password);
1178
+ }
1179
+ if (typeof salt === "string") {
1180
+ salt = sjcl.codec.utf8String.toBits(salt);
1181
+ }
1182
+ Prff = Prff || sjcl.misc.hmac;
1183
+ let prf = new Prff(password),
1184
+ u, ui, i, j, k, out = [], b = sjcl.bitArray;
1185
+ for (k = 1; 32 * out.length < (length || 1); k++) {
1186
+ u = ui = prf.encrypt(b.concat(salt, [k]));
1187
+ for (i = 1; i < count; i++) {
1188
+ ui = prf.encrypt(ui);
1189
+ for (j = 0; j < ui.length; j++) {
1190
+ u[j] ^= ui[j];
1191
+ }
1192
+ }
1193
+ out = out.concat(u);
1194
+ }
1195
+ if (length) {out = b.clamp(out, length);}
1196
+ return out;
1197
+ };
1198
+ sjcl.random = {
1199
+ randomWords: function (nbytes) {
1200
+ function getCryptoModule() {
1201
+ try {
1202
+ return require("crypto");
1203
+ }
1204
+ catch (e) {
1205
+ return null;
1206
+ }
1207
+ }
1208
+ let crypto;
1209
+ if (typeof window !== "undefined") {
1210
+ if (window.crypto) {
1211
+ crypto = window.crypto;
1212
+ } else if (window.msCrypto) {
1213
+ crypto = window.msCrypto;
1214
+ }
1215
+ } else if (typeof self !== "undefined" && self.crypto) {
1216
+ crypto = self.crypto;
1217
+ } else if (typeof module !== "undefined" && module.exports) {
1218
+ crypto = getCryptoModule();
1219
+ } else if (typeof global !== "undefined" && global.crypto) {
1220
+ crypto = global.crypto;
1221
+ }
1222
+ try {
1223
+ if (crypto) {
1224
+ if (crypto.getRandomValues) {
1225
+ return sjcl.codec.bytes.toBits(crypto.getRandomValues(new Uint8Array(nbytes)));
1226
+ }
1227
+ if (crypto.randomBytes) {
1228
+ return sjcl.codec.bytes.toBits(new Uint8Array(crypto.randomBytes(nbytes)));
1229
+ }
1230
+ } else {
1231
+ return getRandomValues(nbytes);
1232
+ }
1233
+ } catch (e) {
1234
+ return getRandomValues(nbytes);
1235
+ }
1236
+ },
1237
+ getRandomValues: function (nbytes) {
1238
+ let words = [];
1239
+ let r = function (m_w) {
1240
+ let m_z = 0x3ade68b1;
1241
+ let mask = 0xffffffff;
1242
+ return function () {
1243
+ m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;
1244
+ m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;
1245
+ let result = ((m_z << 0x10) + m_w) & mask;
1246
+ result /= 0x100000000;
1247
+ result += 0.5;
1248
+ return result * (Math.random() > .5 ? 1 : -1);
1249
+ };
1250
+ };
1251
+ for (let i = 0, rcache; i < nbytes; i += 4) {
1252
+ let _r = r((rcache || Math.random()) * 0x100000000);
1253
+ rcache = _r() * 0x3ade67b7;
1254
+ words.push((_r() * 0x100000000) | 0);
1255
+ }
1256
+ return words;
1257
+ }
1258
+ };
1259
+ sjcl.mode.ctr = {
1260
+ name: "ctr",
1261
+ encrypt: function (prf, plaintext, iv) {
1262
+ return sjcl.mode.ctr._calculate(prf, plaintext, iv);
1263
+ },
1264
+ decrypt: function (prf, ciphertext, iv) {
1265
+ return sjcl.mode.ctr._calculate(prf, ciphertext, iv);
1266
+ },
1267
+ _calculate: function (prf, data, iv) {
1268
+ let l, bl, res, c, d, e, i;
1269
+ if (sjcl.bitArray.bitLength(iv) !== 128) {
1270
+ throw new sjcl.exception.invalid("ctr iv must be 128 bits");
1271
+ }
1272
+ if (!(l = data.length)) {
1273
+ return [];
1274
+ }
1275
+ c = iv.slice(0);
1276
+ d = data.slice(0);
1277
+ bl = sjcl.bitArray.bitLength(d);
1278
+ for (i = 0; i < l; i += 4) {
1279
+ e = prf.encrypt(c);
1280
+ d[i] ^= e[0];
1281
+ d[i + 1] ^= e[1];
1282
+ d[i + 2] ^= e[2];
1283
+ d[i + 3] ^= e[3];
1284
+ for (let carry = 3; carry >= 0; carry--) {
1285
+ if (++c[carry]) break;
1286
+ }
1287
+ }
1288
+ return sjcl.bitArray.clamp(d, bl);
1289
+ }
1290
+ };
1291
+ <\/script>
1292
+ <script>
1293
+ const encryptedHTML = "` + baseRes + `";
1294
+ passData.focus();
1295
+ passData.oninput = () => {
1296
+ if (passData.value.trim().length) {
1297
+ goChat.classList.add("activeBtn");
1298
+ } else {
1299
+ goChat.classList.remove("activeBtn");
1300
+ }
1301
+ }
1302
+ goChat.onclick = () => {
1303
+ decryptString(encryptedHTML, passData.value);
1304
+ }
1305
+ const decoder = new TextDecoder();
1306
+ const passwordVerifierLen = 4;
1307
+ const aesKeyLen = 16; // aes-128-ctr
1308
+ const saltLen = 8;
1309
+ const base64ToUint8Array = (base64) => {
1310
+ let byteString = atob(base64);
1311
+ let bytes = new Uint8Array(byteString.length);
1312
+ for (let i = 0; i < byteString.length; i++) {
1313
+ bytes[i] = byteString.charCodeAt(i);
1314
+ }
1315
+ return bytes
1316
+ }
1317
+ const decryptFromKey = (derivedKey, uint8Data) => {
1318
+ const derivedPassVerifier = sjcl.bitArray.bitSlice(derivedKey, aesKeyLen * 8);
1319
+ const passVerifyValue = sjcl.codec.bytes.toBits(uint8Data.subarray(saltLen, saltLen + passwordVerifierLen));
1320
+ if (!sjcl.bitArray.equal(passVerifyValue, derivedPassVerifier)) {
1321
+ alert("密码错误,请重试!")
1322
+ return;
1323
+ }
1324
+ ` + (enableRemember.checked ? `if (rememberMe && rememberMe.checked) {
1325
+ let baseKey = btoa(String.fromCharCode.apply(null, sjcl.codec.bytes.fromBits(derivedKey)));
1326
+ localStorage.setItem("staticDerivedKey", baseKey);
1327
+ if (expireDays) {
1328
+ localStorage.setItem("staticKeyExpire", new Date().getTime() + expireDays * 8.64e7);
1329
+ }
1330
+ }` : "") +
1331
+ `const aesKey = sjcl.bitArray.bitSlice(derivedKey, 0, aesKeyLen * 8);
1332
+ const encryptedData = uint8Data.subarray(saltLen + passwordVerifierLen);
1333
+ let result = new Uint8Array(sjcl.codec.bytes.fromBits(sjcl.mode.ctr.decrypt(new sjcl.cipher.aes(aesKey), sjcl.codec.bytes.toBits(encryptedData), [0, 0, 0, 0])));
1334
+ if (self.inflateSync) {
1335
+ result = self.inflateSync(result);
1336
+ }
1337
+ const utf8Result = decoder.decode(result)
1338
+ document.write(utf8Result);
1339
+ document.close();
1340
+ }
1341
+ const decryptString = (data, password) => {
1342
+ const uint8Data = base64ToUint8Array(data);
1343
+ const salt = sjcl.codec.bytes.toBits(uint8Data.subarray(0, saltLen));
1344
+ const derivedKey = sjcl.misc.pbkdf2(password, salt, 1000, (aesKeyLen + passwordVerifierLen) * 8);
1345
+ decryptFromKey(derivedKey, uint8Data)
1346
+ }
1347
+ ` + (enableRemember.checked ? `const expireDays = ${expireDays.value || 0};
1348
+ window.onload = () => {
1349
+ let localKey = localStorage.getItem("staticDerivedKey");
1350
+ if (localKey) {
1351
+ let localExpire = localStorage.getItem("staticKeyExpire")
1352
+ if (localExpire && (localExpire < new Date().getTime())) {
1353
+ localStorage.removeItem("staticDerivedKey")
1354
+ return;
1355
+ }
1356
+ const derivedKey = sjcl.codec.bytes.toBits(base64ToUint8Array(localKey));
1357
+ const uint8Data = base64ToUint8Array(encryptedHTML);
1358
+ decryptFromKey(derivedKey, uint8Data);
1359
+ }
1360
+ }`:"")+`
1361
+ <\/script>
1362
+ </body>
1363
+
1364
+ </html>`;
1365
+ outputData.value = htmlRes;
1366
+ downHTML.style.display = outputData.style.display = "block";
1367
+ }
1368
+ reader.readAsDataURL(new Blob([new Uint8Array(sjcl.codec.bytes.fromBits(sjcl.bitArray.concat(preData, result)))]))
1369
+ }
1370
+ function decryptString(data, password) {
1371
+ const byteString = window.atob(data);
1372
+ const uint8Data = new Uint8Array(byteString.length);
1373
+ for (let i = 0; i < byteString.length; i++) {
1374
+ uint8Data[i] = byteString.charCodeAt(i);
1375
+ }
1376
+ const salt = sjcl.codec.bytes.toBits(uint8Data.subarray(0, saltLen));
1377
+ const derivedKey = sjcl.misc.pbkdf2(password, salt, 1000, (aesKeyLen + passwordVerifierLen) * 8);
1378
+ const derivedPassVerifier = sjcl.bitArray.bitSlice(derivedKey, aesKeyLen * 8);
1379
+ const passVerifyValue = sjcl.codec.bytes.toBits(uint8Data.subarray(saltLen, saltLen + passwordVerifierLen));
1380
+ if (!sjcl.bitArray.equal(passVerifyValue, derivedPassVerifier)) {
1381
+ throw new Error("Wrong password!");
1382
+ }
1383
+ const aesKey = sjcl.bitArray.bitSlice(derivedKey, 0, aesKeyLen * 8);
1384
+ const encryptedData = uint8Data.subarray(saltLen + passwordVerifierLen);
1385
+ const result = sjcl.mode.ctr.decrypt(new sjcl.cipher.aes(aesKey), sjcl.codec.bytes.toBits(encryptedData), [0, 0, 0, 0]);
1386
+ const utf8Result = decoder.decode(new Uint8Array(sjcl.codec.bytes.fromBits(result)))
1387
+ console.log(utf8Result);
1388
+ }
1389
+ </script>
1390
+ </body>
1391
+
1392
+ </html>
sw.js ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const cacheName = "caches-v0.9.8";
2
+
3
+ self.addEventListener("install", (e) => {
4
+ e.waitUntil(
5
+ caches.open(cacheName)
6
+ .then(cache => cache.addAll(["./", "./index.html", "./icon.png"]))
7
+ )
8
+ });
9
+
10
+ self.addEventListener("fetch", (e) => {
11
+ e.respondWith(
12
+ caches.match(e.request).then(r => {
13
+ if (r) return r;
14
+ return fetch(e.request).then(response => {
15
+ // only cache css & js
16
+ if (/^http.+(\.css|\.js)$/.test(e.request.url) && !/(\/env\.js)$/.test(e.request.url) && response.ok) {
17
+ const cloned = response.clone();
18
+ caches.open(cacheName).then(cache => {
19
+ cache.put(e.request, cloned);
20
+ })
21
+ };
22
+ return response;
23
+ })
24
+ })
25
+ )
26
+ });
27
+
28
+ self.addEventListener("activate", (e) => {
29
+ e.waitUntil(
30
+ caches.keys().then((keyList) => {
31
+ return Promise.all(
32
+ keyList.map((key) => {
33
+ if (key !== cacheName) {
34
+ return caches.delete(key);
35
+ }
36
+ })
37
+ )
38
+ })
39
+ )
40
+ });