js sm4 算法
var f=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function a(e){if(e.__esModule)return e;var r=e.default;if(typeof r=="function"){var o=function n(){if(this instanceof n){var t=[null];t.push.apply(t,arguments);var u=Function.bind.apply(r,t);return new u}return r.apply(this,arguments)};o.prototype=r.prototype}else o={};return Object.defineProperty(o,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(o,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}),o}; var zi = f; var ot = {} , Vi = { get exports() { return ot }, set exports(s) { ot = s } }; (function(s, n) { (function() { var o, f = 0xdeadbeefcafe, u = (f & 16777215) == 15715070; function r(t, e, i) { t != null && (typeof t == "number" ? this.fromNumber(t, e, i) : e == null && typeof t != "string" ? this.fromString(t, 256) : this.fromString(t, e)) } function l() { return new r(null) } function g(t, e, i, h, c, a) { for (; --a >= 0; ) { var x = e * this[t++] + i[h] + c; c = Math.floor(x / 67108864), i[h++] = x & 67108863 } return c } function d(t, e, i, h, c, a) { for (var x = e & 32767, p = e >> 15; --a >= 0; ) { var S = this[t] & 32767 , q = this[t++] >> 15 , L = p * S + q * x; S = x * S + ((L & 32767) << 15) + i[h] + (c & 1073741823), c = (S >>> 30) + (L >>> 15) + p * q + (c >>> 30), i[h++] = S & 1073741823 } return c } function m(t, e, i, h, c, a) { for (var x = e & 16383, p = e >> 14; --a >= 0; ) { var S = this[t] & 16383 , q = this[t++] >> 14 , L = p * S + q * x; S = x * S + ((L & 16383) << 14) + i[h] + c, c = (S >> 28) + (L >> 14) + p * q, i[h++] = S & 268435455 } return c } var w = typeof navigator < "u"; w && u && navigator.appName == "Microsoft Internet Explorer" ? (r.prototype.am = d, o = 30) : w && u && navigator.appName != "Netscape" ? (r.prototype.am = g, o = 26) : (r.prototype.am = m, o = 28), r.prototype.DB = o, r.prototype.DM = (1 << o) - 1, r.prototype.DV = 1 << o; var y = 52; r.prototype.FV = Math.pow(2, y), r.prototype.F1 = y - o, r.prototype.F2 = 2 * o - y; var b = "0123456789abcdefghijklmnopqrstuvwxyz", F = new Array, T, I; for (T = "0".charCodeAt(0), I = 0; I <= 9; ++I) F[T++] = I; for (T = "a".charCodeAt(0), I = 10; I < 36; ++I) F[T++] = I; for (T = "A".charCodeAt(0), I = 10; I < 36; ++I) F[T++] = I; function C(t) { return b.charAt(t) } function R(t, e) { var i = F[t.charCodeAt(e)]; return i ?? -1 } function B(t) { for (var e = this.t - 1; e >= 0; --e) t[e] = this[e]; t.t = this.t, t.s = this.s } function $(t) { this.t = 1, this.s = t < 0 ? -1 : 0, t > 0 ? this[0] = t : t < -1 ? this[0] = t + this.DV : this.t = 0 } function Z(t) { var e = l(); return e.fromInt(t), e } function wt(t, e) { var i; if (e == 16) i = 4; else if (e == 8) i = 3; else if (e == 256) i = 8; else if (e == 2) i = 1; else if (e == 32) i = 5; else if (e == 4) i = 2; else { this.fromRadix(t, e); return } this.t = 0, this.s = 0; for (var h = t.length, c = !1, a = 0; --h >= 0; ) { var x = i == 8 ? t[h] & 255 : R(t, h); if (x < 0) { t.charAt(h) == "-" && (c = !0); continue } c = !1, a == 0 ? this[this.t++] = x : a + i > this.DB ? (this[this.t - 1] |= (x & (1 << this.DB - a) - 1) << a, this[this.t++] = x >> this.DB - a) : this[this.t - 1] |= x << a, a += i, a >= this.DB && (a -= this.DB) } i == 8 && t[0] & 128 && (this.s = -1, a > 0 && (this[this.t - 1] |= (1 << this.DB - a) - 1 << a)), this.clamp(), c && r.ZERO.subTo(this, this) } function Ft() { for (var t = this.s & this.DM; this.t > 0 && this[this.t - 1] == t; ) --this.t } function ee(t) { if (this.s < 0) return "-" + this.negate().toString(t); var e; if (t == 16) e = 4; else if (t == 8) e = 3; else if (t == 2) e = 1; else if (t == 32) e = 5; else if (t == 4) e = 2; else return this.toRadix(t); var i = (1 << e) - 1, h, c = !1, a = "", x = this.t, p = this.DB - x * this.DB % e; if (x-- > 0) for (p < this.DB && (h = this[x] >> p) > 0 && (c = !0, a = C(h)); x >= 0; ) p < e ? (h = (this[x] & (1 << p) - 1) << e - p, h |= this[--x] >> (p += this.DB - e)) : (h = this[x] >> (p -= e) & i, p <= 0 && (p += this.DB, --x)), h > 0 && (c = !0), c && (a += C(h)); return c ? a : "0" } function ie() { var t = l(); return r.ZERO.subTo(this, t), t } function ne() { return this.s < 0 ? this.negate() : this } function se(t) { var e = this.s - t.s; if (e != 0) return e; var i = this.t; if (e = i - t.t, e != 0) return this.s < 0 ? -e : e; for (; --i >= 0; ) if ((e = this[i] - t[i]) != 0) return e; return 0 } function xt(t) { var e = 1, i; return (i = t >>> 16) != 0 && (t = i, e += 16), (i = t >> 8) != 0 && (t = i, e += 8), (i = t >> 4) != 0 && (t = i, e += 4), (i = t >> 2) != 0 && (t = i, e += 2), (i = t >> 1) != 0 && (t = i, e += 1), e } function re() { return this.t <= 0 ? 0 : this.DB * (this.t - 1) + xt(this[this.t - 1] ^ this.s & this.DM) } function oe(t, e) { var i; for (i = this.t - 1; i >= 0; --i) e[i + t] = this[i]; for (i = t - 1; i >= 0; --i) e[i] = 0; e.t = this.t + t, e.s = this.s } function fe(t, e) { for (var i = t; i < this.t; ++i) e[i - t] = this[i]; e.t = Math.max(this.t - t, 0), e.s = this.s } function he(t, e) { var i = t % this.DB, h = this.DB - i, c = (1 << h) - 1, a = Math.floor(t / this.DB), x = this.s << i & this.DM, p; for (p = this.t - 1; p >= 0; --p) e[p + a + 1] = this[p] >> h | x, x = (this[p] & c) << i; for (p = a - 1; p >= 0; --p) e[p] = 0; e[a] = x, e.t = this.t + a + 1, e.s = this.s, e.clamp() } function ue(t, e) { e.s = this.s; var i = Math.floor(t / this.DB); if (i >= this.t) { e.t = 0; return } var h = t % this.DB , c = this.DB - h , a = (1 << h) - 1; e[0] = this[i] >> h; for (var x = i + 1; x < this.t; ++x) e[x - i - 1] |= (this[x] & a) << c, e[x - i] = this[x] >> h; h > 0 && (e[this.t - i - 1] |= (this.s & a) << c), e.t = this.t - i, e.clamp() } function ce(t, e) { for (var i = 0, h = 0, c = Math.min(t.t, this.t); i < c; ) h += this[i] - t[i], e[i++] = h & this.DM, h >>= this.DB; if (t.t < this.t) { for (h -= t.s; i < this.t; ) h += this[i], e[i++] = h & this.DM, h >>= this.DB; h += this.s } else { for (h += this.s; i < t.t; ) h -= t[i], e[i++] = h & this.DM, h >>= this.DB; h -= t.s } e.s = h < 0 ? -1 : 0, h < -1 ? e[i++] = this.DV + h : h > 0 && (e[i++] = h), e.t = i, e.clamp() } function le(t, e) { var i = this.abs() , h = t.abs() , c = i.t; for (e.t = c + h.t; --c >= 0; ) e[c] = 0; for (c = 0; c < h.t; ++c) e[c + i.t] = i.am(0, h[c], e, c, 0, i.t); e.s = 0, e.clamp(), this.s != t.s && r.ZERO.subTo(e, e) } function ae(t) { for (var e = this.abs(), i = t.t = 2 * e.t; --i >= 0; ) t[i] = 0; for (i = 0; i < e.t - 1; ++i) { var h = e.am(i, e[i], t, 2 * i, 0, 1); (t[i + e.t] += e.am(i + 1, 2 * e[i], t, 2 * i + 1, h, e.t - i - 1)) >= e.DV && (t[i + e.t] -= e.DV, t[i + e.t + 1] = 1) } t.t > 0 && (t[t.t - 1] += e.am(i, e[i], t, 2 * i, 0, 1)), t.s = 0, t.clamp() } function xe(t, e, i) { var h = t.abs(); if (!(h.t <= 0)) { var c = this.abs(); if (c.t < h.t) { e != null && e.fromInt(0), i != null && this.copyTo(i); return } i == null && (i = l()); var a = l() , x = this.s , p = t.s , S = this.DB - xt(h[h.t - 1]); S > 0 ? (h.lShiftTo(S, a), c.lShiftTo(S, i)) : (h.copyTo(a), c.copyTo(i)); var q = a.t , L = a[q - 1]; if (L != 0) { var O = L * (1 << this.F1) + (q > 1 ? a[q - 2] >> this.F2 : 0) , _ = this.FV / O , dt = (1 << this.F1) / O , V = 1 << this.F2 , k = i.t , gt = k - q , G = e ?? l(); for (a.dlShiftTo(gt, G), i.compareTo(G) >= 0 && (i[i.t++] = 1, i.subTo(G, i)), r.ONE.dlShiftTo(q, G), G.subTo(a, a); a.t < q; ) a[a.t++] = 0; for (; --gt >= 0; ) { var Dt = i[--k] == L ? this.DM : Math.floor(i[k] * _ + (i[k - 1] + V) * dt); if ((i[k] += a.am(0, Dt, i, gt, 0, q)) < Dt) for (a.dlShiftTo(gt, G), i.subTo(G, i); i[k] < --Dt; ) i.subTo(G, i) } e != null && (i.drShiftTo(q, e), x != p && r.ZERO.subTo(e, e)), i.t = q, i.clamp(), S > 0 && i.rShiftTo(S, i), x < 0 && r.ZERO.subTo(i, i) } } } function pe(t) { var e = l(); return this.abs().divRemTo(t, null, e), this.s < 0 && e.compareTo(r.ZERO) > 0 && t.subTo(e, e), e } function Q(t) { this.m = t } function de(t) { return t.s < 0 || t.compareTo(this.m) >= 0 ? t.mod(this.m) : t } function ge(t) { return t } function me(t) { t.divRemTo(this.m, null, t) } function ye(t, e, i) { t.multiplyTo(e, i), this.reduce(i) } function ve(t, e) { t.squareTo(e), this.reduce(e) } Q.prototype.convert = de, Q.prototype.revert = ge, Q.prototype.reduce = me, Q.prototype.mulTo = ye, Q.prototype.sqrTo = ve; function be() { if (this.t < 1) return 0; var t = this[0]; if (!(t & 1)) return 0; var e = t & 3; return e = e * (2 - (t & 15) * e) & 15, e = e * (2 - (t & 255) * e) & 255, e = e * (2 - ((t & 65535) * e & 65535)) & 65535, e = e * (2 - t * e % this.DV) % this.DV, e > 0 ? this.DV - e : -e } function J(t) { this.m = t, this.mp = t.invDigit(), this.mpl = this.mp & 32767, this.mph = this.mp >> 15, this.um = (1 << t.DB - 15) - 1, this.mt2 = 2 * t.t } function Te(t) { var e = l(); return t.abs().dlShiftTo(this.m.t, e), e.divRemTo(this.m, null, e), t.s < 0 && e.compareTo(r.ZERO) > 0 && this.m.subTo(e, e), e } function we(t) { var e = l(); return t.copyTo(e), this.reduce(e), e } function Fe(t) { for (; t.t <= this.mt2; ) t[t.t++] = 0; for (var e = 0; e < this.m.t; ++e) { var i = t[e] & 32767 , h = i * this.mpl + ((i * this.mph + (t[e] >> 15) * this.mpl & this.um) << 15) & t.DM; for (i = e + this.m.t, t[i] += this.m.am(0, h, t, e, 0, this.m.t); t[i] >= t.DV; ) t[i] -= t.DV, t[++i]++ } t.clamp(), t.drShiftTo(this.m.t, t), t.compareTo(this.m) >= 0 && t.subTo(this.m, t) } function Be(t, e) { t.squareTo(e), this.reduce(e) } function Se(t, e, i) { t.multiplyTo(e, i), this.reduce(i) } J.prototype.convert = Te, J.prototype.revert = we, J.prototype.reduce = Fe, J.prototype.mulTo = Se, J.prototype.sqrTo = Be; function Ie() { return (this.t > 0 ? this[0] & 1 : this.s) == 0 } function De(t, e) { if (t > 4294967295 || t < 1) return r.ONE; var i = l() , h = l() , c = e.convert(this) , a = xt(t) - 1; for (c.copyTo(i); --a >= 0; ) if (e.sqrTo(i, h), (t & 1 << a) > 0) e.mulTo(h, c, i); else { var x = i; i = h, h = x } return e.revert(i) } function qe(t, e) { var i; return t < 256 || e.isEven() ? i = new Q(e) : i = new J(e), this.exp(t, i) } r.prototype.copyTo = B, r.prototype.fromInt = $, r.prototype.fromString = wt, r.prototype.clamp = Ft, r.prototype.dlShiftTo = oe, r.prototype.drShiftTo = fe, r.prototype.lShiftTo = he, r.prototype.rShiftTo = ue, r.prototype.subTo = ce, r.prototype.multiplyTo = le, r.prototype.squareTo = ae, r.prototype.divRemTo = xe, r.prototype.invDigit = be, r.prototype.isEven = Ie, r.prototype.exp = De, r.prototype.toString = ee, r.prototype.negate = ie, r.prototype.abs = ne, r.prototype.compareTo = se, r.prototype.bitLength = re, r.prototype.mod = pe, r.prototype.modPowInt = qe, r.ZERO = Z(0), r.ONE = Z(1); function Ee() { var t = l(); return this.copyTo(t), t } function Re() { if (this.s < 0) { if (this.t == 1) return this[0] - this.DV; if (this.t == 0) return -1 } else { if (this.t == 1) return this[0]; if (this.t == 0) return 0 } return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0] } function Ae() { return this.t == 0 ? this.s : this[0] << 24 >> 24 } function Pe() { return this.t == 0 ? this.s : this[0] << 16 >> 16 } function Ce(t) { return Math.floor(Math.LN2 * this.DB / Math.log(t)) } function Me() { return this.s < 0 ? -1 : this.t <= 0 || this.t == 1 && this[0] <= 0 ? 0 : 1 } function Oe(t) { if (t == null && (t = 10), this.signum() == 0 || t < 2 || t > 36) return "0"; var e = this.chunkSize(t) , i = Math.pow(t, e) , h = Z(i) , c = l() , a = l() , x = ""; for (this.divRemTo(h, c, a); c.signum() > 0; ) x = (i + a.intValue()).toString(t).substr(1) + x, c.divRemTo(h, c, a); return a.intValue().toString(t) + x } function He(t, e) { this.fromInt(0), e == null && (e = 10); for (var i = this.chunkSize(e), h = Math.pow(e, i), c = !1, a = 0, x = 0, p = 0; p < t.length; ++p) { var S = R(t, p); if (S < 0) { t.charAt(p) == "-" && this.signum() == 0 && (c = !0); continue } x = e * x + S, ++a >= i && (this.dMultiply(h), this.dAddOffset(x, 0), a = 0, x = 0) } a > 0 && (this.dMultiply(Math.pow(e, a)), this.dAddOffset(x, 0)), c && r.ZERO.subTo(this, this) } function Le(t, e, i) { if (typeof e == "number") if (t < 2) this.fromInt(1); else for (this.fromNumber(t, i), this.testBit(t - 1) || this.bitwiseTo(r.ONE.shiftLeft(t - 1), Bt, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(e); ) this.dAddOffset(2, 0), this.bitLength() > t && this.subTo(r.ONE.shiftLeft(t - 1), this); else { var h = new Array , c = t & 7; h.length = (t >> 3) + 1, e.nextBytes(h), c > 0 ? h[0] &= (1 << c) - 1 : h[0] = 0, this.fromString(h, 256) } } function Ne() { var t = this.t , e = new Array; e[0] = this.s; var i = this.DB - t * this.DB % 8, h, c = 0; if (t-- > 0) for (i < this.DB && (h = this[t] >> i) != (this.s & this.DM) >> i && (e[c++] = h | this.s << this.DB - i); t >= 0; ) i < 8 ? (h = (this[t] & (1 << i) - 1) << 8 - i, h |= this[--t] >> (i += this.DB - 8)) : (h = this[t] >> (i -= 8) & 255, i <= 0 && (i += this.DB, --t)), h & 128 && (h |= -256), c == 0 && (this.s & 128) != (h & 128) && ++c, (c > 0 || h != this.s) && (e[c++] = h); return e } function ze(t) { return this.compareTo(t) == 0 } function Ve(t) { return this.compareTo(t) < 0 ? this : t } function ke(t) { return this.compareTo(t) > 0 ? this : t } function je(t, e, i) { var h, c, a = Math.min(t.t, this.t); for (h = 0; h < a; ++h) i[h] = e(this[h], t[h]); if (t.t < this.t) { for (c = t.s & this.DM, h = a; h < this.t; ++h) i[h] = e(this[h], c); i.t = this.t } else { for (c = this.s & this.DM, h = a; h < t.t; ++h) i[h] = e(c, t[h]); i.t = t.t } i.s = e(this.s, t.s), i.clamp() } function Ze(t, e) { return t & e } function $e(t) { var e = l(); return this.bitwiseTo(t, Ze, e), e } function Bt(t, e) { return t | e } function _e(t) { var e = l(); return this.bitwiseTo(t, Bt, e), e } function At(t, e) { return t ^ e } function Ge(t) { var e = l(); return this.bitwiseTo(t, At, e), e } function Pt(t, e) { return t & ~e } function Ue(t) { var e = l(); return this.bitwiseTo(t, Pt, e), e } function Ke() { for (var t = l(), e = 0; e < this.t; ++e) t[e] = this.DM & ~this[e]; return t.t = this.t, t.s = ~this.s, t } function Ye(t) { var e = l(); return t < 0 ? this.rShiftTo(-t, e) : this.lShiftTo(t, e), e } function Xe(t) { var e = l(); return t < 0 ? this.lShiftTo(-t, e) : this.rShiftTo(t, e), e } function We(t) { if (t == 0) return -1; var e = 0; return t & 65535 || (t >>= 16, e += 16), t & 255 || (t >>= 8, e += 8), t & 15 || (t >>= 4, e += 4), t & 3 || (t >>= 2, e += 2), t & 1 || ++e, e } function Qe() { for (var t = 0; t < this.t; ++t) if (this[t] != 0) return t * this.DB + We(this[t]); return this.s < 0 ? this.t * this.DB : -1 } function Je(t) { for (var e = 0; t != 0; ) t &= t - 1, ++e; return e } function ti() { for (var t = 0, e = this.s & this.DM, i = 0; i < this.t; ++i) t += Je(this[i] ^ e); return t } function ei(t) { var e = Math.floor(t / this.DB); return e >= this.t ? this.s != 0 : (this[e] & 1 << t % this.DB) != 0 } function ii(t, e) { var i = r.ONE.shiftLeft(t); return this.bitwiseTo(i, e, i), i } function ni(t) { return this.changeBit(t, Bt) } function si(t) { return this.changeBit(t, Pt) } function ri(t) { return this.changeBit(t, At) } function oi(t, e) { for (var i = 0, h = 0, c = Math.min(t.t, this.t); i < c; ) h += this[i] + t[i], e[i++] = h & this.DM, h >>= this.DB; if (t.t < this.t) { for (h += t.s; i < this.t; ) h += this[i], e[i++] = h & this.DM, h >>= this.DB; h += this.s } else { for (h += this.s; i < t.t; ) h += t[i], e[i++] = h & this.DM, h >>= this.DB; h += t.s } e.s = h < 0 ? -1 : 0, h > 0 ? e[i++] = h : h < -1 && (e[i++] = this.DV + h), e.t = i, e.clamp() } function fi(t) { var e = l(); return this.addTo(t, e), e } function hi(t) { var e = l(); return this.subTo(t, e), e } function ui(t) { var e = l(); return this.multiplyTo(t, e), e } function ci() { var t = l(); return this.squareTo(t), t } function li(t) { var e = l(); return this.divRemTo(t, e, null), e } function ai(t) { var e = l(); return this.divRemTo(t, null, e), e } function xi(t) { var e = l() , i = l(); return this.divRemTo(t, e, i), new Array(e,i) } function pi(t) { this[this.t] = this.am(0, t - 1, this, 0, 0, this.t), ++this.t, this.clamp() } function di(t, e) { if (t != 0) { for (; this.t <= e; ) this[this.t++] = 0; for (this[e] += t; this[e] >= this.DV; ) this[e] -= this.DV, ++e >= this.t && (this[this.t++] = 0), ++this[e] } } function ut() {} function Ct(t) { return t } function gi(t, e, i) { t.multiplyTo(e, i) } function mi(t, e) { t.squareTo(e) } ut.prototype.convert = Ct, ut.prototype.revert = Ct, ut.prototype.mulTo = gi, ut.prototype.sqrTo = mi; function yi(t) { return this.exp(t, new ut) } function vi(t, e, i) { var h = Math.min(this.t + t.t, e); for (i.s = 0, i.t = h; h > 0; ) i[--h] = 0; var c; for (c = i.t - this.t; h < c; ++h) i[h + this.t] = this.am(0, t[h], i, h, 0, this.t); for (c = Math.min(t.t, e); h < c; ++h) this.am(0, t[h], i, h, 0, e - h); i.clamp() } function bi(t, e, i) { --e; var h = i.t = this.t + t.t - e; for (i.s = 0; --h >= 0; ) i[h] = 0; for (h = Math.max(e - this.t, 0); h < t.t; ++h) i[this.t + h - e] = this.am(e - h, t[h], i, 0, 0, this.t + h - e); i.clamp(), i.drShiftTo(1, i) } function tt(t) { this.r2 = l(), this.q3 = l(), r.ONE.dlShiftTo(2 * t.t, this.r2), this.mu = this.r2.divide(t), this.m = t } function Ti(t) { if (t.s < 0 || t.t > 2 * this.m.t) return t.mod(this.m); if (t.compareTo(this.m) < 0) return t; var e = l(); return t.copyTo(e), this.reduce(e), e } function wi(t) { return t } function Fi(t) { for (t.drShiftTo(this.m.t - 1, this.r2), t.t > this.m.t + 1 && (t.t = this.m.t + 1, t.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); t.compareTo(this.r2) < 0; ) t.dAddOffset(1, this.m.t + 1); for (t.subTo(this.r2, t); t.compareTo(this.m) >= 0; ) t.subTo(this.m, t) } function Bi(t, e) { t.squareTo(e), this.reduce(e) } function Si(t, e, i) { t.multiplyTo(e, i), this.reduce(i) } tt.prototype.convert = Ti, tt.prototype.revert = wi, tt.prototype.reduce = Fi, tt.prototype.mulTo = Si, tt.prototype.sqrTo = Bi; function Ii(t, e) { var i = t.bitLength(), h, c = Z(1), a; if (i <= 0) return c; i < 18 ? h = 1 : i < 48 ? h = 3 : i < 144 ? h = 4 : i < 768 ? h = 5 : h = 6, i < 8 ? a = new Q(e) : e.isEven() ? a = new tt(e) : a = new J(e); var x = new Array , p = 3 , S = h - 1 , q = (1 << h) - 1; if (x[1] = a.convert(this), h > 1) { var L = l(); for (a.sqrTo(x[1], L); p <= q; ) x[p] = l(), a.mulTo(L, x[p - 2], x[p]), p += 2 } var O = t.t - 1, _, dt = !0, V = l(), k; for (i = xt(t[O]) - 1; O >= 0; ) { for (i >= S ? _ = t[O] >> i - S & q : (_ = (t[O] & (1 << i + 1) - 1) << S - i, O > 0 && (_ |= t[O - 1] >> this.DB + i - S)), p = h; !(_ & 1); ) _ >>= 1, --p; if ((i -= p) < 0 && (i += this.DB, --O), dt) x[_].copyTo(c), dt = !1; else { for (; p > 1; ) a.sqrTo(c, V), a.sqrTo(V, c), p -= 2; p > 0 ? a.sqrTo(c, V) : (k = c, c = V, V = k), a.mulTo(V, x[_], c) } for (; O >= 0 && !(t[O] & 1 << i); ) a.sqrTo(c, V), k = c, c = V, V = k, --i < 0 && (i = this.DB - 1, --O) } return a.revert(c) } function Di(t) { var e = this.s < 0 ? this.negate() : this.clone() , i = t.s < 0 ? t.negate() : t.clone(); if (e.compareTo(i) < 0) { var h = e; e = i, i = h } var c = e.getLowestSetBit() , a = i.getLowestSetBit(); if (a < 0) return e; for (c < a && (a = c), a > 0 && (e.rShiftTo(a, e), i.rShiftTo(a, i)); e.signum() > 0; ) (c = e.getLowestSetBit()) > 0 && e.rShiftTo(c, e), (c = i.getLowestSetBit()) > 0 && i.rShiftTo(c, i), e.compareTo(i) >= 0 ? (e.subTo(i, e), e.rShiftTo(1, e)) : (i.subTo(e, i), i.rShiftTo(1, i)); return a > 0 && i.lShiftTo(a, i), i } function qi(t) { if (t <= 0) return 0; var e = this.DV % t , i = this.s < 0 ? t - 1 : 0; if (this.t > 0) if (e == 0) i = this[0] % t; else for (var h = this.t - 1; h >= 0; --h) i = (e * i + this[h]) % t; return i } function Ei(t) { var e = t.isEven(); if (this.isEven() && e || t.signum() == 0) return r.ZERO; for (var i = t.clone(), h = this.clone(), c = Z(1), a = Z(0), x = Z(0), p = Z(1); i.signum() != 0; ) { for (; i.isEven(); ) i.rShiftTo(1, i), e ? ((!c.isEven() || !a.isEven()) && (c.addTo(this, c), a.subTo(t, a)), c.rShiftTo(1, c)) : a.isEven() || a.subTo(t, a), a.rShiftTo(1, a); for (; h.isEven(); ) h.rShiftTo(1, h), e ? ((!x.isEven() || !p.isEven()) && (x.addTo(this, x), p.subTo(t, p)), x.rShiftTo(1, x)) : p.isEven() || p.subTo(t, p), p.rShiftTo(1, p); i.compareTo(h) >= 0 ? (i.subTo(h, i), e && c.subTo(x, c), a.subTo(p, a)) : (h.subTo(i, h), e && x.subTo(c, x), p.subTo(a, p)) } if (h.compareTo(r.ONE) != 0) return r.ZERO; if (p.compareTo(t) >= 0) return p.subtract(t); if (p.signum() < 0) p.addTo(t, p); else return p; return p.signum() < 0 ? p.add(t) : p } var A = [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] , Ri = (1 << 26) / A[A.length - 1]; function Ai(t) { var e, i = this.abs(); if (i.t == 1 && i[0] <= A[A.length - 1]) { for (e = 0; e < A.length; ++e) if (i[0] == A[e]) return !0; return !1 } if (i.isEven()) return !1; for (e = 1; e < A.length; ) { for (var h = A[e], c = e + 1; c < A.length && h < Ri; ) h *= A[c++]; for (h = i.modInt(h); e < c; ) if (h % A[e++] == 0) return !1 } return i.millerRabin(t) } function Pi(t) { var e = this.subtract(r.ONE) , i = e.getLowestSetBit(); if (i <= 0) return !1; var h = e.shiftRight(i); t = t + 1 >> 1, t > A.length && (t = A.length); for (var c = l(), a = 0; a < t; ++a) { c.fromInt(A[Math.floor(Math.random() * A.length)]); var x = c.modPow(h, this); if (x.compareTo(r.ONE) != 0 && x.compareTo(e) != 0) { for (var p = 1; p++ < i && x.compareTo(e) != 0; ) if (x = x.modPowInt(2, this), x.compareTo(r.ONE) == 0) return !1; if (x.compareTo(e) != 0) return !1 } } return !0 } r.prototype.chunkSize = Ce, r.prototype.toRadix = Oe, r.prototype.fromRadix = He, r.prototype.fromNumber = Le, r.prototype.bitwiseTo = je, r.prototype.changeBit = ii, r.prototype.addTo = oi, r.prototype.dMultiply = pi, r.prototype.dAddOffset = di, r.prototype.multiplyLowerTo = vi, r.prototype.multiplyUpperTo = bi, r.prototype.modInt = qi, r.prototype.millerRabin = Pi, r.prototype.clone = Ee, r.prototype.intValue = Re, r.prototype.byteValue = Ae, r.prototype.shortValue = Pe, r.prototype.signum = Me, r.prototype.toByteArray = Ne, r.prototype.equals = ze, r.prototype.min = Ve, r.prototype.max = ke, r.prototype.and = $e, r.prototype.or = _e, r.prototype.xor = Ge, r.prototype.andNot = Ue, r.prototype.not = Ke, r.prototype.shiftLeft = Ye, r.prototype.shiftRight = Xe, r.prototype.getLowestSetBit = Qe, r.prototype.bitCount = ti, r.prototype.testBit = ei, r.prototype.setBit = ni, r.prototype.clearBit = si, r.prototype.flipBit = ri, r.prototype.add = fi, r.prototype.subtract = hi, r.prototype.multiply = ui, r.prototype.divide = li, r.prototype.remainder = ai, r.prototype.divideAndRemainder = xi, r.prototype.modPow = Ii, r.prototype.modInverse = Ei, r.prototype.pow = yi, r.prototype.gcd = Di, r.prototype.isProbablePrime = Ai, r.prototype.square = ci, r.prototype.Barrett = tt; var pt, M, D; function Ci(t) { M[D++] ^= t & 255, M[D++] ^= t >> 8 & 255, M[D++] ^= t >> 16 & 255, M[D++] ^= t >> 24 & 255, D >= It && (D -= It) } function Mt() { Ci(new Date().getTime()) } if (M == null) { M = new Array, D = 0; var z; if (typeof window < "u" && window.crypto) { if (window.crypto.getRandomValues) { var Ot = new Uint8Array(32); for (window.crypto.getRandomValues(Ot), z = 0; z < 32; ++z) M[D++] = Ot[z] } else if (navigator.appName == "Netscape" && navigator.appVersion < "5") { var Ht = window.crypto.random(32); for (z = 0; z < Ht.length; ++z) M[D++] = Ht.charCodeAt(z) & 255 } } for (; D < It; ) z = Math.floor(65536 * Math.random()), M[D++] = z >>> 8, M[D++] = z & 255; D = 0, Mt() } function Mi() { if (pt == null) { for (Mt(), pt = Ni(), pt.init(M), D = 0; D < M.length; ++D) M[D] = 0; D = 0 } return pt.next() } function Oi(t) { var e; for (e = 0; e < t.length; ++e) t[e] = Mi() } function Lt() {} Lt.prototype.nextBytes = Oi; function St() { this.i = 0, this.j = 0, this.S = new Array } function Hi(t) { var e, i, h; for (e = 0; e < 256; ++e) this.S[e] = e; for (i = 0, e = 0; e < 256; ++e) i = i + this.S[e] + t[e % t.length] & 255, h = this.S[e], this.S[e] = this.S[i], this.S[i] = h; this.i = 0, this.j = 0 } function Li() { 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] } St.prototype.init = Hi, St.prototype.next = Li; function Ni() { return new St } var It = 256; s.exports = { default: r, BigInteger: r, SecureRandom: Lt } } ).call(zi) } )(Vi); const {BigInteger: ft} = ot; function ki(s) { let n = s.toString(16); if (n[0] !== "-") n.length % 2 === 1 ? n = "0" + n : n.match(/^[0-7]/) || (n = "00" + n); else { n = n.substr(1); let o = n.length; o % 2 === 1 ? o += 1 : n.match(/^[0-7]/) || (o += 2); let f = ""; for (let u = 0; u < o; u++) f += "f"; f = new ft(f,16), n = f.xor(s).add(ft.ONE), n = n.toString(16).replace(/^-/, "") } return n } class _t { constructor() { this.tlv = null, this.t = "00", this.l = "00", this.v = "" } getEncodedHex() { return this.tlv || (this.v = this.getValue(), this.l = this.getLength(), this.tlv = this.t + this.l + this.v), this.tlv } getLength() { const n = this.v.length / 2; let o = n.toString(16); return o.length % 2 === 1 && (o = "0" + o), n < 128 ? o : (128 + o.length / 2).toString(16) + o } getValue() { return "" } } class Nt extends _t { constructor(n) { super(), this.t = "02", n && (this.v = ki(n)) } getValue() { return this.v } } class ji extends _t { constructor(n) { super(), this.t = "30", this.asn1Array = n } getValue() { return this.v = this.asn1Array.map(n=>n.getEncodedHex()).join(""), this.v } } function Gt(s, n) { return +s[n + 2] < 8 ? 1 : +s.substr(n + 2, 2) & 127 + 1 } function zt(s, n) { const o = Gt(s, n) , f = s.substr(n + 2, o * 2); return f ? (+f[0] < 8 ? new ft(f,16) : new ft(f.substr(2),16)).intValue() : -1 } function qt(s, n) { const o = Gt(s, n); return n + (o + 1) * 2 } var Zi = { encodeDer(s, n) { const o = new Nt(s) , f = new Nt(n); return new ji([o, f]).getEncodedHex() }, decodeDer(s) { const n = qt(s, 0) , o = qt(s, n) , f = zt(s, n) , u = s.substr(o, f * 2) , r = o + u.length , l = qt(s, r) , g = zt(s, r) , d = s.substr(l, g * 2) , m = new ft(u,16) , w = new ft(d,16); return { r: m, s: w } } }; const {BigInteger: P} = ot , Vt = new P("2") , kt = new P("3"); class Y { constructor(n, o) { this.x = o, this.q = n } equals(n) { return n === this ? !0 : this.q.equals(n.q) && this.x.equals(n.x) } toBigInteger() { return this.x } negate() { return new Y(this.q,this.x.negate().mod(this.q)) } add(n) { return new Y(this.q,this.x.add(n.toBigInteger()).mod(this.q)) } subtract(n) { return new Y(this.q,this.x.subtract(n.toBigInteger()).mod(this.q)) } multiply(n) { return new Y(this.q,this.x.multiply(n.toBigInteger()).mod(this.q)) } divide(n) { return new Y(this.q,this.x.multiply(n.toBigInteger().modInverse(this.q)).mod(this.q)) } square() { return new Y(this.q,this.x.square().mod(this.q)) } } class W { constructor(n, o, f, u) { this.curve = n, this.x = o, this.y = f, this.z = u ?? P.ONE, this.zinv = null } getX() { return this.zinv === null && (this.zinv = this.z.modInverse(this.curve.q)), this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q)) } getY() { return this.zinv === null && (this.zinv = this.z.modInverse(this.curve.q)), this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q)) } equals(n) { return n === this ? !0 : this.isInfinity() ? n.isInfinity() : n.isInfinity() ? this.isInfinity() : n.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(n.z)).mod(this.curve.q).equals(P.ZERO) ? n.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(n.z)).mod(this.curve.q).equals(P.ZERO) : !1 } isInfinity() { return this.x === null && this.y === null ? !0 : this.z.equals(P.ZERO) && !this.y.toBigInteger().equals(P.ZERO) } negate() { return new W(this.curve,this.x,this.y.negate(),this.z) } add(n) { if (this.isInfinity()) return n; if (n.isInfinity()) return this; const o = this.x.toBigInteger() , f = this.y.toBigInteger() , u = this.z , r = n.x.toBigInteger() , l = n.y.toBigInteger() , g = n.z , d = this.curve.q , m = o.multiply(g).mod(d) , w = r.multiply(u).mod(d) , y = m.subtract(w) , b = f.multiply(g).mod(d) , F = l.multiply(u).mod(d) , T = b.subtract(F); if (P.ZERO.equals(y)) return P.ZERO.equals(T) ? this.twice() : this.curve.infinity; const I = m.add(w) , C = u.multiply(g).mod(d) , R = y.square().mod(d) , B = y.multiply(R).mod(d) , $ = C.multiply(T.square()).subtract(I.multiply(R)).mod(d) , Z = y.multiply($).mod(d) , wt = T.multiply(R.multiply(m).subtract($)).subtract(b.multiply(B)).mod(d) , Ft = B.multiply(C).mod(d); return new W(this.curve,this.curve.fromBigInteger(Z),this.curve.fromBigInteger(wt),Ft) } twice() { if (this.isInfinity()) return this; if (!this.y.toBigInteger().signum()) return this.curve.infinity; const n = this.x.toBigInteger() , o = this.y.toBigInteger() , f = this.z , u = this.curve.q , r = this.curve.a.toBigInteger() , l = n.square().multiply(kt).add(r.multiply(f.square())).mod(u) , g = o.shiftLeft(1).multiply(f).mod(u) , d = o.square().mod(u) , m = d.multiply(n).multiply(f).mod(u) , w = g.square().mod(u) , y = l.square().subtract(m.shiftLeft(3)).mod(u) , b = g.multiply(y).mod(u) , F = l.multiply(m.shiftLeft(2).subtract(y)).subtract(w.shiftLeft(1).multiply(d)).mod(u) , T = g.multiply(w).mod(u); return new W(this.curve,this.curve.fromBigInteger(b),this.curve.fromBigInteger(F),T) } multiply(n) { if (this.isInfinity()) return this; if (!n.signum()) return this.curve.infinity; const o = n.multiply(kt) , f = this.negate(); let u = this; for (let r = o.bitLength() - 2; r > 0; r--) { u = u.twice(); const l = o.testBit(r) , g = n.testBit(r); l !== g && (u = u.add(l ? this : f)) } return u } } let $i = class { constructor(n, o, f) { this.q = n, this.a = this.fromBigInteger(o), this.b = this.fromBigInteger(f), this.infinity = new W(this,null,null) } equals(n) { return n === this ? !0 : this.q.equals(n.q) && this.a.equals(n.a) && this.b.equals(n.b) } fromBigInteger(n) { return new Y(this.q,n) } decodePointHex(n) { switch (parseInt(n.substr(0, 2), 16)) { case 0: return this.infinity; case 2: case 3: const o = this.fromBigInteger(new P(n.substr(2),16)); let f = this.fromBigInteger(o.multiply(o.square()).add(o.multiply(this.a)).add(this.b).toBigInteger().modPow(this.q.divide(new P("4")).add(P.ONE), this.q)); return f.toBigInteger().mod(Vt).equals(new P(n.substr(0, 2),16).subtract(Vt)) || (f = f.negate()), new W(this,o,f); case 4: case 6: case 7: const u = (n.length - 2) / 2 , r = n.substr(2, u) , l = n.substr(u + 2, u); return new W(this,this.fromBigInteger(new P(r,16)),this.fromBigInteger(new P(l,16))); default: return null } } } ; var _i = { ECPointFp: W, ECCurveFp: $i }; const {BigInteger: j, SecureRandom: Gi} = ot , {ECCurveFp: Ui} = _i , Ki = new Gi , {curve: rt, G: Yi, n: jt} = Ut(); function Xi() { return rt } function Ut() { const s = new j("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF",16) , n = new j("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC",16) , o = new j("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93",16) , f = new Ui(s,n,o) , u = "32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7" , r = "BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0" , l = f.decodePointHex("04" + u + r) , g = new j("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123",16); return { curve: f, G: l, n: g } } function Wi(s, n, o) { const u = (s ? new j(s,n,o) : new j(jt.bitLength(),Ki)).mod(jt.subtract(j.ONE)).add(j.ONE) , r = ct(u.toString(16), 64) , l = Yi.multiply(u) , g = ct(l.getX().toBigInteger().toString(16), 64) , d = ct(l.getY().toBigInteger().toString(16), 64) , m = "04" + g + d; return { privateKey: r, publicKey: m } } function Qi(s) { if (s.length !== 130) throw new Error("Invalid public key to compress"); const n = (s.length - 2) / 2 , o = s.substr(2, n) , f = new j(s.substr(n + 2, n),16); let u = "03"; return f.mod(new j("2")).equals(j.ZERO) && (u = "02"), u + o } function Ji(s) { s = unescape(encodeURIComponent(s)); const n = s.length , o = []; for (let u = 0; u < n; u++) o[u >>> 2] |= (s.charCodeAt(u) & 255) << 24 - u % 4 * 8; const f = []; for (let u = 0; u < n; u++) { const r = o[u >>> 2] >>> 24 - u % 4 * 8 & 255; f.push((r >>> 4).toString(16)), f.push((r & 15).toString(16)) } return f.join("") } function ct(s, n) { return s.length >= n ? s : new Array(n - s.length + 1).join("0") + s } function tn(s) { return s.map(n=>(n = n.toString(16), n.length === 1 ? "0" + n : n)).join("") } function en(s) { const n = []; let o = 0; for (let f = 0; f < s.length * 2; f += 2) n[f >>> 3] |= parseInt(s[o], 10) << 24 - f % 8 * 4, o++; try { const f = []; for (let u = 0; u < s.length; u++) { const r = n[u >>> 2] >>> 24 - u % 4 * 8 & 255; f.push(String.fromCharCode(r)) } return decodeURIComponent(escape(f.join(""))) } catch { throw new Error("Malformed UTF-8 data") } } function nn(s) { const n = []; let o = s.length; o % 2 !== 0 && (s = ct(s, o + 1)), o = s.length; for (let f = 0; f < o; f += 2) n.push(parseInt(s.substr(f, 2), 16)); return n } function sn(s) { const n = rt.decodePointHex(s); if (!n) return !1; const o = n.getX(); return n.getY().square().equals(o.multiply(o.square()).add(o.multiply(rt.a)).add(rt.b)) } function rn(s, n) { const o = rt.decodePointHex(s); if (!o) return !1; const f = rt.decodePointHex(n); return f ? o.equals(f) : !1 } var on = { getGlobalCurve: Xi, generateEcparam: Ut, generateKeyPairHex: Wi, compressPublicKeyHex: Qi, utf8ToHex: Ji, leftPad: ct, arrayToHex: tn, arrayToUtf8: en, hexToArray: nn, verifyPublicKey: sn, comparePublicKeyHex: rn }; function N(s, n) { const o = [] , f = ~~(n / 8) , u = n % 8; for (let r = 0, l = s.length; r < l; r++) o[r] = (s[(r + f) % l] << u & 255) + (s[(r + f + 1) % l] >>> 8 - u & 255); return o } function E(s, n) { const o = []; for (let f = s.length - 1; f >= 0; f--) o[f] = (s[f] ^ n[f]) & 255; return o } function lt(s, n) { const o = []; for (let f = s.length - 1; f >= 0; f--) o[f] = s[f] & n[f] & 255; return o } function Rt(s, n) { const o = []; for (let f = s.length - 1; f >= 0; f--) o[f] = (s[f] | n[f]) & 255; return o } function U(s, n) { const o = []; let f = 0; for (let u = s.length - 1; u >= 0; u--) { const r = s[u] + n[u] + f; r > 255 ? (f = 1, o[u] = r & 255) : (f = 0, o[u] = r & 255) } return o } function fn(s) { const n = []; for (let o = s.length - 1; o >= 0; o--) n[o] = ~s[o] & 255; return n } function hn(s) { return E(E(s, N(s, 9)), N(s, 17)) } function un(s) { return E(E(s, N(s, 15)), N(s, 23)) } function cn(s, n, o, f) { return f >= 0 && f <= 15 ? E(E(s, n), o) : Rt(Rt(lt(s, n), lt(s, o)), lt(n, o)) } function ln(s, n, o, f) { return f >= 0 && f <= 15 ? E(E(s, n), o) : Rt(lt(s, n), lt(fn(s), o)) } function an(s, n) { const o = [] , f = []; for (let B = 0; B < 16; B++) { const $ = B * 4; o.push(n.slice($, $ + 4)) } for (let B = 16; B < 68; B++) o.push(E(E(un(E(E(o[B - 16], o[B - 9]), N(o[B - 3], 15))), N(o[B - 13], 7)), o[B - 6])); for (let B = 0; B < 64; B++) f.push(E(o[B], o[B + 4])); const u = [121, 204, 69, 25] , r = [122, 135, 157, 138]; let l = s.slice(0, 4), g = s.slice(4, 8), d = s.slice(8, 12), m = s.slice(12, 16), w = s.slice(16, 20), y = s.slice(20, 24), b = s.slice(24, 28), F = s.slice(28, 32), T, I, C, R; for (let B = 0; B < 64; B++) { const $ = B >= 0 && B <= 15 ? u : r; T = N(U(U(N(l, 12), w), N($, B)), 7), I = E(T, N(l, 12)), C = U(U(U(cn(l, g, d, B), m), I), f[B]), R = U(U(U(ln(w, y, b, B), F), T), o[B]), m = d, d = N(g, 9), g = l, l = C, F = b, b = N(y, 19), y = w, w = hn(R) } return E([].concat(l, g, d, m, w, y, b, F), s) } function Tt(s) { let n = s.length * 8 , o = n % 512; o = o >= 448 ? 512 - o % 448 - 1 : 448 - o - 1; const f = new Array((o - 7) / 8); for (let d = 0, m = f.length; d < m; d++) f[d] = 0; const u = []; n = n.toString(2); for (let d = 7; d >= 0; d--) if (n.length > 8) { const m = n.length - 8; u[d] = parseInt(n.substr(m), 2), n = n.substr(0, m) } else n.length > 0 ? (u[d] = parseInt(n, 2), n = "") : u[d] = 0; const r = [].concat(s, [128], f, u) , l = r.length / 64; let g = [115, 128, 22, 111, 73, 20, 178, 185, 23, 36, 66, 215, 218, 138, 6, 0, 169, 111, 48, 188, 22, 49, 56, 170, 227, 141, 238, 77, 176, 251, 14, 78]; for (let d = 0; d < l; d++) { const m = 64 * d , w = r.slice(m, m + 64); g = an(g, w) } return g } const at = 64 , Kt = new Array(at) , Yt = new Array(at); for (let s = 0; s < at; s++) Kt[s] = 54, Yt[s] = 92; function xn(s, n) { for (n.length > at && (n = Tt(n)); n.length < at; ) n.push(0); let f = E(n, Kt).concat(s); return f = Tt(f), f = E(n, Yt).concat(f), f = Tt(f), f } var Xt = { sm3: Tt, hmac: xn }; const {BigInteger: H} = ot , {encodeDer: pn, decodeDer: dn} = Zi , v = on , ht = Xt.sm3 , {G: it, curve: Wt, n: nt} = v.generateEcparam() , Qt = 0; function gn(s, n, o=1) { s = typeof s == "string" ? v.hexToArray(v.utf8ToHex(s)) : Array.prototype.slice.call(s), n = v.getGlobalCurve().decodePointHex(n); const f = v.generateKeyPairHex() , u = new H(f.privateKey,16); let r = f.publicKey; r.length > 128 && (r = r.substr(r.length - 128)); const l = n.multiply(u) , g = v.hexToArray(v.leftPad(l.getX().toBigInteger().toRadix(16), 64)) , d = v.hexToArray(v.leftPad(l.getY().toBigInteger().toRadix(16), 64)) , m = v.arrayToHex(ht([].concat(g, s, d))); let w = 1 , y = 0 , b = []; const F = [].concat(g, d) , T = ()=>{ b = ht([...F, w >> 24 & 255, w >> 16 & 255, w >> 8 & 255, w & 255]), w++, y = 0 } ; T(); for (let C = 0, R = s.length; C < R; C++) y === b.length && T(), s[C] ^= b[y++] & 255; const I = v.arrayToHex(s); return o === Qt ? r + I + m : r + m + I } function mn(s, n, o=1, {output: f="string"}={}) { n = new H(n,16); let u = s.substr(128, 64) , r = s.substr(128 + 64); o === Qt && (u = s.substr(s.length - 64), r = s.substr(128, s.length - 128 - 64)); const l = v.hexToArray(r) , d = v.getGlobalCurve().decodePointHex("04" + s.substr(0, 128)).multiply(n) , m = v.hexToArray(v.leftPad(d.getX().toBigInteger().toRadix(16), 64)) , w = v.hexToArray(v.leftPad(d.getY().toBigInteger().toRadix(16), 64)); let y = 1 , b = 0 , F = []; const T = [].concat(m, w) , I = ()=>{ F = ht([...T, y >> 24 & 255, y >> 16 & 255, y >> 8 & 255, y & 255]), y++, b = 0 } ; I(); for (let R = 0, B = l.length; R < B; R++) b === F.length && I(), l[R] ^= F[b++] & 255; return v.arrayToHex(ht([].concat(m, l, w))) === u.toLowerCase() ? f === "array" ? l : v.arrayToUtf8(l) : f === "array" ? [] : "" } function yn(s, n, {pointPool: o, der: f, hash: u, publicKey: r, userId: l}={}) { let g = typeof s == "string" ? v.utf8ToHex(s) : v.arrayToHex(s); u && (r = r || bn(n), g = Jt(g, r, l)); const d = new H(n,16) , m = new H(g,16); let w = null , y = null , b = null; do { do { let F; o && o.length ? F = o.pop() : F = te(), w = F.k, y = m.add(F.x1).mod(nt) } while (y.equals(H.ZERO) || y.add(w).equals(nt)); b = d.add(H.ONE).modInverse(nt).multiply(w.subtract(y.multiply(d))).mod(nt) } while (b.equals(H.ZERO)); return f ? pn(y, b) : v.leftPad(y.toString(16), 64) + v.leftPad(b.toString(16), 64) } function vn(s, n, o, {der: f, hash: u, userId: r}={}) { let l = typeof s == "string" ? v.utf8ToHex(s) : v.arrayToHex(s); u && (l = Jt(l, o, r)); let g, d; if (f) { const T = dn(n); g = T.r, d = T.s } else g = new H(n.substring(0, 64),16), d = new H(n.substring(64),16); const m = Wt.decodePointHex(o) , w = new H(l,16) , y = g.add(d).mod(nt); if (y.equals(H.ZERO)) return !1; const b = it.multiply(d).add(m.multiply(y)) , F = w.add(b.getX().toBigInteger()).mod(nt); return g.equals(F) } function Jt(s, n, o="1234567812345678") { o = v.utf8ToHex(o); const f = v.leftPad(it.curve.a.toBigInteger().toRadix(16), 64) , u = v.leftPad(it.curve.b.toBigInteger().toRadix(16), 64) , r = v.leftPad(it.getX().toBigInteger().toRadix(16), 64) , l = v.leftPad(it.getY().toBigInteger().toRadix(16), 64); let g, d; if (n.length === 128) g = n.substr(0, 64), d = n.substr(64, 64); else { const b = it.curve.decodePointHex(n); g = v.leftPad(b.getX().toBigInteger().toRadix(16), 64), d = v.leftPad(b.getY().toBigInteger().toRadix(16), 64) } const m = v.hexToArray(o + f + u + r + l + g + d) , w = o.length * 4; m.unshift(w & 255), m.unshift(w >> 8 & 255); const y = ht(m); return v.arrayToHex(ht(y.concat(v.hexToArray(s)))) } function bn(s) { const n = it.multiply(new H(s,16)) , o = v.leftPad(n.getX().toBigInteger().toString(16), 64) , f = v.leftPad(n.getY().toBigInteger().toString(16), 64); return "04" + o + f } function te() { const s = v.generateKeyPairHex() , n = Wt.decodePointHex(s.publicKey); return s.k = new H(s.privateKey,16), s.x1 = n.getX().toBigInteger(), s } var Tn = { generateKeyPairHex: v.generateKeyPairHex, compressPublicKeyHex: v.compressPublicKeyHex, comparePublicKeyHex: v.comparePublicKeyHex, doEncrypt: gn, doDecrypt: mn, doSignature: yn, doVerifySignature: vn, getPoint: te, verifyPublicKey: v.verifyPublicKey }; const {sm3: wn, hmac: Fn} = Xt; function Bn(s, n) { return s.length >= n ? s : new Array(n - s.length + 1).join("0") + s } function Zt(s) { return s.map(n=>(n = n.toString(16), n.length === 1 ? "0" + n : n)).join("") } function Sn(s) { const n = []; let o = s.length; o % 2 !== 0 && (s = Bn(s, o + 1)), o = s.length; for (let f = 0; f < o; f += 2) n.push(parseInt(s.substr(f, 2), 16)); return n } function In(s) { const n = []; for (let o = 0, f = s.length; o < f; o++) { const u = s.codePointAt(o); if (u <= 127) n.push(u); else if (u <= 2047) n.push(192 | u >>> 6), n.push(128 | u & 63); else if (u <= 55295 || u >= 57344 && u <= 65535) n.push(224 | u >>> 12), n.push(128 | u >>> 6 & 63), n.push(128 | u & 63); else if (u >= 65536 && u <= 1114111) o++, n.push(240 | u >>> 18 & 28), n.push(128 | u >>> 12 & 63), n.push(128 | u >>> 6 & 63), n.push(128 | u & 63); else throw n.push(u), new Error("input is not supported") } return n } var Dn = function(s, n) { if (s = typeof s == "string" ? In(s) : Array.prototype.slice.call(s), n) { if ((n.mode || "hmac") !== "hmac") throw new Error("invalid mode"); let f = n.key; if (!f) throw new Error("invalid key"); return f = typeof f == "string" ? Sn(f) : Array.prototype.slice.call(f), Zt(Fn(s, f)) } return Zt(wn(s)) }; const K = 0 , qn = 32 , et = 16 , mt = [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] , yt = [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]; function Et(s) { const n = []; for (let o = 0, f = s.length; o < f; o += 2) n.push(parseInt(s.substr(o, 2), 16)); return n } function En(s) { return s.map(n=>(n = n.toString(16), n.length === 1 ? "0" + n : n)).join("") } function Rn(s) { const n = []; for (let o = 0, f = s.length; o < f; o++) { const u = s.codePointAt(o); if (u <= 127) n.push(u); else if (u <= 2047) n.push(192 | u >>> 6), n.push(128 | u & 63); else if (u <= 55295 || u >= 57344 && u <= 65535) n.push(224 | u >>> 12), n.push(128 | u >>> 6 & 63), n.push(128 | u & 63); else if (u >= 65536 && u <= 1114111) o++, n.push(240 | u >>> 18 & 28), n.push(128 | u >>> 12 & 63), n.push(128 | u >>> 6 & 63), n.push(128 | u & 63); else throw n.push(u), new Error("input is not supported") } return n } function An(s) { const n = []; for (let o = 0, f = s.length; o < f; o++) s[o] >= 240 && s[o] <= 247 ? (n.push(String.fromCodePoint(((s[o] & 7) << 18) + ((s[o + 1] & 63) << 12) + ((s[o + 2] & 63) << 6) + (s[o + 3] & 63))), o += 3) : s[o] >= 224 && s[o] <= 239 ? (n.push(String.fromCodePoint(((s[o] & 15) << 12) + ((s[o + 1] & 63) << 6) + (s[o + 2] & 63))), o += 2) : s[o] >= 192 && s[o] <= 223 ? (n.push(String.fromCodePoint(((s[o] & 31) << 6) + (s[o + 1] & 63))), o++) : n.push(String.fromCodePoint(s[o])); return n.join("") } function st(s, n) { return s << n | s >>> 32 - n } function X(s) { return (mt[s >>> 24 & 255] & 255) << 24 | (mt[s >>> 16 & 255] & 255) << 16 | (mt[s >>> 8 & 255] & 255) << 8 | mt[s & 255] & 255 } function vt(s) { return s ^ st(s, 2) ^ st(s, 10) ^ st(s, 18) ^ st(s, 24) } function bt(s) { return s ^ st(s, 13) ^ st(s, 23) } function Pn(s, n, o) { const f = new Array(4) , u = new Array(4); for (let r = 0; r < 4; r++) u[0] = s[4 * r] & 255, u[1] = s[4 * r + 1] & 255, u[2] = s[4 * r + 2] & 255, u[3] = s[4 * r + 3] & 255, f[r] = u[0] << 24 | u[1] << 16 | u[2] << 8 | u[3]; for (let r = 0, l; r < 32; r += 4) l = f[1] ^ f[2] ^ f[3] ^ o[r + 0], f[0] ^= vt(X(l)), l = f[2] ^ f[3] ^ f[0] ^ o[r + 1], f[1] ^= vt(X(l)), l = f[3] ^ f[0] ^ f[1] ^ o[r + 2], f[2] ^= vt(X(l)), l = f[0] ^ f[1] ^ f[2] ^ o[r + 3], f[3] ^= vt(X(l)); for (let r = 0; r < 16; r += 4) n[r] = f[3 - r / 4] >>> 24 & 255, n[r + 1] = f[3 - r / 4] >>> 16 & 255, n[r + 2] = f[3 - r / 4] >>> 8 & 255, n[r + 3] = f[3 - r / 4] & 255 } function Cn(s, n, o) { const f = new Array(4) , u = new Array(4); for (let r = 0; r < 4; r++) u[0] = s[0 + 4 * r] & 255, u[1] = s[1 + 4 * r] & 255, u[2] = s[2 + 4 * r] & 255, u[3] = s[3 + 4 * r] & 255, f[r] = u[0] << 24 | u[1] << 16 | u[2] << 8 | u[3]; f[0] ^= 2746333894, f[1] ^= 1453994832, f[2] ^= 1736282519, f[3] ^= 2993693404; for (let r = 0, l; r < 32; r += 4) l = f[1] ^ f[2] ^ f[3] ^ yt[r + 0], n[r + 0] = f[0] ^= bt(X(l)), l = f[2] ^ f[3] ^ f[0] ^ yt[r + 1], n[r + 1] = f[1] ^= bt(X(l)), l = f[3] ^ f[0] ^ f[1] ^ yt[r + 2], n[r + 2] = f[2] ^= bt(X(l)), l = f[0] ^ f[1] ^ f[2] ^ yt[r + 3], n[r + 3] = f[3] ^= bt(X(l)); if (o === K) for (let r = 0, l; r < 16; r++) l = n[r], n[r] = n[31 - r], n[31 - r] = l } function $t(s, n, o, {padding: f="pkcs#7", mode: u, iv: r=[], output: l="string"}={}) { if (u === "cbc" && (typeof r == "string" && (r = Et(r)), r.length !== 128 / 8)) throw new Error("iv is invalid"); if (typeof n == "string" && (n = Et(n)), n.length !== 128 / 8) throw new Error("key is invalid"); if (typeof s == "string" ? o !== K ? s = Rn(s) : s = Et(s) : s = [...s], (f === "pkcs#5" || f === "pkcs#7") && o !== K) { const b = et - s.length % et; for (let F = 0; F < b; F++) s.push(b) } const g = new Array(qn); Cn(n, g, o); const d = []; let m = r , w = s.length , y = 0; for (; w >= et; ) { const b = s.slice(y, y + 16) , F = new Array(16); if (u === "cbc") for (let T = 0; T < et; T++) o !== K && (b[T] ^= m[T]); Pn(b, F, g); for (let T = 0; T < et; T++) u === "cbc" && o === K && (F[T] ^= m[T]), d[y + T] = F[T]; u === "cbc" && (o !== K ? m = F : m = b), w -= et, y += et } if ((f === "pkcs#5" || f === "pkcs#7") && o === K) { const b = d.length , F = d[b - 1]; for (let T = 1; T <= F; T++) if (d[b - T] !== F) throw new Error("padding is invalid"); d.splice(b - F, F) } return l !== "array" ? o !== K ? En(d) : An(d) : d } var Mn = { encrypt(s, n, o) { return $t(s, n, 1, o) }, decrypt(s, n, o) { return $t(s, n, 0, o) } } , Ln = { sm2: Tn, sm3: Dn, sm4: Mn }; Ln; var sm4 = Ln.sm4; // ------------------ const plaintext = '97e925c4c8f5907ebe0097727336261e56c729398b167d32a71e3937fd052c356d99fac94044a50b676b1b6eba9caa23a596837384bdccbc3149102bf2901504e1da0bdbe3b1d7761e42ea26ed37f01653799dc6da00cf3d87f77632f5e6ce4ffabe80909bd67d8cd43570251a3dad7ee6a3023c03cf1e99ef123f51f56ba2e961b62e3161391ff62faecec02e7171601b9e0425cdcf85a8c5da4f19b1f27bb989cbe9d42873c3bd12e8391205a1e548be88bf4d02e2358749319fed9e99a4af3096df10dbb0ae6a8df20d77c76c69e8f76128ac234cde915f16bb14fdc39f610be791b61410649fd6516df6b20bdb2f8e3982a63ac62138639140dfae22924a0e5de67907a7e7c9e0756e6f5e65eb23ab8b67174b8e00aecc5026af5c45534e217d5e4c161e3eb137620de460877b95ffff43ebd4e907ba8aef0ceb510c88c79b64be72a7d15ca873d2d75beaf0f26236ae2073725000fb5c32cd312ac3e5fab8bc8ef6bd18847f3a852fa6b4a918780d234f3d805d0a7f29e30d7ccb8db8a691c47d05e1b0c0fa6831f2f1d2dabbbd9c1cff5413507d9d2a41a224fd147a23483412ade9bd23307d199f5125d4bfe7cbd7f8f46074c1f3c4cd0f642d48b9aa0d6d8f07eecc5a652c5472b7801c961f8f532c5e5a77076ff6e1d0e3a98ed564044bea416318d86621ffd10654edff16307f4957379b573f37482fd68a3f24203d74ac727bad3eb6924e89f4daa28f33a71c039a3d8f11bc8761c7fb1f8ce5506faa3b9925ba93c1d4039fd68f52cf38ae0ad9ef70de0e2d836de49f70010ec651b8d0e2be7b016cda953f51cb7775401f3634dd7f13e33a799ed748ad803cdf8ac1930631d8b59b293197c26f7702210f13487a2bddb7610c46ee61fd6648c72f61756c1d6929bb691ac6f0e08560fc9ff000a41cd3a6d9534f110454793c75efea176e814657fa0004ad41d3fcf783c339479331527e814e5e1eab54b9166a1d6055834f0f1537a2b6d3ce6ae13944399462eb1973650418b8416d08479276fa4c1af0bfa49dc167001a7bb1c6687d9ee14d305bb2b124cfafb6760aeeabafb686924e767005c23954478bead1c6d5197ca25815f5b47e9bc64c35262867f4fb41371722f96a20dc05d8a17ef5371e272768f54083bd97fedf36e8097ef0c55b317cf0107ad81142908cf61f5794a0eb923183f613528a12b3f8778df1e0360b124e316771504d3a631878b82ba4502058f80fbf175a4358853823b5f54d016493dcfbe0f311f4a4219c783616f9a6be66bf6a66793fbb7c3573f3d5989743c87a2411c1d90da9b53238e66986dc705bac5c1297fae3efd14966763d2fb492dd9d363ef029ecc2bea20285393a29f2873553d5c143e22dd2e6591dbc031d4bc6fe5be3ef4c139b24a4c47c0819f0aa5a95cd443b6161a05ee0529d12e94b45ab2b0d19215ebca9aa01cdb1d027fef545261549b65aca0506bb5ef8d512b072559efc8011f5e9fd9af9d9cb4939a7c7885760d204b54fb1b0eacb2c959956d3d40f186244b392a7964809b0c9039368da3bb3b6fa8c191c0251a567c2a3572054c535a9c223622edd49890f2889a867ccc7091198c9aa2b1769072a28940704a5d475a8e4c0fe3b331edc85a2c189a4a2b86b29d524e2759c8594cb334c3963c67bc7cd7b8bca2bbc02fca720f1c92a82f7e01506434da6247d2c1a9e398fc4eb7c471b2c7251ffc8fe55a083d95bc64fd00330a2b6c9325386d2564b0942dfb10f5dbdfeeb4a0e20fbc3e7ca993167aa484577bb2eadc08c3521731705cb10e1c4f841c807389071a4edceeea0b14fde1df2dbe5f888efd023315086dd8dd233b34700139dcce07fdbd43a56c85c9e8afec15ad0f05413e6ac240bcf064894d8358843c38649669157abcbfff44aa4fe89127381f653327ee76fea433089a2418e7607d4472af0316ff7b3bed2ecbe2b202ce1318e4abcef6d8686a7c7226e5f907d4367496676c682d7e22d3e4a6eeca93961bff58fbf9f944c95e13da63607d476246a25d561903c24b61693de307e863f24efc3758bfe0d4df8ee46eacf22289108e007a8f8adfe21469c3b130b7aca4080e8f1d4cc7abed0466214f1a974d802f5a8fb510f9d732bfa67eb5ef751db71dc017dc08a4be858dd12f2343f3c899feef54c93bbdb105b881e41588cb453a6240c325446668ce3289062e0045a25f109038ea6cd860e7e4b7d617d950d5fd91273005e9f09ae88a2c4f2e410eb923183f613528a12b3f8778df1e036f58add5699fdd147208b2c0428d53263f49733029b0fcc47c391d873eca76aa705eff383050a74dd5a287f8644493af9b6334f1651850ae64f70c215dd7a39e9d7f7ee5ecaf672412d087f6d3dd1efca1dda76d40fbb3b7b4ef3615f8ca02cf98b0f835094e2c05500cfdfb4d203ce19eb82749273eaceb49aa81a47acdd4ae097ba1a693f3041c541da0f8bd00b721e66292cdffdb2b07cfa9283e96b03752583714b2dcca12b6b20133a24372cbdd720fc5ca16d40106fd2a84c43b27d8a2cb9beb4db14fe8d73e8959bef545b1bd16a07e2be53e2ebb286ef9e06682963eaa4a104fd188c6a7fcce0f0b39e4535d871957354848eeed1823163c500ec110f53176f6ed3a1a5d38ec5529a42186c65e0ab3edbb27c9988f8f313d2058183d0fc62fdba16bd7978c8b672ac0798a617e54d3d3bf2f5efc777bde09b3bc8396234b05afcf36b8e0f8f86922648b8e296511f54da73b6e5793f28e4a0a0527c4e865e15a96408713efb410ce1161610f4d24ceaacf13f0db113feea718f881214b5447567536fe6d40c7920cb636552554ddf4d22bf5dccf2f21d270f9c59103a05692b55157341e18d9ab7eb6b9562752d5ebb4dc5eceee2c6f0203e21fcefce53cb90cc1c0abc52ddb43722a7bd2822aab6e8d143b49d6ab49a090e8caffed7b80267796e5540c596c3f95f092bdce5e085844e7b1c78e0558e38755d46fa6eccf2f4b9a64d60054a730cbb5ee4a6247a3d9057de8e720a68cb490a130f0f74d9bfee7095b753cf3f1aaae93a7fc18545261549b65aca0506bb5ef8d512b07240b5b12c42dc77b079dc48f81d8d1474c1a1d3e617559e41ed5390749c2489409603db5b36afe8d554863d281f140e2fb564a3a2896bc59ecabc3a38ce934a2cf23b385c3cad7216988487dead09b031fc68e2e5f24e0875f7298b1a4a5bba7f18cef8ec75c742810050faa2f347f0a1ef3f43e9b69a4dd72f4935d3361939f1d2a8b512a295071dd88df3e6799c32398db26ec591a4e266d302a5cfe4674a433a258263a9c3cebe066aeb4a64ed675206b8384963b642557c1df6334545f51e97c95f3b68ce6a9e2e2ff46a0cadd951e5ec2bed2cefbc62d016a434638e0dee9004a511121dd50c13fb3dbd899a5fb5c46ba1a56f14048318b1581c5cffaf0776367c1e5b062922b09a4e9e7634209e9934ed2fd94f4cb5afa265dc7fb17087d944cf3c13ac58162ea391e4f1ee01f3290fa3ea85351bfa13bbc63b03fefe3f18cef8ec75c742810050faa2f347f0a108ef69a1ef529ecbd68bd5151c261dcba24edf2d61b60d08c7207b46e4f2fdc7c62a1501d5fa47df3f6199b71cdf2df391fbfb2c60ccc6db89b8395fd60cb5f785444728eee562a3be9fb62f19998d3b37c17a819b06dc588f71fbff62d893253a6762f15892ec758727f354f3d646927840c0d8db252bf9fe8fe6fc5e2b77f9b597192476e187d1382df54ad3eabdbf15fd916d2761eb81195a76e8528bdce69fb0b9cb7a7eed34339d093a219c916e06b8384963b642557c1df6334545f51eaf859043c008162ef1894e0b9dc3696b8377145221825487a31220c5392c517c5912df200e94613e8fbb121a74f75420f94405abb85751d1f443bf6af52813e7a3cc6b2af737db0daac8b47e59e99ed8ef344b96ba727493501eff0ceeaa5a0755711272b899eea3f5d0135faebf56360ca78f3b5ca8c8d3771a07b46913d872d376a3685c9d2e582171bba42052a8bd963af86f788e8e9a1478dce7c3cf649edaa993aba21a0cdd5ec7e93a03bdef8317781d1ee231611c8a80da09d12f53eb369211cb9afed3833f083ab60f700bed030866c3fe372ec9b8f1c35611b5aafeea9cdfac58e803bbdc6c4c29b08c0a3d0eb3f8a811cc65575f528981d54e85534ed9e100c978f2ae90ebdf1edd55bd26cb960d8ca6af27120fa0a8528a8daadc98072efb8d94913452772ee0b3e25a308ecdd1e9e3fc85932447a1bbd8bbb3693f8de6a485e69c67bfd699a65a064a807afd1411352287e24bd41bb6a93cf1799af728c0f502313c679669e83c44b003d93ceca1c50e664933aba352fe9f74eae6eda44d7cfad15ee8ca2803d2cfbefb44698b3d63b98e33669019a7beb3a05961fa302d2557798c5a41f3bcc504234ad13c9e7a467f393c901508c41804ce39171d6b08f207ad35a589058c88e7a2418af905d828ac45d279953d4a6ebbee6b541e6b1ca95dfe5ce294fa37d2ec94c512d0ef12dcc04700ad383acdf78e5f00fd99bab5febf6dad29264fe37e47ee5264e6eb98f1428362af4e656be6861c76ffede186dc24e7771d505474cacf4471bc301f8d118245477783acf97ea66c11a66d414f1af56d7b77a56a1cfa160eac957a1799df7b6e65e4a13ee71c1e347b38c746e8ec620f1e1f16b7fd4b255c6649e4a5f5d717917065b9b07c45a02547811ae44ce26716163bd53fa9a5c4fe8f8d5461792ef5acf2425830749ad5b3bd7f8dbee32a7be2499d84ee92bf684bd146b6c91adcd2974dfab5be049d5d67d12279e6335f453ddc6e1b1cc1fee73a88369211cb9afed3833f083ab60f700bed030866c3fe372ec9b8f1c35611b5aafede4da8c5305d62f7877d64c393be087f24435a24b28d8361d9f86404fe784f2e54074a005f5bdea7a978a9d3eafe32efe54ca2376acc483bcbd7c4b28f801a30210eefab6e331b2a97f38401702fcb7a4328bee699904df15e697005c6ef1bd6b4e5fcfcf22979528b7744089ff723a351a19b724f27878b6d18a18693ff7ed6c0ffc072a3ef1f420408b46ebdf4bf0762ffb492a2e6b5ae84883ba3977bb31abd442e5970210b6fd1a5edb930f86cc3cd34be87d4d2d9fa40ca45a15a584b1731fc87e0f58efeba74e7b83c262a852bccb52fc098565077b346eaa6d4b212d4be55babafa68385639b12cee1da72742f5805e87c4f05754b28406f24fe3a502a68f7c171b42a6361f623573a0f736b870f84d6b363bada4dd6d3c6a529fa69b8d2980720097311fe6f66623719599fa03596c44dd72ff93f749ee058e13f5f4db10a65071ad215c8e2c3d9fb4af0daa4d828622c4066c03c9b9d809784a6f227d4d3f7e87033ef56913251cac96d0342f0bf4a5352c8312d8bdba274188b67471f0ce8dd55c19991d62906b1c9f62b0f4839d0ceec560fe059acc7329a497ab37ba73ec9a9990ddf04cf58d105cfd5d564b9b65f3a43f436be84a6ee1f8762b8d9d71dbe170c9caeeb78e5dd7b7b15e9c38902501440f718a9a390ba8ee71867878ae17c7c77ab7d4e7cffe219df3eef2065adcc0db753c43aec20af37a3e027202a2549ae8276cc81744f988475bcda06725621d4e958690b1bbc7af6c5d9404cc026788fdbef55b1951211739b687e21b2c07ba3864e395dae7b0ca5d852ea3f92996505cb8f31f28ed9329bc81eac9d7a12180ef87961f2d4ec8db4f7640543cc1b22fea9c877e76de349daa575b36ba83fca0b896d3805179132933f4197431d36057a38b3b89e17733e3635c8e19137c43e0bd6da8af3512c258931153c31657dfa01f98b73e2a8374434b08f99620ce5a3686136dfc2f83892857e007cfca2afce8af41f459a02afca427abde74ac35dc5060add20a87375ca22dd75eefa036b1e61aed314f13c48161151834bbcf2558971815f897a97a2a7c85631ef11e2b66e0d44f03b558f6acd3eaaf6875a20dfdd73140e76302d9927c9032d85e27e480d882c24bce934b42b36f1ecf6b36b533f9501263587146798607e23089358c378dec89ca693691ed3f04705cc3d8e2c2febe9f4155b972c01409b14d6953fbc8db2f80584550dc04217949325b33869a327be981e6307edd16062f31dd31bec19fd45de8fc4d06658f2fef39d4ffc9339b5ba2fecd96b7e87320f5dcf6fb8412ef177e90b12eabb933978989f81c2c4abc5c3f3e12b5a14a340afae7140cda0bf44bfb8cf3751e93bbcad4d04e87028673887e8ffdf1c1078979bad3cab5558417fc8569f157e8c9dbede98935ecf9b9012464534a43f7aaef10277d0425ebf26c368d35b296f2f6a19b82d63957b765899d1b1c503fa02b107e450848891b68cd8eac2cc3a09653976598d5ae1b80a98f03eff7ebf6a44f1117e62c7740f4e168f6b818e2745ef4f5f6786d60059907cd1a50a8d6942573dd739cdeffe79d36a971ab60be579ca85b0bff488d27fbad68c778339573f16c59b27cc6827493c41a5902095922c23545f6f58361300e07521ffac73164329724db60a4063aec0c5370c3e82fb1dcb20e6a6fe4f50a4fb2157b898e38ebe7af0546ea8182ebec05b55b30dcbb98c4fd53fcfd7dee180da43a04d85453426bf344886e88f3f79746e6b0a1bac5aeef30008bfc18cb2eaf44dcea0f9814139b72000214b8dbee5df2717599cd791af6222be7590456fdf0aaa15cac4288707615abdf45e4895ae2fbc51cefe5beccedda3ec8e6dcd78174cfaf03bd3df6850ec855fde936f601ef5f34d74e2955a4eab4306f10812b6ceef888eb5f8de6b1a242dd21fddda29cbe92cac48fa19dbd101e9e1d70a42049c82fc669528a4bdd31d9373140ecced4f365cd7ef61c757267d59c8b7f181b643f22f7ab0a91315c5b0ebb756d1941912d1060cc25f8908cce4a7e42e0c13d74ac727bad3eb6924e89f4daa28f330db1c683b732d2df2c34476b9889cdcb16e6f68e103123e47677677cbe600593be71ac2e6eff37cd14cb398fb80ee4eb777e14d161e52e8c741273739ef7c622cf5fd5cf6f142210e057eb23830b522959dbaba3b93cee6867873cebc8cb24e0e6a3023c03cf1e99ef123f51f56ba2e91c197fefe5b5f12bb79ab71e33b7290b57458c451841ba84d6bce952b4ea91d4c064c7e706a31ffa41029b1e18ed057694e2db1b1bc4c48d6b9b2cf87a90e178504338d74805f7b86ac55dad4ec6699e5af210dae2a112e297744caa8b5d502466855c8437c58a5a85b23528866e5d6d0bb13a139cfd858bc4314ca39873fb5f1d6055834f0f1537a2b6d3ce6ae13944399462eb1973650418b8416d084792766730ca75d26bb2e4b3dc994dd931610da6b6a5737b54a29678dd5465116557c9626429b8c0a8bcf27ae046787187d05304faab4610f226fc3b8434191d6b160492db69680a7b773f4b8733082dadddc880de47a8e1d5506c0b4388aa9941ef4a9d4e3ebdfedfd2b193be3d63b1646ae4f4d308aff3bcca814b2989d0569751a86e3fc43e7b542653a6b3cf5142326c0c10c7afecf8c8355bbba94969bfdb37e8d50efe0e014f89b2e2ab505b21b1524655f47a40a9c322e3eb9024468f0f8082f83da5ebff6b61db2e5e24d81e349aaa08901d458bc04b5a0b1b5991e23536b1586ec7583199e8674e734b5272db8f31ed57590cd0ce08983d130622f05391542bf9f31c08ecc2994ee9647b65259b1ab12728ecf1d342264af89ac1838f84666025349de9b29299daaffa7ea09a32a8298816a5c37f665884c19a983dc4b6cecc93c5749f3962ba729b6f060d4bdf411600778deb6e0c2763181f9f493d2e71aae0da5a1261f519a8bf4a40354811cc164143679d644827e2aa8218dcf28d5dfa426e4e9622f6c4a576f9a34e97377fb72a94892b74fc7e500d182ccd05291b00ae9fffc1aeca26773b9d8e43aefb90e528dd4c0400e390648f120b5fcf1f63bd3f5d99951604b49b4f43791f725dc31093d7a9a300e559dbc1bfaf1a83891563c6d2400224ecf45cd774d293535845cb5aedcdacbffc7b5eaa2941d82b58ebba367aeb118c0a8019a73a9897e659cf05e9c447dab58a9ac65eeb816fccf93eb314c2290728cc680120e1f475e77ff6b61c78624d82f2562c7f848581dcf98be47c3b2e11236cdc5200f083474965b8b89eff266d23fe8fff5f6866a3042e6b14c2ad88811673187a4366fe279fb19f2558859d0e6c2d0cab0902a778b9dc0abbcf2558971815f897a97a2a7c85631ef11e2b66e0d44f03b558f6acd3eaaf68aaf7c472da37f279b1345416f6b01c05d8bdd224214073ec744a55ce9508933311663a4f183f789608427273208d78bde628edf8c3dce879de6929b98c466107b840c4f6c4b90b8d4d630a82b4d7b6e72a06ff6fdb8660c08b51f1f104ae0fe6fab9723fd2b30253b4fece7d756d3799850512ee71db29b85495d46045a46f835f84999c33f5658165d3cc875c8d2ba880add5acc53943a8b960d7c788bb892b85e49d56a5b719733673ccb83f06059712ac33759bed8af3ba724d60dd3fc3390b8278d2f87f9d0e789f57214ff1ba8399b237c31aee30f1079f9cce113ac50420c246d6551e9782a29da77aa2e0743770469712c6f075dedfa02e1033bb9ccc6ebbbe31bf9d02d392cd2531d8d1afe0c6fa762acb5363148d03910dfb3695ff270ca120a8bca128bb8f04aab493057528421c5a64f62dfee567604257c57956c60b3260749e840d6ef93773779834b9c61323e7b84136c6ba401c1b3439aa322eb9e668b3ee77e18b6083a6e367d53f9ff000a41cd3a6d9534f110454793c756abfd6098f007839f3067c02f4466c1ac33c442a43d1a6e71a2f75d2adc29cc6d6d332c2eb1e3b7a5e743105c6445e43a9001ca23fbae26bc0891245bbf7003a5a6db068b4baa6c1f703870340e7cd7b8c944dfac31f43160a1bb397c692f25b441656f100888c22e92de6c7ec028c844b979d2fae17d171f0abd93e5e84124f51144c1bc9d53b8f48c861ec09eb26e0620bd837f4d0cab090b0ba89b3f3ea7cb151a43be2252407d5681926e4184fd4a181d635e3f9b690eede5fc122fc0e248d9427e158812106fea6ff8ef6331ffc84be0e30e5f90ef78e7c834366b4ece342959c836e99def3824c9e46b9da0261b8ab99bb28c66cd1e13af8df6e5462a2823260e413fdc13976aa89b16cf3c31fb855ec8c67ffbc41fd91454b498a9fcfe3de920b294b741b09f509c0d80c24352535eba1576c1b165ab002206ae7f537a2238c88fa60a3524fc5cad2c07351826a19b2e2645cbb4eac378aae26c6bfad8eac49e753e58c7a572a889b66cecdd5'; const key = '594d4f4777673873555149415a333738'; const result = sm4.decrypt(plaintext, key, { padding: "pkcs#5", mode: void 0, iv: void 0 }); result;