if (typeof $ === 'undefined') var $ = {};
$.RSA = function() {
function t(t, e) {
    return new a(t, e)
}
function e(t, e) {
    if (e < t.length + 11) return null;
    for (var n = new Array,
    i = t.length - 1; i >= 0 && e > 0;) {
        var o = t.charCodeAt(i--);
        n[--e] = o
    }
    n[--e] = 0;
    for (var r = new Y,
    p = new Array; e > 2;) {
        for (p[0] = 0; 0 == p[0];) r.nextBytes(p);
        n[--e] = p[0]
    }
    return n[--e] = 2,
    n[--e] = 0,
    new a(n)
}
function n() {
    this.n = null,
    this.e = 0,
    this.d = null,
    this.p = null,
    this.q = null,
    this.dmp1 = null,
    this.dmq1 = null,
    this.coeff = null
}
function i(e, n) {
    null != e && null != n && e.length > 0 && n.length > 0 ? (this.n = t(e, 16), this.e = parseInt(n, 16)) : console.log("Invalid RSA public key")
}
function o(t) {
    return t.modPowInt(this.e, this.n)
}
function r(t) {
    var n = e(t, this.n.bitLength() + 7 >> 3);
    if (null == n) return null;
    var i = this.doPublic(n);
    if (null == i) return null;
    var o = i.toString(16);
    return 0 == (1 & o.length) ? o: "0" + o
}
function a(t, e, n) {
    null != t && ("number" == typeof t ? this.fromNumber(t, e, n) : null == e && "string" != typeof t ? this.fromString(t, 256) : this.fromString(t, e))
}
function p() {
    return new a(null)
}
function s(t, e, n, i, o, r) {
    for (; --r >= 0;) {
        var a = e * this[t++] + n[i] + o;
        o = Math.floor(a / 67108864),
        n[i++] = 67108863 & a
    }
    return o
}
function c(t, e, n, i, o, r) {
    for (var a = 32767 & e,
    p = e >> 15; --r >= 0;) {
        var s = 32767 & this[t],
        c = this[t++] >> 15,
        u = p * s + c * a;
        s = a * s + ((32767 & u) << 15) + n[i] + (1073741823 & o),
        o = (s >>> 30) + (u >>> 15) + p * c + (o >>> 30),
        n[i++] = 1073741823 & s
    }
    return o
}
function u(t, e, n, i, o, r) {
    for (var a = 16383 & e,
    p = e >> 14; --r >= 0;) {
        var s = 16383 & this[t],
        c = this[t++] >> 14,
        u = p * s + c * a;
        s = a * s + ((16383 & u) << 14) + n[i] + o,
        o = (s >> 28) + (u >> 14) + p * c,
        n[i++] = 268435455 & s
    }
    return o
}
function l(t) {
    return lt.charAt(t)
}
function d(t, e) {
    var n = dt[t.charCodeAt(e)];
    return null == n ? -1 : n
}
function f(t) {
    for (var e = this.t - 1; e >= 0; --e) t[e] = this[e];
    t.t = this.t,
    t.s = this.s
}
function h(t) {
    this.t = 1,
    this.s = 0 > t ? -1 : 0,
    t > 0 ? this[0] = t: -1 > t ? this[0] = t + DV: this.t = 0
}
function g(t) {
    var e = p();
    return e.fromInt(t),
    e
}
function w(t, e) {
    var n;
    if (16 == e) n = 4;
    else if (8 == e) n = 3;
    else if (256 == e) n = 8;
    else if (2 == e) n = 1;
    else if (32 == e) n = 5;
    else {
        if (4 != e) return void this.fromRadix(t, e);
        n = 2
    }
    this.t = 0,
    this.s = 0;
    for (var i = t.length,
    o = !1,
    r = 0; --i >= 0;) {
        var p = 8 == n ? 255 & t[i] : d(t, i);
        0 > p ? "-" == t.charAt(i) && (o = !0) : (o = !1, 0 == r ? this[this.t++] = p: r + n > this.DB ? (this[this.t - 1] |= (p & (1 << this.DB - r) - 1) << r, this[this.t++] = p >> this.DB - r) : this[this.t - 1] |= p << r, r += n, r >= this.DB && (r -= this.DB))
    }
    8 == n && 0 != (128 & t[0]) && (this.s = -1, r > 0 && (this[this.t - 1] |= (1 << this.DB - r) - 1 << r)),
    this.clamp(),
    o && a.ZERO.subTo(this, this)
}
function m() {
    for (var t = this.s & this.DM; this.t > 0 && this[this.t - 1] == t;)--this.t
}
function _(t) {
    if (this.s < 0) return "-" + this.negate().toString(t);
    var e;
    if (16 == t) e = 4;
    else if (8 == t) e = 3;
    else if (2 == t) e = 1;
    else if (32 == t) e = 5;
    else {
        if (4 != t) return this.toRadix(t);
        e = 2
    }
    var n, i = (1 << e) - 1,
    o = !1,
    r = "",
    a = this.t,
    p = this.DB - a * this.DB % e;
    if (a-->0) for (p < this.DB && (n = this[a] >> p) > 0 && (o = !0, r = l(n)); a >= 0;) e > p ? (n = (this[a] & (1 << p) - 1) << e - p, n |= this[--a] >> (p += this.DB - e)) : (n = this[a] >> (p -= e) & i, 0 >= p && (p += this.DB, --a)),
    n > 0 && (o = !0),
    o && (r += l(n));
    return o ? r: "0"
}
function v() {
    var t = p();
    return a.ZERO.subTo(this, t),
    t
}
function y() {
    return this.s < 0 ? this.negate() : this
}
function b(t) {
    var e = this.s - t.s;
    if (0 != e) return e;
    var n = this.t;
    if (e = n - t.t, 0 != e) return e;
    for (; --n >= 0;) if (0 != (e = this[n] - t[n])) return e;
    return 0
}
function k(t) {
    var e, n = 1;
    return 0 != (e = t >>> 16) && (t = e, n += 16),
    0 != (e = t >> 8) && (t = e, n += 8),
    0 != (e = t >> 4) && (t = e, n += 4),
    0 != (e = t >> 2) && (t = e, n += 2),
    0 != (e = t >> 1) && (t = e, n += 1),
    n
}
function $() {
    return this.t <= 0 ? 0 : this.DB * (this.t - 1) + k(this[this.t - 1] ^ this.s & this.DM)
}
function q(t, e) {
    var n;
    for (n = this.t - 1; n >= 0; --n) e[n + t] = this[n];
    for (n = t - 1; n >= 0; --n) e[n] = 0;
    e.t = this.t + t,
    e.s = this.s
}
function S(t, e) {
    for (var n = t; n < this.t; ++n) e[n - t] = this[n];
    e.t = Math.max(this.t - t, 0),
    e.s = this.s
}
function T(t, e) {
    var n, i = t % this.DB,
    o = this.DB - i,
    r = (1 << o) - 1,
    a = Math.floor(t / this.DB),
    p = this.s << i & this.DM;
    for (n = this.t - 1; n >= 0; --n) e[n + a + 1] = this[n] >> o | p,
    p = (this[n] & r) << i;
    for (n = a - 1; n >= 0; --n) e[n] = 0;
    e[a] = p,
    e.t = this.t + a + 1,
    e.s = this.s,
    e.clamp()
}
function I(t, e) {
    e.s = this.s;
    var n = Math.floor(t / this.DB);
    if (n >= this.t) return void(e.t = 0);
    var i = t % this.DB,
    o = this.DB - i,
    r = (1 << i) - 1;
    e[0] = this[n] >> i;
    for (var a = n + 1; a < this.t; ++a) e[a - n - 1] |= (this[a] & r) << o,
    e[a - n] = this[a] >> i;
    i > 0 && (e[this.t - n - 1] |= (this.s & r) << o),
    e.t = this.t - n,
    e.clamp()
}
function A(t, e) {
    for (var n = 0,
    i = 0,
    o = Math.min(t.t, this.t); o > n;) i += this[n] - t[n],
    e[n++] = i & this.DM,
    i >>= this.DB;
    if (t.t < this.t) {
        for (i -= t.s; n < this.t;) i += this[n],
        e[n++] = i & this.DM,
        i >>= this.DB;
        i += this.s
    } else {
        for (i += this.s; n < t.t;) i -= t[n],
        e[n++] = i & this.DM,
        i >>= this.DB;
        i -= t.s
    }
    e.s = 0 > i ? -1 : 0,
    -1 > i ? e[n++] = this.DV + i: i > 0 && (e[n++] = i),
    e.t = n,
    e.clamp()
}
function E(t, e) {
    var n = this.abs(),
    i = t.abs(),
    o = n.t;
    for (e.t = o + i.t; --o >= 0;) e[o] = 0;
    for (o = 0; o < i.t; ++o) e[o + n.t] = n.am(0, i[o], e, o, 0, n.t);
    e.s = 0,
    e.clamp(),
    this.s != t.s && a.ZERO.subTo(e, e)
}
function C(t) {
    for (var e = this.abs(), n = t.t = 2 * e.t; --n >= 0;) t[n] = 0;
    for (n = 0; n < e.t - 1; ++n) {
        var i = e.am(n, e[n], t, 2 * n, 0, 1); (t[n + e.t] += e.am(n + 1, 2 * e[n], t, 2 * n + 1, i, e.t - n - 1)) >= e.DV && (t[n + e.t] -= e.DV, t[n + e.t + 1] = 1)
    }
    t.t > 0 && (t[t.t - 1] += e.am(n, e[n], t, 2 * n, 0, 1)),
    t.s = 0,
    t.clamp()
}
function D(t, e, n) {
    var i = t.abs();
    if (! (i.t <= 0)) {
        var o = this.abs();
        if (o.t < i.t) return null != e && e.fromInt(0),
        void(null != n && this.copyTo(n));
        null == n && (n = p());
        var r = p(),
        s = this.s,
        c = t.s,
        u = this.DB - k(i[i.t - 1]);
        u > 0 ? (i.lShiftTo(u, r), o.lShiftTo(u, n)) : (i.copyTo(r), o.copyTo(n));
        var l = r.t,
        d = r[l - 1];
        if (0 != d) {
            var f = d * (1 << this.F1) + (l > 1 ? r[l - 2] >> this.F2: 0),
            h = this.FV / f,
            g = (1 << this.F1) / f,
            w = 1 << this.F2,
            m = n.t,
            _ = m - l,
            v = null == e ? p() : e;
            for (r.dlShiftTo(_, v), n.compareTo(v) >= 0 && (n[n.t++] = 1, n.subTo(v, n)), a.ONE.dlShiftTo(l, v), v.subTo(r, r); r.t < l;) r[r.t++] = 0;
            for (; --_ >= 0;) {
                var y = n[--m] == d ? this.DM: Math.floor(n[m] * h + (n[m - 1] + w) * g);
                if ((n[m] += r.am(0, y, n, _, 0, l)) < y) for (r.dlShiftTo(_, v), n.subTo(v, n); n[m] < --y;) n.subTo(v, n)
            }
            null != e && (n.drShiftTo(l, e), s != c && a.ZERO.subTo(e, e)),
            n.t = l,
            n.clamp(),
            u > 0 && n.rShiftTo(u, n),
            0 > s && a.ZERO.subTo(n, n)
        }
    }
}
function M(t) {
    var e = p();
    return this.abs().divRemTo(t, null, e),
    this.s < 0 && e.compareTo(a.ZERO) > 0 && t.subTo(e, e),
    e
}
function x(t) {
    this.m = t
}
function L(t) {
    return t.s < 0 || t.compareTo(this.m) >= 0 ? t.mod(this.m) : t
}
function B(t) {
    return t
}
function R(t) {
    t.divRemTo(this.m, null, t)
}
function O(t, e, n) {
    t.multiplyTo(e, n),
    this.reduce(n)
}
function H(t, e) {
    t.squareTo(e),
    this.reduce(e)
}
function K() {
    if (this.t < 1) return 0;
    var t = this[0];
    if (0 == (1 & t)) return 0;
    var e = 3 & t;
    return e = e * (2 - (15 & t) * e) & 15,
    e = e * (2 - (255 & t) * e) & 255,
    e = e * (2 - ((65535 & t) * e & 65535)) & 65535,
    e = e * (2 - t * e % this.DV) % this.DV,
    e > 0 ? this.DV - e: -e
}
function U(t) {
    this.m = t,
    this.mp = t.invDigit(),
    this.mpl = 32767 & this.mp,
    this.mph = this.mp >> 15,
    this.um = (1 << t.DB - 15) - 1,
    this.mt2 = 2 * t.t
}
function N(t) {
    var e = p();
    return t.abs().dlShiftTo(this.m.t, e),
    e.divRemTo(this.m, null, e),
    t.s < 0 && e.compareTo(a.ZERO) > 0 && this.m.subTo(e, e),
    e
}
function P(t) {
    var e = p();
    return t.copyTo(e),
    this.reduce(e),
    e
}
function Q(t) {
    for (; t.t <= this.mt2;) t[t.t++] = 0;
    for (var e = 0; e < this.m.t; ++e) {
        var n = 32767 & t[e],
        i = n * this.mpl + ((n * this.mph + (t[e] >> 15) * this.mpl & this.um) << 15) & t.DM;
        for (n = e + this.m.t, t[n] += this.m.am(0, i, t, e, 0, this.m.t); t[n] >= t.DV;) t[n] -= t.DV,
        t[++n]++
    }
    t.clamp(),
    t.drShiftTo(this.m.t, t),
    t.compareTo(this.m) >= 0 && t.subTo(this.m, t)
}
function j(t, e) {
    t.squareTo(e),
    this.reduce(e)
}
function F(t, e, n) {
    t.multiplyTo(e, n),
    this.reduce(n)
}
function V() {
    return 0 == (this.t > 0 ? 1 & this[0] : this.s)
}
function z(t, e) {
    if (t > 4294967295 || 1 > t) return a.ONE;
    var n = p(),
    i = p(),
    o = e.convert(this),
    r = k(t) - 1;
    for (o.copyTo(n); --r >= 0;) if (e.sqrTo(n, i), (t & 1 << r) > 0) e.mulTo(i, o, n);
    else {
        var s = n;
        n = i,
        i = s
    }
    return e.revert(n)
}
function J(t, e) {
    var n;
    return n = 256 > t || e.isEven() ? new x(e) : new U(e),
    this.exp(t, n)
}
function G(t) {
    ht[gt++] ^= 255 & t,
    ht[gt++] ^= t >> 8 & 255,
    ht[gt++] ^= t >> 16 & 255,
    ht[gt++] ^= t >> 24 & 255,
    gt >= _t && (gt -= _t)
}
function W() {
    G((new Date).getTime())
}
function X() {
    if (null == ft) {
        for (W(), ft = it(), ft.init(ht), gt = 0; gt < ht.length; ++gt) ht[gt] = 0;
        gt = 0
    }
    return ft.next()
}
function Z(t) {
    var e;
    for (e = 0; e < t.length; ++e) t[e] = X()
}
function Y() {}
function tt() {
    this.i = 0,
    this.j = 0,
    this.S = new Array
}
function et(t) {
    var e, n, i;
    for (e = 0; 256 > e; ++e) this.S[e] = e;
    for (n = 0, e = 0; 256 > e; ++e) n = n + this.S[e] + t[e % t.length] & 255,
    i = this.S[e],
    this.S[e] = this.S[n],
    this.S[n] = i;
    this.i = 0,
    this.j = 0
}
function nt() {
    var t;
    return this.i = this.i + 1 & 255,
    this.j = this.j + this.S[this.i] & 255,
    t = this.S[this.i],
    this.S[this.i] = this.S[this.j],
    this.S[this.j] = t,
    this.S[t + this.S[this.i] & 255]
}
function it() {
    return new tt
}
function ot(t, e, i) {
    e = "e9a815ab9d6e86abbf33a4ac64e9196d5be44a09bd0ed6ae052914e1a865ac8331fed863de8ea697e9a7f63329e5e23cda09c72570f46775b7e39ea9670086f847d3c9c51963b131409b1e04265d9747419c635404ca651bbcbc87f99b8008f7f5824653e3658be4ba73e4480156b390bb73bc1f8b33578e7a4e12440e9396f2552c1aff1c92e797ebacdc37c109ab7bce2367a19c56a033ee04534723cc2558cb27368f5b9d32c04d12dbd86bbd68b1d99b7c349a8453ea75d1b2e94491ab30acf6c46a36a75b721b312bedf4e7aad21e54e9bcbcf8144c79b6e3c05eb4a1547750d224c0085d80e6da3907c3d945051c13c7c1dcefd6520ee8379c4f5231ed",
    i = "10001";
    var o = new n;
    return o.setPublic(e, i),
    o.encrypt(t)
}
    n.prototype.doPublic = o,
    n.prototype.setPublic = i,
    n.prototype.encrypt = r;
    var rt, at = 0xdeadbeefcafe, pt = 15715070 == (16777215 & at);
    pt && "Microsoft Internet Explorer" == navigator.appName ? (a.prototype.am = c,
    rt = 30) : pt && "Netscape" != navigator.appName ? (a.prototype.am = s,
    rt = 26) : (a.prototype.am = u,
    rt = 28),
    a.prototype.DB = rt,
    a.prototype.DM = (1 << rt) - 1,
    a.prototype.DV = 1 << rt;
    var st = 52;
    a.prototype.FV = Math.pow(2, st),
    a.prototype.F1 = st - rt,
    a.prototype.F2 = 2 * rt - st;
    var ct, ut, lt = "0123456789abcdefghijklmnopqrstuvwxyz", dt = new Array;
    for (ct = "0".charCodeAt(0),
    ut = 0; 9 >= ut; ++ut)
        dt[ct++] = ut;
    for (ct = "a".charCodeAt(0),
    ut = 10; 36 > ut; ++ut)
        dt[ct++] = ut;
    for (ct = "A".charCodeAt(0),
    ut = 10; 36 > ut; ++ut)
        dt[ct++] = ut;
    x.prototype.convert = L,
    x.prototype.revert = B,
    x.prototype.reduce = R,
    x.prototype.mulTo = O,
    x.prototype.sqrTo = H,
    U.prototype.convert = N,
    U.prototype.revert = P,
    U.prototype.reduce = Q,
    U.prototype.mulTo = F,
    U.prototype.sqrTo = j,
    a.prototype.copyTo = f,
    a.prototype.fromInt = h,
    a.prototype.fromString = w,
    a.prototype.clamp = m,
    a.prototype.dlShiftTo = q,
    a.prototype.drShiftTo = S,
    a.prototype.lShiftTo = T,
    a.prototype.rShiftTo = I,
    a.prototype.subTo = A,
    a.prototype.multiplyTo = E,
    a.prototype.squareTo = C,
    a.prototype.divRemTo = D,
    a.prototype.invDigit = K,
    a.prototype.isEven = V,
    a.prototype.exp = z,
    a.prototype.toString = _,
    a.prototype.negate = v,
    a.prototype.abs = y,
    a.prototype.compareTo = b,
    a.prototype.bitLength = $,
    a.prototype.mod = M,
    a.prototype.modPowInt = J,
    a.ZERO = g(0),
    a.ONE = g(1);
    var ft, ht, gt;
    if (null  == ht) {
        ht = new Array,
        gt = 0;
        var wt;
        if ("Netscape" == navigator.appName && navigator.appVersion < "5" && window.crypto && window.crypto.random) {
            var mt = window.crypto.random(32);
            for (wt = 0; wt < mt.length; ++wt)
                ht[gt++] = 255 & mt.charCodeAt(wt)
        }
        for (; _t > gt; )
            wt = Math.floor(65536 * Math.random()),
            ht[gt++] = wt >>> 8,
            ht[gt++] = 255 & wt;
        gt = 0,
        W()
    }
    Y.prototype.nextBytes = Z,
    tt.prototype.init = et,
    tt.prototype.next = nt;
    var _t = 256;
    return {
        rsa_encrypt: ot
    }
}(),
function(t) {
function e() {
    return Math.round(4294967295 * Math.random())
}
function n(t, e, n) { (!n || n > 4) && (n = 4);
    for (var i = 0,
    o = e; e + n > o; o++) i <<= 8,
    i |= t[o];
    return (4294967295 & i) >>> 0
}
function i(t, e, n) {
    t[e + 3] = n >> 0 & 255,
    t[e + 2] = n >> 8 & 255,
    t[e + 1] = n >> 16 & 255,
    t[e + 0] = n >> 24 & 255
}
function o(t) {
    if (!t) return "";
    for (var e = "",
    n = 0; n < t.length; n++) {
        var i = Number(t[n]).toString(16);
        1 == i.length && (i = "0" + i),
        e += i
    }
    return e
}
function r(t) {
    for (var e = "",
    n = 0; n < t.length; n += 2) e += String.fromCharCode(parseInt(t.substr(n, 2), 16));
    return e
}
function a(t, e) {
    if (!t) return "";
    e && (t = p(t));
    for (var n = [], i = 0; i < t.length; i++) n[i] = t.charCodeAt(i);
    return o(n)
}
function p(t) {
    var e, n, i = [],
    o = t.length;
    for (e = 0; o > e; e++) n = t.charCodeAt(e),
    n > 0 && 127 >= n ? i.push(t.charAt(e)) : n >= 128 && 2047 >= n ? i.push(String.fromCharCode(192 | n >> 6 & 31), String.fromCharCode(128 | 63 & n)) : n >= 2048 && 65535 >= n && i.push(String.fromCharCode(224 | n >> 12 & 15), String.fromCharCode(128 | n >> 6 & 63), String.fromCharCode(128 | 63 & n));
    return i.join("")
}
function s(t) {
    m = new Array(8),
    _ = new Array(8),
    v = y = 0,
    $ = !0,
    w = 0;
    var n = t.length,
    i = 0;
    w = (n + 10) % 8,
    0 != w && (w = 8 - w),
    b = new Array(n + w + 10),
    m[0] = 255 & (248 & e() | w);
    for (var o = 1; w >= o; o++) m[o] = 255 & e();
    w++;
    for (var o = 0; 8 > o; o++) _[o] = 0;
    for (i = 1; 2 >= i;) 8 > w && (m[w++] = 255 & e(), i++),
    8 == w && u();
    for (var o = 0; n > 0;) 8 > w && (m[w++] = t[o++], n--),
    8 == w && u();
    for (i = 1; 7 >= i;) 8 > w && (m[w++] = 0, i++),
    8 == w && u();
    return b
}
function c(t) {
    var e = 0,
    n = new Array(8),
    i = t.length;
    if (k = t, i % 8 != 0 || 16 > i) return null;
    if (_ = d(t), w = 7 & _[0], e = i - w - 10, 0 > e) return null;
    for (var o = 0; 0 < n.length; o++) n[o] = 0;
    b = new Array(e),
    y = 0,
    v = 8,
    w++;
    for (var r = 1; 2 >= r;) if (8 > w && (w++, r++), 8 == w && (n = t, !f())) return null;
    for (var o = 0; 0 != e;) if (8 > w && (b[o] = 255 & (n[y + w] ^ _[w]), o++, e--, w++), 8 == w && (n = t, y = v - 8, !f())) return null;
    for (r = 1; 8 > r; r++) {
        if (8 > w) {
            if (0 != (n[y + w] ^ _[w])) return null;
            w++
        }
        if (8 == w && (n = t, y = v, !f())) return null
    }
    return b
}
function u() {
    for (var t = 0; 8 > t; t++) m[t] ^= $ ? _[t] : b[y + t];
    for (var e = l(m), t = 0; 8 > t; t++) b[v + t] = e[t] ^ _[t],
    _[t] = m[t];
    y = v,
    v += 8,
    w = 0,
    $ = !1
}
function l(t) {
    for (var e = 16,
    o = n(t, 0, 4), r = n(t, 4, 4), a = n(g, 0, 4), p = n(g, 4, 4), s = n(g, 8, 4), c = n(g, 12, 4), u = 0, l = 2654435769; e-->0;) u += l,
    u = (4294967295 & u) >>> 0,
    o += (r << 4) + a ^ r + u ^ (r >>> 5) + p,
    o = (4294967295 & o) >>> 0,
    r += (o << 4) + s ^ o + u ^ (o >>> 5) + c,
    r = (4294967295 & r) >>> 0;
    var d = new Array(8);
    return i(d, 0, o),
    i(d, 4, r),
    d
}
function d(t) {
    for (var e = 16,
    o = n(t, 0, 4), r = n(t, 4, 4), a = n(g, 0, 4), p = n(g, 4, 4), s = n(g, 8, 4), c = n(g, 12, 4), u = 3816266640, l = 2654435769; e-->0;) r -= (o << 4) + s ^ o + u ^ (o >>> 5) + c,
    r = (4294967295 & r) >>> 0,
    o -= (r << 4) + a ^ r + u ^ (r >>> 5) + p,
    o = (4294967295 & o) >>> 0,
    u -= l,
    u = (4294967295 & u) >>> 0;
    var d = new Array(8);
    return i(d, 0, o),
    i(d, 4, r),
    d
}
function f() {
    for (var t = (k.length, 0); 8 > t; t++) _[t] ^= k[v + t];
    return _ = d(_),
    v += 8,
    w = 0,
    !0
}
function h(t, e) {
    var n = [];
    if (e) for (var i = 0; i < t.length; i++) n[i] = 255 & t.charCodeAt(i);
    else for (var o = 0,
    i = 0; i < t.length; i += 2) n[o++] = parseInt(t.substr(i, 2), 16);
    return n
}
var g = "",
w = 0,
m = [],
_ = [],
v = 0,
y = 0,
b = [],
k = [],
$ = !0;
TEA = {
    encrypt: function(t, e) {
        var n = h(t, e),
        i = s(n);
        return o(i)
    },
    enAsBase64: function(t, e) {
        for (var n = h(t, e), i = s(n), o = "", r = 0; r < i.length; r++) o += String.fromCharCode(i[r]);
        return btoa(o)
    },
    decrypt: function(t) {
        var e = h(t, !1),
        n = c(e);
        return o(n)
    },
    initkey: function(t, e) {
        g = h(t, e)
    },
    bytesToStr: r,
    strToBytes: a,
    bytesInStr: o,
    dataFromStr: h
};
} (window),
$ = window.$ || {},
$pt = window.$pt || {},
$.Encryption = $pt.Encryption = function() {
function t(t) {
    return e(t)
}
function e(t) {
    return l(n(u(t), t.length * m))
}
function n(t, e) {
    t[e >> 5] |= 128 << ((e) % 32),
    t[(e + 64 >>> 9 << 4) + 14] = e;
    for (var n = 1732584193,
    i = -271733879,
    c = -1732584194,
    u = 271733878,
    l = 0; l < t.length; l += 16) {
        var d = n,
        f = i,
        h = c,
        g = u;
        n = o(n, i, c, u, t[l + 0], 7, -680876936),
        u = o(u, n, i, c, t[l + 1], 12, -389564586),
        c = o(c, u, n, i, t[l + 2], 17, 606105819),
        i = o(i, c, u, n, t[l + 3], 22, -1044525330),
        n = o(n, i, c, u, t[l + 4], 7, -176418897),
        u = o(u, n, i, c, t[l + 5], 12, 1200080426),
        c = o(c, u, n, i, t[l + 6], 17, -1473231341),
        i = o(i, c, u, n, t[l + 7], 22, -45705983),
        n = o(n, i, c, u, t[l + 8], 7, 1770035416),
        u = o(u, n, i, c, t[l + 9], 12, -1958414417),
        c = o(c, u, n, i, t[l + 10], 17, -42063),
        i = o(i, c, u, n, t[l + 11], 22, -1990404162),
        n = o(n, i, c, u, t[l + 12], 7, 1804603682),
        u = o(u, n, i, c, t[l + 13], 12, -40341101),
        c = o(c, u, n, i, t[l + 14], 17, -1502002290),
        i = o(i, c, u, n, t[l + 15], 22, 1236535329),
        n = r(n, i, c, u, t[l + 1], 5, -165796510),
        u = r(u, n, i, c, t[l + 6], 9, -1069501632),
        c = r(c, u, n, i, t[l + 11], 14, 643717713),
        i = r(i, c, u, n, t[l + 0], 20, -373897302),
        n = r(n, i, c, u, t[l + 5], 5, -701558691),
        u = r(u, n, i, c, t[l + 10], 9, 38016083),
        c = r(c, u, n, i, t[l + 15], 14, -660478335),
        i = r(i, c, u, n, t[l + 4], 20, -405537848),
        n = r(n, i, c, u, t[l + 9], 5, 568446438),
        u = r(u, n, i, c, t[l + 14], 9, -1019803690),
        c = r(c, u, n, i, t[l + 3], 14, -187363961),
        i = r(i, c, u, n, t[l + 8], 20, 1163531501),
        n = r(n, i, c, u, t[l + 13], 5, -1444681467),
        u = r(u, n, i, c, t[l + 2], 9, -51403784),
        c = r(c, u, n, i, t[l + 7], 14, 1735328473),
        i = r(i, c, u, n, t[l + 12], 20, -1926607734),
        n = a(n, i, c, u, t[l + 5], 4, -378558),
        u = a(u, n, i, c, t[l + 8], 11, -2022574463),
        c = a(c, u, n, i, t[l + 11], 16, 1839030562),
        i = a(i, c, u, n, t[l + 14], 23, -35309556),
        n = a(n, i, c, u, t[l + 1], 4, -1530992060),
        u = a(u, n, i, c, t[l + 4], 11, 1272893353),
        c = a(c, u, n, i, t[l + 7], 16, -155497632),
        i = a(i, c, u, n, t[l + 10], 23, -1094730640),
        n = a(n, i, c, u, t[l + 13], 4, 681279174),
        u = a(u, n, i, c, t[l + 0], 11, -358537222),
        c = a(c, u, n, i, t[l + 3], 16, -722521979),
        i = a(i, c, u, n, t[l + 6], 23, 76029189),
        n = a(n, i, c, u, t[l + 9], 4, -640364487),
        u = a(u, n, i, c, t[l + 12], 11, -421815835),
        c = a(c, u, n, i, t[l + 15], 16, 530742520),
        i = a(i, c, u, n, t[l + 2], 23, -995338651),
        n = p(n, i, c, u, t[l + 0], 6, -198630844),
        u = p(u, n, i, c, t[l + 7], 10, 1126891415),
        c = p(c, u, n, i, t[l + 14], 15, -1416354905),
        i = p(i, c, u, n, t[l + 5], 21, -57434055),
        n = p(n, i, c, u, t[l + 12], 6, 1700485571),
        u = p(u, n, i, c, t[l + 3], 10, -1894986606),
        c = p(c, u, n, i, t[l + 10], 15, -1051523),
        i = p(i, c, u, n, t[l + 1], 21, -2054922799),
        n = p(n, i, c, u, t[l + 8], 6, 1873313359),
        u = p(u, n, i, c, t[l + 15], 10, -30611744),
        c = p(c, u, n, i, t[l + 6], 15, -1560198380),
        i = p(i, c, u, n, t[l + 13], 21, 1309151649),
        n = p(n, i, c, u, t[l + 4], 6, -145523070),
        u = p(u, n, i, c, t[l + 11], 10, -1120210379),
        c = p(c, u, n, i, t[l + 2], 15, 718787259),
        i = p(i, c, u, n, t[l + 9], 21, -343485551),
        n = s(n, d),
        i = s(i, f),
        c = s(c, h),
        u = s(u, g)
    }
    return 16 == _ ? Array(i, c) : Array(n, i, c, u);

}
function i(t, e, n, i, o, r) {
    return s(c(s(s(e, t), s(i, r)), o), n)
}
function o(t, e, n, o, r, a, p) {
    return i(e & n | ~e & o, t, e, r, a, p)
}
function r(t, e, n, o, r, a, p) {
    return i(e & o | n & ~o, t, e, r, a, p)
}
function a(t, e, n, o, r, a, p) {
    return i(e ^ n ^ o, t, e, r, a, p)
}
function p(t, e, n, o, r, a, p) {
    return i(n ^ (e | ~o), t, e, r, a, p)
}
function s(t, e) {
    var n = (65535 & t) + (65535 & e),
    i = (t >> 16) + (e >> 16) + (n >> 16);
    return i << 16 | 65535 & n
}
function c(t, e) {
    return t << e | t >>> 32 - e
}
function u(t) {
    for (var e = Array(), n = (1 << m) - 1, i = 0; i < t.length * m; i += m) e[i >> 5] |= (t.charCodeAt(i / m) & n) << i % 32;
    return e
}
function l(t) {
    for (var e = w ? "0123456789ABCDEF": "0123456789abcdef", n = "", i = 0; i < 4 * t.length; i++) n += e.charAt(t[i >> 2] >> i % 4 * 8 + 4 & 15) + e.charAt(t[i >> 2] >> i % 4 * 8 & 15);
    return n
}
function d(t) {
    for (var e = [], n = 0; n < t.length; n += 2) e.push(String.fromCharCode(parseInt(t.substr(n, 2), 16)));
    return e.join("")
}
function h(e, n, i, o) {
    i = i || "",
    e = e || "";
    for (var r = o ? e: t(e), a = d(r), p = t(a + n), s = TEA.strToBytes(i.toUpperCase(), !0), c = Number(s.length / 2).toString(16); c.length < 4;) c = "0" + c;
    TEA.initkey(p);
    var u = TEA.encrypt(r + TEA.strToBytes(n) + c + s);
    TEA.initkey("");
    for (var l = Number(u.length / 2).toString(16); l.length < 4;) l = "0" + l;
    var h = $.RSA.rsa_encrypt(d(l + u));
    return btoa(d(h)).replace(/[\/\+=]/g,
    function(t) {
        return {
            "/": "-",
            "+": "*",
            "=": "_"
        } [t]
    })
}
function g(e, n, i) {
    var o = i ? e: t(e),
    r = o + n.toUpperCase(),
    a = $.RSA.rsa_encrypt(r);
    return a
}
var w = 1,
m = 8,
_ = 32;
return {
    getEncryption: h,
    getRSAEncryption: g,
    md5: t
}
} ();
window.getEncryption = function(pwd, uinHex, vcode) {
    // 兼容处理：如果 uinHex 是 literal 的 \x00 这种字符串（长度为 32 或包含 \x），转为 byte string
    if (uinHex && (uinHex.length > 16 || uinHex.indexOf('\\x') !== -1)) {
        try {
            // 使用 eval 转换 \x 序列为字节
            var converted = '';
            eval('converted = "' + uinHex.replace(/"/g, '\\"') + '"');
            uinHex = converted;
        } catch (e) {
            console.error('uinHex conversion failed', e);
        }
    }
    return $.Encryption.getEncryption(pwd, uinHex, vcode);
};
