@btc-vision/transaction 1.7.19 → 1.7.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +10 -1
- package/LICENSE +190 -21
- package/README.md +1 -1
- package/browser/_version.d.ts +1 -1
- package/browser/bip39.js +204 -0
- package/browser/bitcoin-utils.js +3172 -0
- package/browser/btc-vision-bip32.js +805 -0
- package/browser/btc-vision-bitcoin.js +4179 -0
- package/browser/btc-vision-logger.js +273 -0
- package/browser/btc-vision-post-quantum.js +542 -0
- package/browser/chain/ChainData.d.ts +1 -1
- package/browser/crypto/crypto.d.ts +1 -1
- package/browser/generators/AddressGenerator.d.ts +1 -1
- package/browser/generators/Generator.d.ts +1 -1
- package/browser/generators/MLDSAData.d.ts +1 -1
- package/browser/generators/builders/CalldataGenerator.d.ts +1 -1
- package/browser/generators/builders/CustomGenerator.d.ts +1 -1
- package/browser/generators/builders/DeploymentGenerator.d.ts +1 -1
- package/browser/generators/builders/HashCommitmentGenerator.d.ts +49 -0
- package/browser/generators/builders/LegacyCalldataGenerator.d.ts +1 -1
- package/browser/generators/builders/P2WDAGenerator.d.ts +1 -1
- package/browser/index.js +10775 -2
- package/browser/keypair/Address.d.ts +5 -3
- package/browser/keypair/AddressVerificator.d.ts +2 -2
- package/browser/keypair/EcKeyPair.d.ts +2 -2
- package/browser/keypair/MessageSigner.d.ts +2 -2
- package/browser/keypair/Wallet.d.ts +2 -2
- package/browser/metadata/ContractBaseMetadata.d.ts +1 -1
- package/browser/mnemonic/Mnemonic.d.ts +2 -2
- package/browser/noble-curves.js +3316 -0
- package/browser/noble-hashes.js +1608 -0
- package/browser/opnet.d.ts +15 -2
- package/browser/p2wda/P2WDADetector.d.ts +2 -2
- package/browser/polyfills.js +4590 -0
- package/browser/scure-base.js +410 -0
- package/browser/signer/AddressRotation.d.ts +12 -0
- package/browser/signer/SignerUtils.d.ts +1 -1
- package/browser/signer/TweakedSigner.d.ts +1 -1
- package/browser/transaction/TransactionFactory.d.ts +15 -1
- package/browser/transaction/browser/BrowserSignerBase.d.ts +1 -1
- package/browser/transaction/browser/Web3Provider.d.ts +1 -1
- package/browser/transaction/browser/extensions/UnisatSigner.d.ts +1 -1
- package/browser/transaction/browser/extensions/XverseSigner.d.ts +1 -1
- package/browser/transaction/builders/CancelTransaction.d.ts +1 -1
- package/browser/transaction/builders/ConsolidatedInteractionTransaction.d.ts +44 -0
- package/browser/transaction/builders/CustomScriptTransaction.d.ts +1 -1
- package/browser/transaction/builders/DeploymentTransaction.d.ts +1 -1
- package/browser/transaction/builders/FundingTransaction.d.ts +1 -1
- package/browser/transaction/builders/InteractionTransaction.d.ts +1 -1
- package/browser/transaction/builders/InteractionTransactionP2WDA.d.ts +2 -2
- package/browser/transaction/builders/MultiSignTransaction.d.ts +1 -1
- package/browser/transaction/builders/SharedInteractionTransaction.d.ts +1 -1
- package/browser/transaction/builders/TransactionBuilder.d.ts +1 -1
- package/browser/transaction/enums/TransactionType.d.ts +3 -1
- package/browser/transaction/interfaces/IConsolidatedTransactionParameters.d.ts +31 -0
- package/browser/transaction/interfaces/ITransactionParameters.d.ts +3 -1
- package/browser/transaction/interfaces/Tap.d.ts +1 -1
- package/browser/transaction/mineable/TimelockGenerator.d.ts +1 -1
- package/browser/transaction/offline/OfflineTransactionManager.d.ts +69 -0
- package/browser/transaction/offline/TransactionReconstructor.d.ts +28 -0
- package/browser/transaction/offline/TransactionSerializer.d.ts +50 -0
- package/browser/transaction/offline/TransactionStateCapture.d.ts +52 -0
- package/browser/transaction/offline/interfaces/ISerializableState.d.ts +62 -0
- package/browser/transaction/offline/interfaces/ITypeSpecificData.d.ts +62 -0
- package/browser/transaction/processor/PsbtTransaction.d.ts +1 -1
- package/browser/transaction/shared/P2TR_MS.d.ts +1 -1
- package/browser/transaction/shared/TweakedTransaction.d.ts +15 -4
- package/browser/utxo/OPNetLimitedProvider.d.ts +1 -1
- package/browser/utxo/interfaces/IUTXO.d.ts +2 -0
- package/browser/valibot.js +4948 -0
- package/browser/vendors.js +12913 -0
- package/browser/verification/TapscriptVerificator.d.ts +1 -1
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/generators/builders/HashCommitmentGenerator.d.ts +49 -0
- package/build/generators/builders/HashCommitmentGenerator.js +229 -0
- package/build/keypair/Address.d.ts +3 -1
- package/build/keypair/Address.js +87 -54
- package/build/opnet.d.ts +14 -1
- package/build/opnet.js +11 -1
- package/build/signer/AddressRotation.d.ts +12 -0
- package/build/signer/AddressRotation.js +16 -0
- package/build/transaction/TransactionFactory.d.ts +14 -0
- package/build/transaction/TransactionFactory.js +36 -0
- package/build/transaction/builders/ConsolidatedInteractionTransaction.d.ts +44 -0
- package/build/transaction/builders/ConsolidatedInteractionTransaction.js +259 -0
- package/build/transaction/builders/TransactionBuilder.js +2 -0
- package/build/transaction/enums/TransactionType.d.ts +3 -1
- package/build/transaction/enums/TransactionType.js +2 -0
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.d.ts +31 -0
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.js +1 -0
- package/build/transaction/interfaces/ITransactionParameters.d.ts +2 -0
- package/build/transaction/offline/OfflineTransactionManager.d.ts +69 -0
- package/build/transaction/offline/OfflineTransactionManager.js +255 -0
- package/build/transaction/offline/TransactionReconstructor.d.ts +28 -0
- package/build/transaction/offline/TransactionReconstructor.js +243 -0
- package/build/transaction/offline/TransactionSerializer.d.ts +50 -0
- package/build/transaction/offline/TransactionSerializer.js +700 -0
- package/build/transaction/offline/TransactionStateCapture.d.ts +52 -0
- package/build/transaction/offline/TransactionStateCapture.js +275 -0
- package/build/transaction/offline/interfaces/ISerializableState.d.ts +62 -0
- package/build/transaction/offline/interfaces/ISerializableState.js +2 -0
- package/build/transaction/offline/interfaces/ITypeSpecificData.d.ts +62 -0
- package/build/transaction/offline/interfaces/ITypeSpecificData.js +19 -0
- package/build/transaction/shared/TweakedTransaction.d.ts +12 -1
- package/build/transaction/shared/TweakedTransaction.js +75 -8
- package/build/utxo/interfaces/IUTXO.d.ts +2 -0
- package/documentation/README.md +5 -0
- package/documentation/offline-transaction-signing.md +650 -0
- package/documentation/transaction-building.md +603 -0
- package/package.json +62 -4
- package/src/_version.ts +1 -1
- package/src/generators/builders/HashCommitmentGenerator.ts +495 -0
- package/src/keypair/Address.ts +123 -70
- package/src/opnet.ts +16 -1
- package/src/signer/AddressRotation.ts +72 -0
- package/src/transaction/TransactionFactory.ts +87 -0
- package/src/transaction/builders/CancelTransaction.ts +4 -2
- package/src/transaction/builders/ConsolidatedInteractionTransaction.ts +561 -0
- package/src/transaction/builders/CustomScriptTransaction.ts +4 -2
- package/src/transaction/builders/MultiSignTransaction.ts +4 -2
- package/src/transaction/builders/TransactionBuilder.ts +8 -2
- package/src/transaction/enums/TransactionType.ts +2 -0
- package/src/transaction/interfaces/IConsolidatedTransactionParameters.ts +78 -0
- package/src/transaction/interfaces/ITransactionParameters.ts +8 -0
- package/src/transaction/offline/OfflineTransactionManager.ts +630 -0
- package/src/transaction/offline/TransactionReconstructor.ts +402 -0
- package/src/transaction/offline/TransactionSerializer.ts +920 -0
- package/src/transaction/offline/TransactionStateCapture.ts +469 -0
- package/src/transaction/offline/interfaces/ISerializableState.ts +141 -0
- package/src/transaction/offline/interfaces/ITypeSpecificData.ts +172 -0
- package/src/transaction/shared/TweakedTransaction.ts +156 -9
- package/src/utxo/interfaces/IUTXO.ts +8 -0
- package/test/address-rotation.test.ts +553 -0
- package/test/offline-transaction.test.ts +2065 -0
- package/vite.config.browser.ts +92 -0
- package/webpack.config.js +143 -2
- package/browser/crypto/crypto-browser.d.ts +0 -11
- package/browser/index.js.LICENSE.txt +0 -29
|
@@ -0,0 +1,1608 @@
|
|
|
1
|
+
const ct = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
|
|
2
|
+
function le(t) {
|
|
3
|
+
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
|
4
|
+
}
|
|
5
|
+
function Bt(t) {
|
|
6
|
+
if (!Number.isSafeInteger(t) || t < 0)
|
|
7
|
+
throw new Error("positive integer expected, got " + t);
|
|
8
|
+
}
|
|
9
|
+
function ht(t, ...e) {
|
|
10
|
+
if (!le(t))
|
|
11
|
+
throw new Error("Uint8Array expected");
|
|
12
|
+
if (e.length > 0 && !e.includes(t.length))
|
|
13
|
+
throw new Error("Uint8Array expected of length " + e + ", got length=" + t.length);
|
|
14
|
+
}
|
|
15
|
+
function be(t) {
|
|
16
|
+
if (typeof t != "function" || typeof t.create != "function")
|
|
17
|
+
throw new Error("Hash should be wrapped by utils.createHasher");
|
|
18
|
+
Bt(t.outputLen), Bt(t.blockLen);
|
|
19
|
+
}
|
|
20
|
+
function pt(t, e = !0) {
|
|
21
|
+
if (t.destroyed)
|
|
22
|
+
throw new Error("Hash instance has been destroyed");
|
|
23
|
+
if (e && t.finished)
|
|
24
|
+
throw new Error("Hash#digest() has already been called");
|
|
25
|
+
}
|
|
26
|
+
function xe(t, e) {
|
|
27
|
+
ht(t);
|
|
28
|
+
const s = e.outputLen;
|
|
29
|
+
if (t.length < s)
|
|
30
|
+
throw new Error("digestInto() expects output buffer of length at least " + s);
|
|
31
|
+
}
|
|
32
|
+
function nt(...t) {
|
|
33
|
+
for (let e = 0; e < t.length; e++)
|
|
34
|
+
t[e].fill(0);
|
|
35
|
+
}
|
|
36
|
+
function yt(t) {
|
|
37
|
+
return new DataView(t.buffer, t.byteOffset, t.byteLength);
|
|
38
|
+
}
|
|
39
|
+
function Y(t, e) {
|
|
40
|
+
return t << 32 - e | t >>> e;
|
|
41
|
+
}
|
|
42
|
+
function it(t, e) {
|
|
43
|
+
return t << e | t >>> 32 - e >>> 0;
|
|
44
|
+
}
|
|
45
|
+
const Xt = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", pe = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
46
|
+
function rs(t) {
|
|
47
|
+
if (ht(t), Xt)
|
|
48
|
+
return t.toHex();
|
|
49
|
+
let e = "";
|
|
50
|
+
for (let s = 0; s < t.length; s++)
|
|
51
|
+
e += pe[t[s]];
|
|
52
|
+
return e;
|
|
53
|
+
}
|
|
54
|
+
const Z = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
|
|
55
|
+
function Ut(t) {
|
|
56
|
+
if (t >= Z._0 && t <= Z._9)
|
|
57
|
+
return t - Z._0;
|
|
58
|
+
if (t >= Z.A && t <= Z.F)
|
|
59
|
+
return t - (Z.A - 10);
|
|
60
|
+
if (t >= Z.a && t <= Z.f)
|
|
61
|
+
return t - (Z.a - 10);
|
|
62
|
+
}
|
|
63
|
+
function is(t) {
|
|
64
|
+
if (typeof t != "string")
|
|
65
|
+
throw new Error("hex string expected, got " + typeof t);
|
|
66
|
+
if (Xt)
|
|
67
|
+
return Uint8Array.fromHex(t);
|
|
68
|
+
const e = t.length, s = e / 2;
|
|
69
|
+
if (e % 2)
|
|
70
|
+
throw new Error("hex string expected, got unpadded hex of length " + e);
|
|
71
|
+
const i = new Uint8Array(s);
|
|
72
|
+
for (let o = 0, n = 0; o < s; o++, n += 2) {
|
|
73
|
+
const r = Ut(t.charCodeAt(n)), h = Ut(t.charCodeAt(n + 1));
|
|
74
|
+
if (r === void 0 || h === void 0) {
|
|
75
|
+
const d = t[n] + t[n + 1];
|
|
76
|
+
throw new Error('hex string expected, got non-hex character "' + d + '" at index ' + n);
|
|
77
|
+
}
|
|
78
|
+
i[o] = r * 16 + h;
|
|
79
|
+
}
|
|
80
|
+
return i;
|
|
81
|
+
}
|
|
82
|
+
function He(t) {
|
|
83
|
+
if (typeof t != "string")
|
|
84
|
+
throw new Error("string expected");
|
|
85
|
+
return new Uint8Array(new TextEncoder().encode(t));
|
|
86
|
+
}
|
|
87
|
+
function wt(t) {
|
|
88
|
+
return typeof t == "string" && (t = He(t)), ht(t), t;
|
|
89
|
+
}
|
|
90
|
+
function os(...t) {
|
|
91
|
+
let e = 0;
|
|
92
|
+
for (let i = 0; i < t.length; i++) {
|
|
93
|
+
const o = t[i];
|
|
94
|
+
ht(o), e += o.length;
|
|
95
|
+
}
|
|
96
|
+
const s = new Uint8Array(e);
|
|
97
|
+
for (let i = 0, o = 0; i < t.length; i++) {
|
|
98
|
+
const n = t[i];
|
|
99
|
+
s.set(n, o), o += n.length;
|
|
100
|
+
}
|
|
101
|
+
return s;
|
|
102
|
+
}
|
|
103
|
+
class Jt {
|
|
104
|
+
}
|
|
105
|
+
function St(t) {
|
|
106
|
+
const e = (i) => t().update(wt(i)).digest(), s = t();
|
|
107
|
+
return e.outputLen = s.outputLen, e.blockLen = s.blockLen, e.create = () => t(), e;
|
|
108
|
+
}
|
|
109
|
+
function cs(t = 32) {
|
|
110
|
+
if (ct && typeof ct.getRandomValues == "function")
|
|
111
|
+
return ct.getRandomValues(new Uint8Array(t));
|
|
112
|
+
if (ct && typeof ct.randomBytes == "function")
|
|
113
|
+
return Uint8Array.from(ct.randomBytes(t));
|
|
114
|
+
throw new Error("crypto.getRandomValues must be defined");
|
|
115
|
+
}
|
|
116
|
+
function Ae(t, e, s, i) {
|
|
117
|
+
if (typeof t.setBigUint64 == "function")
|
|
118
|
+
return t.setBigUint64(e, s, i);
|
|
119
|
+
const o = BigInt(32), n = BigInt(4294967295), r = Number(s >> o & n), h = Number(s & n), d = i ? 4 : 0, x = i ? 0 : 4;
|
|
120
|
+
t.setUint32(e + d, r, i), t.setUint32(e + x, h, i);
|
|
121
|
+
}
|
|
122
|
+
function Qt(t, e, s) {
|
|
123
|
+
return t & e ^ ~t & s;
|
|
124
|
+
}
|
|
125
|
+
function Yt(t, e, s) {
|
|
126
|
+
return t & e ^ t & s ^ e & s;
|
|
127
|
+
}
|
|
128
|
+
class It extends Jt {
|
|
129
|
+
constructor(e, s, i, o) {
|
|
130
|
+
super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = e, this.outputLen = s, this.padOffset = i, this.isLE = o, this.buffer = new Uint8Array(e), this.view = yt(this.buffer);
|
|
131
|
+
}
|
|
132
|
+
update(e) {
|
|
133
|
+
pt(this), e = wt(e), ht(e);
|
|
134
|
+
const { view: s, buffer: i, blockLen: o } = this, n = e.length;
|
|
135
|
+
for (let r = 0; r < n; ) {
|
|
136
|
+
const h = Math.min(o - this.pos, n - r);
|
|
137
|
+
if (h === o) {
|
|
138
|
+
const d = yt(e);
|
|
139
|
+
for (; o <= n - r; r += o)
|
|
140
|
+
this.process(d, r);
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
i.set(e.subarray(r, r + h), this.pos), this.pos += h, r += h, this.pos === o && (this.process(s, 0), this.pos = 0);
|
|
144
|
+
}
|
|
145
|
+
return this.length += e.length, this.roundClean(), this;
|
|
146
|
+
}
|
|
147
|
+
digestInto(e) {
|
|
148
|
+
pt(this), xe(e, this), this.finished = !0;
|
|
149
|
+
const { buffer: s, view: i, blockLen: o, isLE: n } = this;
|
|
150
|
+
let { pos: r } = this;
|
|
151
|
+
s[r++] = 128, nt(this.buffer.subarray(r)), this.padOffset > o - r && (this.process(i, 0), r = 0);
|
|
152
|
+
for (let b = r; b < o; b++)
|
|
153
|
+
s[b] = 0;
|
|
154
|
+
Ae(i, o - 8, BigInt(this.length * 8), n), this.process(i, 0);
|
|
155
|
+
const h = yt(e), d = this.outputLen;
|
|
156
|
+
if (d % 4)
|
|
157
|
+
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
158
|
+
const x = d / 4, p = this.get();
|
|
159
|
+
if (x > p.length)
|
|
160
|
+
throw new Error("_sha2: outputLen bigger than state");
|
|
161
|
+
for (let b = 0; b < x; b++)
|
|
162
|
+
h.setUint32(4 * b, p[b], n);
|
|
163
|
+
}
|
|
164
|
+
digest() {
|
|
165
|
+
const { buffer: e, outputLen: s } = this;
|
|
166
|
+
this.digestInto(e);
|
|
167
|
+
const i = e.slice(0, s);
|
|
168
|
+
return this.destroy(), i;
|
|
169
|
+
}
|
|
170
|
+
_cloneInto(e) {
|
|
171
|
+
e || (e = new this.constructor()), e.set(...this.get());
|
|
172
|
+
const { blockLen: s, buffer: i, length: o, finished: n, destroyed: r, pos: h } = this;
|
|
173
|
+
return e.destroyed = r, e.finished = n, e.length = o, e.pos = h, o % s && e.buffer.set(i), e;
|
|
174
|
+
}
|
|
175
|
+
clone() {
|
|
176
|
+
return this._cloneInto();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
const tt = /* @__PURE__ */ Uint32Array.from([
|
|
180
|
+
1779033703,
|
|
181
|
+
3144134277,
|
|
182
|
+
1013904242,
|
|
183
|
+
2773480762,
|
|
184
|
+
1359893119,
|
|
185
|
+
2600822924,
|
|
186
|
+
528734635,
|
|
187
|
+
1541459225
|
|
188
|
+
]), ye = /* @__PURE__ */ Uint32Array.from([
|
|
189
|
+
1116352408,
|
|
190
|
+
1899447441,
|
|
191
|
+
3049323471,
|
|
192
|
+
3921009573,
|
|
193
|
+
961987163,
|
|
194
|
+
1508970993,
|
|
195
|
+
2453635748,
|
|
196
|
+
2870763221,
|
|
197
|
+
3624381080,
|
|
198
|
+
310598401,
|
|
199
|
+
607225278,
|
|
200
|
+
1426881987,
|
|
201
|
+
1925078388,
|
|
202
|
+
2162078206,
|
|
203
|
+
2614888103,
|
|
204
|
+
3248222580,
|
|
205
|
+
3835390401,
|
|
206
|
+
4022224774,
|
|
207
|
+
264347078,
|
|
208
|
+
604807628,
|
|
209
|
+
770255983,
|
|
210
|
+
1249150122,
|
|
211
|
+
1555081692,
|
|
212
|
+
1996064986,
|
|
213
|
+
2554220882,
|
|
214
|
+
2821834349,
|
|
215
|
+
2952996808,
|
|
216
|
+
3210313671,
|
|
217
|
+
3336571891,
|
|
218
|
+
3584528711,
|
|
219
|
+
113926993,
|
|
220
|
+
338241895,
|
|
221
|
+
666307205,
|
|
222
|
+
773529912,
|
|
223
|
+
1294757372,
|
|
224
|
+
1396182291,
|
|
225
|
+
1695183700,
|
|
226
|
+
1986661051,
|
|
227
|
+
2177026350,
|
|
228
|
+
2456956037,
|
|
229
|
+
2730485921,
|
|
230
|
+
2820302411,
|
|
231
|
+
3259730800,
|
|
232
|
+
3345764771,
|
|
233
|
+
3516065817,
|
|
234
|
+
3600352804,
|
|
235
|
+
4094571909,
|
|
236
|
+
275423344,
|
|
237
|
+
430227734,
|
|
238
|
+
506948616,
|
|
239
|
+
659060556,
|
|
240
|
+
883997877,
|
|
241
|
+
958139571,
|
|
242
|
+
1322822218,
|
|
243
|
+
1537002063,
|
|
244
|
+
1747873779,
|
|
245
|
+
1955562222,
|
|
246
|
+
2024104815,
|
|
247
|
+
2227730452,
|
|
248
|
+
2361852424,
|
|
249
|
+
2428436474,
|
|
250
|
+
2756734187,
|
|
251
|
+
3204031479,
|
|
252
|
+
3329325298
|
|
253
|
+
]), et = /* @__PURE__ */ new Uint32Array(64);
|
|
254
|
+
class ge extends It {
|
|
255
|
+
constructor(e = 32) {
|
|
256
|
+
super(64, e, 8, !1), this.A = tt[0] | 0, this.B = tt[1] | 0, this.C = tt[2] | 0, this.D = tt[3] | 0, this.E = tt[4] | 0, this.F = tt[5] | 0, this.G = tt[6] | 0, this.H = tt[7] | 0;
|
|
257
|
+
}
|
|
258
|
+
get() {
|
|
259
|
+
const { A: e, B: s, C: i, D: o, E: n, F: r, G: h, H: d } = this;
|
|
260
|
+
return [e, s, i, o, n, r, h, d];
|
|
261
|
+
}
|
|
262
|
+
// prettier-ignore
|
|
263
|
+
set(e, s, i, o, n, r, h, d) {
|
|
264
|
+
this.A = e | 0, this.B = s | 0, this.C = i | 0, this.D = o | 0, this.E = n | 0, this.F = r | 0, this.G = h | 0, this.H = d | 0;
|
|
265
|
+
}
|
|
266
|
+
process(e, s) {
|
|
267
|
+
for (let b = 0; b < 16; b++, s += 4)
|
|
268
|
+
et[b] = e.getUint32(s, !1);
|
|
269
|
+
for (let b = 16; b < 64; b++) {
|
|
270
|
+
const U = et[b - 15], w = et[b - 2], m = Y(U, 7) ^ Y(U, 18) ^ U >>> 3, k = Y(w, 17) ^ Y(w, 19) ^ w >>> 10;
|
|
271
|
+
et[b] = k + et[b - 7] + m + et[b - 16] | 0;
|
|
272
|
+
}
|
|
273
|
+
let { A: i, B: o, C: n, D: r, E: h, F: d, G: x, H: p } = this;
|
|
274
|
+
for (let b = 0; b < 64; b++) {
|
|
275
|
+
const U = Y(h, 6) ^ Y(h, 11) ^ Y(h, 25), w = p + U + Qt(h, d, x) + ye[b] + et[b] | 0, k = (Y(i, 2) ^ Y(i, 13) ^ Y(i, 22)) + Yt(i, o, n) | 0;
|
|
276
|
+
p = x, x = d, d = h, h = r + w | 0, r = n, n = o, o = i, i = w + k | 0;
|
|
277
|
+
}
|
|
278
|
+
i = i + this.A | 0, o = o + this.B | 0, n = n + this.C | 0, r = r + this.D | 0, h = h + this.E | 0, d = d + this.F | 0, x = x + this.G | 0, p = p + this.H | 0, this.set(i, o, n, r, h, d, x, p);
|
|
279
|
+
}
|
|
280
|
+
roundClean() {
|
|
281
|
+
nt(et);
|
|
282
|
+
}
|
|
283
|
+
destroy() {
|
|
284
|
+
this.set(0, 0, 0, 0, 0, 0, 0, 0), nt(this.buffer);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
const _e = /* @__PURE__ */ St(() => new ge()), hs = _e, at = /* @__PURE__ */ Uint32Array.from([
|
|
288
|
+
1732584193,
|
|
289
|
+
4023233417,
|
|
290
|
+
2562383102,
|
|
291
|
+
271733878,
|
|
292
|
+
3285377520
|
|
293
|
+
]), st = /* @__PURE__ */ new Uint32Array(80);
|
|
294
|
+
class we extends It {
|
|
295
|
+
constructor() {
|
|
296
|
+
super(64, 20, 8, !1), this.A = at[0] | 0, this.B = at[1] | 0, this.C = at[2] | 0, this.D = at[3] | 0, this.E = at[4] | 0;
|
|
297
|
+
}
|
|
298
|
+
get() {
|
|
299
|
+
const { A: e, B: s, C: i, D: o, E: n } = this;
|
|
300
|
+
return [e, s, i, o, n];
|
|
301
|
+
}
|
|
302
|
+
set(e, s, i, o, n) {
|
|
303
|
+
this.A = e | 0, this.B = s | 0, this.C = i | 0, this.D = o | 0, this.E = n | 0;
|
|
304
|
+
}
|
|
305
|
+
process(e, s) {
|
|
306
|
+
for (let d = 0; d < 16; d++, s += 4)
|
|
307
|
+
st[d] = e.getUint32(s, !1);
|
|
308
|
+
for (let d = 16; d < 80; d++)
|
|
309
|
+
st[d] = it(st[d - 3] ^ st[d - 8] ^ st[d - 14] ^ st[d - 16], 1);
|
|
310
|
+
let { A: i, B: o, C: n, D: r, E: h } = this;
|
|
311
|
+
for (let d = 0; d < 80; d++) {
|
|
312
|
+
let x, p;
|
|
313
|
+
d < 20 ? (x = Qt(o, n, r), p = 1518500249) : d < 40 ? (x = o ^ n ^ r, p = 1859775393) : d < 60 ? (x = Yt(o, n, r), p = 2400959708) : (x = o ^ n ^ r, p = 3395469782);
|
|
314
|
+
const b = it(i, 5) + x + h + p + st[d] | 0;
|
|
315
|
+
h = r, r = n, n = it(o, 30), o = i, i = b;
|
|
316
|
+
}
|
|
317
|
+
i = i + this.A | 0, o = o + this.B | 0, n = n + this.C | 0, r = r + this.D | 0, h = h + this.E | 0, this.set(i, o, n, r, h);
|
|
318
|
+
}
|
|
319
|
+
roundClean() {
|
|
320
|
+
nt(st);
|
|
321
|
+
}
|
|
322
|
+
destroy() {
|
|
323
|
+
this.set(0, 0, 0, 0, 0), nt(this.buffer);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
const Se = /* @__PURE__ */ St(() => new we()), Ie = /* @__PURE__ */ Uint8Array.from([
|
|
327
|
+
7,
|
|
328
|
+
4,
|
|
329
|
+
13,
|
|
330
|
+
1,
|
|
331
|
+
10,
|
|
332
|
+
6,
|
|
333
|
+
15,
|
|
334
|
+
3,
|
|
335
|
+
12,
|
|
336
|
+
0,
|
|
337
|
+
9,
|
|
338
|
+
5,
|
|
339
|
+
2,
|
|
340
|
+
14,
|
|
341
|
+
11,
|
|
342
|
+
8
|
|
343
|
+
]), Zt = Uint8Array.from(new Array(16).fill(0).map((t, e) => e)), Le = Zt.map((t) => (9 * t + 5) % 16), zt = /* @__PURE__ */ (() => {
|
|
344
|
+
const s = [[Zt], [Le]];
|
|
345
|
+
for (let i = 0; i < 4; i++)
|
|
346
|
+
for (let o of s)
|
|
347
|
+
o.push(o[i].map((n) => Ie[n]));
|
|
348
|
+
return s;
|
|
349
|
+
})(), $t = zt[0], te = zt[1], ee = /* @__PURE__ */ [
|
|
350
|
+
[11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
|
|
351
|
+
[12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
|
|
352
|
+
[13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
|
|
353
|
+
[14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
|
|
354
|
+
[15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
|
|
355
|
+
].map((t) => Uint8Array.from(t)), me = /* @__PURE__ */ $t.map((t, e) => t.map((s) => ee[e][s])), Be = /* @__PURE__ */ te.map((t, e) => t.map((s) => ee[e][s])), Ue = /* @__PURE__ */ Uint32Array.from([
|
|
356
|
+
0,
|
|
357
|
+
1518500249,
|
|
358
|
+
1859775393,
|
|
359
|
+
2400959708,
|
|
360
|
+
2840853838
|
|
361
|
+
]), Ee = /* @__PURE__ */ Uint32Array.from([
|
|
362
|
+
1352829926,
|
|
363
|
+
1548603684,
|
|
364
|
+
1836072691,
|
|
365
|
+
2053994217,
|
|
366
|
+
0
|
|
367
|
+
]);
|
|
368
|
+
function Et(t, e, s, i) {
|
|
369
|
+
return t === 0 ? e ^ s ^ i : t === 1 ? e & s | ~e & i : t === 2 ? (e | ~s) ^ i : t === 3 ? e & i | s & ~i : e ^ (s | ~i);
|
|
370
|
+
}
|
|
371
|
+
const bt = /* @__PURE__ */ new Uint32Array(16);
|
|
372
|
+
class ke extends It {
|
|
373
|
+
constructor() {
|
|
374
|
+
super(64, 20, 8, !0), this.h0 = 1732584193, this.h1 = -271733879, this.h2 = -1732584194, this.h3 = 271733878, this.h4 = -1009589776;
|
|
375
|
+
}
|
|
376
|
+
get() {
|
|
377
|
+
const { h0: e, h1: s, h2: i, h3: o, h4: n } = this;
|
|
378
|
+
return [e, s, i, o, n];
|
|
379
|
+
}
|
|
380
|
+
set(e, s, i, o, n) {
|
|
381
|
+
this.h0 = e | 0, this.h1 = s | 0, this.h2 = i | 0, this.h3 = o | 0, this.h4 = n | 0;
|
|
382
|
+
}
|
|
383
|
+
process(e, s) {
|
|
384
|
+
for (let w = 0; w < 16; w++, s += 4)
|
|
385
|
+
bt[w] = e.getUint32(s, !0);
|
|
386
|
+
let i = this.h0 | 0, o = i, n = this.h1 | 0, r = n, h = this.h2 | 0, d = h, x = this.h3 | 0, p = x, b = this.h4 | 0, U = b;
|
|
387
|
+
for (let w = 0; w < 5; w++) {
|
|
388
|
+
const m = 4 - w, k = Ue[w], M = Ee[w], P = $t[w], R = te[w], V = me[w], T = Be[w];
|
|
389
|
+
for (let g = 0; g < 16; g++) {
|
|
390
|
+
const S = it(i + Et(w, n, h, x) + bt[P[g]] + k, V[g]) + b | 0;
|
|
391
|
+
i = b, b = x, x = it(h, 10) | 0, h = n, n = S;
|
|
392
|
+
}
|
|
393
|
+
for (let g = 0; g < 16; g++) {
|
|
394
|
+
const S = it(o + Et(m, r, d, p) + bt[R[g]] + M, T[g]) + U | 0;
|
|
395
|
+
o = U, U = p, p = it(d, 10) | 0, d = r, r = S;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
this.set(this.h1 + h + p | 0, this.h2 + x + U | 0, this.h3 + b + o | 0, this.h4 + i + r | 0, this.h0 + n + d | 0);
|
|
399
|
+
}
|
|
400
|
+
roundClean() {
|
|
401
|
+
nt(bt);
|
|
402
|
+
}
|
|
403
|
+
destroy() {
|
|
404
|
+
this.destroyed = !0, nt(this.buffer), this.set(0, 0, 0, 0, 0);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
const Ve = /* @__PURE__ */ St(() => new ke()), as = Ve, fs = Se;
|
|
408
|
+
var j = {}, W = {}, gt = {}, ft = {}, kt;
|
|
409
|
+
function Ce() {
|
|
410
|
+
return kt || (kt = 1, Object.defineProperty(ft, "__esModule", { value: !0 }), ft.crypto = void 0, ft.crypto = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0), ft;
|
|
411
|
+
}
|
|
412
|
+
var Vt;
|
|
413
|
+
function lt() {
|
|
414
|
+
return Vt || (Vt = 1, (function(t) {
|
|
415
|
+
Object.defineProperty(t, "__esModule", { value: !0 }), t.wrapXOFConstructorWithOpts = t.wrapConstructorWithOpts = t.wrapConstructor = t.Hash = t.nextTick = t.swap32IfBE = t.byteSwapIfBE = t.swap8IfBE = t.isLE = void 0, t.isBytes = s, t.anumber = i, t.abytes = o, t.ahash = n, t.aexists = r, t.aoutput = h, t.u8 = d, t.u32 = x, t.clean = p, t.createView = b, t.rotr = U, t.rotl = w, t.byteSwap = m, t.byteSwap32 = k, t.bytesToHex = R, t.hexToBytes = g, t.asyncLoop = C, t.utf8ToBytes = B, t.bytesToUtf8 = a, t.toBytes = u, t.kdfInputToBytes = f, t.concatBytes = H, t.checkOpts = l, t.createHasher = I, t.createOptHasher = L, t.createXOFer = D, t.randomBytes = v;
|
|
416
|
+
const e = /* @__PURE__ */ Ce();
|
|
417
|
+
function s(c) {
|
|
418
|
+
return c instanceof Uint8Array || ArrayBuffer.isView(c) && c.constructor.name === "Uint8Array";
|
|
419
|
+
}
|
|
420
|
+
function i(c) {
|
|
421
|
+
if (!Number.isSafeInteger(c) || c < 0)
|
|
422
|
+
throw new Error("positive integer expected, got " + c);
|
|
423
|
+
}
|
|
424
|
+
function o(c, ...A) {
|
|
425
|
+
if (!s(c))
|
|
426
|
+
throw new Error("Uint8Array expected");
|
|
427
|
+
if (A.length > 0 && !A.includes(c.length))
|
|
428
|
+
throw new Error("Uint8Array expected of length " + A + ", got length=" + c.length);
|
|
429
|
+
}
|
|
430
|
+
function n(c) {
|
|
431
|
+
if (typeof c != "function" || typeof c.create != "function")
|
|
432
|
+
throw new Error("Hash should be wrapped by utils.createHasher");
|
|
433
|
+
i(c.outputLen), i(c.blockLen);
|
|
434
|
+
}
|
|
435
|
+
function r(c, A = !0) {
|
|
436
|
+
if (c.destroyed)
|
|
437
|
+
throw new Error("Hash instance has been destroyed");
|
|
438
|
+
if (A && c.finished)
|
|
439
|
+
throw new Error("Hash#digest() has already been called");
|
|
440
|
+
}
|
|
441
|
+
function h(c, A) {
|
|
442
|
+
o(c);
|
|
443
|
+
const y = A.outputLen;
|
|
444
|
+
if (c.length < y)
|
|
445
|
+
throw new Error("digestInto() expects output buffer of length at least " + y);
|
|
446
|
+
}
|
|
447
|
+
function d(c) {
|
|
448
|
+
return new Uint8Array(c.buffer, c.byteOffset, c.byteLength);
|
|
449
|
+
}
|
|
450
|
+
function x(c) {
|
|
451
|
+
return new Uint32Array(c.buffer, c.byteOffset, Math.floor(c.byteLength / 4));
|
|
452
|
+
}
|
|
453
|
+
function p(...c) {
|
|
454
|
+
for (let A = 0; A < c.length; A++)
|
|
455
|
+
c[A].fill(0);
|
|
456
|
+
}
|
|
457
|
+
function b(c) {
|
|
458
|
+
return new DataView(c.buffer, c.byteOffset, c.byteLength);
|
|
459
|
+
}
|
|
460
|
+
function U(c, A) {
|
|
461
|
+
return c << 32 - A | c >>> A;
|
|
462
|
+
}
|
|
463
|
+
function w(c, A) {
|
|
464
|
+
return c << A | c >>> 32 - A >>> 0;
|
|
465
|
+
}
|
|
466
|
+
t.isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
467
|
+
function m(c) {
|
|
468
|
+
return c << 24 & 4278190080 | c << 8 & 16711680 | c >>> 8 & 65280 | c >>> 24 & 255;
|
|
469
|
+
}
|
|
470
|
+
t.swap8IfBE = t.isLE ? (c) => c : (c) => m(c), t.byteSwapIfBE = t.swap8IfBE;
|
|
471
|
+
function k(c) {
|
|
472
|
+
for (let A = 0; A < c.length; A++)
|
|
473
|
+
c[A] = m(c[A]);
|
|
474
|
+
return c;
|
|
475
|
+
}
|
|
476
|
+
t.swap32IfBE = t.isLE ? (c) => c : k;
|
|
477
|
+
const M = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", P = /* @__PURE__ */ Array.from({ length: 256 }, (c, A) => A.toString(16).padStart(2, "0"));
|
|
478
|
+
function R(c) {
|
|
479
|
+
if (o(c), M)
|
|
480
|
+
return c.toHex();
|
|
481
|
+
let A = "";
|
|
482
|
+
for (let y = 0; y < c.length; y++)
|
|
483
|
+
A += P[c[y]];
|
|
484
|
+
return A;
|
|
485
|
+
}
|
|
486
|
+
const V = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
|
|
487
|
+
function T(c) {
|
|
488
|
+
if (c >= V._0 && c <= V._9)
|
|
489
|
+
return c - V._0;
|
|
490
|
+
if (c >= V.A && c <= V.F)
|
|
491
|
+
return c - (V.A - 10);
|
|
492
|
+
if (c >= V.a && c <= V.f)
|
|
493
|
+
return c - (V.a - 10);
|
|
494
|
+
}
|
|
495
|
+
function g(c) {
|
|
496
|
+
if (typeof c != "string")
|
|
497
|
+
throw new Error("hex string expected, got " + typeof c);
|
|
498
|
+
if (M)
|
|
499
|
+
return Uint8Array.fromHex(c);
|
|
500
|
+
const A = c.length, y = A / 2;
|
|
501
|
+
if (A % 2)
|
|
502
|
+
throw new Error("hex string expected, got unpadded hex of length " + A);
|
|
503
|
+
const O = new Uint8Array(y);
|
|
504
|
+
for (let F = 0, G = 0; F < y; F++, G += 2) {
|
|
505
|
+
const z = T(c.charCodeAt(G)), N = T(c.charCodeAt(G + 1));
|
|
506
|
+
if (z === void 0 || N === void 0) {
|
|
507
|
+
const X = c[G] + c[G + 1];
|
|
508
|
+
throw new Error('hex string expected, got non-hex character "' + X + '" at index ' + G);
|
|
509
|
+
}
|
|
510
|
+
O[F] = z * 16 + N;
|
|
511
|
+
}
|
|
512
|
+
return O;
|
|
513
|
+
}
|
|
514
|
+
const S = async () => {
|
|
515
|
+
};
|
|
516
|
+
t.nextTick = S;
|
|
517
|
+
async function C(c, A, y) {
|
|
518
|
+
let O = Date.now();
|
|
519
|
+
for (let F = 0; F < c; F++) {
|
|
520
|
+
y(F);
|
|
521
|
+
const G = Date.now() - O;
|
|
522
|
+
G >= 0 && G < A || (await (0, t.nextTick)(), O += G);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
function B(c) {
|
|
526
|
+
if (typeof c != "string")
|
|
527
|
+
throw new Error("string expected");
|
|
528
|
+
return new Uint8Array(new TextEncoder().encode(c));
|
|
529
|
+
}
|
|
530
|
+
function a(c) {
|
|
531
|
+
return new TextDecoder().decode(c);
|
|
532
|
+
}
|
|
533
|
+
function u(c) {
|
|
534
|
+
return typeof c == "string" && (c = B(c)), o(c), c;
|
|
535
|
+
}
|
|
536
|
+
function f(c) {
|
|
537
|
+
return typeof c == "string" && (c = B(c)), o(c), c;
|
|
538
|
+
}
|
|
539
|
+
function H(...c) {
|
|
540
|
+
let A = 0;
|
|
541
|
+
for (let O = 0; O < c.length; O++) {
|
|
542
|
+
const F = c[O];
|
|
543
|
+
o(F), A += F.length;
|
|
544
|
+
}
|
|
545
|
+
const y = new Uint8Array(A);
|
|
546
|
+
for (let O = 0, F = 0; O < c.length; O++) {
|
|
547
|
+
const G = c[O];
|
|
548
|
+
y.set(G, F), F += G.length;
|
|
549
|
+
}
|
|
550
|
+
return y;
|
|
551
|
+
}
|
|
552
|
+
function l(c, A) {
|
|
553
|
+
if (A !== void 0 && {}.toString.call(A) !== "[object Object]")
|
|
554
|
+
throw new Error("options should be object or undefined");
|
|
555
|
+
return Object.assign(c, A);
|
|
556
|
+
}
|
|
557
|
+
class _ {
|
|
558
|
+
}
|
|
559
|
+
t.Hash = _;
|
|
560
|
+
function I(c) {
|
|
561
|
+
const A = (O) => c().update(u(O)).digest(), y = c();
|
|
562
|
+
return A.outputLen = y.outputLen, A.blockLen = y.blockLen, A.create = () => c(), A;
|
|
563
|
+
}
|
|
564
|
+
function L(c) {
|
|
565
|
+
const A = (O, F) => c(F).update(u(O)).digest(), y = c({});
|
|
566
|
+
return A.outputLen = y.outputLen, A.blockLen = y.blockLen, A.create = (O) => c(O), A;
|
|
567
|
+
}
|
|
568
|
+
function D(c) {
|
|
569
|
+
const A = (O, F) => c(F).update(u(O)).digest(), y = c({});
|
|
570
|
+
return A.outputLen = y.outputLen, A.blockLen = y.blockLen, A.create = (O) => c(O), A;
|
|
571
|
+
}
|
|
572
|
+
t.wrapConstructor = I, t.wrapConstructorWithOpts = L, t.wrapXOFConstructorWithOpts = D;
|
|
573
|
+
function v(c = 32) {
|
|
574
|
+
if (e.crypto && typeof e.crypto.getRandomValues == "function")
|
|
575
|
+
return e.crypto.getRandomValues(new Uint8Array(c));
|
|
576
|
+
if (e.crypto && typeof e.crypto.randomBytes == "function")
|
|
577
|
+
return Uint8Array.from(e.crypto.randomBytes(c));
|
|
578
|
+
throw new Error("crypto.getRandomValues must be defined");
|
|
579
|
+
}
|
|
580
|
+
})(gt)), gt;
|
|
581
|
+
}
|
|
582
|
+
var Ct;
|
|
583
|
+
function se() {
|
|
584
|
+
if (Ct) return W;
|
|
585
|
+
Ct = 1, Object.defineProperty(W, "__esModule", { value: !0 }), W.SHA512_IV = W.SHA384_IV = W.SHA224_IV = W.SHA256_IV = W.HashMD = void 0, W.setBigUint64 = e, W.Chi = s, W.Maj = i;
|
|
586
|
+
const t = /* @__PURE__ */ lt();
|
|
587
|
+
function e(n, r, h, d) {
|
|
588
|
+
if (typeof n.setBigUint64 == "function")
|
|
589
|
+
return n.setBigUint64(r, h, d);
|
|
590
|
+
const x = BigInt(32), p = BigInt(4294967295), b = Number(h >> x & p), U = Number(h & p), w = d ? 4 : 0, m = d ? 0 : 4;
|
|
591
|
+
n.setUint32(r + w, b, d), n.setUint32(r + m, U, d);
|
|
592
|
+
}
|
|
593
|
+
function s(n, r, h) {
|
|
594
|
+
return n & r ^ ~n & h;
|
|
595
|
+
}
|
|
596
|
+
function i(n, r, h) {
|
|
597
|
+
return n & r ^ n & h ^ r & h;
|
|
598
|
+
}
|
|
599
|
+
class o extends t.Hash {
|
|
600
|
+
constructor(r, h, d, x) {
|
|
601
|
+
super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = r, this.outputLen = h, this.padOffset = d, this.isLE = x, this.buffer = new Uint8Array(r), this.view = (0, t.createView)(this.buffer);
|
|
602
|
+
}
|
|
603
|
+
update(r) {
|
|
604
|
+
(0, t.aexists)(this), r = (0, t.toBytes)(r), (0, t.abytes)(r);
|
|
605
|
+
const { view: h, buffer: d, blockLen: x } = this, p = r.length;
|
|
606
|
+
for (let b = 0; b < p; ) {
|
|
607
|
+
const U = Math.min(x - this.pos, p - b);
|
|
608
|
+
if (U === x) {
|
|
609
|
+
const w = (0, t.createView)(r);
|
|
610
|
+
for (; x <= p - b; b += x)
|
|
611
|
+
this.process(w, b);
|
|
612
|
+
continue;
|
|
613
|
+
}
|
|
614
|
+
d.set(r.subarray(b, b + U), this.pos), this.pos += U, b += U, this.pos === x && (this.process(h, 0), this.pos = 0);
|
|
615
|
+
}
|
|
616
|
+
return this.length += r.length, this.roundClean(), this;
|
|
617
|
+
}
|
|
618
|
+
digestInto(r) {
|
|
619
|
+
(0, t.aexists)(this), (0, t.aoutput)(r, this), this.finished = !0;
|
|
620
|
+
const { buffer: h, view: d, blockLen: x, isLE: p } = this;
|
|
621
|
+
let { pos: b } = this;
|
|
622
|
+
h[b++] = 128, (0, t.clean)(this.buffer.subarray(b)), this.padOffset > x - b && (this.process(d, 0), b = 0);
|
|
623
|
+
for (let M = b; M < x; M++)
|
|
624
|
+
h[M] = 0;
|
|
625
|
+
e(d, x - 8, BigInt(this.length * 8), p), this.process(d, 0);
|
|
626
|
+
const U = (0, t.createView)(r), w = this.outputLen;
|
|
627
|
+
if (w % 4)
|
|
628
|
+
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
629
|
+
const m = w / 4, k = this.get();
|
|
630
|
+
if (m > k.length)
|
|
631
|
+
throw new Error("_sha2: outputLen bigger than state");
|
|
632
|
+
for (let M = 0; M < m; M++)
|
|
633
|
+
U.setUint32(4 * M, k[M], p);
|
|
634
|
+
}
|
|
635
|
+
digest() {
|
|
636
|
+
const { buffer: r, outputLen: h } = this;
|
|
637
|
+
this.digestInto(r);
|
|
638
|
+
const d = r.slice(0, h);
|
|
639
|
+
return this.destroy(), d;
|
|
640
|
+
}
|
|
641
|
+
_cloneInto(r) {
|
|
642
|
+
r || (r = new this.constructor()), r.set(...this.get());
|
|
643
|
+
const { blockLen: h, buffer: d, length: x, finished: p, destroyed: b, pos: U } = this;
|
|
644
|
+
return r.destroyed = b, r.finished = p, r.length = x, r.pos = U, x % h && r.buffer.set(d), r;
|
|
645
|
+
}
|
|
646
|
+
clone() {
|
|
647
|
+
return this._cloneInto();
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
return W.HashMD = o, W.SHA256_IV = Uint32Array.from([
|
|
651
|
+
1779033703,
|
|
652
|
+
3144134277,
|
|
653
|
+
1013904242,
|
|
654
|
+
2773480762,
|
|
655
|
+
1359893119,
|
|
656
|
+
2600822924,
|
|
657
|
+
528734635,
|
|
658
|
+
1541459225
|
|
659
|
+
]), W.SHA224_IV = Uint32Array.from([
|
|
660
|
+
3238371032,
|
|
661
|
+
914150663,
|
|
662
|
+
812702999,
|
|
663
|
+
4144912697,
|
|
664
|
+
4290775857,
|
|
665
|
+
1750603025,
|
|
666
|
+
1694076839,
|
|
667
|
+
3204075428
|
|
668
|
+
]), W.SHA384_IV = Uint32Array.from([
|
|
669
|
+
3418070365,
|
|
670
|
+
3238371032,
|
|
671
|
+
1654270250,
|
|
672
|
+
914150663,
|
|
673
|
+
2438529370,
|
|
674
|
+
812702999,
|
|
675
|
+
355462360,
|
|
676
|
+
4144912697,
|
|
677
|
+
1731405415,
|
|
678
|
+
4290775857,
|
|
679
|
+
2394180231,
|
|
680
|
+
1750603025,
|
|
681
|
+
3675008525,
|
|
682
|
+
1694076839,
|
|
683
|
+
1203062813,
|
|
684
|
+
3204075428
|
|
685
|
+
]), W.SHA512_IV = Uint32Array.from([
|
|
686
|
+
1779033703,
|
|
687
|
+
4089235720,
|
|
688
|
+
3144134277,
|
|
689
|
+
2227873595,
|
|
690
|
+
1013904242,
|
|
691
|
+
4271175723,
|
|
692
|
+
2773480762,
|
|
693
|
+
1595750129,
|
|
694
|
+
1359893119,
|
|
695
|
+
2917565137,
|
|
696
|
+
2600822924,
|
|
697
|
+
725511199,
|
|
698
|
+
528734635,
|
|
699
|
+
4215389547,
|
|
700
|
+
1541459225,
|
|
701
|
+
327033209
|
|
702
|
+
]), W;
|
|
703
|
+
}
|
|
704
|
+
var E = {}, Dt;
|
|
705
|
+
function De() {
|
|
706
|
+
if (Dt) return E;
|
|
707
|
+
Dt = 1, Object.defineProperty(E, "__esModule", { value: !0 }), E.toBig = E.shrSL = E.shrSH = E.rotrSL = E.rotrSH = E.rotrBL = E.rotrBH = E.rotr32L = E.rotr32H = E.rotlSL = E.rotlSH = E.rotlBL = E.rotlBH = E.add5L = E.add5H = E.add4L = E.add4H = E.add3L = E.add3H = void 0, E.add = P, E.fromBig = s, E.split = i;
|
|
708
|
+
const t = /* @__PURE__ */ BigInt(2 ** 32 - 1), e = /* @__PURE__ */ BigInt(32);
|
|
709
|
+
function s(a, u = !1) {
|
|
710
|
+
return u ? { h: Number(a & t), l: Number(a >> e & t) } : { h: Number(a >> e & t) | 0, l: Number(a & t) | 0 };
|
|
711
|
+
}
|
|
712
|
+
function i(a, u = !1) {
|
|
713
|
+
const f = a.length;
|
|
714
|
+
let H = new Uint32Array(f), l = new Uint32Array(f);
|
|
715
|
+
for (let _ = 0; _ < f; _++) {
|
|
716
|
+
const { h: I, l: L } = s(a[_], u);
|
|
717
|
+
[H[_], l[_]] = [I, L];
|
|
718
|
+
}
|
|
719
|
+
return [H, l];
|
|
720
|
+
}
|
|
721
|
+
const o = (a, u) => BigInt(a >>> 0) << e | BigInt(u >>> 0);
|
|
722
|
+
E.toBig = o;
|
|
723
|
+
const n = (a, u, f) => a >>> f;
|
|
724
|
+
E.shrSH = n;
|
|
725
|
+
const r = (a, u, f) => a << 32 - f | u >>> f;
|
|
726
|
+
E.shrSL = r;
|
|
727
|
+
const h = (a, u, f) => a >>> f | u << 32 - f;
|
|
728
|
+
E.rotrSH = h;
|
|
729
|
+
const d = (a, u, f) => a << 32 - f | u >>> f;
|
|
730
|
+
E.rotrSL = d;
|
|
731
|
+
const x = (a, u, f) => a << 64 - f | u >>> f - 32;
|
|
732
|
+
E.rotrBH = x;
|
|
733
|
+
const p = (a, u, f) => a >>> f - 32 | u << 64 - f;
|
|
734
|
+
E.rotrBL = p;
|
|
735
|
+
const b = (a, u) => u;
|
|
736
|
+
E.rotr32H = b;
|
|
737
|
+
const U = (a, u) => a;
|
|
738
|
+
E.rotr32L = U;
|
|
739
|
+
const w = (a, u, f) => a << f | u >>> 32 - f;
|
|
740
|
+
E.rotlSH = w;
|
|
741
|
+
const m = (a, u, f) => u << f | a >>> 32 - f;
|
|
742
|
+
E.rotlSL = m;
|
|
743
|
+
const k = (a, u, f) => u << f - 32 | a >>> 64 - f;
|
|
744
|
+
E.rotlBH = k;
|
|
745
|
+
const M = (a, u, f) => a << f - 32 | u >>> 64 - f;
|
|
746
|
+
E.rotlBL = M;
|
|
747
|
+
function P(a, u, f, H) {
|
|
748
|
+
const l = (u >>> 0) + (H >>> 0);
|
|
749
|
+
return { h: a + f + (l / 2 ** 32 | 0) | 0, l: l | 0 };
|
|
750
|
+
}
|
|
751
|
+
const R = (a, u, f) => (a >>> 0) + (u >>> 0) + (f >>> 0);
|
|
752
|
+
E.add3L = R;
|
|
753
|
+
const V = (a, u, f, H) => u + f + H + (a / 2 ** 32 | 0) | 0;
|
|
754
|
+
E.add3H = V;
|
|
755
|
+
const T = (a, u, f, H) => (a >>> 0) + (u >>> 0) + (f >>> 0) + (H >>> 0);
|
|
756
|
+
E.add4L = T;
|
|
757
|
+
const g = (a, u, f, H, l) => u + f + H + l + (a / 2 ** 32 | 0) | 0;
|
|
758
|
+
E.add4H = g;
|
|
759
|
+
const S = (a, u, f, H, l) => (a >>> 0) + (u >>> 0) + (f >>> 0) + (H >>> 0) + (l >>> 0);
|
|
760
|
+
E.add5L = S;
|
|
761
|
+
const C = (a, u, f, H, l, _) => u + f + H + l + _ + (a / 2 ** 32 | 0) | 0;
|
|
762
|
+
E.add5H = C;
|
|
763
|
+
const B = {
|
|
764
|
+
fromBig: s,
|
|
765
|
+
split: i,
|
|
766
|
+
toBig: o,
|
|
767
|
+
shrSH: n,
|
|
768
|
+
shrSL: r,
|
|
769
|
+
rotrSH: h,
|
|
770
|
+
rotrSL: d,
|
|
771
|
+
rotrBH: x,
|
|
772
|
+
rotrBL: p,
|
|
773
|
+
rotr32H: b,
|
|
774
|
+
rotr32L: U,
|
|
775
|
+
rotlSH: w,
|
|
776
|
+
rotlSL: m,
|
|
777
|
+
rotlBH: k,
|
|
778
|
+
rotlBL: M,
|
|
779
|
+
add: P,
|
|
780
|
+
add3L: R,
|
|
781
|
+
add3H: V,
|
|
782
|
+
add4L: T,
|
|
783
|
+
add4H: g,
|
|
784
|
+
add5H: C,
|
|
785
|
+
add5L: S
|
|
786
|
+
};
|
|
787
|
+
return E.default = B, E;
|
|
788
|
+
}
|
|
789
|
+
var Ot;
|
|
790
|
+
function ne() {
|
|
791
|
+
if (Ot) return j;
|
|
792
|
+
Ot = 1, Object.defineProperty(j, "__esModule", { value: !0 }), j.sha512_224 = j.sha512_256 = j.sha384 = j.sha512 = j.sha224 = j.sha256 = j.SHA512_256 = j.SHA512_224 = j.SHA384 = j.SHA512 = j.SHA224 = j.SHA256 = void 0;
|
|
793
|
+
const t = /* @__PURE__ */ se(), e = /* @__PURE__ */ De(), s = /* @__PURE__ */ lt(), i = /* @__PURE__ */ Uint32Array.from([
|
|
794
|
+
1116352408,
|
|
795
|
+
1899447441,
|
|
796
|
+
3049323471,
|
|
797
|
+
3921009573,
|
|
798
|
+
961987163,
|
|
799
|
+
1508970993,
|
|
800
|
+
2453635748,
|
|
801
|
+
2870763221,
|
|
802
|
+
3624381080,
|
|
803
|
+
310598401,
|
|
804
|
+
607225278,
|
|
805
|
+
1426881987,
|
|
806
|
+
1925078388,
|
|
807
|
+
2162078206,
|
|
808
|
+
2614888103,
|
|
809
|
+
3248222580,
|
|
810
|
+
3835390401,
|
|
811
|
+
4022224774,
|
|
812
|
+
264347078,
|
|
813
|
+
604807628,
|
|
814
|
+
770255983,
|
|
815
|
+
1249150122,
|
|
816
|
+
1555081692,
|
|
817
|
+
1996064986,
|
|
818
|
+
2554220882,
|
|
819
|
+
2821834349,
|
|
820
|
+
2952996808,
|
|
821
|
+
3210313671,
|
|
822
|
+
3336571891,
|
|
823
|
+
3584528711,
|
|
824
|
+
113926993,
|
|
825
|
+
338241895,
|
|
826
|
+
666307205,
|
|
827
|
+
773529912,
|
|
828
|
+
1294757372,
|
|
829
|
+
1396182291,
|
|
830
|
+
1695183700,
|
|
831
|
+
1986661051,
|
|
832
|
+
2177026350,
|
|
833
|
+
2456956037,
|
|
834
|
+
2730485921,
|
|
835
|
+
2820302411,
|
|
836
|
+
3259730800,
|
|
837
|
+
3345764771,
|
|
838
|
+
3516065817,
|
|
839
|
+
3600352804,
|
|
840
|
+
4094571909,
|
|
841
|
+
275423344,
|
|
842
|
+
430227734,
|
|
843
|
+
506948616,
|
|
844
|
+
659060556,
|
|
845
|
+
883997877,
|
|
846
|
+
958139571,
|
|
847
|
+
1322822218,
|
|
848
|
+
1537002063,
|
|
849
|
+
1747873779,
|
|
850
|
+
1955562222,
|
|
851
|
+
2024104815,
|
|
852
|
+
2227730452,
|
|
853
|
+
2361852424,
|
|
854
|
+
2428436474,
|
|
855
|
+
2756734187,
|
|
856
|
+
3204031479,
|
|
857
|
+
3329325298
|
|
858
|
+
]), o = /* @__PURE__ */ new Uint32Array(64);
|
|
859
|
+
class n extends t.HashMD {
|
|
860
|
+
constructor(V = 32) {
|
|
861
|
+
super(64, V, 8, !1), this.A = t.SHA256_IV[0] | 0, this.B = t.SHA256_IV[1] | 0, this.C = t.SHA256_IV[2] | 0, this.D = t.SHA256_IV[3] | 0, this.E = t.SHA256_IV[4] | 0, this.F = t.SHA256_IV[5] | 0, this.G = t.SHA256_IV[6] | 0, this.H = t.SHA256_IV[7] | 0;
|
|
862
|
+
}
|
|
863
|
+
get() {
|
|
864
|
+
const { A: V, B: T, C: g, D: S, E: C, F: B, G: a, H: u } = this;
|
|
865
|
+
return [V, T, g, S, C, B, a, u];
|
|
866
|
+
}
|
|
867
|
+
// prettier-ignore
|
|
868
|
+
set(V, T, g, S, C, B, a, u) {
|
|
869
|
+
this.A = V | 0, this.B = T | 0, this.C = g | 0, this.D = S | 0, this.E = C | 0, this.F = B | 0, this.G = a | 0, this.H = u | 0;
|
|
870
|
+
}
|
|
871
|
+
process(V, T) {
|
|
872
|
+
for (let l = 0; l < 16; l++, T += 4)
|
|
873
|
+
o[l] = V.getUint32(T, !1);
|
|
874
|
+
for (let l = 16; l < 64; l++) {
|
|
875
|
+
const _ = o[l - 15], I = o[l - 2], L = (0, s.rotr)(_, 7) ^ (0, s.rotr)(_, 18) ^ _ >>> 3, D = (0, s.rotr)(I, 17) ^ (0, s.rotr)(I, 19) ^ I >>> 10;
|
|
876
|
+
o[l] = D + o[l - 7] + L + o[l - 16] | 0;
|
|
877
|
+
}
|
|
878
|
+
let { A: g, B: S, C, D: B, E: a, F: u, G: f, H } = this;
|
|
879
|
+
for (let l = 0; l < 64; l++) {
|
|
880
|
+
const _ = (0, s.rotr)(a, 6) ^ (0, s.rotr)(a, 11) ^ (0, s.rotr)(a, 25), I = H + _ + (0, t.Chi)(a, u, f) + i[l] + o[l] | 0, D = ((0, s.rotr)(g, 2) ^ (0, s.rotr)(g, 13) ^ (0, s.rotr)(g, 22)) + (0, t.Maj)(g, S, C) | 0;
|
|
881
|
+
H = f, f = u, u = a, a = B + I | 0, B = C, C = S, S = g, g = I + D | 0;
|
|
882
|
+
}
|
|
883
|
+
g = g + this.A | 0, S = S + this.B | 0, C = C + this.C | 0, B = B + this.D | 0, a = a + this.E | 0, u = u + this.F | 0, f = f + this.G | 0, H = H + this.H | 0, this.set(g, S, C, B, a, u, f, H);
|
|
884
|
+
}
|
|
885
|
+
roundClean() {
|
|
886
|
+
(0, s.clean)(o);
|
|
887
|
+
}
|
|
888
|
+
destroy() {
|
|
889
|
+
this.set(0, 0, 0, 0, 0, 0, 0, 0), (0, s.clean)(this.buffer);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
j.SHA256 = n;
|
|
893
|
+
class r extends n {
|
|
894
|
+
constructor() {
|
|
895
|
+
super(28), this.A = t.SHA224_IV[0] | 0, this.B = t.SHA224_IV[1] | 0, this.C = t.SHA224_IV[2] | 0, this.D = t.SHA224_IV[3] | 0, this.E = t.SHA224_IV[4] | 0, this.F = t.SHA224_IV[5] | 0, this.G = t.SHA224_IV[6] | 0, this.H = t.SHA224_IV[7] | 0;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
j.SHA224 = r;
|
|
899
|
+
const h = e.split([
|
|
900
|
+
"0x428a2f98d728ae22",
|
|
901
|
+
"0x7137449123ef65cd",
|
|
902
|
+
"0xb5c0fbcfec4d3b2f",
|
|
903
|
+
"0xe9b5dba58189dbbc",
|
|
904
|
+
"0x3956c25bf348b538",
|
|
905
|
+
"0x59f111f1b605d019",
|
|
906
|
+
"0x923f82a4af194f9b",
|
|
907
|
+
"0xab1c5ed5da6d8118",
|
|
908
|
+
"0xd807aa98a3030242",
|
|
909
|
+
"0x12835b0145706fbe",
|
|
910
|
+
"0x243185be4ee4b28c",
|
|
911
|
+
"0x550c7dc3d5ffb4e2",
|
|
912
|
+
"0x72be5d74f27b896f",
|
|
913
|
+
"0x80deb1fe3b1696b1",
|
|
914
|
+
"0x9bdc06a725c71235",
|
|
915
|
+
"0xc19bf174cf692694",
|
|
916
|
+
"0xe49b69c19ef14ad2",
|
|
917
|
+
"0xefbe4786384f25e3",
|
|
918
|
+
"0x0fc19dc68b8cd5b5",
|
|
919
|
+
"0x240ca1cc77ac9c65",
|
|
920
|
+
"0x2de92c6f592b0275",
|
|
921
|
+
"0x4a7484aa6ea6e483",
|
|
922
|
+
"0x5cb0a9dcbd41fbd4",
|
|
923
|
+
"0x76f988da831153b5",
|
|
924
|
+
"0x983e5152ee66dfab",
|
|
925
|
+
"0xa831c66d2db43210",
|
|
926
|
+
"0xb00327c898fb213f",
|
|
927
|
+
"0xbf597fc7beef0ee4",
|
|
928
|
+
"0xc6e00bf33da88fc2",
|
|
929
|
+
"0xd5a79147930aa725",
|
|
930
|
+
"0x06ca6351e003826f",
|
|
931
|
+
"0x142929670a0e6e70",
|
|
932
|
+
"0x27b70a8546d22ffc",
|
|
933
|
+
"0x2e1b21385c26c926",
|
|
934
|
+
"0x4d2c6dfc5ac42aed",
|
|
935
|
+
"0x53380d139d95b3df",
|
|
936
|
+
"0x650a73548baf63de",
|
|
937
|
+
"0x766a0abb3c77b2a8",
|
|
938
|
+
"0x81c2c92e47edaee6",
|
|
939
|
+
"0x92722c851482353b",
|
|
940
|
+
"0xa2bfe8a14cf10364",
|
|
941
|
+
"0xa81a664bbc423001",
|
|
942
|
+
"0xc24b8b70d0f89791",
|
|
943
|
+
"0xc76c51a30654be30",
|
|
944
|
+
"0xd192e819d6ef5218",
|
|
945
|
+
"0xd69906245565a910",
|
|
946
|
+
"0xf40e35855771202a",
|
|
947
|
+
"0x106aa07032bbd1b8",
|
|
948
|
+
"0x19a4c116b8d2d0c8",
|
|
949
|
+
"0x1e376c085141ab53",
|
|
950
|
+
"0x2748774cdf8eeb99",
|
|
951
|
+
"0x34b0bcb5e19b48a8",
|
|
952
|
+
"0x391c0cb3c5c95a63",
|
|
953
|
+
"0x4ed8aa4ae3418acb",
|
|
954
|
+
"0x5b9cca4f7763e373",
|
|
955
|
+
"0x682e6ff3d6b2b8a3",
|
|
956
|
+
"0x748f82ee5defb2fc",
|
|
957
|
+
"0x78a5636f43172f60",
|
|
958
|
+
"0x84c87814a1f0ab72",
|
|
959
|
+
"0x8cc702081a6439ec",
|
|
960
|
+
"0x90befffa23631e28",
|
|
961
|
+
"0xa4506cebde82bde9",
|
|
962
|
+
"0xbef9a3f7b2c67915",
|
|
963
|
+
"0xc67178f2e372532b",
|
|
964
|
+
"0xca273eceea26619c",
|
|
965
|
+
"0xd186b8c721c0c207",
|
|
966
|
+
"0xeada7dd6cde0eb1e",
|
|
967
|
+
"0xf57d4f7fee6ed178",
|
|
968
|
+
"0x06f067aa72176fba",
|
|
969
|
+
"0x0a637dc5a2c898a6",
|
|
970
|
+
"0x113f9804bef90dae",
|
|
971
|
+
"0x1b710b35131c471b",
|
|
972
|
+
"0x28db77f523047d84",
|
|
973
|
+
"0x32caab7b40c72493",
|
|
974
|
+
"0x3c9ebe0a15c9bebc",
|
|
975
|
+
"0x431d67c49c100d4c",
|
|
976
|
+
"0x4cc5d4becb3e42b6",
|
|
977
|
+
"0x597f299cfc657e2a",
|
|
978
|
+
"0x5fcb6fab3ad6faec",
|
|
979
|
+
"0x6c44198c4a475817"
|
|
980
|
+
].map((R) => BigInt(R))), d = h[0], x = h[1], p = /* @__PURE__ */ new Uint32Array(80), b = /* @__PURE__ */ new Uint32Array(80);
|
|
981
|
+
class U extends t.HashMD {
|
|
982
|
+
constructor(V = 64) {
|
|
983
|
+
super(128, V, 16, !1), this.Ah = t.SHA512_IV[0] | 0, this.Al = t.SHA512_IV[1] | 0, this.Bh = t.SHA512_IV[2] | 0, this.Bl = t.SHA512_IV[3] | 0, this.Ch = t.SHA512_IV[4] | 0, this.Cl = t.SHA512_IV[5] | 0, this.Dh = t.SHA512_IV[6] | 0, this.Dl = t.SHA512_IV[7] | 0, this.Eh = t.SHA512_IV[8] | 0, this.El = t.SHA512_IV[9] | 0, this.Fh = t.SHA512_IV[10] | 0, this.Fl = t.SHA512_IV[11] | 0, this.Gh = t.SHA512_IV[12] | 0, this.Gl = t.SHA512_IV[13] | 0, this.Hh = t.SHA512_IV[14] | 0, this.Hl = t.SHA512_IV[15] | 0;
|
|
984
|
+
}
|
|
985
|
+
// prettier-ignore
|
|
986
|
+
get() {
|
|
987
|
+
const { Ah: V, Al: T, Bh: g, Bl: S, Ch: C, Cl: B, Dh: a, Dl: u, Eh: f, El: H, Fh: l, Fl: _, Gh: I, Gl: L, Hh: D, Hl: v } = this;
|
|
988
|
+
return [V, T, g, S, C, B, a, u, f, H, l, _, I, L, D, v];
|
|
989
|
+
}
|
|
990
|
+
// prettier-ignore
|
|
991
|
+
set(V, T, g, S, C, B, a, u, f, H, l, _, I, L, D, v) {
|
|
992
|
+
this.Ah = V | 0, this.Al = T | 0, this.Bh = g | 0, this.Bl = S | 0, this.Ch = C | 0, this.Cl = B | 0, this.Dh = a | 0, this.Dl = u | 0, this.Eh = f | 0, this.El = H | 0, this.Fh = l | 0, this.Fl = _ | 0, this.Gh = I | 0, this.Gl = L | 0, this.Hh = D | 0, this.Hl = v | 0;
|
|
993
|
+
}
|
|
994
|
+
process(V, T) {
|
|
995
|
+
for (let y = 0; y < 16; y++, T += 4)
|
|
996
|
+
p[y] = V.getUint32(T), b[y] = V.getUint32(T += 4);
|
|
997
|
+
for (let y = 16; y < 80; y++) {
|
|
998
|
+
const O = p[y - 15] | 0, F = b[y - 15] | 0, G = e.rotrSH(O, F, 1) ^ e.rotrSH(O, F, 8) ^ e.shrSH(O, F, 7), z = e.rotrSL(O, F, 1) ^ e.rotrSL(O, F, 8) ^ e.shrSL(O, F, 7), N = p[y - 2] | 0, X = b[y - 2] | 0, ot = e.rotrSH(N, X, 19) ^ e.rotrBH(N, X, 61) ^ e.shrSH(N, X, 6), J = e.rotrSL(N, X, 19) ^ e.rotrBL(N, X, 61) ^ e.shrSL(N, X, 6), $ = e.add4L(z, J, b[y - 7], b[y - 16]), At = e.add4H($, G, ot, p[y - 7], p[y - 16]);
|
|
999
|
+
p[y] = At | 0, b[y] = $ | 0;
|
|
1000
|
+
}
|
|
1001
|
+
let { Ah: g, Al: S, Bh: C, Bl: B, Ch: a, Cl: u, Dh: f, Dl: H, Eh: l, El: _, Fh: I, Fl: L, Gh: D, Gl: v, Hh: c, Hl: A } = this;
|
|
1002
|
+
for (let y = 0; y < 80; y++) {
|
|
1003
|
+
const O = e.rotrSH(l, _, 14) ^ e.rotrSH(l, _, 18) ^ e.rotrBH(l, _, 41), F = e.rotrSL(l, _, 14) ^ e.rotrSL(l, _, 18) ^ e.rotrBL(l, _, 41), G = l & I ^ ~l & D, z = _ & L ^ ~_ & v, N = e.add5L(A, F, z, x[y], b[y]), X = e.add5H(N, c, O, G, d[y], p[y]), ot = N | 0, J = e.rotrSH(g, S, 28) ^ e.rotrBH(g, S, 34) ^ e.rotrBH(g, S, 39), $ = e.rotrSL(g, S, 28) ^ e.rotrBL(g, S, 34) ^ e.rotrBL(g, S, 39), At = g & C ^ g & a ^ C & a, de = S & B ^ S & u ^ B & u;
|
|
1004
|
+
c = D | 0, A = v | 0, D = I | 0, v = L | 0, I = l | 0, L = _ | 0, { h: l, l: _ } = e.add(f | 0, H | 0, X | 0, ot | 0), f = a | 0, H = u | 0, a = C | 0, u = B | 0, C = g | 0, B = S | 0;
|
|
1005
|
+
const mt = e.add3L(ot, $, de);
|
|
1006
|
+
g = e.add3H(mt, X, J, At), S = mt | 0;
|
|
1007
|
+
}
|
|
1008
|
+
({ h: g, l: S } = e.add(this.Ah | 0, this.Al | 0, g | 0, S | 0)), { h: C, l: B } = e.add(this.Bh | 0, this.Bl | 0, C | 0, B | 0), { h: a, l: u } = e.add(this.Ch | 0, this.Cl | 0, a | 0, u | 0), { h: f, l: H } = e.add(this.Dh | 0, this.Dl | 0, f | 0, H | 0), { h: l, l: _ } = e.add(this.Eh | 0, this.El | 0, l | 0, _ | 0), { h: I, l: L } = e.add(this.Fh | 0, this.Fl | 0, I | 0, L | 0), { h: D, l: v } = e.add(this.Gh | 0, this.Gl | 0, D | 0, v | 0), { h: c, l: A } = e.add(this.Hh | 0, this.Hl | 0, c | 0, A | 0), this.set(g, S, C, B, a, u, f, H, l, _, I, L, D, v, c, A);
|
|
1009
|
+
}
|
|
1010
|
+
roundClean() {
|
|
1011
|
+
(0, s.clean)(p, b);
|
|
1012
|
+
}
|
|
1013
|
+
destroy() {
|
|
1014
|
+
(0, s.clean)(this.buffer), this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
j.SHA512 = U;
|
|
1018
|
+
class w extends U {
|
|
1019
|
+
constructor() {
|
|
1020
|
+
super(48), this.Ah = t.SHA384_IV[0] | 0, this.Al = t.SHA384_IV[1] | 0, this.Bh = t.SHA384_IV[2] | 0, this.Bl = t.SHA384_IV[3] | 0, this.Ch = t.SHA384_IV[4] | 0, this.Cl = t.SHA384_IV[5] | 0, this.Dh = t.SHA384_IV[6] | 0, this.Dl = t.SHA384_IV[7] | 0, this.Eh = t.SHA384_IV[8] | 0, this.El = t.SHA384_IV[9] | 0, this.Fh = t.SHA384_IV[10] | 0, this.Fl = t.SHA384_IV[11] | 0, this.Gh = t.SHA384_IV[12] | 0, this.Gl = t.SHA384_IV[13] | 0, this.Hh = t.SHA384_IV[14] | 0, this.Hl = t.SHA384_IV[15] | 0;
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
j.SHA384 = w;
|
|
1024
|
+
const m = /* @__PURE__ */ Uint32Array.from([
|
|
1025
|
+
2352822216,
|
|
1026
|
+
424955298,
|
|
1027
|
+
1944164710,
|
|
1028
|
+
2312950998,
|
|
1029
|
+
502970286,
|
|
1030
|
+
855612546,
|
|
1031
|
+
1738396948,
|
|
1032
|
+
1479516111,
|
|
1033
|
+
258812777,
|
|
1034
|
+
2077511080,
|
|
1035
|
+
2011393907,
|
|
1036
|
+
79989058,
|
|
1037
|
+
1067287976,
|
|
1038
|
+
1780299464,
|
|
1039
|
+
286451373,
|
|
1040
|
+
2446758561
|
|
1041
|
+
]), k = /* @__PURE__ */ Uint32Array.from([
|
|
1042
|
+
573645204,
|
|
1043
|
+
4230739756,
|
|
1044
|
+
2673172387,
|
|
1045
|
+
3360449730,
|
|
1046
|
+
596883563,
|
|
1047
|
+
1867755857,
|
|
1048
|
+
2520282905,
|
|
1049
|
+
1497426621,
|
|
1050
|
+
2519219938,
|
|
1051
|
+
2827943907,
|
|
1052
|
+
3193839141,
|
|
1053
|
+
1401305490,
|
|
1054
|
+
721525244,
|
|
1055
|
+
746961066,
|
|
1056
|
+
246885852,
|
|
1057
|
+
2177182882
|
|
1058
|
+
]);
|
|
1059
|
+
class M extends U {
|
|
1060
|
+
constructor() {
|
|
1061
|
+
super(28), this.Ah = m[0] | 0, this.Al = m[1] | 0, this.Bh = m[2] | 0, this.Bl = m[3] | 0, this.Ch = m[4] | 0, this.Cl = m[5] | 0, this.Dh = m[6] | 0, this.Dl = m[7] | 0, this.Eh = m[8] | 0, this.El = m[9] | 0, this.Fh = m[10] | 0, this.Fl = m[11] | 0, this.Gh = m[12] | 0, this.Gl = m[13] | 0, this.Hh = m[14] | 0, this.Hl = m[15] | 0;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
j.SHA512_224 = M;
|
|
1065
|
+
class P extends U {
|
|
1066
|
+
constructor() {
|
|
1067
|
+
super(32), this.Ah = k[0] | 0, this.Al = k[1] | 0, this.Bh = k[2] | 0, this.Bl = k[3] | 0, this.Ch = k[4] | 0, this.Cl = k[5] | 0, this.Dh = k[6] | 0, this.Dl = k[7] | 0, this.Eh = k[8] | 0, this.El = k[9] | 0, this.Fh = k[10] | 0, this.Fl = k[11] | 0, this.Gh = k[12] | 0, this.Gl = k[13] | 0, this.Hh = k[14] | 0, this.Hl = k[15] | 0;
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
return j.SHA512_256 = P, j.sha256 = (0, s.createHasher)(() => new n()), j.sha224 = (0, s.createHasher)(() => new r()), j.sha512 = (0, s.createHasher)(() => new U()), j.sha384 = (0, s.createHasher)(() => new w()), j.sha512_256 = (0, s.createHasher)(() => new P()), j.sha512_224 = (0, s.createHasher)(() => new M()), j;
|
|
1071
|
+
}
|
|
1072
|
+
var _t = {}, Mt;
|
|
1073
|
+
function Oe() {
|
|
1074
|
+
return Mt || (Mt = 1, (function(t) {
|
|
1075
|
+
Object.defineProperty(t, "__esModule", { value: !0 }), t.hmac = t.HMAC = void 0;
|
|
1076
|
+
const e = /* @__PURE__ */ lt();
|
|
1077
|
+
class s extends e.Hash {
|
|
1078
|
+
constructor(n, r) {
|
|
1079
|
+
super(), this.finished = !1, this.destroyed = !1, (0, e.ahash)(n);
|
|
1080
|
+
const h = (0, e.toBytes)(r);
|
|
1081
|
+
if (this.iHash = n.create(), typeof this.iHash.update != "function")
|
|
1082
|
+
throw new Error("Expected instance of class which extends utils.Hash");
|
|
1083
|
+
this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
|
|
1084
|
+
const d = this.blockLen, x = new Uint8Array(d);
|
|
1085
|
+
x.set(h.length > d ? n.create().update(h).digest() : h);
|
|
1086
|
+
for (let p = 0; p < x.length; p++)
|
|
1087
|
+
x[p] ^= 54;
|
|
1088
|
+
this.iHash.update(x), this.oHash = n.create();
|
|
1089
|
+
for (let p = 0; p < x.length; p++)
|
|
1090
|
+
x[p] ^= 106;
|
|
1091
|
+
this.oHash.update(x), (0, e.clean)(x);
|
|
1092
|
+
}
|
|
1093
|
+
update(n) {
|
|
1094
|
+
return (0, e.aexists)(this), this.iHash.update(n), this;
|
|
1095
|
+
}
|
|
1096
|
+
digestInto(n) {
|
|
1097
|
+
(0, e.aexists)(this), (0, e.abytes)(n, this.outputLen), this.finished = !0, this.iHash.digestInto(n), this.oHash.update(n), this.oHash.digestInto(n), this.destroy();
|
|
1098
|
+
}
|
|
1099
|
+
digest() {
|
|
1100
|
+
const n = new Uint8Array(this.oHash.outputLen);
|
|
1101
|
+
return this.digestInto(n), n;
|
|
1102
|
+
}
|
|
1103
|
+
_cloneInto(n) {
|
|
1104
|
+
n || (n = Object.create(Object.getPrototypeOf(this), {}));
|
|
1105
|
+
const { oHash: r, iHash: h, finished: d, destroyed: x, blockLen: p, outputLen: b } = this;
|
|
1106
|
+
return n = n, n.finished = d, n.destroyed = x, n.blockLen = p, n.outputLen = b, n.oHash = r._cloneInto(n.oHash), n.iHash = h._cloneInto(n.iHash), n;
|
|
1107
|
+
}
|
|
1108
|
+
clone() {
|
|
1109
|
+
return this._cloneInto();
|
|
1110
|
+
}
|
|
1111
|
+
destroy() {
|
|
1112
|
+
this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
t.HMAC = s;
|
|
1116
|
+
const i = (o, n, r) => new s(o, n).update(r).digest();
|
|
1117
|
+
t.hmac = i, t.hmac.create = (o, n) => new s(o, n);
|
|
1118
|
+
})(_t)), _t;
|
|
1119
|
+
}
|
|
1120
|
+
var rt = {}, K = {}, Tt;
|
|
1121
|
+
function Me() {
|
|
1122
|
+
if (Tt) return K;
|
|
1123
|
+
Tt = 1, Object.defineProperty(K, "__esModule", { value: !0 }), K.ripemd160 = K.RIPEMD160 = K.md5 = K.MD5 = K.sha1 = K.SHA1 = void 0;
|
|
1124
|
+
const t = /* @__PURE__ */ se(), e = /* @__PURE__ */ lt(), s = /* @__PURE__ */ Uint32Array.from([
|
|
1125
|
+
1732584193,
|
|
1126
|
+
4023233417,
|
|
1127
|
+
2562383102,
|
|
1128
|
+
271733878,
|
|
1129
|
+
3285377520
|
|
1130
|
+
]), i = /* @__PURE__ */ new Uint32Array(80);
|
|
1131
|
+
class o extends t.HashMD {
|
|
1132
|
+
constructor() {
|
|
1133
|
+
super(64, 20, 8, !1), this.A = s[0] | 0, this.B = s[1] | 0, this.C = s[2] | 0, this.D = s[3] | 0, this.E = s[4] | 0;
|
|
1134
|
+
}
|
|
1135
|
+
get() {
|
|
1136
|
+
const { A: a, B: u, C: f, D: H, E: l } = this;
|
|
1137
|
+
return [a, u, f, H, l];
|
|
1138
|
+
}
|
|
1139
|
+
set(a, u, f, H, l) {
|
|
1140
|
+
this.A = a | 0, this.B = u | 0, this.C = f | 0, this.D = H | 0, this.E = l | 0;
|
|
1141
|
+
}
|
|
1142
|
+
process(a, u) {
|
|
1143
|
+
for (let L = 0; L < 16; L++, u += 4)
|
|
1144
|
+
i[L] = a.getUint32(u, !1);
|
|
1145
|
+
for (let L = 16; L < 80; L++)
|
|
1146
|
+
i[L] = (0, e.rotl)(i[L - 3] ^ i[L - 8] ^ i[L - 14] ^ i[L - 16], 1);
|
|
1147
|
+
let { A: f, B: H, C: l, D: _, E: I } = this;
|
|
1148
|
+
for (let L = 0; L < 80; L++) {
|
|
1149
|
+
let D, v;
|
|
1150
|
+
L < 20 ? (D = (0, t.Chi)(H, l, _), v = 1518500249) : L < 40 ? (D = H ^ l ^ _, v = 1859775393) : L < 60 ? (D = (0, t.Maj)(H, l, _), v = 2400959708) : (D = H ^ l ^ _, v = 3395469782);
|
|
1151
|
+
const c = (0, e.rotl)(f, 5) + D + I + v + i[L] | 0;
|
|
1152
|
+
I = _, _ = l, l = (0, e.rotl)(H, 30), H = f, f = c;
|
|
1153
|
+
}
|
|
1154
|
+
f = f + this.A | 0, H = H + this.B | 0, l = l + this.C | 0, _ = _ + this.D | 0, I = I + this.E | 0, this.set(f, H, l, _, I);
|
|
1155
|
+
}
|
|
1156
|
+
roundClean() {
|
|
1157
|
+
(0, e.clean)(i);
|
|
1158
|
+
}
|
|
1159
|
+
destroy() {
|
|
1160
|
+
this.set(0, 0, 0, 0, 0), (0, e.clean)(this.buffer);
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
K.SHA1 = o, K.sha1 = (0, e.createHasher)(() => new o());
|
|
1164
|
+
const n = /* @__PURE__ */ Math.pow(2, 32), r = /* @__PURE__ */ Array.from({ length: 64 }, (B, a) => Math.floor(n * Math.abs(Math.sin(a + 1)))), h = /* @__PURE__ */ s.slice(0, 4), d = /* @__PURE__ */ new Uint32Array(16);
|
|
1165
|
+
class x extends t.HashMD {
|
|
1166
|
+
constructor() {
|
|
1167
|
+
super(64, 16, 8, !0), this.A = h[0] | 0, this.B = h[1] | 0, this.C = h[2] | 0, this.D = h[3] | 0;
|
|
1168
|
+
}
|
|
1169
|
+
get() {
|
|
1170
|
+
const { A: a, B: u, C: f, D: H } = this;
|
|
1171
|
+
return [a, u, f, H];
|
|
1172
|
+
}
|
|
1173
|
+
set(a, u, f, H) {
|
|
1174
|
+
this.A = a | 0, this.B = u | 0, this.C = f | 0, this.D = H | 0;
|
|
1175
|
+
}
|
|
1176
|
+
process(a, u) {
|
|
1177
|
+
for (let I = 0; I < 16; I++, u += 4)
|
|
1178
|
+
d[I] = a.getUint32(u, !0);
|
|
1179
|
+
let { A: f, B: H, C: l, D: _ } = this;
|
|
1180
|
+
for (let I = 0; I < 64; I++) {
|
|
1181
|
+
let L, D, v;
|
|
1182
|
+
I < 16 ? (L = (0, t.Chi)(H, l, _), D = I, v = [7, 12, 17, 22]) : I < 32 ? (L = (0, t.Chi)(_, H, l), D = (5 * I + 1) % 16, v = [5, 9, 14, 20]) : I < 48 ? (L = H ^ l ^ _, D = (3 * I + 5) % 16, v = [4, 11, 16, 23]) : (L = l ^ (H | ~_), D = 7 * I % 16, v = [6, 10, 15, 21]), L = L + f + r[I] + d[D], f = _, _ = l, l = H, H = H + (0, e.rotl)(L, v[I % 4]);
|
|
1183
|
+
}
|
|
1184
|
+
f = f + this.A | 0, H = H + this.B | 0, l = l + this.C | 0, _ = _ + this.D | 0, this.set(f, H, l, _);
|
|
1185
|
+
}
|
|
1186
|
+
roundClean() {
|
|
1187
|
+
(0, e.clean)(d);
|
|
1188
|
+
}
|
|
1189
|
+
destroy() {
|
|
1190
|
+
this.set(0, 0, 0, 0), (0, e.clean)(this.buffer);
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
K.MD5 = x, K.md5 = (0, e.createHasher)(() => new x());
|
|
1194
|
+
const p = /* @__PURE__ */ Uint8Array.from([
|
|
1195
|
+
7,
|
|
1196
|
+
4,
|
|
1197
|
+
13,
|
|
1198
|
+
1,
|
|
1199
|
+
10,
|
|
1200
|
+
6,
|
|
1201
|
+
15,
|
|
1202
|
+
3,
|
|
1203
|
+
12,
|
|
1204
|
+
0,
|
|
1205
|
+
9,
|
|
1206
|
+
5,
|
|
1207
|
+
2,
|
|
1208
|
+
14,
|
|
1209
|
+
11,
|
|
1210
|
+
8
|
|
1211
|
+
]), b = Uint8Array.from(new Array(16).fill(0).map((B, a) => a)), U = b.map((B) => (9 * B + 5) % 16), w = /* @__PURE__ */ (() => {
|
|
1212
|
+
const u = [[b], [U]];
|
|
1213
|
+
for (let f = 0; f < 4; f++)
|
|
1214
|
+
for (let H of u)
|
|
1215
|
+
H.push(H[f].map((l) => p[l]));
|
|
1216
|
+
return u;
|
|
1217
|
+
})(), m = w[0], k = w[1], M = /* @__PURE__ */ [
|
|
1218
|
+
[11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
|
|
1219
|
+
[12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
|
|
1220
|
+
[13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
|
|
1221
|
+
[14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
|
|
1222
|
+
[15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
|
|
1223
|
+
].map((B) => Uint8Array.from(B)), P = /* @__PURE__ */ m.map((B, a) => B.map((u) => M[a][u])), R = /* @__PURE__ */ k.map((B, a) => B.map((u) => M[a][u])), V = /* @__PURE__ */ Uint32Array.from([
|
|
1224
|
+
0,
|
|
1225
|
+
1518500249,
|
|
1226
|
+
1859775393,
|
|
1227
|
+
2400959708,
|
|
1228
|
+
2840853838
|
|
1229
|
+
]), T = /* @__PURE__ */ Uint32Array.from([
|
|
1230
|
+
1352829926,
|
|
1231
|
+
1548603684,
|
|
1232
|
+
1836072691,
|
|
1233
|
+
2053994217,
|
|
1234
|
+
0
|
|
1235
|
+
]);
|
|
1236
|
+
function g(B, a, u, f) {
|
|
1237
|
+
return B === 0 ? a ^ u ^ f : B === 1 ? a & u | ~a & f : B === 2 ? (a | ~u) ^ f : B === 3 ? a & f | u & ~f : a ^ (u | ~f);
|
|
1238
|
+
}
|
|
1239
|
+
const S = /* @__PURE__ */ new Uint32Array(16);
|
|
1240
|
+
class C extends t.HashMD {
|
|
1241
|
+
constructor() {
|
|
1242
|
+
super(64, 20, 8, !0), this.h0 = 1732584193, this.h1 = -271733879, this.h2 = -1732584194, this.h3 = 271733878, this.h4 = -1009589776;
|
|
1243
|
+
}
|
|
1244
|
+
get() {
|
|
1245
|
+
const { h0: a, h1: u, h2: f, h3: H, h4: l } = this;
|
|
1246
|
+
return [a, u, f, H, l];
|
|
1247
|
+
}
|
|
1248
|
+
set(a, u, f, H, l) {
|
|
1249
|
+
this.h0 = a | 0, this.h1 = u | 0, this.h2 = f | 0, this.h3 = H | 0, this.h4 = l | 0;
|
|
1250
|
+
}
|
|
1251
|
+
process(a, u) {
|
|
1252
|
+
for (let y = 0; y < 16; y++, u += 4)
|
|
1253
|
+
S[y] = a.getUint32(u, !0);
|
|
1254
|
+
let f = this.h0 | 0, H = f, l = this.h1 | 0, _ = l, I = this.h2 | 0, L = I, D = this.h3 | 0, v = D, c = this.h4 | 0, A = c;
|
|
1255
|
+
for (let y = 0; y < 5; y++) {
|
|
1256
|
+
const O = 4 - y, F = V[y], G = T[y], z = m[y], N = k[y], X = P[y], ot = R[y];
|
|
1257
|
+
for (let J = 0; J < 16; J++) {
|
|
1258
|
+
const $ = (0, e.rotl)(f + g(y, l, I, D) + S[z[J]] + F, X[J]) + c | 0;
|
|
1259
|
+
f = c, c = D, D = (0, e.rotl)(I, 10) | 0, I = l, l = $;
|
|
1260
|
+
}
|
|
1261
|
+
for (let J = 0; J < 16; J++) {
|
|
1262
|
+
const $ = (0, e.rotl)(H + g(O, _, L, v) + S[N[J]] + G, ot[J]) + A | 0;
|
|
1263
|
+
H = A, A = v, v = (0, e.rotl)(L, 10) | 0, L = _, _ = $;
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
this.set(this.h1 + I + v | 0, this.h2 + D + A | 0, this.h3 + c + H | 0, this.h4 + f + _ | 0, this.h0 + l + L | 0);
|
|
1267
|
+
}
|
|
1268
|
+
roundClean() {
|
|
1269
|
+
(0, e.clean)(S);
|
|
1270
|
+
}
|
|
1271
|
+
destroy() {
|
|
1272
|
+
this.destroyed = !0, (0, e.clean)(this.buffer), this.set(0, 0, 0, 0, 0);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
return K.RIPEMD160 = C, K.ripemd160 = (0, e.createHasher)(() => new C()), K;
|
|
1276
|
+
}
|
|
1277
|
+
var vt;
|
|
1278
|
+
function us() {
|
|
1279
|
+
if (vt) return rt;
|
|
1280
|
+
vt = 1, Object.defineProperty(rt, "__esModule", { value: !0 }), rt.ripemd160 = rt.RIPEMD160 = void 0;
|
|
1281
|
+
const t = /* @__PURE__ */ Me();
|
|
1282
|
+
return rt.RIPEMD160 = t.RIPEMD160, rt.ripemd160 = t.ripemd160, rt;
|
|
1283
|
+
}
|
|
1284
|
+
var Q = {}, Ft;
|
|
1285
|
+
function ds() {
|
|
1286
|
+
if (Ft) return Q;
|
|
1287
|
+
Ft = 1, Object.defineProperty(Q, "__esModule", { value: !0 }), Q.sha224 = Q.SHA224 = Q.sha256 = Q.SHA256 = void 0;
|
|
1288
|
+
const t = /* @__PURE__ */ ne();
|
|
1289
|
+
return Q.SHA256 = t.SHA256, Q.sha256 = t.sha256, Q.SHA224 = t.SHA224, Q.sha224 = t.sha224, Q;
|
|
1290
|
+
}
|
|
1291
|
+
var q = {}, Rt;
|
|
1292
|
+
function ls() {
|
|
1293
|
+
if (Rt) return q;
|
|
1294
|
+
Rt = 1, Object.defineProperty(q, "__esModule", { value: !0 }), q.sha512_256 = q.SHA512_256 = q.sha512_224 = q.SHA512_224 = q.sha384 = q.SHA384 = q.sha512 = q.SHA512 = void 0;
|
|
1295
|
+
const t = /* @__PURE__ */ ne();
|
|
1296
|
+
return q.SHA512 = t.SHA512, q.sha512 = t.sha512, q.SHA384 = t.SHA384, q.sha384 = t.sha384, q.SHA512_224 = t.SHA512_224, q.sha512_224 = t.sha512_224, q.SHA512_256 = t.SHA512_256, q.sha512_256 = t.sha512_256, q;
|
|
1297
|
+
}
|
|
1298
|
+
function Te(t) {
|
|
1299
|
+
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
|
1300
|
+
}
|
|
1301
|
+
function jt(t, e = "") {
|
|
1302
|
+
if (!Number.isSafeInteger(t) || t < 0) {
|
|
1303
|
+
const s = e && `"${e}" `;
|
|
1304
|
+
throw new Error(`${s}expected integer >= 0, got ${t}`);
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
function Ht(t, e, s = "") {
|
|
1308
|
+
const i = Te(t), o = t?.length, n = e !== void 0;
|
|
1309
|
+
if (!i || n && o !== e) {
|
|
1310
|
+
const r = s && `"${s}" `, h = n ? ` of length ${e}` : "", d = i ? `length=${o}` : `type=${typeof t}`;
|
|
1311
|
+
throw new Error(r + "expected Uint8Array" + h + ", got " + d);
|
|
1312
|
+
}
|
|
1313
|
+
return t;
|
|
1314
|
+
}
|
|
1315
|
+
function Pt(t, e = !0) {
|
|
1316
|
+
if (t.destroyed)
|
|
1317
|
+
throw new Error("Hash instance has been destroyed");
|
|
1318
|
+
if (e && t.finished)
|
|
1319
|
+
throw new Error("Hash#digest() has already been called");
|
|
1320
|
+
}
|
|
1321
|
+
function ve(t, e) {
|
|
1322
|
+
Ht(t, void 0, "digestInto() output");
|
|
1323
|
+
const s = e.outputLen;
|
|
1324
|
+
if (t.length < s)
|
|
1325
|
+
throw new Error('"digestInto() output" expected to be of length >=' + s);
|
|
1326
|
+
}
|
|
1327
|
+
function Fe(t) {
|
|
1328
|
+
return new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4));
|
|
1329
|
+
}
|
|
1330
|
+
function re(...t) {
|
|
1331
|
+
for (let e = 0; e < t.length; e++)
|
|
1332
|
+
t[e].fill(0);
|
|
1333
|
+
}
|
|
1334
|
+
const Re = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
1335
|
+
function je(t) {
|
|
1336
|
+
return t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
|
|
1337
|
+
}
|
|
1338
|
+
function Pe(t) {
|
|
1339
|
+
for (let e = 0; e < t.length; e++)
|
|
1340
|
+
t[e] = je(t[e]);
|
|
1341
|
+
return t;
|
|
1342
|
+
}
|
|
1343
|
+
const Gt = Re ? (t) => t : Pe;
|
|
1344
|
+
function bs(...t) {
|
|
1345
|
+
let e = 0;
|
|
1346
|
+
for (let i = 0; i < t.length; i++) {
|
|
1347
|
+
const o = t[i];
|
|
1348
|
+
Ht(o), e += o.length;
|
|
1349
|
+
}
|
|
1350
|
+
const s = new Uint8Array(e);
|
|
1351
|
+
for (let i = 0, o = 0; i < t.length; i++) {
|
|
1352
|
+
const n = t[i];
|
|
1353
|
+
s.set(n, o), o += n.length;
|
|
1354
|
+
}
|
|
1355
|
+
return s;
|
|
1356
|
+
}
|
|
1357
|
+
function Ge(t, e = {}) {
|
|
1358
|
+
const s = (o, n) => t(n).update(o).digest(), i = t(void 0);
|
|
1359
|
+
return s.outputLen = i.outputLen, s.blockLen = i.blockLen, s.create = (o) => t(o), Object.assign(s, e), Object.freeze(s);
|
|
1360
|
+
}
|
|
1361
|
+
function xs(t = 32) {
|
|
1362
|
+
const e = typeof globalThis == "object" ? globalThis.crypto : null;
|
|
1363
|
+
if (typeof e?.getRandomValues != "function")
|
|
1364
|
+
throw new Error("crypto.getRandomValues must be defined");
|
|
1365
|
+
return e.getRandomValues(new Uint8Array(t));
|
|
1366
|
+
}
|
|
1367
|
+
const ie = (t) => ({
|
|
1368
|
+
oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, t])
|
|
1369
|
+
}), xt = /* @__PURE__ */ BigInt(2 ** 32 - 1), qt = /* @__PURE__ */ BigInt(32);
|
|
1370
|
+
function qe(t, e = !1) {
|
|
1371
|
+
return e ? { h: Number(t & xt), l: Number(t >> qt & xt) } : { h: Number(t >> qt & xt) | 0, l: Number(t & xt) | 0 };
|
|
1372
|
+
}
|
|
1373
|
+
function We(t, e = !1) {
|
|
1374
|
+
const s = t.length;
|
|
1375
|
+
let i = new Uint32Array(s), o = new Uint32Array(s);
|
|
1376
|
+
for (let n = 0; n < s; n++) {
|
|
1377
|
+
const { h: r, l: h } = qe(t[n], e);
|
|
1378
|
+
[i[n], o[n]] = [r, h];
|
|
1379
|
+
}
|
|
1380
|
+
return [i, o];
|
|
1381
|
+
}
|
|
1382
|
+
const Ke = (t, e, s) => t << s | e >>> 32 - s, Ne = (t, e, s) => e << s | t >>> 32 - s, Xe = (t, e, s) => e << s - 32 | t >>> 64 - s, Je = (t, e, s) => t << s - 32 | e >>> 64 - s, Qe = BigInt(0), ut = BigInt(1), Ye = BigInt(2), Ze = BigInt(7), ze = BigInt(256), $e = BigInt(113), oe = [], ce = [], he = [];
|
|
1383
|
+
for (let t = 0, e = ut, s = 1, i = 0; t < 24; t++) {
|
|
1384
|
+
[s, i] = [i, (2 * s + 3 * i) % 5], oe.push(2 * (5 * i + s)), ce.push((t + 1) * (t + 2) / 2 % 64);
|
|
1385
|
+
let o = Qe;
|
|
1386
|
+
for (let n = 0; n < 7; n++)
|
|
1387
|
+
e = (e << ut ^ (e >> Ze) * $e) % ze, e & Ye && (o ^= ut << (ut << BigInt(n)) - ut);
|
|
1388
|
+
he.push(o);
|
|
1389
|
+
}
|
|
1390
|
+
const ae = We(he, !0), ts = ae[0], es = ae[1], Wt = (t, e, s) => s > 32 ? Xe(t, e, s) : Ke(t, e, s), Kt = (t, e, s) => s > 32 ? Je(t, e, s) : Ne(t, e, s);
|
|
1391
|
+
function ss(t, e = 24) {
|
|
1392
|
+
const s = new Uint32Array(10);
|
|
1393
|
+
for (let i = 24 - e; i < 24; i++) {
|
|
1394
|
+
for (let r = 0; r < 10; r++)
|
|
1395
|
+
s[r] = t[r] ^ t[r + 10] ^ t[r + 20] ^ t[r + 30] ^ t[r + 40];
|
|
1396
|
+
for (let r = 0; r < 10; r += 2) {
|
|
1397
|
+
const h = (r + 8) % 10, d = (r + 2) % 10, x = s[d], p = s[d + 1], b = Wt(x, p, 1) ^ s[h], U = Kt(x, p, 1) ^ s[h + 1];
|
|
1398
|
+
for (let w = 0; w < 50; w += 10)
|
|
1399
|
+
t[r + w] ^= b, t[r + w + 1] ^= U;
|
|
1400
|
+
}
|
|
1401
|
+
let o = t[2], n = t[3];
|
|
1402
|
+
for (let r = 0; r < 24; r++) {
|
|
1403
|
+
const h = ce[r], d = Wt(o, n, h), x = Kt(o, n, h), p = oe[r];
|
|
1404
|
+
o = t[p], n = t[p + 1], t[p] = d, t[p + 1] = x;
|
|
1405
|
+
}
|
|
1406
|
+
for (let r = 0; r < 50; r += 10) {
|
|
1407
|
+
for (let h = 0; h < 10; h++)
|
|
1408
|
+
s[h] = t[r + h];
|
|
1409
|
+
for (let h = 0; h < 10; h++)
|
|
1410
|
+
t[r + h] ^= ~s[(h + 2) % 10] & s[(h + 4) % 10];
|
|
1411
|
+
}
|
|
1412
|
+
t[0] ^= ts[i], t[1] ^= es[i];
|
|
1413
|
+
}
|
|
1414
|
+
re(s);
|
|
1415
|
+
}
|
|
1416
|
+
class Lt {
|
|
1417
|
+
state;
|
|
1418
|
+
pos = 0;
|
|
1419
|
+
posOut = 0;
|
|
1420
|
+
finished = !1;
|
|
1421
|
+
state32;
|
|
1422
|
+
destroyed = !1;
|
|
1423
|
+
blockLen;
|
|
1424
|
+
suffix;
|
|
1425
|
+
outputLen;
|
|
1426
|
+
enableXOF = !1;
|
|
1427
|
+
rounds;
|
|
1428
|
+
// NOTE: we accept arguments in bytes instead of bits here.
|
|
1429
|
+
constructor(e, s, i, o = !1, n = 24) {
|
|
1430
|
+
if (this.blockLen = e, this.suffix = s, this.outputLen = i, this.enableXOF = o, this.rounds = n, jt(i, "outputLen"), !(0 < e && e < 200))
|
|
1431
|
+
throw new Error("only keccak-f1600 function is supported");
|
|
1432
|
+
this.state = new Uint8Array(200), this.state32 = Fe(this.state);
|
|
1433
|
+
}
|
|
1434
|
+
clone() {
|
|
1435
|
+
return this._cloneInto();
|
|
1436
|
+
}
|
|
1437
|
+
keccak() {
|
|
1438
|
+
Gt(this.state32), ss(this.state32, this.rounds), Gt(this.state32), this.posOut = 0, this.pos = 0;
|
|
1439
|
+
}
|
|
1440
|
+
update(e) {
|
|
1441
|
+
Pt(this), Ht(e);
|
|
1442
|
+
const { blockLen: s, state: i } = this, o = e.length;
|
|
1443
|
+
for (let n = 0; n < o; ) {
|
|
1444
|
+
const r = Math.min(s - this.pos, o - n);
|
|
1445
|
+
for (let h = 0; h < r; h++)
|
|
1446
|
+
i[this.pos++] ^= e[n++];
|
|
1447
|
+
this.pos === s && this.keccak();
|
|
1448
|
+
}
|
|
1449
|
+
return this;
|
|
1450
|
+
}
|
|
1451
|
+
finish() {
|
|
1452
|
+
if (this.finished)
|
|
1453
|
+
return;
|
|
1454
|
+
this.finished = !0;
|
|
1455
|
+
const { state: e, suffix: s, pos: i, blockLen: o } = this;
|
|
1456
|
+
e[i] ^= s, (s & 128) !== 0 && i === o - 1 && this.keccak(), e[o - 1] ^= 128, this.keccak();
|
|
1457
|
+
}
|
|
1458
|
+
writeInto(e) {
|
|
1459
|
+
Pt(this, !1), Ht(e), this.finish();
|
|
1460
|
+
const s = this.state, { blockLen: i } = this;
|
|
1461
|
+
for (let o = 0, n = e.length; o < n; ) {
|
|
1462
|
+
this.posOut >= i && this.keccak();
|
|
1463
|
+
const r = Math.min(i - this.posOut, n - o);
|
|
1464
|
+
e.set(s.subarray(this.posOut, this.posOut + r), o), this.posOut += r, o += r;
|
|
1465
|
+
}
|
|
1466
|
+
return e;
|
|
1467
|
+
}
|
|
1468
|
+
xofInto(e) {
|
|
1469
|
+
if (!this.enableXOF)
|
|
1470
|
+
throw new Error("XOF is not possible for this instance");
|
|
1471
|
+
return this.writeInto(e);
|
|
1472
|
+
}
|
|
1473
|
+
xof(e) {
|
|
1474
|
+
return jt(e), this.xofInto(new Uint8Array(e));
|
|
1475
|
+
}
|
|
1476
|
+
digestInto(e) {
|
|
1477
|
+
if (ve(e, this), this.finished)
|
|
1478
|
+
throw new Error("digest() was already called");
|
|
1479
|
+
return this.writeInto(e), this.destroy(), e;
|
|
1480
|
+
}
|
|
1481
|
+
digest() {
|
|
1482
|
+
return this.digestInto(new Uint8Array(this.outputLen));
|
|
1483
|
+
}
|
|
1484
|
+
destroy() {
|
|
1485
|
+
this.destroyed = !0, re(this.state);
|
|
1486
|
+
}
|
|
1487
|
+
_cloneInto(e) {
|
|
1488
|
+
const { blockLen: s, suffix: i, outputLen: o, rounds: n, enableXOF: r } = this;
|
|
1489
|
+
return e ||= new Lt(s, i, o, r, n), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = n, e.suffix = i, e.outputLen = o, e.enableXOF = r, e.destroyed = this.destroyed, e;
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
const fe = (t, e, s, i = {}) => Ge((o = {}) => new Lt(e, t, o.dkLen === void 0 ? s : o.dkLen, !0), i), ps = /* @__PURE__ */ fe(31, 168, 16, /* @__PURE__ */ ie(11)), Hs = /* @__PURE__ */ fe(31, 136, 32, /* @__PURE__ */ ie(12));
|
|
1493
|
+
class ue extends Jt {
|
|
1494
|
+
constructor(e, s) {
|
|
1495
|
+
super(), this.finished = !1, this.destroyed = !1, be(e);
|
|
1496
|
+
const i = wt(s);
|
|
1497
|
+
if (this.iHash = e.create(), typeof this.iHash.update != "function")
|
|
1498
|
+
throw new Error("Expected instance of class which extends utils.Hash");
|
|
1499
|
+
this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
|
|
1500
|
+
const o = this.blockLen, n = new Uint8Array(o);
|
|
1501
|
+
n.set(i.length > o ? e.create().update(i).digest() : i);
|
|
1502
|
+
for (let r = 0; r < n.length; r++)
|
|
1503
|
+
n[r] ^= 54;
|
|
1504
|
+
this.iHash.update(n), this.oHash = e.create();
|
|
1505
|
+
for (let r = 0; r < n.length; r++)
|
|
1506
|
+
n[r] ^= 106;
|
|
1507
|
+
this.oHash.update(n), nt(n);
|
|
1508
|
+
}
|
|
1509
|
+
update(e) {
|
|
1510
|
+
return pt(this), this.iHash.update(e), this;
|
|
1511
|
+
}
|
|
1512
|
+
digestInto(e) {
|
|
1513
|
+
pt(this), ht(e, this.outputLen), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
|
|
1514
|
+
}
|
|
1515
|
+
digest() {
|
|
1516
|
+
const e = new Uint8Array(this.oHash.outputLen);
|
|
1517
|
+
return this.digestInto(e), e;
|
|
1518
|
+
}
|
|
1519
|
+
_cloneInto(e) {
|
|
1520
|
+
e || (e = Object.create(Object.getPrototypeOf(this), {}));
|
|
1521
|
+
const { oHash: s, iHash: i, finished: o, destroyed: n, blockLen: r, outputLen: h } = this;
|
|
1522
|
+
return e = e, e.finished = o, e.destroyed = n, e.blockLen = r, e.outputLen = h, e.oHash = s._cloneInto(e.oHash), e.iHash = i._cloneInto(e.iHash), e;
|
|
1523
|
+
}
|
|
1524
|
+
clone() {
|
|
1525
|
+
return this._cloneInto();
|
|
1526
|
+
}
|
|
1527
|
+
destroy() {
|
|
1528
|
+
this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
const ns = (t, e, s) => new ue(t, e).update(s).digest();
|
|
1532
|
+
ns.create = (t, e) => new ue(t, e);
|
|
1533
|
+
var dt = {}, Nt;
|
|
1534
|
+
function As() {
|
|
1535
|
+
if (Nt) return dt;
|
|
1536
|
+
Nt = 1, Object.defineProperty(dt, "__esModule", { value: !0 }), dt.pbkdf2 = o, dt.pbkdf2Async = n;
|
|
1537
|
+
const t = /* @__PURE__ */ Oe(), e = /* @__PURE__ */ lt();
|
|
1538
|
+
function s(r, h, d, x) {
|
|
1539
|
+
(0, e.ahash)(r);
|
|
1540
|
+
const p = (0, e.checkOpts)({ dkLen: 32, asyncTick: 10 }, x), { c: b, dkLen: U, asyncTick: w } = p;
|
|
1541
|
+
if ((0, e.anumber)(b), (0, e.anumber)(U), (0, e.anumber)(w), b < 1)
|
|
1542
|
+
throw new Error("iterations (c) should be >= 1");
|
|
1543
|
+
const m = (0, e.kdfInputToBytes)(h), k = (0, e.kdfInputToBytes)(d), M = new Uint8Array(U), P = t.hmac.create(r, m), R = P._cloneInto().update(k);
|
|
1544
|
+
return { c: b, dkLen: U, asyncTick: w, DK: M, PRF: P, PRFSalt: R };
|
|
1545
|
+
}
|
|
1546
|
+
function i(r, h, d, x, p) {
|
|
1547
|
+
return r.destroy(), h.destroy(), x && x.destroy(), (0, e.clean)(p), d;
|
|
1548
|
+
}
|
|
1549
|
+
function o(r, h, d, x) {
|
|
1550
|
+
const { c: p, dkLen: b, DK: U, PRF: w, PRFSalt: m } = s(r, h, d, x);
|
|
1551
|
+
let k;
|
|
1552
|
+
const M = new Uint8Array(4), P = (0, e.createView)(M), R = new Uint8Array(w.outputLen);
|
|
1553
|
+
for (let V = 1, T = 0; T < b; V++, T += w.outputLen) {
|
|
1554
|
+
const g = U.subarray(T, T + w.outputLen);
|
|
1555
|
+
P.setInt32(0, V, !1), (k = m._cloneInto(k)).update(M).digestInto(R), g.set(R.subarray(0, g.length));
|
|
1556
|
+
for (let S = 1; S < p; S++) {
|
|
1557
|
+
w._cloneInto(k).update(R).digestInto(R);
|
|
1558
|
+
for (let C = 0; C < g.length; C++)
|
|
1559
|
+
g[C] ^= R[C];
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
return i(w, m, U, k, R);
|
|
1563
|
+
}
|
|
1564
|
+
async function n(r, h, d, x) {
|
|
1565
|
+
const { c: p, dkLen: b, asyncTick: U, DK: w, PRF: m, PRFSalt: k } = s(r, h, d, x);
|
|
1566
|
+
let M;
|
|
1567
|
+
const P = new Uint8Array(4), R = (0, e.createView)(P), V = new Uint8Array(m.outputLen);
|
|
1568
|
+
for (let T = 1, g = 0; g < b; T++, g += m.outputLen) {
|
|
1569
|
+
const S = w.subarray(g, g + m.outputLen);
|
|
1570
|
+
R.setInt32(0, T, !1), (M = k._cloneInto(M)).update(P).digestInto(V), S.set(V.subarray(0, S.length)), await (0, e.asyncLoop)(p - 1, U, () => {
|
|
1571
|
+
m._cloneInto(M).update(V).digestInto(V);
|
|
1572
|
+
for (let C = 0; C < S.length; C++)
|
|
1573
|
+
S[C] ^= V[C];
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1576
|
+
return i(m, k, w, M, V);
|
|
1577
|
+
}
|
|
1578
|
+
return dt;
|
|
1579
|
+
}
|
|
1580
|
+
export {
|
|
1581
|
+
He as A,
|
|
1582
|
+
ls as a,
|
|
1583
|
+
ds as b,
|
|
1584
|
+
lt as c,
|
|
1585
|
+
us as d,
|
|
1586
|
+
Oe as e,
|
|
1587
|
+
as as f,
|
|
1588
|
+
fs as g,
|
|
1589
|
+
Ht as h,
|
|
1590
|
+
xs as i,
|
|
1591
|
+
bs as j,
|
|
1592
|
+
Te as k,
|
|
1593
|
+
ps as l,
|
|
1594
|
+
Hs as m,
|
|
1595
|
+
ne as n,
|
|
1596
|
+
rs as o,
|
|
1597
|
+
le as p,
|
|
1598
|
+
is as q,
|
|
1599
|
+
As as r,
|
|
1600
|
+
hs as s,
|
|
1601
|
+
ht as t,
|
|
1602
|
+
os as u,
|
|
1603
|
+
Bt as v,
|
|
1604
|
+
be as w,
|
|
1605
|
+
cs as x,
|
|
1606
|
+
ns as y,
|
|
1607
|
+
_e as z
|
|
1608
|
+
};
|