webpack里扣出来的代码,但在e语言里无法加载运行,请帮忙修改E语言可执行的JS
//var window = global;
var huahua;
(function(e, t, n, o, r) {
return function(e) {
function t(t) {
for (var o, r, c = t[0], s = t[1], l = t[2], u = 0, m = []; u < c.length; u++)
r = c[u],
Object.prototype.hasOwnProperty.call(a, r) && a[r] && m.push(a[r][0]),
a[r] = 0;
for (o in s)
Object.prototype.hasOwnProperty.call(s, o) && (e[o] = s[o]);
d && d(t);
while (m.length)
m.shift()();
return i.push.apply(i, l || []),
n()
}
function n() {
for (var e, t = 0; t < i.length; t++) {
for (var n = i[t], o = !0, r = 1; r < n.length; r++) {
var c = n[r];
0 !== a[c] && (o = !1)
}
o && (i.splice(t--, 1),
e = s(s.s = n[0]))
}
return e
}
var o = {}
, r = {
app: 0
}
, a = {
app: 0
}
, i = [];
function c(e) {
return s.p + "static/js/" + ({}[e] || e) + "." + {
"chunk-2d221fc9": "a9e1e962",
"chunk-3acf1d6e": "388887cb",
"chunk-2d224fe5": "eae60147",
"chunk-c1290cd2": "e44550a8",
"chunk-5a7c8f4f": "91eaeec5",
"chunk-703bee02": "d91f9292",
"chunk-cf6595f6": "e3e9ef5f",
"chunk-dbb15fec": "ffb380c7",
"chunk-e6254136": "a4ceb3f1",
"chunk-f03233ec": "5d1ddde8"
}[e] + ".js"
}
function s(t) {
//console.log(t)
if (o[t])
return o[t].exports;
var n = o[t] = {
i: t,
l: !1,
exports: {}
};
return e[t].call(n.exports, n, n.exports, s),
n.l = !0,
n.exports
}
huahua = s
s.e = function(e) {
var t = []
, n = {
"chunk-3acf1d6e": 1,
"chunk-c1290cd2": 1,
"chunk-703bee02": 1,
"chunk-cf6595f6": 1,
"chunk-dbb15fec": 1,
"chunk-e6254136": 1,
"chunk-f03233ec": 1
};
r[e] ? t.push(r[e]) : 0 !== r[e] && n[e] && t.push(r[e] = new Promise((function(t, n) {
for (var o = "static/css/" + ({}[e] || e) + "." + {
"chunk-2d221fc9": "31d6cfe0",
"chunk-3acf1d6e": "5f380082",
"chunk-2d224fe5": "31d6cfe0",
"chunk-c1290cd2": "bf9286d3",
"chunk-5a7c8f4f": "31d6cfe0",
"chunk-703bee02": "66e4f6e9",
"chunk-cf6595f6": "30e8ad7a",
"chunk-dbb15fec": "b9aaa745",
"chunk-e6254136": "88960790",
"chunk-f03233ec": "c9e191c4"
}[e] + ".css", a = s.p + o, i = document.getElementsByTagName("link"), c = 0; c < i.length; c++) {
var l = i[c]
, u = l.getAttribute("data-href") || l.getAttribute("href");
if ("stylesheet" === l.rel && (u === o || u === a))
return t()
}
var m = document.getElementsByTagName("style");
for (c = 0; c < m.length; c++) {
l = m[c],
u = l.getAttribute("data-href");
if (u === o || u === a)
return t()
}
var d = document.createElement("link");
d.rel = "stylesheet",
d.type = "text/css",
d.onload = t,
d.onerror = function(t) {
var o = t && t.target && t.target.src || a
, i = new Error("Loading CSS chunk " + e + " failed.\n(" + o + ")");
i.code = "CSS_CHUNK_LOAD_FAILED",
i.request = o,
delete r[e],
d.parentNode.removeChild(d),
n(i)
}
,
d.href = a;
var p = document.getElementsByTagName("head")[0];
p.appendChild(d)
}
)).then((function() {
r[e] = 0
}
)));
var o = a[e];
if (0 !== o)
if (o)
t.push(o[2]);
else {
var i = new Promise((function(t, n) {
o = a[e] = [t, n]
}
));
t.push(o[2] = i);
var l, u = document.createElement("script");
u.charset = "utf-8",
u.timeout = 120,
s.nc && u.setAttribute("nonce", s.nc),
u.src = c(e);
var m = new Error;
l = function(t) {
u.onerror = u.onload = null,
clearTimeout(d);
var n = a[e];
if (0 !== n) {
if (n) {
var o = t && ("load" === t.type ? "missing" : t.type)
, r = t && t.target && t.target.src;
m.message = "Loading chunk " + e + " failed.\n(" + o + ": " + r + ")",
m.name = "ChunkLoadError",
m.type = o,
m.request = r,
n[1](m)
}
a[e] = void 0
}
}
;
var d = setTimeout((function() {
l({
type: "timeout",
target: u
})
}
), 12e4);
u.onerror = u.onload = l,
document.head.appendChild(u)
}
return Promise.all(t)
}
,
s.m = e,
s.c = o,
s.d = function(e, t, n) {
s.o(e, t) || Object.defineProperty(e, t, {
enumerable: !0,
get: n
})
}
,
s.r = function(e) {
"undefined" !== typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
value: "Module"
}),
Object.defineProperty(e, "__esModule", {
value: !0
})
}
,
s.t = function(e, t) {
if (1 & t && (e = s(e)),
8 & t)
return e;
if (4 & t && "object" === typeof e && e && e.__esModule)
return e;
var n = Object.create(null);
if (s.r(n),
Object.defineProperty(n, "default", {
enumerable: !0,
value: e
}),
2 & t && "string" != typeof e)
for (var o in e)
s.d(n, o, function(t) {
return e[t]
}
.bind(null, o));
return n
}
,
s.n = function(e) {
var t = e && e.__esModule ? function() {
return e["default"]
}
: function() {
return e
}
;
return s.d(t, "a", t),
t
}
,
s.o = function(e, t) {
return Object.prototype.hasOwnProperty.call(e, t)
}
,
s.p = "",
s.oe = function(e) {
throw console.error(e),
e
}
;
var l = window["webpackJsonp_subapp-iotmgt-iotacqobjrelamigration"] = window["webpackJsonp_subapp-iotmgt-iotacqobjrelamigration"] || []
, u = l.push.bind(l);
l.push = t,
l = l.slice();
for (var m = 0; m < l.length; m++)
t(l[m]);
var d = u;
return i.push([0, "chunk-vendors"]),
n()
}({
"a951": function(e, t, r) {
"use strict";
function o(e) {
return o = "function" === typeof Symbol && "symbol" === typeof Symbol.iterator ? function(e) {
return typeof e
}
: function(e) {
return e && "function" === typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
}
,
o(e)
}
Object.defineProperty(t, "__esModule", {
value: !0
}),
t.SG_sm4encrypt = x,
t.SG_sm4decrypt = L,
t.SG_sm2Decrypt = xr,
t.SG_sm2Encrypt = Or,
t.SG_sm3encrypt = Lr,
t.generateSM4Key = Sr;
var n, i = function() {
return this.parseUTF8 = function(e) {
e = unescape(encodeURIComponent(e));
for (var t = e.length, r = [], o = 0; o < t; o++)
r[o >>> 2] |= (255 & e.charCodeAt(o)) << 24 - o % 4 * 8;
return new s(r,t)
}
,
this.stringifyUTF8 = function(e) {
try {
for (var t, r = decodeURIComponent, o = escape, n = e.words, i = e.sigBytes, s = (e = [],
0); s < i; s++) {
var a = n[s >>> 2] >>> 24 - s % 4 * 8 & 255;
0 != a && e.push(String.fromCharCode(a))
}
return t = e.join(""),
r(o(t))
} catch (u) {
throw Error("Malformed UTF-8 data")
}
}
,
this.HexParse = function(e) {
for (var t = e.length, r = [], o = 0; o < t; o += 2)
r[o >>> 3] |= parseInt(e.substr(o, 2), 16) << 24 - o % 8 * 4;
return new s(r,t / 2)
}
,
this.HexStringify = function(e) {
for (var t = e.words, r = (e = e.sigBytes,
[]), o = 0; o < e; o++) {
var n = t[o >>> 2] >>> 24 - o % 4 * 8 & 255;
r.push((n >>> 4).toString(16)),
r.push((15 & n).toString(16))
}
return r.join("")
}
,
this
}, s = function(e, t) {
return this.words = e || [],
this.sigBytes = void 0 != t ? t : 4 * e.length,
this.getArrs = function() {
return this.words
}
,
this
}, a = 0xdeadbeefcafe, u = 15715070 == (16777215 & a), c = 52, f = "0123456789abcdefghijklmnopqrstuvwxyz", l = [];
for (T = "0".charCodeAt(0),
D = 0; D <= 9; ++D)
l[T++] = D;
for (T = "a".charCodeAt(0),
D = 10; D < 36; ++D)
l[T++] = D;
for (T = "A".charCodeAt(0),
D = 10; D < 36; ++D)
l[T++] = D;
function h() {
var e = navigator.userAgent
, t = (e.indexOf("Opera"),
e.indexOf("compatible") > -1 && e.indexOf("MSIE") > -1)
, r = e.indexOf("Edge") > -1 && !t
, o = e.indexOf("Trident") > -1 && e.indexOf("rv:11.0") > -1
, n = e.indexOf("Firefox") > -1
, i = (e.indexOf("Safari"),
e.indexOf("Chrome") > -1);
return r ? "edge" : o ? "IE11" : n || i ? "FF" : void 0
}
Array.Clear = function(e) {
for (var t in e)
e[t] = null
}
,
Array.Copy = function(e, t, r, o, n) {
for (e = e.slice(t, t + n),
t = 0; t < e.length; t++)
r[o] = e[t],
o++
}
,
window.Int32 = {
minValue: -parseInt("10000000000000000000000000000000", 2),
maxValue: parseInt("1111111111111111111111111111111", 2),
parse: function(e) {
if (e < this.minValue) {
e = new Number(-e),
e = e.toString(2),
e = e.substr(e.length - 31, 31);
for (var t = "", r = 0; r < e.length; r++) {
var o = e.substr(r, 1);
t += "0" == o ? "1" : "0"
}
return e = parseInt(t, 2),
e + 1
}
if (e > this.maxValue) {
for (e = Number(e).toString(2),
e = e.substr(e.length - 31, 31),
t = "",
r = 0; r < e.length; r++)
o = e.substr(r, 1),
t += "0" == o ? "1" : "0";
return e = parseInt(t, 2),
-(e + 1)
}
return e
},
parseByte: function(e) {
if (e < 0) {
e = new Number(-e),
e = e.toString(2),
e = e.substr(e.length - 8, 8);
for (var t = "", r = 0; r < e.length; r++) {
var o = e.substr(r, 1);
t += "0" == o ? "1" : "0"
}
return parseInt(t, 2) + 1
}
return e > 255 ? (e = Number(e).toString(2),
parseInt(e.substr(e.length - 8, 8), 2)) : e
}
},
"undefined" != typeof n && n || (n = {}),
"undefined" != typeof n.crypto && n.crypto || (n.crypto = {}),
"undefined" != typeof n && n || (n = {}),
"undefined" != typeof n.crypto && n.crypto || (n.crypto = {});
var d = [[214, 144, 233, 254, 204, 225, 61, 183, 22, 182, 20, 194, 40, 251, 44, 5], [43, 103, 154, 118, 42, 190, 4, 195, 170, 68, 19, 38, 73, 134, 6, 153], [156, 66, 80, 244, 145, 239, 152, 122, 51, 84, 11, 67, 237, 207, 172, 98], [228, 179, 28, 169, 201, 8, 232, 149, 128, 223, 148, 250, 117, 143, 63, 166], [71, 7, 167, 252, 243, 115, 23, 186, 131, 89, 60, 25, 230, 133, 79, 168], [104, 107, 129, 178, 113, 100, 218, 139, 248, 235, 15, 75, 112, 86, 157, 53], [30, 36, 14, 94, 99, 88, 209, 162, 37, 34, 124, 59, 1, 33, 120, 135], [212, 0, 70, 87, 159, 211, 39, 82, 76, 54, 2, 231, 160, 196, 200, 158], [234, 191, 138, 210, 64, 199, 56, 181, 163, 247, 242, 206, 249, 97, 21, 161], [224, 174, 93, 164, 155, 52, 26, 85, 173, 147, 50, 48, 245, 140, 177, 227], [29, 246, 226, 46, 130, 102, 202, 96, 192, 41, 35, 171, 13, 83, 78, 111], [213, 219, 55, 69, 222, 253, 142, 47, 3, 255, 106, 114, 109, 108, 91, 81], [141, 27, 175, 146, 187, 221, 188, 127, 17, 217, 92, 65, 31, 16, 90, 216], [10, 193, 49, 136, 165, 205, 123, 189, 45, 116, 208, 18, 184, 229, 180, 176], [137, 105, 151, 74, 12, 150, 119, 126, 101, 185, 241, 9, 197, 110, 198, 132], [24, 240, 125, 236, 58, 220, 77, 32, 121, 238, 95, 62, 215, 203, 57, 72]]
, p = [462357, 472066609, 943670861, 1415275113, 1886879365, 2358483617, 2830087869, 3301692121, 3773296373, 4228057617, 404694573, 876298825, 1347903077, 1819507329, 2291111581, 2762715833, 3234320085, 3705924337, 4177462797, 337322537, 808926789, 1280531041, 1752135293, 2223739545, 2695343797, 3166948049, 3638552301, 4110090761, 269950501, 741554753, 1213159005, 1684763257]
, g = [2746333894, 1453994832, 1736282519, 2993693404];
function m(e, t) {
return e ^ t
}
function w(e, t) {
return t %= 32,
e << t | e >>> 32 - t
}
function y(e) {
return d[(4026531840 & e) >>> 28][(251658240 & e) >>> 24] << 24 | d[(15728640 & e) >>> 20][(983040 & e) >>> 16] << 16 | d[(61440 & e) >>> 12][(3840 & e) >>> 8] << 8 | d[(240 & e) >>> 4][(15 & e) >>> 0] << 0
}
function v(e) {
return e = y(e),
m(m(m(e, w(e, 2)), m(w(e, 10), w(e, 18))), w(e, 24))
}
function F(e) {
return e = y(e),
m(e, m(w(e, 13), w(e, 23)))
}
function C(e) {
var t = []
, r = [];
for (t[0] = m(e[0], g[0]),
t[1] = m(e[1], g[1]),
t[2] = m(e[2], g[2]),
t[3] = m(e[3], g[3]),
e = 0; e < 32; e++)
t[e + 4] = m(t[e], F(m(m(t[e + 1], t[e + 2]), m(t[e + 3], p[e])))),
r[e] = t[e + 4].toString(16);
return r
}
function b(e, t) {
for (var r = Math.ceil(e.length / 4), o = [], n = 0; n < r; n++) {
for (var i = e.slice(4 * n, 4 * (n + 1)), a = C(t), u = 0; u < 32; u++)
i[u + 4] = m(i[u], v(m(m(i[u + 1], i[u + 2]), m(i[u + 3], parseInt(a[u], 16)))));
o = o.concat([i[35].toString(10), i[34].toString(10), i[33].toString(10), i[32].toString(10)])
}
return new s(o)
}
function O(e, t) {
for (var r = Math.ceil(e.length / 4), o = [], n = 0; n < r; n++) {
for (var i = e.slice(4 * n, 4 * (n + 1)), a = C(t), u = [], c = a.length - 1; c >= 0; c--)
u[a.length - 1 - c] = a[c];
for (c = 0; c < 32; c++)
i[c + 4] = m(i[c], v(m(m(i[c + 1], i[c + 2]), m(i[c + 3], parseInt(u[c], 16)))));
o = o.concat([i[35].toString(10), i[34].toString(10), i[33].toString(10), i[32].toString(10)])
}
return new s(o)
}
function x(e, t) {
if (void 0 != e && void 0 != t && "" != e && "" != t) {
var r = new i
, o = b(r.parseUTF8(e).getArrs(), r.HexParse(t).getArrs());
return r.HexStringify(o)
}
}
function L(e, t) {
if (void 0 != e && void 0 != t && "" != e && "" != t) {
var r = new i
, o = r.HexParse(e);
r = r.HexParse(t),
o = O(o.getArrs(), r.getArrs());
return (new i).stringifyUTF8(o)
}
}
var S, A = A || function(e, t) {
var r = {}
, o = r.lib = {}
, n = o.Base = function() {
function e() {}
return {
extend: function(t) {
e.prototype = this;
var r = new e;
return t && r.mixIn(t),
r.hasOwnProperty("init") || (r.init = function() {
r.$super.init.apply(this, arguments)
}
),
r.init.prototype = r,
r.$super = this,
r
},
create: function() {
var e = this.extend();
return e.init.apply(e, arguments),
e
},
init: function() {},
mixIn: function(e) {
for (var t in e)
e.hasOwnProperty(t) && (this[t] = e[t]);
e.hasOwnProperty("toString") && (this.toString = e.toString)
},
clone: function() {
return this.init.prototype.extend(this)
}
}
}()
, i = o.WordArray = n.extend({
init: function(e, r) {
e = this.words = e || [],
this.sigBytes = r != t ? r : 4 * e.length
},
toString: function(e) {
return (e || a).stringify(this)
},
concat: function(e) {
var t = this.words
, r = e.words
, o = this.sigBytes
, n = e.sigBytes;
if (this.clamp(),
o % 4)
for (var i = 0; i < n; i += 1) {
var s = r[i >>> 2] >>> 24 - i % 4 * 8 & 255;
t[o + i >>> 2] |= s << 24 - (o + i) % 4 * 8
}
else if (r.length > 65535)
for (i = 0; i < n; i += 4)
t[o + i >>> 2] = r[i >>> 2];
else
t.push.apply(t, r);
return this.sigBytes += n,
this
},
clamp: function() {
var t = this.words
, r = this.sigBytes;
t[r >>> 2] &= 4294967295 << 32 - r % 4 * 8,
t.length = e.ceil(r / 4)
},
clone: function() {
var e = n.clone.call(this);
return e.words = this.words.slice(0),
e
},
random: function(t) {
for (var r = [], o = 0; o < t; o += 4)
r.push(4294967296 * e.random() | 0);
return new i.init(r,t)
}
})
, s = r.enc = {}
, a = s.Hex = {
stringify: function(e) {
for (var t = e.words, r = e.sigBytes, o = [], n = 0; n < r; n += 1) {
var i = t[n >>> 2] >>> 24 - n % 4 * 8 & 255;
o.push((i >>> 4).toString(16)),
o.push((15 & i).toString(16))
}
return o.join("")
},
parse: function(e) {
for (var t = e.length, r = [], o = 0; o < t; o += 2)
r[o >>> 3] |= parseInt(e.substr(o, 2), 16) << 24 - o % 8 * 4;
return new i.init(r,t / 2)
}
}
, u = s.Latin1 = {
stringify: function(e) {
for (var t = e.words, r = e.sigBytes, o = [], n = 0; n < r; n += 1) {
var i = t[n >>> 2] >>> 24 - n % 4 * 8 & 255;
o.push(String.fromCharCode(i))
}
return o.join("")
},
parse: function(e) {
for (var t = e.length, r = [], o = 0; o < t; o += 1)
r[o >>> 2] |= (255 & e.charCodeAt(o)) << 24 - o % 4 * 8;
return new i.init(r,t)
}
}
, c = s.Utf8 = {
stringify: function(e) {
try {
return decodeURIComponent(escape(u.stringify(e)))
} catch (t) {
throw new Error("Malformed UTF-8 data")
}
},
parse: function(e) {
return u.parse(unescape(encodeURIComponent(e)))
}
}
, f = o.BufferedBlockAlgorithm = n.extend({
reset: function() {
this._data = new i.init,
this._nDataBytes = 0
},
_append: function(e) {
"string" == typeof e && (e = c.parse(e)),
this._data.concat(e),
this._nDataBytes += e.sigBytes
},
_process: function(t) {
var r = this._data
, o = r.words
, n = r.sigBytes
, s = this.blockSize
, a = 4 * s
, u = n / a;
u = t ? e.ceil(u) : e.max((0 | u) - this._minBufferSize, 0);
var c = u * s
, f = e.min(4 * c, n);
if (c) {
for (var l = 0; l < c; l += s)
this._doProcessBlock(o, l);
var h = o.splice(0, c);
r.sigBytes -= f
}
return new i.init(h,f)
},
clone: function() {
var e = n.clone.call(this);
return e._data = this._data.clone(),
e
},
_minBufferSize: 0
})
, l = (o.Hasher = f.extend({
cfg: n.extend(),
init: function(e) {
this.cfg = this.cfg.extend(e),
this.reset()
},
reset: function() {
f.reset.call(this),
this._doReset()
},
update: function(e) {
return this._append(e),
this._process(),
this
},
finalize: function(e) {
e && this._append(e);
var t = this._doFinalize();
return t
},
blockSize: 16,
_createHelper: function(e) {
return function(t, r) {
return new e.init(r).finalize(t)
}
},
_createHmacHelper: function(e) {
return function(t, r) {
return new l.HMAC.init(e,r).finalize(t)
}
}
}),
r.algo = {});
return r
}(Math);
a = 0xdeadbeefcafe,
u = 15715070 == (16777215 & a);
function E(e, t, r) {
null != e && ("number" == typeof e ? this.fromNumber(e, t, r) : null == t && "string" != typeof e ? this.fromString(e, 256) : this.fromString(e, t))
}
function B() {
return new E(null)
}
function _(e, t, r, o, n, i) {
while (--i >= 0) {
var s = t * this[e++] + r[o] + n;
n = Math.floor(s / 67108864),
r[o++] = 67108863 & s
}
return n
}
function I(e, t, r, o, n, i) {
var s = 32767 & t
, a = t >> 15;
while (--i >= 0) {
var u = 32767 & this[e]
, c = this[e++] >> 15
, f = a * u + c * s;
u = s * u + ((32767 & f) << 15) + r[o] + (1073741823 & n),
n = (u >>> 30) + (f >>> 15) + a * c + (n >>> 30),
r[o++] = 1073741823 & u
}
return n
}
function k(e, t, r, o, n, i) {
var s = 16383 & t
, a = t >> 14;
while (--i >= 0) {
var u = 16383 & this[e]
, c = this[e++] >> 14
, f = a * u + c * s;
u = s * u + ((16383 & f) << 14) + r[o] + n,
n = (u >> 28) + (f >> 14) + a * c,
r[o++] = 268435455 & u
}
return n
}
u && "Microsoft Internet Explorer" == navigator.appName ? (E.prototype.am = I,
S = 30) : u && "Netscape" != navigator.appName ? (E.prototype.am = _,
S = 26) : (E.prototype.am = k,
S = 28),
E.prototype.DB = S,
E.prototype.DM = (1 << S) - 1,
E.prototype.DV = 1 << S;
c = 52;
E.prototype.FV = Math.pow(2, c),
E.prototype.F1 = c - S,
E.prototype.F2 = 2 * S - c;
var T, D;
f = "0123456789abcdefghijklmnopqrstuvwxyz",
l = [];
for (T = "0".charCodeAt(0),
D = 0; D <= 9; D += 1)
l[T++] = D;
for (T = "a".charCodeAt(0),
D = 10; D < 36; D += 1)
l[T++] = D;
for (T = "A".charCodeAt(0),
D = 10; D < 36; D += 1)
l[T++] = D;
function P(e) {
return f.charAt(e)
}
function M(e, t) {
var r = l[e.charCodeAt(t)];
return null == r ? -1 : r
}
function R(e) {
for (var t = this.t - 1; t >= 0; t -= 1)
e[t] = this[t];
e.t = this.t,
e.s = this.s
}
function N(e) {
this.t = 1,
this.s = e < 0 ? -1 : 0,
e > 0 ? this[0] = e : e < -1 ? this[0] = e + this.DV : this.t = 0
}
function U(e) {
var t = B();
return t.fromInt(e),
t
}
function j(e, t) {
var r;
if (16 == t)
r = 4;
else if (8 == t)
r = 3;
else if (256 == t)
r = 8;
else if (2 == t)
r = 1;
else if (32 == t)
r = 5;
else {
if (4 != t)
return void this.fromRadix(e, t);
r = 2
}
this.t = 0,
this.s = 0;
var o = e.length
, n = !1
, i = 0;
while (--o >= 0) {
var s = 8 == r ? 255 & e[o] : M(e, o);
s < 0 ? "-" == e.charAt(o) && (n = !0) : (n = !1,
0 == i ? this[this.t++] = s : i + r > this.DB ? (this[this.t - 1] |= (s & (1 << this.DB - i) - 1) << i,
this[this.t++] = s >> this.DB - i) : this[this.t - 1] |= s << i,
i += r,
i >= this.DB && (i -= this.DB))
}
8 == r && 0 != (128 & e[0]) && (this.s = -1,
i > 0 && (this[this.t - 1] |= (1 << this.DB - i) - 1 << i)),
this.clamp(),
n && E.ZERO.subTo(this, this)
}
function H() {
var e = this.s & this.DM;
while (this.t > 0 && this[this.t - 1] == e)
--this.t
}
function q(e) {
if (this.s < 0)
return "-" + this.negate().toString(e);
var t;
if (16 == e)
t = 4;
else if (8 == e)
t = 3;
else if (2 == e)
t = 1;
else if (32 == e)
t = 5;
else {
if (4 != e)
return this.toRadix(e);
t = 2
}
var r, o = (1 << t) - 1, n = !1, i = "", s = this.t, a = this.DB - s * this.DB % t;
if (s-- > 0) {
a < this.DB && (r = this[s] >> a) > 0 && (n = !0,
i = P(r));
while (s >= 0)
a < t ? (r = (this[s] & (1 << a) - 1) << t - a,
r |= this[s -= 1] >> (a += this.DB - t)) : (r = this[s] >> (a -= t) & o,
a <= 0 && (a += this.DB,
s -= 1)),
r > 0 && (n = !0),
n && (i += P(r))
}
return n ? i : "0"
}
function G() {
var e = B();
return E.ZERO.subTo(this, e),
e
}
function W() {
return this.s < 0 ? this.negate() : this
}
function V(e) {
var t = this.s - e.s;
if (0 != t)
return t;
var r = this.t;
if (t = r - e.t,
0 != t)
return this.s < 0 ? -t : t;
while (--r >= 0)
if (0 != (t = this[r] - e[r]))
return t;
return 0
}
function z(e) {
var t, r = 1;
return 0 != (t = e >>> 16) && (e = t,
r += 16),
0 != (t = e >> 8) && (e = t,
r += 8),
0 != (t = e >> 4) && (e = t,
r += 4),
0 != (t = e >> 2) && (e = t,
r += 2),
0 != (t = e >> 1) && (e = t,
r += 1),
r
}
function X() {
return this.t <= 0 ? 0 : this.DB * (this.t - 1) + z(this[this.t - 1] ^ this.s & this.DM)
}
function J(e, t) {
var r;
for (r = this.t - 1; r >= 0; r -= 1)
t[r + e] = this[r];
for (r = e - 1; r >= 0; r -= 1)
t[r] = 0;
t.t = this.t + e,
t.s = this.s
}
function K(e, t) {
for (var r = e; r < this.t; r += 1)
t[r - e] = this[r];
t.t = Math.max(this.t - e, 0),
t.s = this.s
}
function Y(e, t) {
var r, o = e % this.DB, n = this.DB - o, i = (1 << n) - 1, s = Math.floor(e / this.DB), a = this.s << o & this.DM;
for (r = this.t - 1; r >= 0; r -= 1)
t[r + s + 1] = this[r] >> n | a,
a = (this[r] & i) << o;
for (r = s - 1; r >= 0; r -= 1)
t[r] = 0;
t[s] = a,
t.t = this.t + s + 1,
t.s = this.s,
t.clamp()
}
function $(e, t) {
t.s = this.s;
var r = Math.floor(e / this.DB);
if (r >= this.t)
t.t = 0;
else {
var o = e % this.DB
, n = this.DB - o
, i = (1 << o) - 1;
t[0] = this[r] >> o;
for (var s = r + 1; s < this.t; s += 1)
t[s - r - 1] |= (this[s] & i) << n,
t[s - r] = this[s] >> o;
o > 0 && (t[this.t - r - 1] |= (this.s & i) << n),
t.t = this.t - r,
t.clamp()
}
}
function Z(e, t) {
var r = 0
, o = 0
, n = Math.min(e.t, this.t);
while (r < n)
o += this[r] - e[r],
t[r++] = o & this.DM,
o >>= this.DB;
if (e.t < this.t) {
o -= e.s;
while (r < this.t)
o += this[r],
t[r++] = o & this.DM,
o >>= this.DB;
o += this.s
} else {
o += this.s;
while (r < e.t)
o -= e[r],
t[r++] = o & this.DM,
o >>= this.DB;
o -= e.s
}
t.s = o < 0 ? -1 : 0,
o < -1 ? t[r++] = this.DV + o : o > 0 && (t[r++] = o),
t.t = r,
t.clamp()
}
function Q(e, t) {
var r = this.abs()
, o = e.abs()
, n = r.t;
t.t = n + o.t;
while (--n >= 0)
t[n] = 0;
for (n = 0; n < o.t; n += 1)
t[n + r.t] = r.am(0, o[n], t, n, 0, r.t);
t.s = 0,
t.clamp(),
this.s != e.s && E.ZERO.subTo(t, t)
}
function ee(e) {
var t = this.abs()
, r = e.t = 2 * t.t;
while (--r >= 0)
e[r] = 0;
for (r = 0; r < t.t - 1; r += 1) {
var o = t.am(r, t[r], e, 2 * r, 0, 1);
(e[r + t.t] += t.am(r + 1, 2 * t[r], e, 2 * r + 1, o, t.t - r - 1)) >= t.DV && (e[r + t.t] -= t.DV,
e[r + t.t + 1] = 1)
}
e.t > 0 && (e[e.t - 1] += t.am(r, t[r], e, 2 * r, 0, 1)),
e.s = 0,
e.clamp()
}
function te(e, t, r) {
var o = e.abs();
if (!(o.t <= 0)) {
var n = this.abs();
if (n.t < o.t)
return null != t && t.fromInt(0),
void (null != r && this.copyTo(r));
null == r && (r = B());
var i = B()
, s = this.s
, a = e.s
, u = this.DB - z(o[o.t - 1]);
u > 0 ? (o.lShiftTo(u, i),
n.lShiftTo(u, r)) : (o.copyTo(i),
n.copyTo(r));
var c = i.t
, f = i[c - 1];
if (0 != f) {
var l = f * (1 << this.F1) + (c > 1 ? i[c - 2] >> this.F2 : 0)
, h = this.FV / l
, d = (1 << this.F1) / l
, p = 1 << this.F2
, g = r.t
, m = g - c
, w = null == t ? B() : t;
i.dlShiftTo(m, w),
r.compareTo(w) >= 0 && (r[r.t++] = 1,
r.subTo(w, r)),
E.ONE.dlShiftTo(c, w),
w.subTo(i, i);
while (i.t < c)
i[i.t++] = 0;
while (--m >= 0) {
var y = r[g -= 1] == f ? this.DM : Math.floor(r[g] * h + (r[g - 1] + p) * d);
if ((r[g] += i.am(0, y, r, m, 0, c)) < y) {
i.dlShiftTo(m, w),
r.subTo(w, r);
while (r[g] < --y)
r.subTo(w, r)
}
}
null != t && (r.drShiftTo(c, t),
s != a && E.ZERO.subTo(t, t)),
r.t = c,
r.clamp(),
u > 0 && r.rShiftTo(u, r),
s < 0 && E.ZERO.subTo(r, r)
}
}
}
function re(e) {
var t = B();
return this.abs().divRemTo(e, null, t),
this.s < 0 && t.compareTo(E.ZERO) > 0 && e.subTo(t, t),
t
}
function oe(e) {
this.m = e
}
function ne(e) {
return e.s < 0 || e.compareTo(this.m) >= 0 ? e.mod(this.m) : e
}
function ie(e) {
return e
}
function se(e) {
e.divRemTo(this.m, null, e)
}
function ae(e, t, r) {
e.multiplyTo(t, r),
this.reduce(r)
}
function ue(e, t) {
e.squareTo(t),
this.reduce(t)
}
function ce() {
if (this.t < 1)
return 0;
var e = this[0];
if (0 == (1 & e))
return 0;
var t = 3 & e;
return t = t * (2 - (15 & e) * t) & 15,
t = t * (2 - (255 & e) * t) & 255,
t = t * (2 - ((65535 & e) * t & 65535)) & 65535,
t = t * (2 - e * t % this.DV) % this.DV,
t > 0 ? this.DV - t : -t
}
function fe(e) {
this.m = e,
this.mp = e.invDigit(),
this.mpl = 32767 & this.mp,
this.mph = this.mp >> 15,
this.um = (1 << e.DB - 15) - 1,
this.mt2 = 2 * e.t
}
function le(e) {
var t = B();
return e.abs().dlShiftTo(this.m.t, t),
t.divRemTo(this.m, null, t),
e.s < 0 && t.compareTo(E.ZERO) > 0 && this.m.subTo(t, t),
t
}
function he(e) {
var t = B();
return e.copyTo(t),
this.reduce(t),
t
}
function de(e) {
while (e.t <= this.mt2)
e[e.t++] = 0;
for (var t = 0; t < this.m.t; t += 1) {
var r = 32767 & e[t]
, o = r * this.mpl + ((r * this.mph + (e[t] >> 15) * this.mpl & this.um) << 15) & e.DM;
r = t + this.m.t,
e[r] += this.m.am(0, o, e, t, 0, this.m.t);
while (e[r] >= e.DV)
e[r] -= e.DV,
e[r += 1] += 1
}
e.clamp(),
e.drShiftTo(this.m.t, e),
e.compareTo(this.m) >= 0 && e.subTo(this.m, e)
}
function pe(e, t) {
e.squareTo(t),
this.reduce(t)
}
function ge(e, t, r) {
e.multiplyTo(t, r),
this.reduce(r)
}
function me() {
return 0 == (this.t > 0 ? 1 & this[0] : this.s)
}
function we(e, t) {
if (e > 4294967295 || e < 1)
return E.ONE;
var r = B()
, o = B()
, n = t.convert(this)
, i = z(e) - 1;
n.copyTo(r);
while (--i >= 0)
if (t.sqrTo(r, o),
(e & 1 << i) > 0)
t.mulTo(o, n, r);
else {
var s = r;
r = o,
o = s
}
return t.revert(r)
}
function ye(e, t) {
var r;
return r = e < 256 || t.isEven() ? new oe(t) : new fe(t),
this.exp(e, r)
}
function ve() {
var e = B();
return this.copyTo(e),
e
}
function Fe() {
if (this.s < 0) {
if (1 == this.t)
return this[0] - this.DV;
if (0 == this.t)
return -1
} else {
if (1 == this.t)
return this[0];
if (0 == this.t)
return 0
}
return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0]
}
function Ce() {
return 0 == this.t ? this.s : this[0] << 24 >> 24
}
function be() {
return 0 == this.t ? this.s : this[0] << 16 >> 16
}
function Oe(e) {
return Math.floor(Math.LN2 * this.DB / Math.log(e))
}
function xe() {
return this.s < 0 ? -1 : this.t <= 0 || 1 == this.t && this[0] <= 0 ? 0 : 1
}
function Le(e) {
if (null == e && (e = 10),
0 == this.signum() || e < 2 || e > 36)
return "0";
var t = this.chunkSize(e)
, r = Math.pow(e, t)
, o = U(r)
, n = B()
, i = B()
, s = "";
this.divRemTo(o, n, i);
while (n.signum() > 0)
s = (r + i.intValue()).toString(e).substr(1) + s,
n.divRemTo(o, n, i);
return i.intValue().toString(e) + s
}
function Se(e, t) {
this.fromInt(0),
null == t && (t = 10);
for (var r = this.chunkSize(t), o = Math.pow(t, r), n = !1, i = 0, s = 0, a = 0; a < e.length; a += 1) {
var u = M(e, a);
u < 0 ? "-" == e.charAt(a) && 0 == this.signum() && (n = !0) : (s = t * s + u,
++i >= r && (this.dMultiply(o),
this.dAddOffset(s, 0),
i = 0,
s = 0))
}
i > 0 && (this.dMultiply(Math.pow(t, i)),
this.dAddOffset(s, 0)),
n && E.ZERO.subTo(this, this)
}
function Ae(e, t, r) {
if ("number" == typeof t)
if (e < 2)
this.fromInt(1);
else {
this.fromNumber(e, r),
this.testBit(e - 1) || this.bitwiseTo(E.ONE.shiftLeft(e - 1), Pe, this),
this.isEven() && this.dAddOffset(1, 0);
while (!this.isProbablePrime(t))
this.dAddOffset(2, 0),
this.bitLength() > e && this.subTo(E.ONE.shiftLeft(e - 1), this)
}
else {
var o = []
, n = 7 & e;
if (o.length = 1 + (e >> 3),
t.nextBytes(o),
n > 0 ? o[0] &= (1 << n) - 1 : o[0] = 0,
"FF" == h() && window.crypto) {
var i = new ArrayBuffer(32)
, s = new Int8Array(i);
for (window.crypto.getRandomValues(s),
r = 0; r < s.length; ++r)
o[r] = 255 & s[r]
} else if ("IE11" == h()) {
i = new ArrayBuffer(32),
s = new Int8Array(i);
var a = window.crypto || window.msCrypto;
for (a.getRandomValues(s),
r = 0; r < s.length; ++r)
o[r] = 255 & s[r]
} else if ("edge" == h()) {
i = new ArrayBuffer(32),
s = new Int8Array(i),
a = window.crypto || window.msCrypto;
for (a.getRandomValues(s),
r = 0; r < s.length; ++r)
o[r] = 255 & s[r]
}
this.fromString(o, 256)
}
}
function Ee() {
var e = this.t
, t = [];
t[0] = this.s;
var r, o = this.DB - e * this.DB % 8, n = 0;
if (e-- > 0) {
o < this.DB && (r = this[e] >> o) != (this.s & this.DM) >> o && (t[n++] = r | this.s << this.DB - o);
while (e >= 0)
o < 8 ? (r = (this[e] & (1 << o) - 1) << 8 - o,
r |= this[e -= 1] >> (o += this.DB - 8)) : (r = this[e] >> (o -= 8) & 255,
o <= 0 && (o += this.DB,
e -= 1)),
0 != (128 & r) && (r |= -256),
0 == n && (128 & this.s) != (128 & r) && ++n,
(n > 0 || r != this.s) && (t[n++] = r)
}
return t
}
function Be(e) {
return 0 == this.compareTo(e)
}
function _e(e) {
return this.compareTo(e) < 0 ? this : e
}
function Ie(e) {
return this.compareTo(e) > 0 ? this : e
}
function ke(e, t, r) {
var o, n, i = Math.min(e.t, this.t);
for (o = 0; o < i; o += 1)
r[o] = t(this[o], e[o]);
if (e.t < this.t) {
for (n = e.s & this.DM,
o = i; o < this.t; o += 1)
r[o] = t(this[o], n);
r.t = this.t
} else {
for (n = this.s & this.DM,
o = i; o < e.t; o += 1)
r[o] = t(n, e[o]);
r.t = e.t
}
r.s = t(this.s, e.s),
r.clamp()
}
function Te(e, t) {
return e & t
}
function De(e) {
var t = B();
return this.bitwiseTo(e, Te, t),
t
}
function Pe(e, t) {
return e | t
}
function Me(e) {
var t = B();
return this.bitwiseTo(e, Pe, t),
t
}
function Re(e, t) {
return e ^ t
}
function Ne(e) {
var t = B();
return this.bitwiseTo(e, Re, t),
t
}
function Ue(e, t) {
return e & ~t
}
function je(e) {
var t = B();
return this.bitwiseTo(e, Ue, t),
t
}
function He() {
for (var e = B(), t = 0; t < this.t; t += 1)
e[t] = this.DM & ~this[t];
return e.t = this.t,
e.s = ~this.s,
e
}
function qe(e) {
var t = B();
return e < 0 ? this.rShiftTo(-e, t) : this.lShiftTo(e, t),
t
}
function Ge(e) {
var t = B();
return e < 0 ? this.lShiftTo(-e, t) : this.rShiftTo(e, t),
t
}
function We(e) {
if (0 == e)
return -1;
var t = 0;
return 0 == (65535 & e) && (e >>= 16,
t += 16),
0 == (255 & e) && (e >>= 8,
t += 8),
0 == (15 & e) && (e >>= 4,
t += 4),
0 == (3 & e) && (e >>= 2,
t += 2),
0 == (1 & e) && ++t,
t
}
function Ve() {
for (var e = 0; e < this.t; e += 1)
if (0 != this[e])
return e * this.DB + We(this[e]);
return this.s < 0 ? this.t * this.DB : -1
}
function ze(e) {
var t = 0;
while (0 != e)
e &= e - 1,
t += 1;
return t
}
function Xe() {
for (var e = 0, t = this.s & this.DM, r = 0; r < this.t; r += 1)
e += ze(this[r] ^ t);
return e
}
function Je(e) {
var t = Math.floor(e / this.DB);
return t >= this.t ? 0 != this.s : 0 != (this[t] & 1 << e % this.DB)
}
function Ke(e, t) {
var r = E.ONE.shiftLeft(e);
return this.bitwiseTo(r, t, r),
r
}
function Ye(e) {
return this.changeBit(e, Pe)
}
function $e(e) {
return this.changeBit(e, Ue)
}
function Ze(e) {
return this.changeBit(e, Re)
}
function Qe(e, t) {
var r = 0
, o = 0
, n = Math.min(e.t, this.t);
while (r < n)
o += this[r] + e[r],
t[r++] = o & this.DM,
o >>= this.DB;
if (e.t < this.t) {
o += e.s;
while (r < this.t)
o += this[r],
t[r++] = o & this.DM,
o >>= this.DB;
o += this.s
} else {
o += this.s;
while (r < e.t)
o += e[r],
t[r++] = o & this.DM,
o >>= this.DB;
o += e.s
}
t.s = o < 0 ? -1 : 0,
o > 0 ? t[r++] = o : o < -1 && (t[r++] = this.DV + o),
t.t = r,
t.clamp()
}
function et(e) {
var t = B();
return this.addTo(e, t),
t
}
function tt(e) {
var t = B();
return this.subTo(e, t),
t
}
function rt(e) {
var t = B();
return this.multiplyTo(e, t),
t
}
function ot() {
var e = B();
return this.squareTo(e),
e
}
function nt(e) {
var t = B();
return this.divRemTo(e, t, null),
t
}
function it(e) {
var t = B();
return this.divRemTo(e, null, t),
t
}
function st(e) {
var t = B()
, r = B();
return this.divRemTo(e, t, r),
[t, r]
}
function at(e) {
this[this.t] = this.am(0, e - 1, this, 0, 0, this.t),
++this.t,
this.clamp()
}
function ut(e, t) {
if (0 != e) {
while (this.t <= t)
this[this.t++] = 0;
this[t] += e;
while (this[t] >= this.DV)
this[t] -= this.DV,
++t >= this.t && (this[this.t++] = 0),
++this[t]
}
}
function ct() {}
function ft(e) {
return e
}
function lt(e, t, r) {
e.multiplyTo(t, r)
}
function ht(e, t) {
e.squareTo(t)
}
function dt(e) {
return this.exp(e, new ct)
}
function pt(e, t, r) {
var o, n = Math.min(this.t + e.t, t);
r.s = 0,
r.t = n;
while (n > 0)
r[n -= 1] = 0;
for (o = r.t - this.t; n < o; n += 1)
r[n + this.t] = this.am(0, e[n], r, n, 0, this.t);
for (o = Math.min(e.t, t); n < o; n += 1)
this.am(0, e[n], r, n, 0, t - n);
r.clamp()
}
function gt(e, t, r) {
t -= 1;
var o = r.t = this.t + e.t - t;
r.s = 0;
while (--o >= 0)
r[o] = 0;
for (o = Math.max(t - this.t, 0); o < e.t; o += 1)
r[this.t + o - t] = this.am(t - o, e[o], r, 0, 0, this.t + o - t);
r.clamp(),
r.drShiftTo(1, r)
}
function mt(e) {
this.r2 = B(),
this.q3 = B(),
E.ONE.dlShiftTo(2 * e.t, this.r2),
this.mu = this.r2.divide(e),
this.m = e
}
function wt(e) {
if (e.s < 0 || e.t > 2 * this.m.t)
return e.mod(this.m);
if (e.compareTo(this.m) < 0)
return e;
var t = B();
return e.copyTo(t),
this.reduce(t),
t
}
function yt(e) {
return e
}
function vt(e) {
e.drShiftTo(this.m.t - 1, this.r2),
e.t > this.m.t + 1 && (e.t = this.m.t + 1,
e.clamp()),
this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3),
this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2);
while (e.compareTo(this.r2) < 0)
e.dAddOffset(1, this.m.t + 1);
e.subTo(this.r2, e);
while (e.compareTo(this.m) >= 0)
e.subTo(this.m, e)
}
function Ft(e, t) {
e.squareTo(t),
this.reduce(t)
}
function Ct(e, t, r) {
e.multiplyTo(t, r),
this.reduce(r)
}
function bt(e, t) {
var r, o, n = e.bitLength(), i = U(1);
if (n <= 0)
return i;
r = n < 18 ? 1 : n < 48 ? 3 : n < 144 ? 4 : n < 768 ? 5 : 6,
o = n < 8 ? new oe(t) : t.isEven() ? new mt(t) : new fe(t);
var s = []
, a = 3
, u = r - 1
, c = (1 << r) - 1;
if (s[1] = o.convert(this),
r > 1) {
var f = B();
o.sqrTo(s[1], f);
while (a <= c)
s[a] = B(),
o.mulTo(f, s[a - 2], s[a]),
a += 2
}
var l, h, d = e.t - 1, p = !0, g = B();
n = z(e[d]) - 1;
while (d >= 0) {
n >= u ? l = e[d] >> n - u & c : (l = (e[d] & (1 << n + 1) - 1) << u - n,
d > 0 && (l |= e[d - 1] >> this.DB + n - u)),
a = r;
while (0 == (1 & l))
l >>= 1,
a -= 1;
if ((n -= a) < 0 && (n += this.DB,
d -= 1),
p)
s[l].copyTo(i),
p = !1;
else {
while (a > 1)
o.sqrTo(i, g),
o.sqrTo(g, i),
a -= 2;
a > 0 ? o.sqrTo(i, g) : (h = i,
i = g,
g = h),
o.mulTo(g, s[l], i)
}
while (d >= 0 && 0 == (e[d] & 1 << n))
o.sqrTo(i, g),
h = i,
i = g,
g = h,
--n < 0 && (n = this.DB - 1,
d -= 1)
}
return o.revert(i)
}
function Ot(e) {
var t = this.s < 0 ? this.negate() : this.clone()
, r = e.s < 0 ? e.negate() : e.clone();
if (t.compareTo(r) < 0) {
var o = t;
t = r,
r = o
}
var n = t.getLowestSetBit()
, i = r.getLowestSetBit();
if (i < 0)
return t;
n < i && (i = n),
i > 0 && (t.rShiftTo(i, t),
r.rShiftTo(i, r));
while (t.signum() > 0)
(n = t.getLowestSetBit()) > 0 && t.rShiftTo(n, t),
(n = r.getLowestSetBit()) > 0 && r.rShiftTo(n, r),
t.compareTo(r) >= 0 ? (t.subTo(r, t),
t.rShiftTo(1, t)) : (r.subTo(t, r),
r.rShiftTo(1, r));
return i > 0 && r.lShiftTo(i, r),
r
}
function xt(e) {
if (e <= 0)
return 0;
var t = this.DV % e
, r = this.s < 0 ? e - 1 : 0;
if (this.t > 0)
if (0 == t)
r = this[0] % e;
else
for (var o = this.t - 1; o >= 0; o -= 1)
r = (t * r + this[o]) % e;
return r
}
function Lt(e) {
var t = e.isEven();
if (this.isEven() && t || 0 == e.signum())
return E.ZERO;
var r = e.clone()
, o = this.clone()
, n = U(1)
, i = U(0)
, s = U(0)
, a = U(1);
while (0 != r.signum()) {
while (r.isEven())
r.rShiftTo(1, r),
t ? (n.isEven() && i.isEven() || (n.addTo(this, n),
i.subTo(e, i)),
n.rShiftTo(1, n)) : i.isEven() || i.subTo(e, i),
i.rShiftTo(1, i);
while (o.isEven())
o.rShiftTo(1, o),
t ? (s.isEven() && a.isEven() || (s.addTo(this, s),
a.subTo(e, a)),
s.rShiftTo(1, s)) : a.isEven() || a.subTo(e, a),
a.rShiftTo(1, a);
r.compareTo(o) >= 0 ? (r.subTo(o, r),
t && n.subTo(s, n),
i.subTo(a, i)) : (o.subTo(r, o),
t && s.subTo(n, s),
a.subTo(i, a))
}
return 0 != o.compareTo(E.ONE) ? E.ZERO : a.compareTo(e) >= 0 ? a.subtract(e) : a.signum() < 0 ? (a.addTo(e, a),
a.signum() < 0 ? a.add(e) : a) : a
}
oe.prototype.convert = ne,
oe.prototype.revert = ie,
oe.prototype.reduce = se,
oe.prototype.mulTo = ae,
oe.prototype.sqrTo = ue,
fe.prototype.convert = le,
fe.prototype.revert = he,
fe.prototype.reduce = de,
fe.prototype.mulTo = ge,
fe.prototype.sqrTo = pe,
E.prototype.copyTo = R,
E.prototype.fromInt = N,
E.prototype.fromString = j,
E.prototype.clamp = H,
E.prototype.dlShiftTo = J,
E.prototype.drShiftTo = K,
E.prototype.lShiftTo = Y,
E.prototype.rShiftTo = $,
E.prototype.subTo = Z,
E.prototype.multiplyTo = Q,
E.prototype.squareTo = ee,
E.prototype.divRemTo = te,
E.prototype.invDigit = ce,
E.prototype.isEven = me,
E.prototype.exp = we,
E.prototype.toString = q,
E.prototype.negate = G,
E.prototype.abs = W,
E.prototype.compareTo = V,
E.prototype.bitLength = X,
E.prototype.mod = re,
E.prototype.modPowInt = ye,
E.ZERO = U(0),
E.ONE = U(1),
ct.prototype.convert = ft,
ct.prototype.revert = ft,
ct.prototype.mulTo = lt,
ct.prototype.sqrTo = ht,
mt.prototype.convert = wt,
mt.prototype.revert = yt,
mt.prototype.reduce = vt,
mt.prototype.mulTo = Ct,
mt.prototype.sqrTo = Ft;
var St = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
, At = (1 << 26) / St[St.length - 1];
function Et(e) {
var t, r = this.abs();
if (1 == r.t && r[0] <= St[St.length - 1]) {
for (t = 0; t < St.length; t += 1)
if (r[0] == St[t])
return !0;
return !1
}
if (r.isEven())
return !1;
t = 1;
while (t < St.length) {
var o = St[t]
, n = t + 1;
while (n < St.length && o < At)
o *= St[n++];
o = r.modInt(o);
while (t < n)
if (o % St[t++] == 0)
return !1
}
return r.millerRabin(e)
}
function Bt(e) {
var t = this.subtract(E.ONE)
, r = t.getLowestSetBit();
if (r <= 0)
return !1;
var o = t.shiftRight(r);
e = e + 1 >> 1,
e > St.length && (e = St.length);
for (var n = B(), i = 0; i < e; i += 1) {
n.fromInt(St[Math.floor(Math.random() * St.length)]);
var s = n.modPow(o, this);
if (0 != s.compareTo(E.ONE) && 0 != s.compareTo(t)) {
var a = 1;
while (a++ < r && 0 != s.compareTo(t))
if (s = s.modPowInt(2, this),
0 == s.compareTo(E.ONE))
return !1;
if (0 != s.compareTo(t))
return !1
}
}
return !0
}
function _t() {
this.i = 0,
this.j = 0,
this.S = []
}
function It(e) {
var t, r, o;
for (t = 0; t < 256; t += 1)
this.S[t] = t;
for (r = 0,
t = 0; t < 256; t += 1)
r = r + this.S[t] + e[t % e.length] & 255,
o = this.S[t],
this.S[t] = this.S[r],
this.S[r] = o;
this.i = 0,
this.j = 0
}
function kt() {
var e;
return this.i = this.i + 1 & 255,
this.j = this.j + this.S[this.i] & 255,
e = this.S[this.i],
this.S[this.i] = this.S[this.j],
this.S[this.j] = e,
this.S[e + this.S[this.i] & 255]
}
function Tt() {
return new _t
}
E.prototype.chunkSize = Oe,
E.prototype.toRadix = Le,
E.prototype.fromRadix = Se,
E.prototype.fromNumber = Ae,
E.prototype.bitwiseTo = ke,
E.prototype.changeBit = Ke,
E.prototype.addTo = Qe,
E.prototype.dMultiply = at,
E.prototype.dAddOffset = ut,
E.prototype.multiplyLowerTo = pt,
E.prototype.multiplyUpperTo = gt,
E.prototype.modInt = xt,
E.prototype.millerRabin = Bt,
E.prototype.clone = ve,
E.prototype.intValue = Fe,
E.prototype.byteValue = Ce,
E.prototype.shortValue = be,
E.prototype.signum = xe,
E.prototype.toByteArray = Ee,
E.prototype.equals = Be,
E.prototype.min = _e,
E.prototype.max = Ie,
E.prototype.and = De,
E.prototype.or = Me,
E.prototype.xor = Ne,
E.prototype.andNot = je,
E.prototype.not = He,
E.prototype.shiftLeft = qe,
E.prototype.shiftRight = Ge,
E.prototype.getLowestSetBit = Ve,
E.prototype.bitCount = Xe,
E.prototype.testBit = Je,
E.prototype.setBit = Ye,
E.prototype.clearBit = $e,
E.prototype.flipBit = Ze,
E.prototype.add = et,
E.prototype.subtract = tt,
E.prototype.multiply = rt,
E.prototype.divide = nt,
E.prototype.remainder = it,
E.prototype.divideAndRemainder = st,
E.prototype.modPow = bt,
E.prototype.modInverse = Lt,
E.prototype.pow = dt,
E.prototype.gcd = Ot,
E.prototype.isProbablePrime = Et,
E.prototype.square = ot,
_t.prototype.init = It,
_t.prototype.next = kt;
var Dt, Pt, Mt, Rt = 256;
function Nt(e) {
Pt[Mt++] ^= 255 & e,
Pt[Mt++] ^= e >> 8 & 255,
Pt[Mt++] ^= e >> 16 & 255,
Pt[Mt++] ^= e >> 24 & 255,
Mt >= Rt && (Mt -= Rt)
}
function Ut() {
Nt((new Date).getTime())
}
if (null == Pt) {
var jt;
if (Pt = [],
Mt = 0,
window.crypto && window.crypto.getRandomValues) {
var Ht = new Uint8Array(32);
for (window.crypto.getRandomValues(Ht),
jt = 0; jt < 32; jt += 1)
Pt[Mt++] = Ht[jt]
}
if ("Netscape" == navigator.appName && navigator.appVersion < "5" && window.crypto) {
var qt = window.crypto.random(32);
for (jt = 0; jt < qt.length; jt += 1)
Pt[Mt++] = 255 & qt.charCodeAt(jt)
}
while (Mt < Rt)
jt = Math.floor(65536 * Math.random()),
Pt[Mt++] = jt >>> 8,
Pt[Mt++] = 255 & jt;
Mt = 0,
Ut()
}
function Gt() {
if (null == Dt) {
for (Ut(),
Dt = Tt(),
Dt.init(Pt),
Mt = 0; Mt < Pt.length; Mt += 1)
Pt[Mt] = 0;
Mt = 0
}
return Dt.next()
}
function Wt(e) {
var t;
for (t = 0; t < e.length; t += 1)
e[t] = Gt()
}
function Vt() {}
function zt(e, t) {
this.x = t,
this.q = e
}
function Xt(e) {
return e == this || this.q.equals(e.q) && this.x.equals(e.x)
}
function Jt() {
return this.x
}
function Kt() {
return new zt(this.q,this.x.negate().mod(this.q))
}
function Yt(e) {
return new zt(this.q,this.x.add(e.toBigInteger()).mod(this.q))
}
function $t(e) {
return new zt(this.q,this.x.subtract(e.toBigInteger()).mod(this.q))
}
function Zt(e) {
return new zt(this.q,this.x.multiply(e.toBigInteger()).mod(this.q))
}
function Qt() {
return new zt(this.q,this.x.square().mod(this.q))
}
function er(e) {
return new zt(this.q,this.x.multiply(e.toBigInteger().modInverse(this.q)).mod(this.q))
}
function tr(e, t, r, o) {
this.curve = e,
this.x = t,
this.y = r,
this.z = null == o ? E.ONE : o,
this.zinv = null
}
function rr() {
return null == this.zinv && (this.zinv = this.z.modInverse(this.curve.q)),
this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))
}
function or() {
return null == this.zinv && (this.zinv = this.z.modInverse(this.curve.q)),
this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))
}
function nr(e) {
return e == this || (this.isInfinity() ? e.isInfinity() : e.isInfinity() ? this.isInfinity() : (t = e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q),
!!t.equals(E.ZERO) && (r = e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q),
r.equals(E.ZERO))));
var t, r
}
function ir() {
return null == this.x && null == this.y || this.z.equals(E.ZERO) && !this.y.toBigInteger().equals(E.ZERO)
}
function sr() {
return new tr(this.curve,this.x,this.y.negate(),this.z)
}
function ar(e) {
if (this.isInfinity())
return e;
if (e.isInfinity())
return this;
var t = e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q)
, r = e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q);
if (E.ZERO.equals(r))
return E.ZERO.equals(t) ? this.twice() : this.curve.getInfinity();
var o = new E("3")
, n = this.x.toBigInteger()
, i = this.y.toBigInteger()
, s = (e.x.toBigInteger(),
e.y.toBigInteger(),
r.square())
, a = s.multiply(r)
, u = n.multiply(s)
, c = t.square().multiply(this.z)
, f = c.subtract(u.shiftLeft(1)).multiply(e.z).subtract(a).multiply(r).mod(this.curve.q)
, l = u.multiply(o).multiply(t).subtract(i.multiply(a)).subtract(c.multiply(t)).multiply(e.z).add(t.multiply(a)).mod(this.curve.q)
, h = a.multiply(this.z).multiply(e.z).mod(this.curve.q);
return new tr(this.curve,this.curve.fromBigInteger(f),this.curve.fromBigInteger(l),h)
}
function ur() {
if (this.isInfinity())
return this;
if (0 == this.y.toBigInteger().signum())
return this.curve.getInfinity();
var e = new E("3")
, t = this.x.toBigInteger()
, r = this.y.toBigInteger()
, o = r.multiply(this.z)
, n = o.multiply(r).mod(this.curve.q)
, i = this.curve.a.toBigInteger()
, s = t.square().multiply(e);
E.ZERO.equals(i) || (s = s.add(this.z.square().multiply(i))),
s = s.mod(this.curve.q);
var a = s.square().subtract(t.shiftLeft(3).multiply(n)).shiftLeft(1).multiply(o).mod(this.curve.q)
, u = s.multiply(e).multiply(t).subtract(n.shiftLeft(1)).shiftLeft(2).multiply(n).subtract(s.square().multiply(s)).mod(this.curve.q)
, c = o.square().multiply(o).shiftLeft(3).mod(this.curve.q);
return new tr(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(u),c)
}
function cr(e) {
if (this.isInfinity())
return this;
if (0 == e.signum())
return this.curve.getInfinity();
var t, r = e, o = r.multiply(new E("3")), n = this.negate(), i = this;
for (t = o.bitLength() - 2; t > 0; t -= 1) {
i = i.twice();
var s = o.testBit(t)
, a = r.testBit(t);
s != a && (i = i.add(s ? this : n))
}
return i
}
function fr(e, t, r) {
var o;
o = e.bitLength() > r.bitLength() ? e.bitLength() - 1 : r.bitLength() - 1;
var n = this.curve.getInfinity()
, i = this.add(t);
while (o >= 0)
n = n.twice(),
e.testBit(o) ? n = r.testBit(o) ? n.add(i) : n.add(this) : r.testBit(o) && (n = n.add(t)),
o -= 1;
return n
}
function lr(e, t, r) {
this.q = e,
this.a = this.fromBigInteger(t),
this.b = this.fromBigInteger(r),
this.infinity = new tr(this,null,null)
}
function hr() {
return this.q
}
function dr() {
return this.a
}
function pr() {
return this.b
}
function gr(e) {
return e == this || this.q.equals(e.q) && this.a.equals(e.a) && this.b.equals(e.b)
}
function mr() {
return this.infinity
}
function wr(e) {
return new zt(this.q,e)
}
function yr(e) {
switch (parseInt(e.substr(0, 2), 16)) {
case 0:
return this.infinity;
case 2:
case 3:
return null;
case 4:
case 6:
case 7:
var t = (e.length - 2) / 2
, r = e.substr(2, t)
, o = e.substr(t + 2, t);
return new tr(this,this.fromBigInteger(new E(r,16)),this.fromBigInteger(new E(o,16)));
default:
return null
}
}
function vr() {
this.BYTE_LENGTH = 64,
this.xBuf = [],
this.xBufOff = 0,
this.byteCount = 0,
this.DIGEST_LENGTH = 32,
this.v0 = [1937774191, 1226093241, 388252375, -628488704, -1452330820, 372324522, -477237683, -1325724082],
this.v = [0, 0, 0, 0, 0, 0, 0, 0],
this.v_ = [0, 0, 0, 0, 0, 0, 0, 0],
this.X0 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
this.X = [68],
this.xOff = 0,
this.T_00_15 = 2043430169,
this.T_16_63 = 2055708042,
arguments.length > 0 ? this.InitDigest(arguments[0]) : this.Init()
}
function Fr(e, t) {
return e << t | e >>> -t
}
function Cr(e) {
if (e > 2147483647 || e < -2147483648) {
var t = 4294967295 & e;
return t > 2147483647 ? (t = 2147483647 & e,
t ^= 2147483647,
-(t + 1)) : t
}
return e
}
function br(e) {
this.ct = 1,
this.p2 = null,
this.sm3keybase = null,
this.sm3c3 = null,
this.key = new Array(32),
this.keyOff = 0,
this.cipherMode = "undefined" != typeof e ? e : SM2CipherMode.C1C3C2
}
function Or(e, t) {
if (void 0 != e && void 0 != t && "" != e && "" != t && 130 == t.length) {
var r = A.enc.Utf8.parse(e)
, o = t
, n = o.substr(0, 2);
if ("04" == n) {
o.length > 128 && (o = o.substr(o.length - 128));
var i = o.substr(0, 64)
, s = o.substr(64)
, a = new br(1)
, u = a.CreatePoint(i, s);
if (void 0 != u) {
r = a.GetWords(r.toString());
var c = a.Encrypt(u, r);
return "04" + c
}
}
}
}
function xr(e, t) {
if (void 0 != e && void 0 != t && "" != e && "" != t && 64 == t.length && !(e.length <= 194)) {
var r = e.substr(0, 2);
if ("04" == r) {
e = e.substr(2);
var o = new E(t,16)
, n = new br(1)
, i = n.Decrypt(o, e);
return i
}
}
}
function Lr(e) {
if (void 0 != e && "" != e) {
var t = A.enc.Utf8.parse(e)
, r = new vr;
t = r.GetWords(t.toString()),
r.BlockUpdate(t, 0, t.length);
var o = new Array(32);
r.DoFinal(o, 0);
var n = r.GetHex(o).toString();
return n
}
}
function Sr() {
var e = new Vt
, t = new Array(16);
e.nextBytes(t);
var r = (new vr).GetHex(t);
return r.toString()
}
Vt.prototype.nextBytes = Wt,
zt.prototype.equals = Xt,
zt.prototype.toBigInteger = Jt,
zt.prototype.negate = Kt,
zt.prototype.add = Yt,
zt.prototype.subtract = $t,
zt.prototype.multiply = Zt,
zt.prototype.square = Qt,
zt.prototype.divide = er,
tr.prototype.getX = rr,
tr.prototype.getY = or,
tr.prototype.equals = nr,
tr.prototype.isInfinity = ir,
tr.prototype.negate = sr,
tr.prototype.add = ar,
tr.prototype.twice = ur,
tr.prototype.multiply = cr,
tr.prototype.multiplyTwo = fr,
lr.prototype.getQ = hr,
lr.prototype.getA = dr,
lr.prototype.getB = pr,
lr.prototype.equals = gr,
lr.prototype.getInfinity = mr,
lr.prototype.fromBigInteger = wr,
lr.prototype.decodePointHex = yr,
zt.prototype.getByteLength = function() {
return Math.floor((this.toBigInteger().bitLength() + 7) / 8)
}
,
tr.prototype.getEncoded = function(e) {
var t = function(e, t) {
var r = e.toByteArrayUnsigned();
if (t < r.length)
r = r.slice(r.length - t);
else
while (t > r.length)
r.unshift(0);
return r
}
, r = this.getX().toBigInteger()
, o = this.getY().toBigInteger()
, n = t(r, 32);
return e ? o.isEven() ? n.unshift(2) : n.unshift(3) : (n.unshift(4),
n = n.concat(t(o, 32))),
n
}
,
tr.decodeFrom = function(e, t) {
t[0];
var r = t.length - 1
, o = t.slice(1, 1 + r / 2)
, n = t.slice(1 + r / 2, 1 + r);
o.unshift(0),
n.unshift(0);
var i = new E(o)
, s = new E(n);
return new tr(e,e.fromBigInteger(i),e.fromBigInteger(s))
}
,
tr.decodeFromHex = function(e, t) {
t.substr(0, 2);
var r = t.length - 2
, o = t.substr(2, r / 2)
, n = t.substr(2 + r / 2, r / 2)
, i = new E(o,16)
, s = new E(n,16);
return new tr(e,e.fromBigInteger(i),e.fromBigInteger(s))
}
,
tr.prototype.add2D = function(e) {
if (this.isInfinity())
return e;
if (e.isInfinity())
return this;
if (this.x.equals(e.x))
return this.y.equals(e.y) ? this.twice() : this.curve.getInfinity();
var t = e.x.subtract(this.x)
, r = e.y.subtract(this.y)
, o = r.divide(t)
, n = o.square().subtract(this.x).subtract(e.x)
, i = o.multiply(this.x.subtract(n)).subtract(this.y);
return new tr(this.curve,n,i)
}
,
tr.prototype.twice2D = function() {
if (this.isInfinity())
return this;
if (0 == this.y.toBigInteger().signum())
return this.curve.getInfinity();
var e = this.curve.fromBigInteger(E.valueOf(2))
, t = this.curve.fromBigInteger(E.valueOf(3))
, r = this.x.square().multiply(t).add(this.curve.a).divide(this.y.multiply(e))
, o = r.square().subtract(this.x.multiply(e))
, n = r.multiply(this.x.subtract(o)).subtract(this.y);
return new tr(this.curve,o,n)
}
,
tr.prototype.multiply2D = function(e) {
if (this.isInfinity())
return this;
if (0 == e.signum())
return this.curve.getInfinity();
var t, r = e, o = r.multiply(new E("3")), n = this.negate(), i = this;
for (t = o.bitLength() - 2; t > 0; t -= 1) {
i = i.twice();
var s = o.testBit(t)
, a = r.testBit(t);
s != a && (i = i.add2D(s ? this : n))
}
return i
}
,
tr.prototype.isOnCurve = function() {
var e = this.getX().toBigInteger()
, t = this.getY().toBigInteger()
, r = this.curve.getA().toBigInteger()
, o = this.curve.getB().toBigInteger()
, n = this.curve.getQ()
, i = t.multiply(t).mod(n)
, s = e.multiply(e).multiply(e).add(r.multiply(e)).add(o).mod(n);
return i.equals(s)
}
,
tr.prototype.toString = function() {
return "(" + this.getX().toBigInteger().toString() + "," + this.getY().toBigInteger().toString() + ")"
}
,
tr.prototype.validate = function() {
var e = this.curve.getQ();
if (this.isInfinity())
throw new Error("Point is at infinity.");
var t = this.getX().toBigInteger()
, r = this.getY().toBigInteger();
if (t.compareTo(E.ONE) < 0 || t.compareTo(e.subtract(E.ONE)) > 0)
throw new Error("x coordinate out of bounds");
if (r.compareTo(E.ONE) < 0 || r.compareTo(e.subtract(E.ONE)) > 0)
throw new Error("y coordinate out of bounds");
if (!this.isOnCurve())
throw new Error("Point is not on the curve.");
if (this.multiply(e).isInfinity())
throw new Error("Point is not a scalar multiple of G.");
return !0
}
,
"undefined" != typeof n && n || (n = {}),
"undefined" != typeof n.crypto && n.crypto || (n.crypto = {}),
n.crypto.ECDSA = function(e) {
var t = "secp256r1"
, r = new Vt;
this.type = "EC",
this.getBigRandom = function(e) {
return new E(e.bitLength(),r).mod(e.subtract(E.ONE)).add(E.ONE)
}
,
this.setNamedCurve = function(e) {
this.ecparams = n.crypto.ECParameterDB.getByName(e),
this.prvKeyHex = null,
this.pubKeyHex = null,
this.curveName = e
}
,
this.setPrivateKeyHex = function(e) {
this.isPrivate = !0,
this.prvKeyHex = e
}
,
this.setPublicKeyHex = function(e) {
this.isPublic = !0,
this.pubKeyHex = e
}
,
this.getPublicKeyXYHex = function() {
var e = this.pubKeyHex;
if ("04" !== e.substr(0, 2))
throw "this method supports uncompressed format(04) only";
var t = this.ecparams.keylen / 4;
if (e.length !== 2 + 2 * t)
throw "malformed public key hex length";
var r = {};
return r.x = e.substr(2, t),
r.y = e.substr(2 + t),
r
}
,
this.getShortNISTPCurveName = function() {
var e = this.curveName;
return "secp256r1" === e || "NIST P-256" === e || "P-256" === e || "prime256v1" === e ? "P-256" : "secp384r1" === e || "NIST P-384" === e || "P-384" === e ? "P-384" : null
}
,
this.generateKeyPairHex = function() {
var e = this.ecparams["n"]
, t = this.getBigRandom(e)
, r = this.ecparams["G"].multiply(t)
, o = r.getX().toBigInteger()
, n = r.getY().toBigInteger()
, i = this.ecparams["keylen"] / 4
, s = ("0000000000" + t.toString(16)).slice(-i)
, a = ("0000000000" + o.toString(16)).slice(-i)
, u = ("0000000000" + n.toString(16)).slice(-i)
, c = "04" + a + u;
return this.setPrivateKeyHex(s),
this.setPublicKeyHex(c),
{
ecprvhex: s,
ecpubhex: c
}
}
,
this.signWithMessageHash = function(e) {
return this.signHex(e, this.prvKeyHex)
}
,
this.signHex = function(e, t) {
var r = new E(t,16)
, o = this.ecparams["n"]
, i = new E(e,16);
do {
var s = this.getBigRandom(o)
, a = this.ecparams["G"]
, u = a.multiply(s)
, c = u.getX().toBigInteger().mod(o)
} while (c.compareTo(E.ZERO) <= 0);
var f = s.modInverse(o).multiply(i.add(r.multiply(c))).mod(o);
return n.crypto.ECDSA.biRSSigToASN1Sig(c, f)
}
,
this.sign = function(e, t) {
var r = t
, o = this.ecparams["n"]
, n = E.fromByteArrayUnsigned(e);
do {
var i = this.getBigRandom(o)
, s = this.ecparams["G"]
, a = s.multiply(i)
, u = a.getX().toBigInteger().mod(o)
} while (u.compareTo(E.ZERO) <= 0);
var c = i.modInverse(o).multiply(n.add(r.multiply(u))).mod(o);
return this.serializeSig(u, c)
}
,
this.verifyWithMessageHash = function(e, t) {
return this.verifyHex(e, t, this.pubKeyHex)
}
,
this.verifyHex = function(e, t, r) {
var o, i, s, a = n.crypto.ECDSA.parseSigHex(t);
o = a.r,
i = a.s,
s = tr.decodeFromHex(this.ecparams["curve"], r);
var u = new E(e,16);
return this.verifyRaw(u, o, i, s)
}
,
this.verify = function(e, t, r) {
var n, i, s;
if (Bitcoin.Util.isArray(t)) {
var a = this.parseSig(t);
n = a.r,
i = a.s
} else {
if ("object" !== o(t) || !t.r || !t.s)
throw "Invalid value for signature";
n = t.r,
i = t.s
}
if (r instanceof tr)
s = r;
else {
if (!Bitcoin.Util.isArray(r))
throw "Invalid format for pubkey value, must be byte array or ECPointFp";
s = tr.decodeFrom(this.ecparams["curve"], r)
}
var u = E.fromByteArrayUnsigned(e);
return this.verifyRaw(u, n, i, s)
}
,
this.verifyRaw = function(e, t, r, o) {
var n = this.ecparams["n"]
, i = this.ecparams["G"];
if (t.compareTo(E.ONE) < 0 || t.compareTo(n) >= 0)
return !1;
if (r.compareTo(E.ONE) < 0 || r.compareTo(n) >= 0)
return !1;
var s = r.modInverse(n)
, a = e.multiply(s).mod(n)
, u = t.multiply(s).mod(n)
, c = i.multiply(a).add(o.multiply(u))
, f = c.getX().toBigInteger().mod(n);
return f.equals(t)
}
,
this.serializeSig = function(e, t) {
var r = e.toByteArraySigned()
, o = t.toByteArraySigned()
, n = [];
return n.push(2),
n.push(r.length),
n = n.concat(r),
n.push(2),
n.push(o.length),
n = n.concat(o),
n.unshift(n.length),
n.unshift(48),
n
}
,
this.parseSig = function(e) {
var t;
if (48 != e[0])
throw new Error("Signature not a valid DERSequence");
if (t = 2,
2 != e[t])
throw new Error("First element in signature must be a DERInteger");
var r = e.slice(t + 2, t + 2 + e[t + 1]);
if (t += 2 + e[t + 1],
2 != e[t])
throw new Error("Second element in signature must be a DERInteger");
var o = e.slice(t + 2, t + 2 + e[t + 1]);
t += 2 + e[t + 1];
var n = E.fromByteArrayUnsigned(r)
, i = E.fromByteArrayUnsigned(o);
return {
r: n,
s: i
}
}
,
this.parseSigCompact = function(e) {
if (65 !== e.length)
throw "Signature has the wrong length";
var t = e[0] - 27;
if (t < 0 || t > 7)
throw "Invalid signature type";
var r = this.ecparams["n"]
, o = E.fromByteArrayUnsigned(e.slice(1, 33)).mod(r)
, n = E.fromByteArrayUnsigned(e.slice(33, 65)).mod(r);
return {
r: o,
s: n,
i: t
}
}
,
void 0 !== e && void 0 !== e["curve"] && (this.curveName = e["curve"]),
void 0 === this.curveName && (this.curveName = t),
this.setNamedCurve(this.curveName),
void 0 !== e && (void 0 !== e["prv"] && this.setPrivateKeyHex(e["prv"]),
void 0 !== e["pub"] && this.setPublicKeyHex(e["pub"]))
}
,
n.crypto.ECDSA.parseSigHex = function(e) {
var t = n.crypto.ECDSA.parseSigHexInHexRS(e)
, r = new E(t.r,16)
, o = new E(t.s,16);
return {
r: r,
s: o
}
}
,
n.crypto.ECDSA.parseSigHexInHexRS = function(e) {
if ("30" != e.substr(0, 2))
throw "signature is not a ASN.1 sequence";
var t = ASN1HEX.getPosArrayOfChildren_AtObj(e, 0);
if (2 != t.length)
throw "number of signature ASN.1 sequence elements seem wrong";
var r = t[0]
, o = t[1];
if ("02" != e.substr(r, 2))
throw "1st item of sequene of signature is not ASN.1 integer";
if ("02" != e.substr(o, 2))
throw "2nd item of sequene of signature is not ASN.1 integer";
var n = ASN1HEX.getHexOfV_AtObj(e, r)
, i = ASN1HEX.getHexOfV_AtObj(e, o);
return {
r: n,
s: i
}
}
,
n.crypto.ECDSA.asn1SigToConcatSig = function(e) {
var t = n.crypto.ECDSA.parseSigHexInHexRS(e)
, r = t.r
, o = t.s;
if ("00" == r.substr(0, 2) && r.length / 2 * 8 % 128 == 8 && (r = r.substr(2)),
"00" == o.substr(0, 2) && o.length / 2 * 8 % 128 == 8 && (o = o.substr(2)),
r.length / 2 * 8 % 128 != 0)
throw "unknown ECDSA sig r length error";
if (o.length / 2 * 8 % 128 != 0)
throw "unknown ECDSA sig s length error";
return r + o
}
,
n.crypto.ECDSA.concatSigToASN1Sig = function(e) {
if (e.length / 2 * 8 % 128 != 0)
throw "unknown ECDSA concatinated r-s sig length error";
var t = e.substr(0, e.length / 2)
, r = e.substr(e.length / 2);
return n.crypto.ECDSA.hexRSSigToASN1Sig(t, r)
}
,
n.crypto.ECDSA.hexRSSigToASN1Sig = function(e, t) {
var r = new E(e,16)
, o = new E(t,16);
return n.crypto.ECDSA.biRSSigToASN1Sig(r, o)
}
,
n.crypto.ECDSA.biRSSigToASN1Sig = function(e, t) {
var r = new n.asn1.DERInteger({
bigint: e
})
, o = new n.asn1.DERInteger({
bigint: t
})
, i = new n.asn1.DERSequence({
array: [r, o]
});
return i.getEncodedHex()
}
,
function() {
var e = A
, t = e.lib
, r = t.WordArray
, o = t.Hasher
, n = e.algo
, i = []
, s = n.SM3 = o.extend({
_doReset: function() {
this._hash = new r.init([1937774191, 1226093241, 388252375, 3666478592, 2842636476, 372324522, 3817729613, 2969243214])
},
_doProcessBlock: function(e, t) {
for (var r = this._hash.words, o = r[0], n = r[1], s = r[2], a = r[3], u = r[4], c = 0; c < 80; c += 1) {
if (c < 16)
i[c] = 0 | e[t + c];
else {
var f = i[c - 3] ^ i[c - 8] ^ i[c - 14] ^ i[c - 16];
i[c] = f << 1 | f >>> 31
}
var l = (o << 5 | o >>> 27) + u + i[c];
l += c < 20 ? 1518500249 + (n & s | ~n & a) : c < 40 ? 1859775393 + (n ^ s ^ a) : c < 60 ? (n & s | n & a | s & a) - 1894007588 : (n ^ s ^ a) - 899497514,
u = a,
a = s,
s = n << 30 | n >>> 2,
n = o,
o = l
}
r[0] = r[0] + o | 0,
r[1] = r[1] + n | 0,
r[2] = r[2] + s | 0,
r[3] = r[3] + a | 0,
r[4] = r[4] + u | 0
},
_doFinalize: function() {
var e = this._data
, t = e.words
, r = 8 * this._nDataBytes
, o = 8 * e.sigBytes;
return t[o >>> 5] |= 128 << 24 - o % 32,
t[14 + (o + 64 >>> 9 << 4)] = Math.floor(r / 4294967296),
t[15 + (o + 64 >>> 9 << 4)] = r,
e.sigBytes = 4 * t.length,
this._process(),
this._hash
},
clone: function() {
var e = o.clone.call(this);
return e._hash = this._hash.clone(),
e
}
});
e.SM3 = o._createHelper(s),
e.HmacSM3 = o._createHmacHelper(s)
}(),
vr.prototype = {
Init: function() {
this.xBuf = [0, 0, 0, 0],
this.Reset()
},
InitDigest: function(e) {
this.xBuf = [e.xBuf.length],
Array.Copy(e.xBuf, 0, this.xBuf, 0, e.xBuf.length),
this.xBufOff = e.xBufOff,
this.byteCount = e.byteCount,
Array.Copy(e.X, 0, this.X, 0, e.X.length),
this.xOff = e.xOff,
Array.Copy(e.v, 0, this.v, 0, e.v.length)
},
GetDigestSize: function() {
return this.DIGEST_LENGTH
},
Reset: function() {
this.byteCount = 0,
this.xBufOff = 0,
Array.Clear(this.xBuf, 0, this.xBuf.length),
Array.Copy(this.v0, 0, this.v, 0, this.v0.length),
this.xOff = 0,
Array.Copy(this.X0, 0, this.X, 0, this.X0.length)
},
GetByteLength: function() {
return this.BYTE_LENGTH
},
ProcessBlock: function() {
var e, t = this.X, r = [64];
for (e = 16; e < 68; e += 1)
t[e] = this.P1(t[e - 16] ^ t[e - 9] ^ Fr(t[e - 3], 15)) ^ Fr(t[e - 13], 7) ^ t[e - 6];
for (e = 0; e < 64; e += 1)
r[e] = t[e] ^ t[e + 4];
var o, n, i, s, a, u = this.v, c = this.v_;
for (Array.Copy(u, 0, c, 0, this.v0.length),
e = 0; e < 16; e += 1)
a = Fr(c[0], 12),
o = a + c[4] + Fr(this.T_00_15, e),
o = Fr(o, 7),
n = o ^ a,
i = this.FF_00_15(c[0], c[1], c[2]) + c[3] + n + r[e],
s = this.GG_00_15(c[4], c[5], c[6]) + c[7] + o + t[e],
c[3] = c[2],
c[2] = Fr(c[1], 9),
c[1] = c[0],
c[0] = i,
c[7] = c[6],
c[6] = Fr(c[5], 19),
c[5] = c[4],
c[4] = this.P0(s);
for (e = 16; e < 64; e += 1)
a = Fr(c[0], 12),
o = a + c[4] + Fr(this.T_16_63, e),
o = Fr(o, 7),
n = o ^ a,
i = this.FF_16_63(c[0], c[1], c[2]) + c[3] + n + r[e],
s = this.GG_16_63(c[4], c[5], c[6]) + c[7] + o + t[e],
c[3] = c[2],
c[2] = Fr(c[1], 9),
c[1] = c[0],
c[0] = i,
c[7] = c[6],
c[6] = Fr(c[5], 19),
c[5] = c[4],
c[4] = this.P0(s);
for (e = 0; e < 8; e += 1)
u[e] ^= c[e];
this.xOff = 0,
Array.Copy(this.X0, 0, this.X, 0, this.X0.length)
},
ProcessWord: function(e, t) {
var r = e[t] << 24;
r |= (255 & e[t += 1]) << 16,
r |= (255 & e[t += 1]) << 8,
r |= 255 & e[t += 1],
this.X[this.xOff] = r,
16 == ++this.xOff && this.ProcessBlock()
},
ProcessLength: function(e) {
this.xOff > 14 && this.ProcessBlock(),
this.X[14] = this.URShiftLong(e, 32),
this.X[15] = 4294967295 & e
},
IntToBigEndian: function(e, t, r) {
t[r] = e >>> 24 & 255,
t[r += 1] = e >>> 16 & 255,
t[r += 1] = e >>> 8 & 255,
t[r += 1] = 255 & e
},
DoFinal: function(e, t) {
this.Finish();
for (var r = 0; r < 8; r += 1)
this.IntToBigEndian(this.v[r], e, t + 4 * r);
return this.Reset(),
this.DIGEST_LENGTH
},
Update: function(e) {
this.xBuf[this.xBufOff++] = e,
this.xBufOff == this.xBuf.length && (this.ProcessWord(this.xBuf, 0),
this.xBufOff = 0),
this.byteCount++
},
BlockUpdate: function(e, t, r) {
while (0 != this.xBufOff && r > 0)
this.Update(e[t]),
t += 1,
r -= 1;
while (r > this.xBuf.length)
this.ProcessWord(e, t),
t += this.xBuf.length,
r -= this.xBuf.length,
this.byteCount += this.xBuf.length;
while (r > 0)
this.Update(e[t]),
t += 1,
r -= 1
},
Finish: function() {
var e = this.byteCount << 3;
this.Update(128);
while (0 != this.xBufOff)
this.Update(0);
this.ProcessLength(e),
this.ProcessBlock()
},
ROTATE: function(e, t) {
return e << t | this.URShift(e, 32 - t)
},
P0: function(e) {
return e ^ Fr(e, 9) ^ Fr(e, 17)
},
P1: function(e) {
return e ^ Fr(e, 15) ^ Fr(e, 23)
},
FF_00_15: function(e, t, r) {
return e ^ t ^ r
},
FF_16_63: function(e, t, r) {
return e & t | e & r | t & r
},
GG_00_15: function(e, t, r) {
return e ^ t ^ r
},
GG_16_63: function(e, t, r) {
return e & t | ~e & r
},
URShift: function(e, t) {
return console.error(e),
(e > Int32.maxValue || e < Int32.minValue) && (console.error(e),
e = Cr(e)),
e >= 0 ? e >> t : (e >> t) + (2 << ~t)
},
URShiftLong: function(e, t) {
var r, o = new E;
if (o.fromInt(e),
o.signum() >= 0)
r = o.shiftRight(t).intValue();
else {
var n = new E;
n.fromInt(2);
var i = ~t
, s = "";
if (i < 0) {
for (var a = 64 + i, u = 0; u < a; u += 1)
s += "0";
var c = new E;
c.fromInt(e >> t);
var f = new E("10" + s,2);
s = f.toRadix(10);
var l = f.add(c);
r = l.toRadix(10)
} else
s = n.shiftLeft(~t).intValue(),
r = (e >> t) + s
}
return r
},
GetZ: function(e, t, r) {
var o = A.enc.Utf8.parse(r)
, n = 4 * o.words.length * 8;
this.Update(n >> 8 & 255),
this.Update(255 & n);
var i = this.GetWords(o.toString());
this.BlockUpdate(i, 0, i.length);
var s = this.GetWords(e.curve.a.toBigInteger().toRadix(16))
, a = this.GetWords(e.curve.b.toBigInteger().toRadix(16))
, u = this.GetWords(e.getX().toBigInteger().toRadix(16))
, c = this.GetWords(e.getY().toBigInteger().toRadix(16))
, f = this.GetWords(t.substr(0, 64))
, l = this.GetWords(t.substr(64, 64));
this.BlockUpdate(s, 0, s.length),
this.BlockUpdate(a, 0, a.length),
this.BlockUpdate(u, 0, u.length),
this.BlockUpdate(c, 0, c.length),
this.BlockUpdate(f, 0, f.length),
this.BlockUpdate(l, 0, l.length);
var h = [this.GetDigestSize()];
return this.DoFinal(h, 0),
h
},
GetWords: function(e) {
for (var t = [], r = e.length, o = 0; o < r; o += 2)
t[t.length] = parseInt(e.substr(o, 2), 16);
return t
},
GetHex: function(e) {
for (var t = [], r = 0, o = 0; o < 2 * e.length; o += 2)
t[o >>> 3] |= parseInt(e[r]) << 24 - o % 8 * 4,
r += 1;
var n = new A.lib.WordArray.init(t,e.length);
return n
}
},
Array.Clear = function(e, t, r) {
for (var o in e)
e[o] = null
}
,
Array.Copy = function(e, t, r, o, n) {
for (var i = e.slice(t, t + n), s = 0; s < i.length; s += 1)
r[o] = i[s],
o += 1
}
,
window.Int32 = {
minValue: -parseInt("10000000000000000000000000000000", 2),
maxValue: parseInt("1111111111111111111111111111111", 2),
parse: function(e) {
if (e < this.minValue) {
for (var t = new Number(-e), r = t.toString(2), o = r.substr(r.length - 31, 31), n = "", i = 0; i < o.length; i += 1) {
var s = o.substr(i, 1);
n += "0" == s ? "1" : "0"
}
var a = parseInt(n, 2);
return a + 1
}
if (e > this.maxValue) {
for (t = Number(e),
r = t.toString(2),
o = r.substr(r.length - 31, 31),
n = "",
i = 0; i < o.length; i += 1) {
s = o.substr(i, 1);
n += "0" == s ? "1" : "0"
}
a = parseInt(n, 2);
return -(a + 1)
}
return e
},
parseByte: function(e) {
if (e > 255) {
var t = 255 & e;
return t
}
if (e < -256) {
t = 255 & e;
return t ^= 255,
t + 1
}
return e
}
},
n.crypto.SM3withSM2 = function(e) {
var t = "sm2"
, r = new Vt;
this.type = "SM2",
this.getBigRandom = function(e) {
return new E(e.bitLength(),r).mod(e.subtract(E.ONE)).add(E.ONE)
}
,
this.setNamedCurve = function(e) {
this.ecparams = n.crypto.ECParameterDB.getByName(e),
this.prvKeyHex = null,
this.pubKeyHex = null,
this.curveName = e
}
,
this.setPrivateKeyHex = function(e) {
this.isPrivate = !0,
this.prvKeyHex = e
}
,
this.setPublicKeyHex = function(e) {
this.isPublic = !0,
this.pubKeyHex = e
}
,
this.generateKeyPairHex = function() {
var e = this.ecparams["n"]
, t = this.getBigRandom(e)
, r = this.ecparams["G"].multiply(t)
, o = r.getX().toBigInteger()
, n = r.getY().toBigInteger()
, i = this.ecparams["keylen"] / 4
, s = ("0000000000" + t.toString(16)).slice(-i)
, a = ("0000000000" + o.toString(16)).slice(-i)
, u = ("0000000000" + n.toString(16)).slice(-i)
, c = "04" + a + u;
return this.setPrivateKeyHex(s),
this.setPublicKeyHex(c),
{
ecprvhex: s,
ecpubhex: c
}
}
,
this.signWithMessageHash = function(e) {
return this.signHex(e, this.prvKeyHex)
}
,
this.signHex = function(e, t) {
var r = new E(t,16)
, o = this.ecparams["n"]
, n = new E(e,16)
, i = null
, s = null
, a = null
, u = null
, c = r;
do {
do {
var f = this.generateKeyPairHex();
i = new E(f.ecprvhex,16);
var l = f.ecpubhex;
s = tr.decodeFromHex(this.ecparams["curve"], l),
a = n.add(s.getX().toBigInteger()),
a = a.mod(o)
} while (a.equals(E.ZERO) || a.add(i).equals(o));
var h = c.add(E.ONE);
h = h.modInverse(o),
u = a.multiply(c),
u = i.subtract(u).mod(o),
u = h.multiply(u).mod(o)
} while (u.equals(E.ZERO));
var d = a.toRadix(16)
, p = u.toRadix(16);
if (64 != d.length) {
r = 64 - d.length;
for (var g = 0; g < r; g++)
d = "0" + d
}
if (64 != p.length)
for (r = 64 - p.length,
g = 0; g < r; g++)
p = "0" + p;
return d + p
}
,
this.sign = function(e, t) {
var r = t
, o = this.ecparams["n"]
, n = E.fromByteArrayUnsigned(e);
do {
var i = this.getBigRandom(o)
, s = this.ecparams["G"]
, a = s.multiply(i)
, u = a.getX().toBigInteger().mod(o)
} while (u.compareTo(E.ZERO) <= 0);
var c = i.modInverse(o).multiply(n.add(r.multiply(u))).mod(o);
return this.serializeSig(u, c)
}
,
this.verifyWithMessageHash = function(e, t) {
return this.verifyHex(e, t, this.pubKeyHex)
}
,
this.verifyHex = function(e, t, r) {
var o, n;
o = t.substr(0, 64),
n = t.substr(64, 64);
var i, s = new E(o,16), a = new E(n,16);
i = tr.decodeFromHex(this.ecparams["curve"], r);
var u = new E(e,16);
return this.verifyRaw(u, s, a, i)
}
,
this.verify = function(e, t, r) {
var n, i, s;
if (Bitcoin.Util.isArray(t)) {
var a = this.parseSig(t);
n = a.r,
i = a.s
} else {
if ("object" !== o(t) || !t.r || !t.s)
throw "Invalid value for signature";
n = t.r,
i = t.s
}
if (r instanceof tr)
s = r;
else {
if (!Bitcoin.Util.isArray(r))
throw "Invalid format for pubkey value, must be byte array or ECPointFp";
s = tr.decodeFrom(this.ecparams["curve"], r)
}
var u = E.fromByteArrayUnsigned(e);
return this.verifyRaw(u, n, i, s)
}
,
this.verifyRaw = function(e, t, r, o) {
var n = this.ecparams["n"]
, i = this.ecparams["G"]
, s = t.add(r).mod(n);
if (s.equals(E.ZERO))
return !1;
if (t.compareTo(E.ONE) < 0 || t.compareTo(n) >= 0)
return !1;
if (r.compareTo(E.ONE) < 0 || r.compareTo(n) >= 0)
return !1;
if (0 == o.isOnCurve())
return !1;
var a = i.multiply(r);
a = a.add(o.multiply(s));
var u = e.add(a.getX().toBigInteger()).mod(n);
return t.equals(u)
}
,
this.serializeSig = function(e, t) {
var r = e.toByteArraySigned()
, o = t.toByteArraySigned()
, n = [];
return n.push(2),
n.push(r.length),
n = n.concat(r),
n.push(2),
n.push(o.length),
n = n.concat(o),
n.unshift(n.length),
n.unshift(48),
n
}
,
this.parseSig = function(e) {
var t;
if (48 != e[0])
throw new Error("Signature not a valid DERSequence");
if (t = 2,
2 != e[t])
throw new Error("First element in signature must be a DERInteger");
var r = e.slice(t + 2, t + 2 + e[t + 1]);
if (t += 2 + e[t + 1],
2 != e[t])
throw new Error("Second element in signature must be a DERInteger");
var o = e.slice(t + 2, t + 2 + e[t + 1]);
t += 2 + e[t + 1];
var n = E.fromByteArrayUnsigned(r)
, i = E.fromByteArrayUnsigned(o);
return {
r: n,
s: i
}
}
,
this.parseSigCompact = function(e) {
if (65 !== e.length)
throw "Signature has the wrong length";
var t = e[0] - 27;
if (t < 0 || t > 7)
throw "Invalid signature type";
var r = this.ecparams["n"]
, o = E.fromByteArrayUnsigned(e.slice(1, 33)).mod(r)
, n = E.fromByteArrayUnsigned(e.slice(33, 65)).mod(r);
return {
r: o,
s: n,
i: t
}
}
,
void 0 !== e && void 0 !== e["curve"] && (this.curveName = e["curve"]),
void 0 === this.curveName && (this.curveName = t),
this.setNamedCurve(this.curveName),
void 0 !== e && (void 0 !== e["prv"] && this.setPrivateKeyHex(e["prv"]),
void 0 !== e["pub"] && this.setPublicKeyHex(e["pub"]))
}
,
n.crypto.ECParameterDB = new function() {
var e = {}
, t = {};
function r(e) {
return new E(e,16)
}
this.getByName = function(r) {
var o = r;
if ("undefined" != typeof t[o] && (o = t[r]),
"undefined" != typeof e[o])
return e[o];
throw "unregistered EC curve name: " + o
}
,
this.regist = function(o, n, i, s, a, u, c, f, l, h, d, p) {
e[o] = {};
var g = r(i)
, m = r(s)
, w = r(a)
, y = r(u)
, v = r(c)
, F = new lr(g,m,w)
, C = F.decodePointHex("04" + f + l);
e[o]["name"] = o,
e[o]["keylen"] = n,
e[o]["curve"] = F,
e[o]["G"] = C,
e[o]["n"] = y,
e[o]["h"] = v,
e[o]["oid"] = d,
e[o]["info"] = p;
for (var b = 0; b < h.length; b += 1)
t[h[b]] = o
}
}
,
n.crypto.ECParameterDB.regist("secp128r1", 128, "FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF", "FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC", "E87579C11079F43DD824993C2CEE5ED3", "FFFFFFFE0000000075A30D1B9038A115", "1", "161FF7528B899B2D0C28607CA52C5B86", "CF5AC8395BAFEB13C02DA292DDED7A83", [], "", "secp128r1 : SECG curve over a 128 bit prime field"),
n.crypto.ECParameterDB.regist("secp160k1", 160, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73", "0", "7", "0100000000000000000001B8FA16DFAB9ACA16B6B3", "1", "3B4C382CE37AA192A4019E763036F4F5DD4D7EBB", "938CF935318FDCED6BC28286531733C3F03C4FEE", [], "", "secp160k1 : SECG curve over a 160 bit prime field"),
n.crypto.ECParameterDB.regist("secp160r1", 160, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC", "1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45", "0100000000000000000001F4C8F927AED3CA752257", "1", "4A96B5688EF573284664698968C38BB913CBFC82", "23A628553168947D59DCC912042351377AC5FB32", [], "", "secp160r1 : SECG curve over a 160 bit prime field"),
n.crypto.ECParameterDB.regist("secp192k1", 192, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37", "0", "3", "FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D", "1", "DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D", "9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D", []),
n.crypto.ECParameterDB.regist("secp192r1", 192, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC", "64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1", "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831", "1", "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012", "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811", []),
n.crypto.ECParameterDB.regist("secp224r1", 224, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE", "B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4", "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D", "1", "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21", "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34", []),
n.crypto.ECParameterDB.regist("secp256k1", 256, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", "0", "7", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", "1", "79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", "483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", []),
n.crypto.ECParameterDB.regist("secp256r1", 256, "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF", "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC", "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B", "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551", "1", "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296", "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5", ["NIST P-256", "P-256", "prime256v1"]),
n.crypto.ECParameterDB.regist("secp384r1", 384, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC", "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973", "1", "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7", "3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f", ["NIST P-384", "P-384"]),
n.crypto.ECParameterDB.regist("secp521r1", 521, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC", "051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00", "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409", "1", "C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66", "011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650", ["NIST P-521", "P-521"]),
n.crypto.ECParameterDB.regist("sm2", 256, "FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF", "FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC", "28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93", "FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123", "1", "32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7", "BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0", ["sm2", "SM2"]),
br.prototype = {
getHexString: function(e) {
return 0 == (1 & e.length) ? e : "0" + e
},
hex2Byte: function(e) {
if (e > 127 || e < -128) {
var t = 255 & e;
return t > 127 ? (t = 127 & e,
t ^= 127,
-(t + 1)) : t
}
return e
},
Reset: function() {
this.sm3keybase = new vr,
this.sm3c3 = new vr;
var e = this.p2.getX().toBigInteger().toRadix(16)
, t = this.p2.getY().toBigInteger().toRadix(16);
if (64 != e.length)
for (var r = 64 - e.length, o = 0; o < r; o++)
e = "0" + e;
if (64 != t.length && 64 != t.length)
for (r = 64 - t.length,
o = 0; o < r; o++)
t = "0" + t;
var n = this.GetWords(e)
, i = this.GetWords(t);
this.sm3c3.BlockUpdate(n, 0, n.length),
this.sm3keybase.BlockUpdate(n, 0, n.length),
this.sm3keybase.BlockUpdate(i, 0, i.length),
this.ct = 1,
this.NextKey()
},
NextKey: function() {
var e = new vr(this.sm3keybase);
e.Update(this.ct >> 24 & 255),
e.Update(this.ct >> 16 & 255),
e.Update(this.ct >> 8 & 255),
e.Update(255 & this.ct),
e.DoFinal(this.key, 0),
this.keyOff = 0,
this.ct++
},
InitEncipher: function(e) {
var t = null
, r = null
, o = new n.crypto.ECDSA({
curve: "sm2"
})
, i = o.generateKeyPairHex();
t = new E(i.ecprvhex,16);
var s = i.ecpubhex;
return r = tr.decodeFromHex(o.ecparams["curve"], s),
this.p2 = e.multiply(t),
this.Reset(),
r
},
EncryptBlock: function(e) {
this.sm3c3.BlockUpdate(e, 0, e.length);
for (var t = 0; t < e.length; t++)
this.keyOff == this.key.length && this.NextKey(),
e[t] ^= this.key[this.keyOff++]
},
InitDecipher: function(e, t) {
this.p2 = t.multiply(e),
this.Reset()
},
DecryptBlock: function(e) {
for (var t = 0; t < e.length; t++)
this.keyOff == this.key.length && this.NextKey(),
e[t] ^= this.key[this.keyOff++];
this.sm3c3.BlockUpdate(e, 0, e.length)
},
Dofinal: function(e) {
var t = this.p2.getY().toBigInteger().toRadix(16);
if (64 != t.length && 64 != t.length)
for (var r = 64 - t.length, o = 0; o < r; o++)
t = "0" + t;
var n = this.GetWords(t);
this.sm3c3.BlockUpdate(n, 0, n.length),
this.sm3c3.DoFinal(e, 0),
this.Reset()
},
Encrypt: function(e, t) {
var r = new Array(t.length);
Array.Copy(t, 0, r, 0, t.length);
var o = this.InitEncipher(e);
this.EncryptBlock(r);
var n, i = new Array(32);
this.Dofinal(i);
var s = o.getX().toBigInteger().toRadix(16)
, a = o.getY().toBigInteger().toRadix(16);
if (64 != s.length)
for (var u = 64 - s.length, c = 0; c < u; c++)
s = "0" + s;
if (64 != a.length && 64 != a.length)
for (u = 64 - a.length,
c = 0; c < u; c++)
a = "0" + a;
switch (this.cipherMode) {
case SM2CipherMode.C1C3C2:
n = s + a + this.GetHex(i).toString() + this.GetHex(r).toString();
break;
case SM2CipherMode.C1C2C3:
n = o.getX().toBigInteger().toRadix(16) + o.getY().toBigInteger().toRadix(16) + this.GetHex(r).toString() + this.GetHex(i).toString();
break;
default:
throw new Error("[SM2:Decrypt]invalid type cipherMode(" + this.cipherMode + ")")
}
return n
},
GetWords: function(e) {
for (var t = [], r = e.length, o = 0; o < r; o += 2)
t[t.length] = parseInt(e.substr(o, 2), 16);
return t
},
GetHex: function(e) {
for (var t = new Array(32), r = 0, o = 0; o < 2 * e.length; o += 2)
t[o >>> 3] |= parseInt(e[r]) << 24 - o % 8 * 4,
r++;
var n = new A.lib.WordArray.init(t,e.length);
return n
},
Decrypt: function(e, t) {
var r, o = t, i = o.substr(0, 64), s = o.substr(0 + i.length, 64), a = new n.crypto.ECDSA({
curve: "sm2"
}), u = a.ecparams["n"];
if (!(e.compareTo(u.subtract(E.ONE)) > 0) && !(e.compareTo(E.ONE) < 0)) {
var c;
switch (this.cipherMode) {
case SM2CipherMode.C1C3C2:
r = o.substr(i.length + s.length, 64),
c = o.substr(i.length + s.length + 64);
break;
case SM2CipherMode.C1C2C3:
c = o.substr(i.length + s.length, o.length - i.length - s.length - 64),
r = o.substr(o.length - 64);
break;
default:
throw new Error("[SM2:Decrypt]invalid type cipherMode(" + this.cipherMode + ")")
}
var f = this.GetWords(c)
, l = this.CreatePoint(i, s);
if (void 0 != l) {
this.InitDecipher(e, l),
this.DecryptBlock(f);
var h = new Array(32);
this.Dofinal(h);
var d = this.GetHex(h).toString().toLowerCase() == r.toLowerCase();
if (d) {
var p = this.GetHex(f)
, g = A.enc.Utf8.stringify(p);
return g
}
throw new Error("[SM2:Decrypt] C3 is not match!")
}
}
},
CreatePoint: function(e, t) {
var r = new n.crypto.ECDSA({
curve: "sm2"
})
, o = (r.ecparams["curve"],
"04" + e + t)
, i = tr.decodeFromHex(r.ecparams["curve"], o);
if (0 != i.isOnCurve())
return i
}
},
window.SM2CipherMode = {
C1C2C3: 0,
C1C3C2: 1
}
}
})
}
)({})
//console.log(huahua("a951"))
var e = JSON.stringify({
"aaa": "123465",
"bbb": "",
"ccc": "",
"ddd": "",
"eee": "",
"ggg": "",
"fff": "654321",
"hhh": "",
"iii": 1,
"jjj": 50
});
function getdata1(e) {
a = "04996bc6779bc2b061177dc250a06702234f31f787a91079daacd6e72b6e6f9d66295c0fa7dfc16f6ccc87b0d4a598dd52400b57410d2e19fc92741c94742542ed",
u = "04e203e18365928fa36eb139ffe1d7342bc0f53f12a83c67ccbd69e7e847a1cdac5be935cce1bea90e6b6c8329c7f4ded49a07ff1985191367345e770fa3e90d6d",
c = "10a28b6084ebf95d8c11c4ff285081ea7e7e59739fa9846f3f60a90dc4451062",
o = huahua("a951"),
t = e,
r = (0, o.SG_sm3encrypt)(t),
n = r + t,
i = (0,o.generateSM4Key)(),
s = (0,o.SG_sm4encrypt)(n, i),
u = (0,o.SG_sm2Encrypt)(i, a),
c = new Object;
return c.privateParam = u,
c.data = s,
JSON.stringify(c)
}
console.log(getdata1(e))