edge-currency-accountbased 0.22.21 → 0.23.0
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/CHANGELOG.md +7 -0
- package/android/src/main/assets/edge-currency-accountbased/{645.chunk.js → 216.chunk.js} +6 -6
- package/android/src/main/assets/edge-currency-accountbased/244.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/387.chunk.js +9 -0
- package/android/src/main/assets/edge-currency-accountbased/491.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/549.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/94.chunk.js +8 -9
- package/android/src/main/assets/edge-currency-accountbased/bnb.chunk.js +3 -3
- package/android/src/main/assets/edge-currency-accountbased/edge-currency-accountbased.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/eos.chunk.js +11 -11
- package/android/src/main/assets/edge-currency-accountbased/ethereum.chunk.js +9 -9
- package/android/src/main/assets/edge-currency-accountbased/fio.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/hedera.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/polkadot.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/ripple.chunk.js +5 -4
- package/android/src/main/assets/edge-currency-accountbased/solana.chunk.js +3 -3
- package/android/src/main/assets/edge-currency-accountbased/stellar.chunk.js +6 -6
- package/android/src/main/assets/edge-currency-accountbased/tezos.chunk.js +3 -3
- package/android/src/main/assets/edge-currency-accountbased/tron.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/zcash.chunk.js +2 -2
- package/lib/binance/bnbEngine.js +28 -16
- package/lib/binance/bnbTypes.js +11 -0
- package/lib/common/engine.js +47 -3
- package/lib/common/types.js +20 -0
- package/lib/declare-modules.d.js +0 -22
- package/lib/eos/eosEngine.js +32 -21
- package/lib/eos/eosTypes.js +16 -0
- package/lib/eos/info/eosInfo.js +3 -1
- package/lib/ethereum/ethEngine.js +90 -140
- package/lib/ethereum/ethTypes.js +64 -0
- package/lib/fio/fioConst.js +26 -55
- package/lib/fio/fioEngine.js +830 -609
- package/lib/fio/fioError.js +15 -22
- package/lib/fio/fioInfo.js +13 -23
- package/lib/fio/fioPlugin.js +85 -94
- package/lib/fio/fioTypes.js +180 -1
- package/lib/hedera/hederaEngine.js +24 -12
- package/lib/hedera/hederaTypes.js +37 -0
- package/lib/polkadot/polkadotEngine.js +30 -10
- package/lib/polkadot/polkadotTypes.js +37 -0
- package/lib/solana/solanaEngine.js +25 -27
- package/lib/solana/solanaTypes.js +37 -0
- package/lib/stellar/stellarEngine.js +21 -19
- package/lib/stellar/stellarTypes.js +10 -0
- package/lib/tezos/tezosEngine.js +23 -18
- package/lib/tezos/tezosTypes.js +16 -0
- package/lib/tron/tronEngine.js +14 -7
- package/lib/tron/tronPlugin.js +1 -1
- package/lib/tron/tronTypes.js +15 -11
- package/lib/xrp/xrpEngine.js +86 -59
- package/lib/xrp/xrpTypes.js +16 -0
- package/lib/zcash/zecEngine.js +33 -27
- package/lib/zcash/zecInfo.js +4 -1
- package/lib/zcash/zecPlugin.js +20 -6
- package/lib/zcash/zecTypes.js +57 -1
- package/package.json +3 -3
- package/android/src/main/assets/edge-currency-accountbased/206.chunk.js +0 -8
package/lib/zcash/zecEngine.js
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
|
|
12
|
+
|
|
11
13
|
var _types = require('edge-core-js/types');
|
|
12
14
|
|
|
13
15
|
var _engine = require('../common/engine');
|
|
@@ -23,9 +25,15 @@ var _utils = require('./../common/utils');
|
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
26
31
|
var _zecTypes = require('./zecTypes');
|
|
27
32
|
|
|
28
|
-
class ZcashEngine extends _engine.CurrencyEngine
|
|
33
|
+
class ZcashEngine extends _engine.CurrencyEngine
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
{
|
|
29
37
|
|
|
30
38
|
|
|
31
39
|
|
|
@@ -271,10 +279,7 @@ var _zecTypes = require('./zecTypes');
|
|
|
271
279
|
await this.clearBlockchainCache()
|
|
272
280
|
await this.startEngine()
|
|
273
281
|
this.synchronizer
|
|
274
|
-
.rescan(
|
|
275
|
-
_nullishCoalesce(this.walletInfo.keys[`${this.pluginId}BirthdayHeight`], () => (
|
|
276
|
-
this.networkInfo.defaultBirthday))
|
|
277
|
-
)
|
|
282
|
+
.rescan(this.walletInfo.keys.birthdayHeight)
|
|
278
283
|
.catch((e) => this.warn('resyncBlockchain failed: ', e))
|
|
279
284
|
}
|
|
280
285
|
|
|
@@ -349,8 +354,12 @@ var _zecTypes = require('./zecTypes');
|
|
|
349
354
|
}
|
|
350
355
|
|
|
351
356
|
async broadcastTx(
|
|
352
|
-
edgeTransaction
|
|
357
|
+
edgeTransaction,
|
|
358
|
+
opts
|
|
353
359
|
) {
|
|
360
|
+
const zcashPrivateKeys = _zecTypes.asZcashPrivateKeys.call(void 0, this.pluginId)(
|
|
361
|
+
_optionalChain([opts, 'optionalAccess', _ => _.privateKeys])
|
|
362
|
+
)
|
|
354
363
|
if (
|
|
355
364
|
edgeTransaction.spendTargets == null ||
|
|
356
365
|
edgeTransaction.spendTargets.length !== 1
|
|
@@ -366,7 +375,7 @@ var _zecTypes = require('./zecTypes');
|
|
|
366
375
|
toAddress: spendTarget.publicAddress,
|
|
367
376
|
memo: _nullishCoalesce(_nullishCoalesce(spendTarget.memo, () => ( spendTarget.uniqueIdentifier)), () => ( '')),
|
|
368
377
|
fromAccountIndex: 0,
|
|
369
|
-
spendingKey:
|
|
378
|
+
spendingKey: zcashPrivateKeys.spendKey
|
|
370
379
|
}
|
|
371
380
|
|
|
372
381
|
try {
|
|
@@ -382,12 +391,13 @@ var _zecTypes = require('./zecTypes');
|
|
|
382
391
|
return edgeTransaction
|
|
383
392
|
}
|
|
384
393
|
|
|
385
|
-
getDisplayPrivateSeed() {
|
|
386
|
-
|
|
394
|
+
getDisplayPrivateSeed(privateKeys) {
|
|
395
|
+
const zcashPrivateKeys = _zecTypes.asZcashPrivateKeys.call(void 0, this.pluginId)(privateKeys)
|
|
396
|
+
return zcashPrivateKeys.mnemonic
|
|
387
397
|
}
|
|
388
398
|
|
|
389
399
|
getDisplayPublicSeed() {
|
|
390
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
400
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _2 => _2.walletInfo, 'access', _3 => _3.keys, 'access', _4 => _4.unifiedViewingKeys, 'optionalAccess', _5 => _5.extfvk]), () => ( ''))
|
|
391
401
|
}
|
|
392
402
|
|
|
393
403
|
async loadEngine(
|
|
@@ -398,22 +408,11 @@ var _zecTypes = require('./zecTypes');
|
|
|
398
408
|
await super.loadEngine(plugin, walletInfo, opts)
|
|
399
409
|
this.engineOn = true
|
|
400
410
|
|
|
401
|
-
|
|
402
|
-
this.walletInfo.keys.publicKey != null ||
|
|
403
|
-
this.walletInfo.keys.unifiedViewingKeys != null
|
|
404
|
-
) {
|
|
405
|
-
const pubKeys = await plugin.derivePublicKey(this.walletInfo)
|
|
406
|
-
this.walletInfo.keys.publicKey = pubKeys.publicKey
|
|
407
|
-
this.walletInfo.keys[`${this.pluginId}ViewKeys`] =
|
|
408
|
-
pubKeys.unifiedViewingKeys
|
|
409
|
-
}
|
|
410
|
-
const { rpcNode, defaultBirthday } = this.networkInfo
|
|
411
|
+
const { rpcNode } = this.networkInfo
|
|
411
412
|
this.initializer = {
|
|
412
|
-
fullViewingKey:
|
|
413
|
-
birthdayHeight:
|
|
414
|
-
|
|
415
|
-
defaultBirthday)),
|
|
416
|
-
alias: this.walletInfo.keys.publicKey,
|
|
413
|
+
fullViewingKey: walletInfo.keys.unifiedViewingKeys,
|
|
414
|
+
birthdayHeight: walletInfo.keys.birthdayHeight,
|
|
415
|
+
alias: walletInfo.keys.publicKey,
|
|
417
416
|
...rpcNode
|
|
418
417
|
}
|
|
419
418
|
}
|
|
@@ -424,13 +423,20 @@ var _zecTypes = require('./zecTypes');
|
|
|
424
423
|
walletInfo,
|
|
425
424
|
opts
|
|
426
425
|
) {
|
|
426
|
+
const safeWalletInfo = _zecTypes.asSafeZcashWalletInfo.call(void 0, walletInfo)
|
|
427
427
|
const { makeSynchronizer } =
|
|
428
428
|
env.nativeIo['edge-currency-accountbased'][env.networkInfo.nativeSdk]
|
|
429
429
|
|
|
430
|
-
const engine = new ZcashEngine(
|
|
430
|
+
const engine = new ZcashEngine(
|
|
431
|
+
env,
|
|
432
|
+
tools,
|
|
433
|
+
safeWalletInfo,
|
|
434
|
+
opts,
|
|
435
|
+
makeSynchronizer
|
|
436
|
+
)
|
|
431
437
|
|
|
432
438
|
// Do any async initialization necessary for the engine
|
|
433
|
-
await engine.loadEngine(tools,
|
|
439
|
+
await engine.loadEngine(tools, safeWalletInfo, opts)
|
|
434
440
|
|
|
435
441
|
return engine
|
|
436
442
|
} exports.makeCurrencyEngine = makeCurrencyEngine;
|
package/lib/zcash/zecInfo.js
CHANGED
package/lib/zcash/zecPlugin.js
CHANGED
|
@@ -17,10 +17,16 @@ var _buffer = require('buffer');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
+
|
|
20
21
|
var _uriHelpers = require('../common/uriHelpers');
|
|
21
22
|
var _utils = require('../common/utils');
|
|
22
23
|
|
|
23
24
|
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
var _zecTypes = require('./zecTypes');
|
|
29
|
+
|
|
24
30
|
class ZcashTools {
|
|
25
31
|
|
|
26
32
|
|
|
@@ -48,17 +54,14 @@ var _utils = require('../common/utils');
|
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
async getNewWalletBirthdayBlockheight() {
|
|
51
|
-
let birthdayHeight = this.networkInfo.defaultBirthday
|
|
52
57
|
try {
|
|
53
|
-
|
|
58
|
+
return await this.KeyTool.getBirthdayHeight(
|
|
54
59
|
this.networkInfo.rpcNode.defaultHost,
|
|
55
60
|
this.networkInfo.rpcNode.defaultPort
|
|
56
61
|
)
|
|
57
62
|
} catch (e) {
|
|
58
|
-
|
|
63
|
+
return this.networkInfo.defaultBirthday
|
|
59
64
|
}
|
|
60
|
-
|
|
61
|
-
return birthdayHeight
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
async isValidAddress(address) {
|
|
@@ -102,13 +105,23 @@ var _utils = require('../common/utils');
|
|
|
102
105
|
return await this.importPrivateKey(mnemonic)
|
|
103
106
|
}
|
|
104
107
|
|
|
108
|
+
async checkPublicKey(publicKey) {
|
|
109
|
+
try {
|
|
110
|
+
_zecTypes.asZecPublicKey.call(void 0, publicKey)
|
|
111
|
+
return true
|
|
112
|
+
} catch (err) {
|
|
113
|
+
return false
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
105
117
|
async derivePublicKey(walletInfo) {
|
|
106
118
|
const { pluginId } = this.currencyInfo
|
|
119
|
+
const zcashPrivateKeys = _zecTypes.asZcashPrivateKeys.call(void 0, pluginId)(walletInfo.keys)
|
|
107
120
|
if (walletInfo.type !== this.currencyInfo.walletType) {
|
|
108
121
|
throw new Error('InvalidWalletType')
|
|
109
122
|
}
|
|
110
123
|
|
|
111
|
-
const mnemonic =
|
|
124
|
+
const mnemonic = zcashPrivateKeys.mnemonic
|
|
112
125
|
if (typeof mnemonic !== 'string') {
|
|
113
126
|
throw new Error('InvalidMnemonic')
|
|
114
127
|
}
|
|
@@ -124,6 +137,7 @@ var _utils = require('../common/utils');
|
|
|
124
137
|
this.networkInfo.rpcNode.networkName
|
|
125
138
|
)
|
|
126
139
|
return {
|
|
140
|
+
birthdayHeight: zcashPrivateKeys.birthdayHeight,
|
|
127
141
|
publicKey: shieldedAddress,
|
|
128
142
|
unifiedViewingKeys
|
|
129
143
|
}
|
package/lib/zcash/zecTypes.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
var _cleaners = require('cleaners');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _types = require('../common/types');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
8
17
|
|
|
9
18
|
|
|
10
19
|
|
|
@@ -114,3 +123,50 @@
|
|
|
114
123
|
|
|
115
124
|
|
|
116
125
|
|
|
126
|
+
|
|
127
|
+
const asZecPublicKey = _cleaners.asObject.call(void 0, {
|
|
128
|
+
birthdayHeight: _cleaners.asNumber,
|
|
129
|
+
publicKey: _cleaners.asString,
|
|
130
|
+
unifiedViewingKeys: _cleaners.asObject.call(void 0, {
|
|
131
|
+
extfvk: _cleaners.asString,
|
|
132
|
+
extpub: _cleaners.asString
|
|
133
|
+
})
|
|
134
|
+
}); exports.asZecPublicKey = asZecPublicKey
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
const asSafeZcashWalletInfo = _types.asWalletInfo.call(void 0, exports.asZecPublicKey); exports.asSafeZcashWalletInfo = asSafeZcashWalletInfo
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
const asZcashPrivateKeys = (
|
|
145
|
+
pluginId
|
|
146
|
+
) =>
|
|
147
|
+
_cleaners.asCodec.call(void 0,
|
|
148
|
+
(value) => {
|
|
149
|
+
const from = _cleaners.asObject.call(void 0, {
|
|
150
|
+
[`${pluginId}Mnemonic`]: _cleaners.asString,
|
|
151
|
+
[`${pluginId}SpendKey`]: _cleaners.asString,
|
|
152
|
+
[`${pluginId}BirthdayHeight`]: _cleaners.asNumber
|
|
153
|
+
})(value)
|
|
154
|
+
const to = {
|
|
155
|
+
mnemonic: from[`${pluginId}Mnemonic`],
|
|
156
|
+
spendKey: from[`${pluginId}SpendKey`],
|
|
157
|
+
birthdayHeight: from[`${pluginId}BirthdayHeight`]
|
|
158
|
+
}
|
|
159
|
+
return _cleaners.asObject.call(void 0, {
|
|
160
|
+
mnemonic: _cleaners.asString,
|
|
161
|
+
spendKey: _cleaners.asString,
|
|
162
|
+
birthdayHeight: _cleaners.asNumber
|
|
163
|
+
})(to)
|
|
164
|
+
},
|
|
165
|
+
zecPrivateKey => {
|
|
166
|
+
return {
|
|
167
|
+
[`${pluginId}Mnemonic`]: zecPrivateKey.mnemonic,
|
|
168
|
+
[`${pluginId}SpendKey`]: zecPrivateKey.spendKey,
|
|
169
|
+
[`${pluginId}BirthdayHeight`]: zecPrivateKey.birthdayHeight
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
); exports.asZcashPrivateKeys = asZcashPrivateKeys
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "edge-currency-accountbased",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "Edge currency plugin for account based currencies",
|
|
5
5
|
"homepage": "https://edge.app/",
|
|
6
6
|
"repository": {
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@binance-chain/javascript-sdk": "^4.2.0",
|
|
77
77
|
"@ethereumjs/common": "^2.4.0",
|
|
78
78
|
"@ethereumjs/tx": "^3.3.0",
|
|
79
|
-
"@fioprotocol/fiosdk": "
|
|
79
|
+
"@fioprotocol/fiosdk": "https://github.com/peachbits/fiosdk_typescript.git#d04449fff9f9b8c1487359a5b6bf64b7b53d0b6b",
|
|
80
80
|
"@greymass/eosio": "^0.6.8",
|
|
81
81
|
"@greymass/eosio-resources": "^0.7.0",
|
|
82
82
|
"@hashgraph/sdk": "^1.1.9",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"babel-eslint": "^10.1.0",
|
|
118
118
|
"chai": "^4.2.0",
|
|
119
119
|
"crypto-browserify": "^3.12.0",
|
|
120
|
-
"edge-core-js": "^0.19.
|
|
120
|
+
"edge-core-js": "^0.19.48",
|
|
121
121
|
"esbuild-loader": "^2.20.0",
|
|
122
122
|
"eslint": "^7.14.0",
|
|
123
123
|
"eslint-config-standard-kit": "0.15.1",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
(self.webpackChunkedge_currency_accountbased=self.webpackChunkedge_currency_accountbased||[]).push([[206],{91094:function(S,Dt,_){var Et=_(34155),Ot;/**
|
|
2
|
-
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
3
|
-
*
|
|
4
|
-
* @version 0.8.0
|
|
5
|
-
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
6
|
-
* @copyright Chen, Yi-Cyuan 2015-2018
|
|
7
|
-
* @license MIT
|
|
8
|
-
*/(function(){"use strict";var x="input is invalid type",Gt="finalize already called",Mt=typeof window=="object",y=Mt?window:{};y.JS_SHA3_NO_WINDOW&&(Mt=!1);var Lt=!Mt&&typeof self=="object",Xt=!y.JS_SHA3_NO_NODE_JS&&typeof Et=="object"&&Et.versions&&Et.versions.node;Xt?y=_.g:Lt&&(y=self);var Zt=!y.JS_SHA3_NO_COMMON_JS&&!0&&S.exports,Qt=_.amdO,k=!y.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",b="0123456789abcdef".split(""),$t=[31,7936,2031616,520093696],gt=[4,1024,262144,67108864],mt=[1,256,65536,16777216],qt=[6,1536,393216,100663296],p=[0,8,16,24],Ht=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],Kt=[224,256,384,512],Rt=[128,256],zt=["hex","buffer","arrayBuffer","array","digest"],Jt={128:168,256:136};(y.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(t){return Object.prototype.toString.call(t)==="[object Array]"}),k&&(y.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(t){return typeof t=="object"&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var Ut=function(t,e,r){return function(n){return new h(t,e,t).update(n)[r]()}},Pt=function(t,e,r){return function(n,a){return new h(t,e,a).update(n)[r]()}},Tt=function(t,e,r){return function(n,a,i,f){return d["cshake"+t].update(n,a,i,f)[r]()}},Wt=function(t,e,r){return function(n,a,i,f){return d["kmac"+t].update(n,a,i,f)[r]()}},C=function(t,e,r,n){for(var a=0;a<zt.length;++a){var i=zt[a];t[i]=e(r,n,i)}return t},jt=function(t,e){var r=Ut(t,e,"hex");return r.create=function(){return new h(t,e,t)},r.update=function(n){return r.create().update(n)},C(r,Ut,t,e)},st=function(t,e){var r=Pt(t,e,"hex");return r.create=function(n){return new h(t,e,n)},r.update=function(n,a){return r.create(a).update(n)},C(r,Pt,t,e)},te=function(t,e){var r=Jt[t],n=Tt(t,e,"hex");return n.create=function(a,i,f){return!i&&!f?d["shake"+t].create(a):new h(t,e,a).bytepad([i,f],r)},n.update=function(a,i,f,o){return n.create(i,f,o).update(a)},C(n,Tt,t,e)},ee=function(t,e){var r=Jt[t],n=Wt(t,e,"hex");return n.create=function(a,i,f){return new Nt(t,e,i).bytepad(["KMAC",f],r).bytepad([a],r)},n.update=function(a,i,f,o){return n.create(a,f,o).update(i)},C(n,Wt,t,e)},Vt=[{name:"keccak",padding:mt,bits:Kt,createMethod:jt},{name:"sha3",padding:qt,bits:Kt,createMethod:jt},{name:"shake",padding:$t,bits:Rt,createMethod:st},{name:"cshake",padding:gt,bits:Rt,createMethod:te},{name:"kmac",padding:gt,bits:Rt,createMethod:ee}],d={},B=[],v=0;v<Vt.length;++v)for(var A=Vt[v],E=A.bits,w=0;w<E.length;++w){var It=A.name+"_"+E[w];if(B.push(It),d[It]=A.createMethod(E[w],A.padding),A.name!=="sha3"){var Yt=A.name+E[w];B.push(Yt),d[Yt]=d[It]}}function h(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(r&31)>>3;for(var n=0;n<50;++n)this.s[n]=0}h.prototype.update=function(t){if(this.finalized)throw new Error(Gt);var e,r=typeof t;if(r!=="string"){if(r==="object"){if(t===null)throw new Error(x);if(k&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!k||!ArrayBuffer.isView(t)))throw new Error(x)}else throw new Error(x);e=!0}for(var n=this.blocks,a=this.byteCount,i=t.length,f=this.blockCount,o=0,l=this.s,u,c;o<i;){if(this.reset)for(this.reset=!1,n[0]=this.block,u=1;u<f+1;++u)n[u]=0;if(e)for(u=this.start;o<i&&u<a;++o)n[u>>2]|=t[o]<<p[u++&3];else for(u=this.start;o<i&&u<a;++o)c=t.charCodeAt(o),c<128?n[u>>2]|=c<<p[u++&3]:c<2048?(n[u>>2]|=(192|c>>6)<<p[u++&3],n[u>>2]|=(128|c&63)<<p[u++&3]):c<55296||c>=57344?(n[u>>2]|=(224|c>>12)<<p[u++&3],n[u>>2]|=(128|c>>6&63)<<p[u++&3],n[u>>2]|=(128|c&63)<<p[u++&3]):(c=65536+((c&1023)<<10|t.charCodeAt(++o)&1023),n[u>>2]|=(240|c>>18)<<p[u++&3],n[u>>2]|=(128|c>>12&63)<<p[u++&3],n[u>>2]|=(128|c>>6&63)<<p[u++&3],n[u>>2]|=(128|c&63)<<p[u++&3]);if(this.lastByteIndex=u,u>=a){for(this.start=u-a,this.block=n[f],u=0;u<f;++u)l[u]^=n[u];F(l),this.reset=!0}else this.start=u}return this},h.prototype.encode=function(t,e){var r=t&255,n=1,a=[r];for(t=t>>8,r=t&255;r>0;)a.unshift(r),t=t>>8,r=t&255,++n;return e?a.push(n):a.unshift(n),this.update(a),a.length},h.prototype.encodeString=function(t){var e,r=typeof t;if(r!=="string"){if(r==="object"){if(t===null)throw new Error(x);if(k&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!k||!ArrayBuffer.isView(t)))throw new Error(x)}else throw new Error(x);e=!0}var n=0,a=t.length;if(e)n=a;else for(var i=0;i<t.length;++i){var f=t.charCodeAt(i);f<128?n+=1:f<2048?n+=2:f<55296||f>=57344?n+=3:(f=65536+((f&1023)<<10|t.charCodeAt(++i)&1023),n+=4)}return n+=this.encode(n*8),this.update(t),n},h.prototype.bytepad=function(t,e){for(var r=this.encode(e),n=0;n<t.length;++n)r+=this.encodeString(t[n]);var a=e-r%e,i=[];return i.length=a,this.update(i),this},h.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[e&3],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)n[e]^=t[e];F(n)}},h.prototype.toString=h.prototype.hex=function(){this.finalize();for(var t=this.blockCount,e=this.s,r=this.outputBlocks,n=this.extraBytes,a=0,i=0,f="",o;i<r;){for(a=0;a<t&&i<r;++a,++i)o=e[a],f+=b[o>>4&15]+b[o&15]+b[o>>12&15]+b[o>>8&15]+b[o>>20&15]+b[o>>16&15]+b[o>>28&15]+b[o>>24&15];i%t===0&&(F(e),a=0)}return n&&(o=e[a],f+=b[o>>4&15]+b[o&15],n>1&&(f+=b[o>>12&15]+b[o>>8&15]),n>2&&(f+=b[o>>20&15]+b[o>>16&15])),f},h.prototype.arrayBuffer=function(){this.finalize();var t=this.blockCount,e=this.s,r=this.outputBlocks,n=this.extraBytes,a=0,i=0,f=this.outputBits>>3,o;n?o=new ArrayBuffer(r+1<<2):o=new ArrayBuffer(f);for(var l=new Uint32Array(o);i<r;){for(a=0;a<t&&i<r;++a,++i)l[i]=e[a];i%t===0&&F(e)}return n&&(l[a]=e[a],o=o.slice(0,f)),o},h.prototype.buffer=h.prototype.arrayBuffer,h.prototype.digest=h.prototype.array=function(){this.finalize();for(var t=this.blockCount,e=this.s,r=this.outputBlocks,n=this.extraBytes,a=0,i=0,f=[],o,l;i<r;){for(a=0;a<t&&i<r;++a,++i)o=i<<2,l=e[a],f[o]=l&255,f[o+1]=l>>8&255,f[o+2]=l>>16&255,f[o+3]=l>>24&255;i%t===0&&F(e)}return n&&(o=i<<2,l=e[a],f[o]=l&255,n>1&&(f[o+1]=l>>8&255),n>2&&(f[o+2]=l>>16&255)),f};function Nt(t,e,r){h.call(this,t,e,r)}Nt.prototype=new h,Nt.prototype.finalize=function(){return this.encode(this.outputBits,!0),h.prototype.finalize.call(this)};var F=function(t){var e,r,n,a,i,f,o,l,u,c,O,M,R,I,N,D,g,H,K,z,J,U,P,T,W,j,V,Y,G,L,X,Z,Q,$,m,q,s,tt,et,rt,nt,at,ot,it,ft,ut,ct,ht,lt,bt,pt,yt,dt,vt,xt,At,kt,Bt,wt,Ft,St,_t,Ct;for(n=0;n<48;n+=2)a=t[0]^t[10]^t[20]^t[30]^t[40],i=t[1]^t[11]^t[21]^t[31]^t[41],f=t[2]^t[12]^t[22]^t[32]^t[42],o=t[3]^t[13]^t[23]^t[33]^t[43],l=t[4]^t[14]^t[24]^t[34]^t[44],u=t[5]^t[15]^t[25]^t[35]^t[45],c=t[6]^t[16]^t[26]^t[36]^t[46],O=t[7]^t[17]^t[27]^t[37]^t[47],M=t[8]^t[18]^t[28]^t[38]^t[48],R=t[9]^t[19]^t[29]^t[39]^t[49],e=M^(f<<1|o>>>31),r=R^(o<<1|f>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=a^(l<<1|u>>>31),r=i^(u<<1|l>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=f^(c<<1|O>>>31),r=o^(O<<1|c>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=l^(M<<1|R>>>31),r=u^(R<<1|M>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=c^(a<<1|i>>>31),r=O^(i<<1|a>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,I=t[0],N=t[1],ut=t[11]<<4|t[10]>>>28,ct=t[10]<<4|t[11]>>>28,Y=t[20]<<3|t[21]>>>29,G=t[21]<<3|t[20]>>>29,Ft=t[31]<<9|t[30]>>>23,St=t[30]<<9|t[31]>>>23,at=t[40]<<18|t[41]>>>14,ot=t[41]<<18|t[40]>>>14,$=t[2]<<1|t[3]>>>31,m=t[3]<<1|t[2]>>>31,D=t[13]<<12|t[12]>>>20,g=t[12]<<12|t[13]>>>20,ht=t[22]<<10|t[23]>>>22,lt=t[23]<<10|t[22]>>>22,L=t[33]<<13|t[32]>>>19,X=t[32]<<13|t[33]>>>19,_t=t[42]<<2|t[43]>>>30,Ct=t[43]<<2|t[42]>>>30,vt=t[5]<<30|t[4]>>>2,xt=t[4]<<30|t[5]>>>2,q=t[14]<<6|t[15]>>>26,s=t[15]<<6|t[14]>>>26,H=t[25]<<11|t[24]>>>21,K=t[24]<<11|t[25]>>>21,bt=t[34]<<15|t[35]>>>17,pt=t[35]<<15|t[34]>>>17,Z=t[45]<<29|t[44]>>>3,Q=t[44]<<29|t[45]>>>3,T=t[6]<<28|t[7]>>>4,W=t[7]<<28|t[6]>>>4,At=t[17]<<23|t[16]>>>9,kt=t[16]<<23|t[17]>>>9,tt=t[26]<<25|t[27]>>>7,et=t[27]<<25|t[26]>>>7,z=t[36]<<21|t[37]>>>11,J=t[37]<<21|t[36]>>>11,yt=t[47]<<24|t[46]>>>8,dt=t[46]<<24|t[47]>>>8,it=t[8]<<27|t[9]>>>5,ft=t[9]<<27|t[8]>>>5,j=t[18]<<20|t[19]>>>12,V=t[19]<<20|t[18]>>>12,Bt=t[29]<<7|t[28]>>>25,wt=t[28]<<7|t[29]>>>25,rt=t[38]<<8|t[39]>>>24,nt=t[39]<<8|t[38]>>>24,U=t[48]<<14|t[49]>>>18,P=t[49]<<14|t[48]>>>18,t[0]=I^~D&H,t[1]=N^~g&K,t[10]=T^~j&Y,t[11]=W^~V&G,t[20]=$^~q&tt,t[21]=m^~s&et,t[30]=it^~ut&ht,t[31]=ft^~ct<,t[40]=vt^~At&Bt,t[41]=xt^~kt&wt,t[2]=D^~H&z,t[3]=g^~K&J,t[12]=j^~Y&L,t[13]=V^~G&X,t[22]=q^~tt&rt,t[23]=s^~et&nt,t[32]=ut^~ht&bt,t[33]=ct^~lt&pt,t[42]=At^~Bt&Ft,t[43]=kt^~wt&St,t[4]=H^~z&U,t[5]=K^~J&P,t[14]=Y^~L&Z,t[15]=G^~X&Q,t[24]=tt^~rt&at,t[25]=et^~nt&ot,t[34]=ht^~bt&yt,t[35]=lt^~pt&dt,t[44]=Bt^~Ft&_t,t[45]=wt^~St&Ct,t[6]=z^~U&I,t[7]=J^~P&N,t[16]=L^~Z&T,t[17]=X^~Q&W,t[26]=rt^~at&$,t[27]=nt^~ot&m,t[36]=bt^~yt&it,t[37]=pt^~dt&ft,t[46]=Ft^~_t&vt,t[47]=St^~Ct&xt,t[8]=U^~I&D,t[9]=P^~N&g,t[18]=Z^~T&j,t[19]=Q^~W&V,t[28]=at^~$&q,t[29]=ot^~m&s,t[38]=yt^~it&ut,t[39]=dt^~ft&ct,t[48]=_t^~vt&At,t[49]=Ct^~xt&kt,t[0]^=Ht[n],t[1]^=Ht[n+1]};if(Zt)S.exports=d;else{for(v=0;v<B.length;++v)y[B[v]]=d[B[v]];Qt&&(Ot=function(){return d}.call(Dt,_,Dt,S),Ot!==void 0&&(S.exports=Ot))}})()}}]);
|