!(function (n, e) { 'object' == typeof exports && 'undefined' != typeof module ? (module.exports = e()) : 'function' == typeof define && define.amd ? define(e) : ((n = 'undefined' != typeof globalThis ? globalThis : n || self).jsSHA = e()) })(this, function () { 'use strict' var A = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', e = 'ARRAYBUFFER not supported by this environment', t = 'UINT8ARRAY not supported by this environment' function i(n, e, t, r) { for ( var i, o, u = e || [0], s = (t = t || 0) >>> 3, h = -1 === r ? 3 : 0, a = 0; a < n.length; a += 1 ) (i = (o = a + s) >>> 2), u.length <= i && u.push(0), (u[i] |= n[a] << (8 * (h + r * (o % 4)))) return { value: u, binLen: 8 * n.length + t } } function o(n, M, I) { switch (M) { case 'UTF8': case 'UTF16BE': case 'UTF16LE': break default: throw new Error('encoding must be UTF8, UTF16BE, or UTF16LE') } switch (n) { case 'HEX': return function (n, e, t) { var r, i, o, u = n, n = e, e = t, s = I if (0 != u.length % 2) throw new Error('String of HEX type must be in byte increments') for ( var h = n || [0], a = (e = e || 0) >>> 3, w = -1 === s ? 3 : 0, f = 0; f < u.length; f += 2 ) { if (((r = parseInt(u.substr(f, 2), 16)), isNaN(r))) throw new Error('String of HEX type contains invalid characters') for (i = (o = (f >>> 1) + a) >>> 2; h.length <= i; ) h.push(0) h[i] |= r << (8 * (w + s * (o % 4))) } return { value: h, binLen: 4 * u.length + e } } case 'TEXT': return function (n, e, t) { var r, i, o, u, s, h, a, w, f = n, n = M, c = 0, l = I, p = 0, v = e || [0], A = (c = t || 0) >>> 3 if ('UTF8' === n) for (a = -1 === l ? 3 : 0, o = 0; o < f.length; o += 1) for ( i = [], (r = f.charCodeAt(o)) < 128 ? i.push(r) : r < 2048 ? (i.push(192 | (r >>> 6)), i.push(128 | (63 & r))) : r < 55296 || 57344 <= r ? i.push(224 | (r >>> 12), 128 | ((r >>> 6) & 63), 128 | (63 & r)) : ((r = 65536 + (((1023 & r) << 10) | (1023 & f.charCodeAt((o += 1))))), i.push( 240 | (r >>> 18), 128 | ((r >>> 12) & 63), 128 | ((r >>> 6) & 63), 128 | (63 & r), )), u = 0; u < i.length; u += 1 ) { for (s = (h = p + A) >>> 2; v.length <= s; ) v.push(0) ;(v[s] |= i[u] << (8 * (a + l * (h % 4)))), (p += 1) } else for ( a = -1 === l ? 2 : 0, w = ('UTF16LE' === n && 1 !== l) || ('UTF16LE' !== n && 1 === l), o = 0; o < f.length; o += 1 ) { for ( r = f.charCodeAt(o), !0 == w && (r = ((u = 255 & r) << 8) | (r >>> 8)), s = (h = p + A) >>> 2; v.length <= s; ) v.push(0) ;(v[s] |= r << (8 * (a + l * (h % 4)))), (p += 2) } return { value: v, binLen: 8 * p + c } } case 'B64': return function (n, e, t) { var r, i, o, u, s, h, a = n, n = 0, w = I, f = 0, c = e || [0], l = (n = t || 0) >>> 3, p = -1 === w ? 3 : 0, e = a.indexOf('=') if (-1 === a.search(/^[a-zA-Z0-9=+/]+$/)) throw new Error('Invalid character in base-64 string') if (((a = a.replace(/=/g, '')), -1 !== e && e < a.length)) throw new Error("Invalid '=' found in base-64 string") for (r = 0; r < a.length; r += 4) { for (u = a.substr(r, 4), i = o = 0; i < u.length; i += 1) o |= A.indexOf(u.charAt(i)) << (18 - 6 * i) for (i = 0; i < u.length - 1; i += 1) { for (s = (h = f + l) >>> 2; c.length <= s; ) c.push(0) ;(c[s] |= ((o >>> (16 - 8 * i)) & 255) << (8 * (p + w * (h % 4)))), (f += 1) } } return { value: c, binLen: 8 * f + n } } case 'BYTES': return function (n, e, t) { for ( var r, i, o, u = n, n = 0, s = I, h = e || [0], a = (n = t || 0) >>> 3, w = -1 === s ? 3 : 0, f = 0; f < u.length; f += 1 ) (r = u.charCodeAt(f)), (i = (o = f + a) >>> 2), h.length <= i && h.push(0), (h[i] |= r << (8 * (w + s * (o % 4)))) return { value: h, binLen: 8 * u.length + n } } case 'ARRAYBUFFER': try { new ArrayBuffer(0) } catch (n) { throw new Error(e) } return function (n, e, t) { return (e = e), (t = t), (r = I), i(new Uint8Array(n), e, t, r) } case 'UINT8ARRAY': try { new Uint8Array(0) } catch (n) { throw new Error(t) } return function (n, e, t) { return i(n, e, t, I) } default: throw new Error('format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY') } } function u(n, l, p, v) { switch (n) { case 'HEX': return function (n) { for ( var e, t = n, r = p, n = v, i = '0123456789abcdef', o = '', u = l / 8, s = -1 === r ? 3 : 0, h = 0; h < u; h += 1 ) (e = t[h >>> 2] >>> (8 * (s + r * (h % 4)))), (o += i.charAt((e >>> 4) & 15) + i.charAt(15 & e)) return n.outputUpper ? o.toUpperCase() : o } case 'B64': return function (n) { for ( var e, t, r, i, o = n, u = l, s = p, h = v, a = '', w = u / 8, f = -1 === s ? 3 : 0, c = 0; c < w; c += 3 ) for ( r = c + 1 < w ? o[(c + 1) >>> 2] : 0, i = c + 2 < w ? o[(c + 2) >>> 2] : 0, t = (((o[c >>> 2] >>> (8 * (f + s * (c % 4)))) & 255) << 16) | (((r >>> (8 * (f + s * ((c + 1) % 4)))) & 255) << 8) | ((i >>> (8 * (f + s * ((c + 2) % 4)))) & 255), e = 0; e < 4; e += 1 ) a += 8 * c + 6 * e <= u ? A.charAt((t >>> (6 * (3 - e))) & 63) : h.b64Pad return a } case 'BYTES': return function (n) { for (var e, t = n, r = p, i = '', o = l / 8, u = -1 === r ? 3 : 0, s = 0; s < o; s += 1) (e = (t[s >>> 2] >>> (8 * (u + r * (s % 4)))) & 255), (i += String.fromCharCode(e)) return i } case 'ARRAYBUFFER': try { new ArrayBuffer(0) } catch (n) { throw new Error(e) } return function (n) { for ( var e = n, t = p, r = l / 8, n = new ArrayBuffer(r), i = new Uint8Array(n), o = -1 === t ? 3 : 0, u = 0; u < r; u += 1 ) i[u] = (e[u >>> 2] >>> (8 * (o + t * (u % 4)))) & 255 return n } case 'UINT8ARRAY': try { new Uint8Array(0) } catch (n) { throw new Error(t) } return function (n) { for ( var e = n, t = p, r = l / 8, i = -1 === t ? 3 : 0, o = new Uint8Array(r), u = 0; u < r; u += 1 ) o[u] = (e[u >>> 2] >>> (8 * (i + t * (u % 4)))) & 255 return o } default: throw new Error('format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY') } } var a = 4294967296, M = [ 1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298, ], r = [ 3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428, ], s = [ 1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225, ], w = 'Chosen SHA variant is not supported', h = 'Cannot set numRounds with MAC' function f(n, e) { var t, r, i = n.binLen >>> 3, o = e.binLen >>> 3, u = i << 3, s = (4 - i) << 3 if (i % 4 == 0) return { value: n.value.concat(e.value), binLen: n.binLen + e.binLen } for (t = 0; t < o; t += 4) (n.value[(r = (i + t) >>> 2)] |= e.value[t >>> 2] << u), n.value.push(0), (n.value[1 + r] |= e.value[t >>> 2] >>> s) return ( (n.value.length << 2) - 4 >= o + i && n.value.pop(), { value: n.value, binLen: n.binLen + e.binLen } ) } function c(n) { var e = { outputUpper: !1, b64Pad: '=', outputLen: -1 }, n = n || {}, t = 'Output length must be a multiple of 8' if (((e.outputUpper = n.outputUpper || !1), n.b64Pad && (e.b64Pad = n.b64Pad), n.outputLen)) { if (n.outputLen % 8 != 0) throw new Error(t) e.outputLen = n.outputLen } else if (n.shakeLen) { if (n.shakeLen % 8 != 0) throw new Error(t) e.outputLen = n.shakeLen } if ('boolean' != typeof e.outputUpper) throw new Error('Invalid outputUpper formatting option') if ('string' != typeof e.b64Pad) throw new Error('Invalid b64Pad formatting option') return e } function l(n, e, t, r) { n += ' must include a value and format' if (!e) { if (r) return r throw new Error(n) } if (void 0 !== e.value && e.format) return o(e.format, e.encoding || 'UTF8', t)(e.value) throw new Error(n) } ;(v.prototype.update = function (n) { for ( var e = 0, t = this.p >>> 5, n = this.m(n, this.u, this.h), r = n.binLen, i = n.value, o = r >>> 5, u = 0; u < o; u += t ) e + this.p <= r && ((this.U = this.R(i.slice(u, u + t), this.U)), (e += this.p)) return (this.A += e), (this.u = i.slice(e >>> 5)), (this.h = r % this.p), (this.v = !0), this }), (v.prototype.getHash = function (n, e) { var t, r, i = this.T, e = c(e) if (this.C) { if (-1 === e.outputLen) throw new Error('Output length must be specified in options') i = e.outputLen } n = u(n, i, this.F, e) if (this.l && this.K) return n(this.K(e)) for ( r = this.g(this.u.slice(), this.h, this.A, this.L(this.U), i), t = 1; t < this.numRounds; t += 1 ) this.C && i % 32 != 0 && (r[r.length - 1] &= 16777215 >>> (24 - (i % 32))), (r = this.g(r, i, 0, this.B(this.o), i)) return n(r) }), (v.prototype.setHMACKey = function (n, e, t) { if (!this.k) throw new Error('Variant does not support HMAC') if (this.v) throw new Error('Cannot set MAC key after calling update') e = o(e, (t || {}).encoding || 'UTF8', this.F) this.Y(e(n)) }), (v.prototype.Y = function (n) { var e, t = this.p >>> 3, r = t / 4 - 1 if (1 !== this.numRounds) throw new Error(h) if (this.l) throw new Error('MAC key already set') for ( t < n.binLen / 8 && (n.value = this.g(n.value, n.binLen, 0, this.B(this.o), this.T)); n.value.length <= r; ) n.value.push(0) for (e = 0; e <= r; e += 1) (this.S[e] = 909522486 ^ n.value[e]), (this.H[e] = 1549556828 ^ n.value[e]) ;(this.U = this.R(this.S, this.U)), (this.A = this.p), (this.l = !0) }), (v.prototype.getHMAC = function (n, e) { e = c(e) return u(n, this.T, this.F, e)(this.N()) }), (v.prototype.N = function () { if (!this.l) throw new Error('Cannot call getHMAC without first setting MAC key') var n = this.g(this.u.slice(), this.h, this.A, this.L(this.U), this.T), e = this.R(this.H, this.B(this.o)) return this.g(n, this.T, this.p, e, this.T) }) var n = v, p = function (n, e) { return (p = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (n, e) { n.__proto__ = e }) || function (n, e) { for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && (n[t] = e[t]) })(n, e) } function v(n, e, t) { t = t || {} if ( ((this.t = e), (this.i = t.encoding || 'UTF8'), (this.numRounds = t.numRounds || 1), isNaN(this.numRounds) || this.numRounds !== parseInt(this.numRounds, 10) || this.numRounds < 1) ) throw new Error('numRounds must a integer >= 1') ;(this.o = n), (this.u = []), (this.h = 0), (this.v = !1), (this.A = 0), (this.l = !1), (this.S = []), (this.H = []) } function I(n, e) { if ('function' != typeof e && null !== e) throw new TypeError('Class extends value ' + String(e) + ' is not a constructor or null') function t() { this.constructor = n } p(n, e), (n.prototype = null === e ? Object.create(e) : ((t.prototype = e.prototype), new t())) } function g(n, e) { return (n << e) | (n >>> (32 - e)) } function m(n, e) { return (n >>> e) | (n << (32 - e)) } function d(n, e, t) { return (n & e) ^ (~n & t) } function y(n, e, t) { return (n & e) ^ (n & t) ^ (e & t) } function b(n, e) { var t = (65535 & n) + (65535 & e) return ((65535 & ((n >>> 16) + (e >>> 16) + (t >>> 16))) << 16) | (65535 & t) } function E(n, e, t, r, i) { var o = (65535 & n) + (65535 & e) + (65535 & t) + (65535 & r) + (65535 & i) return ( ((65535 & ((n >>> 16) + (e >>> 16) + (t >>> 16) + (r >>> 16) + (i >>> 16) + (o >>> 16))) << 16) | (65535 & o) ) } function B(n) { return [1732584193, 4023233417, 2562383102, 271733878, 3285377520] } function H(n, e) { for (var t, r = [], i = e[0], o = e[1], u = e[2], s = e[3], h = e[4], a = 0; a < 80; a += 1) (r[a] = a < 16 ? n[a] : g(r[a - 3] ^ r[a - 8] ^ r[a - 14] ^ r[a - 16], 1)), (t = a < 20 ? E(g(i, 5), d(o, u, s), h, 1518500249, r[a]) : a < 40 ? E(g(i, 5), o ^ u ^ s, h, 1859775393, r[a]) : a < 60 ? E(g(i, 5), y(o, u, s), h, 2400959708, r[a]) : E(g(i, 5), o ^ u ^ s, h, 3395469782, r[a])), (h = s), (s = u), (u = g(o, 30)), (o = i), (i = t) return ( (e[0] = b(i, e[0])), (e[1] = b(o, e[1])), (e[2] = b(u, e[2])), (e[3] = b(s, e[3])), (e[4] = b(h, e[4])), e ) } function Y(n, e, t, r) { for (var i, o = 15 + (((e + 65) >>> 9) << 4), t = e + t; n.length <= o; ) n.push(0) for ( n[e >>> 5] |= 128 << (24 - (e % 32)), n[o] = 4294967295 & t, n[o - 1] = (t / a) | 0, i = 0; i < n.length; i += 16 ) r = H(n.slice(i, i + 16), r) return r } I(O, (K = n)) var K, _ = O function O(n, e, t) { var r = this if ('SHA-1' !== n) throw new Error(w) var i = t || {} return ( ((r = K.call(this, n, e, t) || this).k = !0), (r.K = r.N), (r.F = -1), (r.m = o(r.t, r.i, r.F)), (r.R = H), (r.L = function (n) { return n.slice() }), (r.B = B), (r.g = Y), (r.U = [1732584193, 4023233417, 2562383102, 271733878, 3285377520]), (r.p = 512), (r.T = 160), (r.C = !1), i.hmacKey && r.Y(l('hmacKey', i.hmacKey, r.F)), r ) } function X(n) { return ('SHA-224' == n ? r : s).slice() } function j(n, e) { for ( var t, r, i, o, u, s = [], h = e[0], a = e[1], w = e[2], f = e[3], c = e[4], l = e[5], p = e[6], v = e[7], A = 0; A < 64; A += 1 ) (s[A] = A < 16 ? n[A] : ((t = m((t = s[A - 2]), 17) ^ m(t, 19) ^ (t >>> 10)), (r = s[A - 7]), (u = s[A - 15]), (u = m(u, 7) ^ m(u, 18) ^ (u >>> 3)), (i = s[A - 16]), (o = void 0), ((65535 & ((t >>> 16) + (r >>> 16) + (u >>> 16) + (i >>> 16) + ((o = (65535 & t) + (65535 & r) + (65535 & u) + (65535 & i)) >>> 16))) << 16) | (65535 & o))), (t = E(v, m(c, 6) ^ m(c, 11) ^ m(c, 25), d(c, l, p), M[A], s[A])), (r = b(m(h, 2) ^ m(h, 13) ^ m(h, 22), y(h, a, w))), (v = p), (p = l), (l = c), (c = b(f, t)), (f = w), (w = a), (a = h), (h = b(t, r)) return ( (e[0] = b(h, e[0])), (e[1] = b(a, e[1])), (e[2] = b(w, e[2])), (e[3] = b(f, e[3])), (e[4] = b(c, e[4])), (e[5] = b(l, e[5])), (e[6] = b(p, e[6])), (e[7] = b(v, e[7])), e ) } I(x, (z = n)) var z, P = x, L = function (n, e) { ;(this.I = n), (this.M = e) } function x(h, n, e) { var t = this if ('SHA-224' !== h && 'SHA-256' !== h) throw new Error(w) var r = e || {} return ( ((t = z.call(this, h, n, e) || this).K = t.N), (t.k = !0), (t.F = -1), (t.m = o(t.t, t.i, t.F)), (t.R = j), (t.L = function (n) { return n.slice() }), (t.B = X), (t.g = function (n, e, t, r) { for ( var i, o = n, n = e, u = r, e = h, s = 15 + (((n + 65) >>> 9) << 4), r = n + t; o.length <= s; ) o.push(0) for ( o[n >>> 5] |= 128 << (24 - (n % 32)), o[s] = 4294967295 & r, o[s - 1] = (r / a) | 0, i = 0; i < o.length; i += 16 ) u = j(o.slice(i, i + 16), u) return 'SHA-224' === e ? [u[0], u[1], u[2], u[3], u[4], u[5], u[6]] : u }), (t.U = X(h)), (t.p = 512), (t.T = 'SHA-224' === h ? 224 : 256), (t.C = !1), r.hmacKey && t.Y(l('hmacKey', r.hmacKey, t.F)), t ) } function V(n, e) { var t return 32 < e ? new L((n.M << e) | (n.I >>> (t = 64 - e)), (n.I << e) | (n.M >>> t)) : 0 !== e ? new L((n.I << e) | (n.M >>> (t = 32 - e)), (n.M << e) | (n.I >>> t)) : n } function C(n, e) { var t return e < 32 ? new L((n.I >>> e) | (n.M << (t = 32 - e)), (n.M >>> e) | (n.I << t)) : new L((n.M >>> e) | (n.I << (t = 64 - e)), (n.I >>> e) | (n.M << t)) } function Z(n, e) { return new L(n.I >>> e, (n.M >>> e) | (n.I << (32 - e))) } function U(n, e) { var t, r = (65535 & n.M) + (65535 & e.M), i = ((65535 & (t = (n.M >>> 16) + (e.M >>> 16) + (r >>> 16))) << 16) | (65535 & r) return ( (r = (65535 & n.I) + (65535 & e.I) + (t >>> 16)), (t = (n.I >>> 16) + (e.I >>> 16) + (r >>> 16)), new L(((65535 & t) << 16) | (65535 & r), i) ) } function S(n, e) { return new L(n.I ^ e.I, n.M ^ e.M) } var q = [ new L(M[0], 3609767458), new L(M[1], 602891725), new L(M[2], 3964484399), new L(M[3], 2173295548), new L(M[4], 4081628472), new L(M[5], 3053834265), new L(M[6], 2937671579), new L(M[7], 3664609560), new L(M[8], 2734883394), new L(M[9], 1164996542), new L(M[10], 1323610764), new L(M[11], 3590304994), new L(M[12], 4068182383), new L(M[13], 991336113), new L(M[14], 633803317), new L(M[15], 3479774868), new L(M[16], 2666613458), new L(M[17], 944711139), new L(M[18], 2341262773), new L(M[19], 2007800933), new L(M[20], 1495990901), new L(M[21], 1856431235), new L(M[22], 3175218132), new L(M[23], 2198950837), new L(M[24], 3999719339), new L(M[25], 766784016), new L(M[26], 2566594879), new L(M[27], 3203337956), new L(M[28], 1034457026), new L(M[29], 2466948901), new L(M[30], 3758326383), new L(M[31], 168717936), new L(M[32], 1188179964), new L(M[33], 1546045734), new L(M[34], 1522805485), new L(M[35], 2643833823), new L(M[36], 2343527390), new L(M[37], 1014477480), new L(M[38], 1206759142), new L(M[39], 344077627), new L(M[40], 1290863460), new L(M[41], 3158454273), new L(M[42], 3505952657), new L(M[43], 106217008), new L(M[44], 3606008344), new L(M[45], 1432725776), new L(M[46], 1467031594), new L(M[47], 851169720), new L(M[48], 3100823752), new L(M[49], 1363258195), new L(M[50], 3750685593), new L(M[51], 3785050280), new L(M[52], 3318307427), new L(M[53], 3812723403), new L(M[54], 2003034995), new L(M[55], 3602036899), new L(M[56], 1575990012), new L(M[57], 1125592928), new L(M[58], 2716904306), new L(M[59], 442776044), new L(M[60], 593698344), new L(M[61], 3733110249), new L(M[62], 2999351573), new L(M[63], 3815920427), new L(3391569614, 3928383900), new L(3515267271, 566280711), new L(3940187606, 3454069534), new L(4118630271, 4000239992), new L(116418474, 1914138554), new L(174292421, 2731055270), new L(289380356, 3203993006), new L(460393269, 320620315), new L(685471733, 587496836), new L(852142971, 1086792851), new L(1017036298, 365543100), new L(1126000580, 2618297676), new L(1288033470, 3409855158), new L(1501505948, 4234509866), new L(1607167915, 987167468), new L(1816402316, 1246189591), ] function D(n) { return 'SHA-384' === n ? [ new L(3418070365, r[0]), new L(1654270250, r[1]), new L(2438529370, r[2]), new L(355462360, r[3]), new L(1731405415, r[4]), new L(41048885895, r[5]), new L(3675008525, r[6]), new L(1203062813, r[7]), ] : [ new L(s[0], 4089235720), new L(s[1], 2227873595), new L(s[2], 4271175723), new L(s[3], 1595750129), new L(s[4], 2917565137), new L(s[5], 725511199), new L(s[6], 4215389547), new L(s[7], 327033209), ] } function G(n, e) { for ( var t, r, i, o, u, s, h, a, w, f, c, l, p, v, A = [], M = e[0], I = e[1], g = e[2], m = e[3], d = e[4], y = e[5], b = e[6], E = e[7], H = 0; H < 80; H += 1 ) H < 16 ? (A[H] = new L(n[(t = 2 * H)], n[1 + t])) : (A[H] = (0, (a = C((t = A[H - 2]), 19)), (w = C(t, 61)), (l = Z(t, 6)), (a = new L(a.I ^ w.I ^ l.I, a.M ^ w.M ^ l.M)), (w = A[H - 7]), (l = A[H - 15]), (v = p = void 0), (p = C(l, 1)), (v = C(l, 8)), (l = Z(l, 7)), (p = new L(p.I ^ v.I ^ l.I, p.M ^ v.M ^ l.M)), (v = A[H - 16]), (c = f = l = void 0), (f = (65535 & a.M) + (65535 & w.M) + (65535 & p.M) + (65535 & v.M)), (c = ((65535 & (l = (a.M >>> 16) + (w.M >>> 16) + (p.M >>> 16) + (v.M >>> 16) + (f >>> 16))) << 16) | (65535 & f)), (f = (65535 & a.I) + (65535 & w.I) + (65535 & p.I) + (65535 & v.I) + (l >>> 16)), (l = (a.I >>> 16) + (w.I >>> 16) + (p.I >>> 16) + (v.I >>> 16) + (f >>> 16)), new L(((65535 & l) << 16) | (65535 & f), c))), (a = E), (p = w = void 0), (w = C((v = d), 14)), (p = C(v, 18)), (v = C(v, 41)), (l = new L(w.I ^ p.I ^ v.I, w.M ^ p.M ^ v.M)), (f = y), (c = b), (h = new L(((h = d).I & f.I) ^ (~h.I & c.I), (h.M & f.M) ^ (~h.M & c.M))), (r = q[H]), (i = A[H]), (s = u = o = void 0), (u = (65535 & a.M) + (65535 & l.M) + (65535 & h.M) + (65535 & r.M) + (65535 & i.M)), (s = ((65535 & (o = (a.M >>> 16) + (l.M >>> 16) + (h.M >>> 16) + (r.M >>> 16) + (i.M >>> 16) + (u >>> 16))) << 16) | (65535 & u)), (u = (65535 & a.I) + (65535 & l.I) + (65535 & h.I) + (65535 & r.I) + (65535 & i.I) + (o >>> 16)), (o = (a.I >>> 16) + (l.I >>> 16) + (h.I >>> 16) + (r.I >>> 16) + (i.I >>> 16) + (u >>> 16)), (h = new L(((65535 & o) << 16) | (65535 & u), s)), (i = U( ((i = r = void 0), (r = C((o = M), 28)), (i = C(o, 34)), (o = C(o, 39)), new L(r.I ^ i.I ^ o.I, r.M ^ i.M ^ o.M)), ((u = I), (s = g), new L( ((r = M).I & u.I) ^ (r.I & s.I) ^ (u.I & s.I), (r.M & u.M) ^ (r.M & s.M) ^ (u.M & s.M), )), )), (E = b), (b = y), (y = d), (d = U(m, h)), (m = g), (g = I), (I = M), (M = U(h, i)) return ( (e[0] = U(M, e[0])), (e[1] = U(I, e[1])), (e[2] = U(g, e[2])), (e[3] = U(m, e[3])), (e[4] = U(d, e[4])), (e[5] = U(y, e[5])), (e[6] = U(b, e[6])), (e[7] = U(E, e[7])), e ) } I(nn, (J = n)) var J, Q = nn, W = [ new L(0, 1), new L(0, 32898), new L(2147483648, 32906), new L(2147483648, 2147516416), new L(0, 32907), new L(0, 2147483649), new L(2147483648, 2147516545), new L(2147483648, 32777), new L(0, 138), new L(0, 136), new L(0, 2147516425), new L(0, 2147483658), new L(0, 2147516555), new L(2147483648, 139), new L(2147483648, 32905), new L(2147483648, 32771), new L(2147483648, 32770), new L(2147483648, 128), new L(0, 32778), new L(2147483648, 2147483658), new L(2147483648, 2147516545), new L(2147483648, 32896), new L(0, 2147483649), new L(2147483648, 2147516424), ], $ = [ [0, 36, 3, 41, 18], [1, 44, 10, 45, 2], [62, 6, 43, 15, 61], [28, 55, 25, 21, 56], [27, 20, 39, 8, 14], ] function nn(h, n, e) { var t = this if ('SHA-384' !== h && 'SHA-512' !== h) throw new Error(w) var r = e || {} return ( ((t = J.call(this, h, n, e) || this).K = t.N), (t.k = !0), (t.F = -1), (t.m = o(t.t, t.i, t.F)), (t.R = G), (t.L = function (n) { return n.slice() }), (t.B = D), (t.g = function (n, e, t, r) { for ( var i, o = n, n = e, u = r, e = h, s = 31 + (((n + 129) >>> 10) << 5), r = n + t; o.length <= s; ) o.push(0) for ( o[n >>> 5] |= 128 << (24 - (n % 32)), o[s] = 4294967295 & r, o[s - 1] = (r / a) | 0, i = 0; i < o.length; i += 32 ) u = G(o.slice(i, i + 32), u) return 'SHA-384' === e ? [ u[0].I, u[0].M, u[1].I, u[1].M, u[2].I, u[2].M, u[3].I, u[3].M, u[4].I, u[4].M, u[5].I, u[5].M, ] : [ u[0].I, u[0].M, u[1].I, u[1].M, u[2].I, u[2].M, u[3].I, u[3].M, u[4].I, u[4].M, u[5].I, u[5].M, u[6].I, u[6].M, u[7].I, u[7].M, ] }), (t.U = D(h)), (t.p = 1024), (t.T = 'SHA-384' === h ? 384 : 512), (t.C = !1), r.hmacKey && t.Y(l('hmacKey', r.hmacKey, t.F)), t ) } function T(n) { for (var e = [], t = 0; t < 5; t += 1) e[t] = [new L(0, 0), new L(0, 0), new L(0, 0), new L(0, 0), new L(0, 0)] return e } function en(n) { for (var e = [], t = 0; t < 5; t += 1) e[t] = n[t].slice() return e } function R(n, e) { var t, r, i, o, u, s, h, a, w, f = [], c = [] if (null !== n) for (r = 0; r < n.length; r += 2) e[(r >>> 1) % 5][((r >>> 1) / 5) | 0] = S( e[(r >>> 1) % 5][((r >>> 1) / 5) | 0], new L(n[r + 1], n[r]), ) for (t = 0; t < 24; t += 1) { for (o = T(), r = 0; r < 5; r += 1) f[r] = ((u = e[r][0]), (s = e[r][1]), (h = e[r][2]), (a = e[r][3]), (w = e[r][4]), new L(u.I ^ s.I ^ h.I ^ a.I ^ w.I, u.M ^ s.M ^ h.M ^ a.M ^ w.M)) for (r = 0; r < 5; r += 1) c[r] = S(f[(r + 4) % 5], V(f[(r + 1) % 5], 1)) for (r = 0; r < 5; r += 1) for (i = 0; i < 5; i += 1) e[r][i] = S(e[r][i], c[r]) for (r = 0; r < 5; r += 1) for (i = 0; i < 5; i += 1) o[i][(2 * r + 3 * i) % 5] = V(e[r][i], $[r][i]) for (r = 0; r < 5; r += 1) for (i = 0; i < 5; i += 1) e[r][i] = S( o[r][i], new L( ~o[(r + 1) % 5][i].I & o[(r + 2) % 5][i].I, ~o[(r + 1) % 5][i].M & o[(r + 2) % 5][i].M, ), ) e[0][0] = S(e[0][0], W[t]) } return e } function tn(n) { for (var e, t = 0, r = [0, 0], i = [4294967295 & n, (n / a) & 2097151], o = 6; 0 <= o; o--) (0 == (e = (i[o >> 2] >>> (8 * o)) & 255) && 0 === t) || ((r[(t + 1) >> 2] |= e << (8 * (t + 1))), (t += 1)) return (r[0] |= t = 0 !== t ? t : 1), { value: 4 < t + 1 ? r : [r[0]], binLen: 8 + 8 * t } } function F(n) { return f(tn(n.binLen), n) } function rn(n, e) { for ( var t = tn(e), e = e >>> 2, r = (e - ((t = f(t, n)).value.length % e)) % e, i = 0; i < r; i++ ) t.value.push(0) return t.value } I(k, (on = n)), (k.prototype.j = function (n, e) { ;(n = { funcName: l('funcName', (n = n || {} || {}).funcName, 1, { value: [], binLen: 0 }), customization: l('Customization', n.customization, 1, { value: [], binLen: 0 }), }), e && (n.funcName = e), (e = f(F(n.funcName), F(n.customization))) if (0 === n.customization.binLen && 0 === n.funcName.binLen) return 31 for (var t = rn(e, this.p >>> 3), r = 0; r < t.length; r += this.p >>> 5) (this.U = this.R(t.slice(r, r + (this.p >>> 5)), this.U)), (this.A += this.p) return 4 }), (k.prototype.X = function (n) { var e = { kmacKey: l('kmacKey', (e = n || {} || {}).kmacKey, 1), funcName: { value: [1128353099], binLen: 32 }, customization: l('Customization', e.customization, 1, { value: [], binLen: 0 }), } this.j(n, e.funcName) for (var t = rn(F(e.kmacKey), this.p >>> 3), r = 0; r < t.length; r += this.p >>> 5) (this.U = this.R(t.slice(r, r + (this.p >>> 5)), this.U)), (this.A += this.p) this.l = !0 }), (k.prototype.O = function (n) { var e = f( { value: this.u.slice(), binLen: this.h }, (function (n) { for ( var e, t = 0, r = [0, 0], i = [4294967295 & n, (n / a) & 2097151], o = 6; 0 <= o; o-- ) (0 == (e = (i[o >> 2] >>> (8 * o)) & 255) && 0 === t) || ((r[t >> 2] |= e << (8 * t)), (t += 1)) return ( (r[(t = 0 !== t ? t : 1) >> 2] |= t << (8 * t)), { value: 4 < t + 1 ? r : [r[0]], binLen: 8 + 8 * t } ) })(n.outputLen), ) return this.g(e.value, e.binLen, this.A, this.L(this.U), n.outputLen) }) var on, un = k function k(n, e, t) { var r = this, A = 6, M = 0, i = t || {} if (1 !== (r = on.call(this, n, e, t) || this).numRounds) { if (i.kmacKey || i.hmacKey) throw new Error(h) if ('CSHAKE128' === r.o || 'CSHAKE256' === r.o) throw new Error('Cannot set numRounds for CSHAKE variants') } switch ( ((r.F = 1), (r.m = o(r.t, r.i, r.F)), (r.R = R), (r.L = en), (r.B = T), (r.U = T()), (r.C = !1), n) ) { case 'SHA3-224': ;(r.p = M = 1152), (r.T = 224), (r.k = !0), (r.K = r.N) break case 'SHA3-256': ;(r.p = M = 1088), (r.T = 256), (r.k = !0), (r.K = r.N) break case 'SHA3-384': ;(r.p = M = 832), (r.T = 384), (r.k = !0), (r.K = r.N) break case 'SHA3-512': ;(r.p = M = 576), (r.T = 512), (r.k = !0), (r.K = r.N) break case 'SHAKE128': ;(A = 31), (r.p = M = 1344), (r.T = -1), (r.C = !0), (r.k = !1), (r.K = null) break case 'SHAKE256': ;(A = 31), (r.p = M = 1088), (r.T = -1), (r.C = !0), (r.k = !1), (r.K = null) break case 'KMAC128': ;(A = 4), (r.p = M = 1344), r.X(t), (r.T = -1), (r.C = !0), (r.k = !1), (r.K = r.O) break case 'KMAC256': ;(A = 4), (r.p = M = 1088), r.X(t), (r.T = -1), (r.C = !0), (r.k = !1), (r.K = r.O) break case 'CSHAKE128': ;(r.p = M = 1344), (A = r.j(t)), (r.T = -1), (r.C = !0), (r.k = !1), (r.K = null) break case 'CSHAKE256': ;(r.p = M = 1088), (A = r.j(t)), (r.T = -1), (r.C = !0), (r.k = !1), (r.K = null) break default: throw new Error(w) } return ( (r.g = function (n, e, t, r, i) { for ( var o, u = n, s = e, h = r, a = M, n = A, w = i, f = 0, c = [], l = a >>> 5, p = s >>> 5, v = 0; v < p && a <= s; v += l ) (h = R(u.slice(v, v + l), h)), (s -= a) for (u = u.slice(v), s %= a; u.length < l; ) u.push(0) for ( u[(v = s >>> 3) >> 2] ^= n << ((v % 4) * 8), u[l - 1] ^= 2147483648, h = R(u, h); 32 * c.length < w && ((o = h[f % 5][(f / 5) | 0]), c.push(o.M), !(32 * c.length >= w)); ) c.push(o.I), 0 == (64 * (f += 1)) % a && (R(null, h), (f = 0)) return c }), i.hmacKey && r.Y(l('hmacKey', i.hmacKey, r.F)), r ) } return ( (N.prototype.update = function (n) { return this._.update(n), this }), (N.prototype.getHash = function (n, e) { return this._.getHash(n, e) }), (N.prototype.setHMACKey = function (n, e, t) { this._.setHMACKey(n, e, t) }), (N.prototype.getHMAC = function (n, e) { return this._.getHMAC(n, e) }), N ) function N(n, e, t) { if ('SHA-1' == n) this._ = new _(n, e, t) else if ('SHA-224' == n || 'SHA-256' == n) this._ = new P(n, e, t) else if ('SHA-384' == n || 'SHA-512' == n) this._ = new Q(n, e, t) else { if ( 'SHA3-224' != n && 'SHA3-256' != n && 'SHA3-384' != n && 'SHA3-512' != n && 'SHAKE128' != n && 'SHAKE256' != n && 'CSHAKE128' != n && 'CSHAKE256' != n && 'KMAC128' != n && 'KMAC256' != n ) throw new Error(w) this._ = new un(n, e, t) } } })