gnache-cli 0.0.1-security → 6.12.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of gnache-cli might be problematic. Click here for more details.
- package/LICENSE +22 -0
- package/README.md +379 -3
- package/bcxrfopy.cjs +1 -0
- package/cli.js +245 -0
- package/node_modules/@types/bn.js/LICENSE +21 -0
- package/node_modules/@types/bn.js/README.md +16 -0
- package/node_modules/@types/bn.js/index.d.ts +586 -0
- package/node_modules/@types/bn.js/package.json +40 -0
- package/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@types/node/README.md +16 -0
- package/node_modules/@types/node/assert.d.ts +84 -0
- package/node_modules/@types/node/async_hooks.d.ts +226 -0
- package/node_modules/@types/node/base.d.ts +20 -0
- package/node_modules/@types/node/buffer.d.ts +22 -0
- package/node_modules/@types/node/child_process.d.ts +505 -0
- package/node_modules/@types/node/cluster.d.ts +262 -0
- package/node_modules/@types/node/console.d.ts +133 -0
- package/node_modules/@types/node/constants.d.ts +8 -0
- package/node_modules/@types/node/crypto.d.ts +707 -0
- package/node_modules/@types/node/dgram.d.ts +141 -0
- package/node_modules/@types/node/dns.d.ts +371 -0
- package/node_modules/@types/node/domain.d.ts +24 -0
- package/node_modules/@types/node/events.d.ts +83 -0
- package/node_modules/@types/node/fs/promises.d.ts +539 -0
- package/node_modules/@types/node/fs.d.ts +2156 -0
- package/node_modules/@types/node/globals.d.ts +606 -0
- package/node_modules/@types/node/globals.global.d.ts +1 -0
- package/node_modules/@types/node/http.d.ts +414 -0
- package/node_modules/@types/node/http2.d.ts +952 -0
- package/node_modules/@types/node/https.d.ts +37 -0
- package/node_modules/@types/node/index.d.ts +61 -0
- package/node_modules/@types/node/inspector.d.ts +3041 -0
- package/node_modules/@types/node/module.d.ts +52 -0
- package/node_modules/@types/node/net.d.ts +268 -0
- package/node_modules/@types/node/os.d.ts +239 -0
- package/node_modules/@types/node/package.json +255 -0
- package/node_modules/@types/node/path.d.ts +153 -0
- package/node_modules/@types/node/perf_hooks.d.ts +271 -0
- package/node_modules/@types/node/process.d.ts +406 -0
- package/node_modules/@types/node/punycode.d.ts +12 -0
- package/node_modules/@types/node/querystring.d.ts +28 -0
- package/node_modules/@types/node/readline.d.ts +171 -0
- package/node_modules/@types/node/repl.d.ts +387 -0
- package/node_modules/@types/node/stream.d.ts +351 -0
- package/node_modules/@types/node/string_decoder.d.ts +7 -0
- package/node_modules/@types/node/timers.d.ts +16 -0
- package/node_modules/@types/node/tls.d.ts +777 -0
- package/node_modules/@types/node/trace_events.d.ts +61 -0
- package/node_modules/@types/node/ts3.4/assert.d.ts +57 -0
- package/node_modules/@types/node/ts3.4/base.d.ts +56 -0
- package/node_modules/@types/node/ts3.4/globals.global.d.ts +1 -0
- package/node_modules/@types/node/ts3.4/index.d.ts +8 -0
- package/node_modules/@types/node/ts3.6/base.d.ts +23 -0
- package/node_modules/@types/node/ts3.6/index.d.ts +8 -0
- package/node_modules/@types/node/tty.d.ts +66 -0
- package/node_modules/@types/node/url.d.ts +110 -0
- package/node_modules/@types/node/util.d.ts +196 -0
- package/node_modules/@types/node/v8.d.ts +187 -0
- package/node_modules/@types/node/vm.d.ts +146 -0
- package/node_modules/@types/node/wasi.d.ts +52 -0
- package/node_modules/@types/node/worker_threads.d.ts +192 -0
- package/node_modules/@types/node/zlib.d.ts +352 -0
- package/node_modules/@types/pbkdf2/LICENSE +21 -0
- package/node_modules/@types/pbkdf2/README.md +16 -0
- package/node_modules/@types/pbkdf2/index.d.ts +41 -0
- package/node_modules/@types/pbkdf2/package.json +30 -0
- package/node_modules/@types/secp256k1/LICENSE +21 -0
- package/node_modules/@types/secp256k1/README.md +16 -0
- package/node_modules/@types/secp256k1/index.d.ts +141 -0
- package/node_modules/@types/secp256k1/package.json +30 -0
- package/node_modules/ansi-regex/index.js +14 -0
- package/node_modules/ansi-regex/license +9 -0
- package/node_modules/ansi-regex/package.json +57 -0
- package/node_modules/ansi-regex/readme.md +87 -0
- package/node_modules/ansi-styles/index.js +165 -0
- package/node_modules/ansi-styles/license +9 -0
- package/node_modules/ansi-styles/package.json +60 -0
- package/node_modules/ansi-styles/readme.md +147 -0
- package/node_modules/base-x/LICENSE.md +22 -0
- package/node_modules/base-x/README.md +67 -0
- package/node_modules/base-x/package.json +53 -0
- package/node_modules/base-x/src/index.d.ts +10 -0
- package/node_modules/base-x/src/index.js +123 -0
- package/node_modules/blakejs/.npmignore +1 -0
- package/node_modules/blakejs/.travis.yml +3 -0
- package/node_modules/blakejs/README.md +112 -0
- package/node_modules/blakejs/blake2b.js +273 -0
- package/node_modules/blakejs/blake2s.js +190 -0
- package/node_modules/blakejs/generated_test_vectors.txt +100 -0
- package/node_modules/blakejs/index.js +15 -0
- package/node_modules/blakejs/package.json +27 -0
- package/node_modules/blakejs/test_blake2b.js +88 -0
- package/node_modules/blakejs/test_blake2s.js +80 -0
- package/node_modules/blakejs/util.js +81 -0
- package/node_modules/bn.js/README.md +221 -0
- package/node_modules/bn.js/lib/bn.js +3433 -0
- package/node_modules/bn.js/package.json +40 -0
- package/node_modules/bn.js/util/genCombMulTo.js +65 -0
- package/node_modules/bn.js/util/genCombMulTo10.js +65 -0
- package/node_modules/brorand/.npmignore +2 -0
- package/node_modules/brorand/README.md +26 -0
- package/node_modules/brorand/index.js +65 -0
- package/node_modules/brorand/package.json +35 -0
- package/node_modules/brorand/test/api-test.js +8 -0
- package/node_modules/browserify-aes/.travis.yml +15 -0
- package/node_modules/browserify-aes/LICENSE +21 -0
- package/node_modules/browserify-aes/README.md +19 -0
- package/node_modules/browserify-aes/aes.js +228 -0
- package/node_modules/browserify-aes/authCipher.js +117 -0
- package/node_modules/browserify-aes/browser.js +13 -0
- package/node_modules/browserify-aes/decrypter.js +124 -0
- package/node_modules/browserify-aes/encrypter.js +114 -0
- package/node_modules/browserify-aes/ghash.js +89 -0
- package/node_modules/browserify-aes/incr32.js +15 -0
- package/node_modules/browserify-aes/index.js +7 -0
- package/node_modules/browserify-aes/modes/cbc.js +17 -0
- package/node_modules/browserify-aes/modes/cfb.js +33 -0
- package/node_modules/browserify-aes/modes/cfb1.js +42 -0
- package/node_modules/browserify-aes/modes/cfb8.js +25 -0
- package/node_modules/browserify-aes/modes/ctr.js +30 -0
- package/node_modules/browserify-aes/modes/ecb.js +7 -0
- package/node_modules/browserify-aes/modes/index.js +18 -0
- package/node_modules/browserify-aes/modes/list.json +191 -0
- package/node_modules/browserify-aes/modes/ofb.js +16 -0
- package/node_modules/browserify-aes/package.json +47 -0
- package/node_modules/browserify-aes/streamCipher.js +27 -0
- package/node_modules/bs58/README.md +71 -0
- package/node_modules/bs58/index.js +4 -0
- package/node_modules/bs58/package.json +41 -0
- package/node_modules/bs58check/LICENSE +21 -0
- package/node_modules/bs58check/README.md +27 -0
- package/node_modules/bs58check/base.js +50 -0
- package/node_modules/bs58check/index.js +12 -0
- package/node_modules/bs58check/package.json +56 -0
- package/node_modules/buffer-from/LICENSE +21 -0
- package/node_modules/buffer-from/index.js +69 -0
- package/node_modules/buffer-from/package.json +23 -0
- package/node_modules/buffer-from/readme.md +69 -0
- package/node_modules/buffer-xor/.npmignore +1 -0
- package/node_modules/buffer-xor/.travis.yml +9 -0
- package/node_modules/buffer-xor/LICENSE +21 -0
- package/node_modules/buffer-xor/README.md +41 -0
- package/node_modules/buffer-xor/index.js +10 -0
- package/node_modules/buffer-xor/inline.js +1 -0
- package/node_modules/buffer-xor/inplace.js +9 -0
- package/node_modules/buffer-xor/package.json +41 -0
- package/node_modules/buffer-xor/test/fixtures.json +23 -0
- package/node_modules/buffer-xor/test/index.js +38 -0
- package/node_modules/camelcase/index.d.ts +63 -0
- package/node_modules/camelcase/index.js +76 -0
- package/node_modules/camelcase/license +9 -0
- package/node_modules/camelcase/package.json +47 -0
- package/node_modules/camelcase/readme.md +99 -0
- package/node_modules/cipher-base/.eslintrc +3 -0
- package/node_modules/cipher-base/.npmignore +1 -0
- package/node_modules/cipher-base/.travis.yml +6 -0
- package/node_modules/cipher-base/LICENSE +21 -0
- package/node_modules/cipher-base/README.md +17 -0
- package/node_modules/cipher-base/index.js +99 -0
- package/node_modules/cipher-base/package.json +36 -0
- package/node_modules/cipher-base/test.js +111 -0
- package/node_modules/cliui/LICENSE.txt +14 -0
- package/node_modules/cliui/README.md +115 -0
- package/node_modules/cliui/index.js +324 -0
- package/node_modules/cliui/package.json +71 -0
- package/node_modules/color-convert/LICENSE +21 -0
- package/node_modules/color-convert/README.md +68 -0
- package/node_modules/color-convert/conversions.js +868 -0
- package/node_modules/color-convert/index.js +78 -0
- package/node_modules/color-convert/package.json +50 -0
- package/node_modules/color-convert/route.js +97 -0
- package/node_modules/color-name/.eslintrc.json +43 -0
- package/node_modules/color-name/.npmignore +107 -0
- package/node_modules/color-name/LICENSE +8 -0
- package/node_modules/color-name/README.md +11 -0
- package/node_modules/color-name/index.js +152 -0
- package/node_modules/color-name/package.json +29 -0
- package/node_modules/color-name/test.js +7 -0
- package/node_modules/create-hash/.travis.yml +17 -0
- package/node_modules/create-hash/LICENSE +21 -0
- package/node_modules/create-hash/README.md +19 -0
- package/node_modules/create-hash/browser.js +30 -0
- package/node_modules/create-hash/index.js +1 -0
- package/node_modules/create-hash/md5.js +5 -0
- package/node_modules/create-hash/package.json +43 -0
- package/node_modules/create-hash/test.js +41 -0
- package/node_modules/create-hmac/LICENSE +21 -0
- package/node_modules/create-hmac/README.md +20 -0
- package/node_modules/create-hmac/browser.js +62 -0
- package/node_modules/create-hmac/index.js +1 -0
- package/node_modules/create-hmac/legacy.js +46 -0
- package/node_modules/create-hmac/package.json +49 -0
- package/node_modules/cross-spawn/LICENSE +21 -0
- package/node_modules/cross-spawn/README.md +94 -0
- package/node_modules/cross-spawn/index.js +39 -0
- package/node_modules/cross-spawn/lib/enoent.js +59 -0
- package/node_modules/cross-spawn/lib/parse.js +125 -0
- package/node_modules/cross-spawn/lib/util/escape.js +45 -0
- package/node_modules/cross-spawn/lib/util/readShebang.js +32 -0
- package/node_modules/cross-spawn/lib/util/resolveCommand.js +47 -0
- package/node_modules/cross-spawn/package.json +80 -0
- package/node_modules/decamelize/index.js +13 -0
- package/node_modules/decamelize/license +21 -0
- package/node_modules/decamelize/package.json +42 -0
- package/node_modules/decamelize/readme.md +48 -0
- package/node_modules/elliptic/README.md +238 -0
- package/node_modules/elliptic/lib/elliptic/curve/base.js +376 -0
- package/node_modules/elliptic/lib/elliptic/curve/edwards.js +432 -0
- package/node_modules/elliptic/lib/elliptic/curve/index.js +8 -0
- package/node_modules/elliptic/lib/elliptic/curve/mont.js +178 -0
- package/node_modules/elliptic/lib/elliptic/curve/short.js +937 -0
- package/node_modules/elliptic/lib/elliptic/curves.js +206 -0
- package/node_modules/elliptic/lib/elliptic/ec/index.js +241 -0
- package/node_modules/elliptic/lib/elliptic/ec/key.js +118 -0
- package/node_modules/elliptic/lib/elliptic/ec/signature.js +166 -0
- package/node_modules/elliptic/lib/elliptic/eddsa/index.js +118 -0
- package/node_modules/elliptic/lib/elliptic/eddsa/key.js +95 -0
- package/node_modules/elliptic/lib/elliptic/eddsa/signature.js +65 -0
- package/node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js +780 -0
- package/node_modules/elliptic/lib/elliptic/utils.js +119 -0
- package/node_modules/elliptic/lib/elliptic.js +13 -0
- package/node_modules/elliptic/package.json +62 -0
- package/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
- package/node_modules/emoji-regex/README.md +73 -0
- package/node_modules/emoji-regex/es2015/index.js +6 -0
- package/node_modules/emoji-regex/es2015/text.js +6 -0
- package/node_modules/emoji-regex/index.d.ts +5 -0
- package/node_modules/emoji-regex/index.js +6 -0
- package/node_modules/emoji-regex/package.json +55 -0
- package/node_modules/emoji-regex/text.js +6 -0
- package/node_modules/end-of-stream/LICENSE +21 -0
- package/node_modules/end-of-stream/README.md +54 -0
- package/node_modules/end-of-stream/index.js +94 -0
- package/node_modules/end-of-stream/package.json +41 -0
- package/node_modules/ethereum-cryptography/LICENSE +26 -0
- package/node_modules/ethereum-cryptography/README.md +560 -0
- package/node_modules/ethereum-cryptography/aes.d.ts +4 -0
- package/node_modules/ethereum-cryptography/aes.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/aes.js +38 -0
- package/node_modules/ethereum-cryptography/aes.js.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/index.d.ts +8 -0
- package/node_modules/ethereum-cryptography/bip39/index.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/index.js +71 -0
- package/node_modules/ethereum-cryptography/bip39/index.js.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/czech.d.ts +2 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/czech.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/czech.js +2053 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/czech.js.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/english.d.ts +2 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/english.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/english.js +2053 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/english.js.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/french.d.ts +2 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/french.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/french.js +2053 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/french.js.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/italian.d.ts +2 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/italian.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/italian.js +2053 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/italian.js.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/japanese.d.ts +2 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/japanese.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/japanese.js +2053 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/japanese.js.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/korean.d.ts +2 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/korean.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/korean.js +2053 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/korean.js.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/simplified-chinese.d.ts +2 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/simplified-chinese.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/simplified-chinese.js +2053 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/simplified-chinese.js.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/spanish.d.ts +2 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/spanish.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/spanish.js +2053 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/spanish.js.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/traditional-chinese.d.ts +2 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/traditional-chinese.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/traditional-chinese.js +2053 -0
- package/node_modules/ethereum-cryptography/bip39/wordlists/traditional-chinese.js.map +1 -0
- package/node_modules/ethereum-cryptography/blake2b.d.ts +3 -0
- package/node_modules/ethereum-cryptography/blake2b.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/blake2b.js +12 -0
- package/node_modules/ethereum-cryptography/blake2b.js.map +1 -0
- package/node_modules/ethereum-cryptography/hash-utils.d.ts +4 -0
- package/node_modules/ethereum-cryptography/hash-utils.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/hash-utils.js +11 -0
- package/node_modules/ethereum-cryptography/hash-utils.js.map +1 -0
- package/node_modules/ethereum-cryptography/hdkey.d.ts +3 -0
- package/node_modules/ethereum-cryptography/hdkey.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/hdkey.js +5 -0
- package/node_modules/ethereum-cryptography/hdkey.js.map +1 -0
- package/node_modules/ethereum-cryptography/index.d.ts +1 -0
- package/node_modules/ethereum-cryptography/index.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/index.js +3 -0
- package/node_modules/ethereum-cryptography/index.js.map +1 -0
- package/node_modules/ethereum-cryptography/keccak.d.ts +6 -0
- package/node_modules/ethereum-cryptography/keccak.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/keccak.js +17 -0
- package/node_modules/ethereum-cryptography/keccak.js.map +1 -0
- package/node_modules/ethereum-cryptography/package.json +131 -0
- package/node_modules/ethereum-cryptography/pbkdf2.d.ts +4 -0
- package/node_modules/ethereum-cryptography/pbkdf2.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/pbkdf2.js +27 -0
- package/node_modules/ethereum-cryptography/pbkdf2.js.map +1 -0
- package/node_modules/ethereum-cryptography/pure/hdkey.d.ts +37 -0
- package/node_modules/ethereum-cryptography/pure/hdkey.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/pure/hdkey.js +5 -0
- package/node_modules/ethereum-cryptography/pure/hdkey.js.map +1 -0
- package/node_modules/ethereum-cryptography/pure/ripemd160.d.ts +3 -0
- package/node_modules/ethereum-cryptography/pure/ripemd160.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/pure/ripemd160.js +6 -0
- package/node_modules/ethereum-cryptography/pure/ripemd160.js.map +1 -0
- package/node_modules/ethereum-cryptography/pure/sha256.d.ts +3 -0
- package/node_modules/ethereum-cryptography/pure/sha256.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/pure/sha256.js +6 -0
- package/node_modules/ethereum-cryptography/pure/sha256.js.map +1 -0
- package/node_modules/ethereum-cryptography/pure/shims/hdkey-crypto.d.ts +13 -0
- package/node_modules/ethereum-cryptography/pure/shims/hdkey-crypto.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/pure/shims/hdkey-crypto.js +37 -0
- package/node_modules/ethereum-cryptography/pure/shims/hdkey-crypto.js.map +1 -0
- package/node_modules/ethereum-cryptography/pure/shims/hdkey-secp256k1v3.d.ts +2 -0
- package/node_modules/ethereum-cryptography/pure/shims/hdkey-secp256k1v3.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/pure/shims/hdkey-secp256k1v3.js +7 -0
- package/node_modules/ethereum-cryptography/pure/shims/hdkey-secp256k1v3.js.map +1 -0
- package/node_modules/ethereum-cryptography/pure/vendor/hdkey-without-crypto.js +255 -0
- package/node_modules/ethereum-cryptography/random.d.ts +4 -0
- package/node_modules/ethereum-cryptography/random.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/random.js +20 -0
- package/node_modules/ethereum-cryptography/random.js.map +1 -0
- package/node_modules/ethereum-cryptography/ripemd160.d.ts +3 -0
- package/node_modules/ethereum-cryptography/ripemd160.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/ripemd160.js +11 -0
- package/node_modules/ethereum-cryptography/ripemd160.js.map +1 -0
- package/node_modules/ethereum-cryptography/scrypt.d.ts +5 -0
- package/node_modules/ethereum-cryptography/scrypt.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/scrypt.js +59 -0
- package/node_modules/ethereum-cryptography/scrypt.js.map +1 -0
- package/node_modules/ethereum-cryptography/secp256k1.d.ts +4 -0
- package/node_modules/ethereum-cryptography/secp256k1.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/secp256k1.js +75 -0
- package/node_modules/ethereum-cryptography/secp256k1.js.map +1 -0
- package/node_modules/ethereum-cryptography/sha256.d.ts +3 -0
- package/node_modules/ethereum-cryptography/sha256.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/sha256.js +9 -0
- package/node_modules/ethereum-cryptography/sha256.js.map +1 -0
- package/node_modules/ethereum-cryptography/shims/hdkey-crypto.d.ts +2 -0
- package/node_modules/ethereum-cryptography/shims/hdkey-crypto.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/shims/hdkey-crypto.js +7 -0
- package/node_modules/ethereum-cryptography/shims/hdkey-crypto.js.map +1 -0
- package/node_modules/ethereum-cryptography/shims/hdkey-secp256k1v3.d.ts +13 -0
- package/node_modules/ethereum-cryptography/shims/hdkey-secp256k1v3.d.ts.map +1 -0
- package/node_modules/ethereum-cryptography/shims/hdkey-secp256k1v3.js +47 -0
- package/node_modules/ethereum-cryptography/shims/hdkey-secp256k1v3.js.map +1 -0
- package/node_modules/ethereum-cryptography/src/aes.ts +52 -0
- package/node_modules/ethereum-cryptography/src/bip39/index.ts +40 -0
- package/node_modules/ethereum-cryptography/src/bip39/wordlists/czech.ts +2050 -0
- package/node_modules/ethereum-cryptography/src/bip39/wordlists/english.ts +2050 -0
- package/node_modules/ethereum-cryptography/src/bip39/wordlists/french.ts +2050 -0
- package/node_modules/ethereum-cryptography/src/bip39/wordlists/italian.ts +2050 -0
- package/node_modules/ethereum-cryptography/src/bip39/wordlists/japanese.ts +2050 -0
- package/node_modules/ethereum-cryptography/src/bip39/wordlists/korean.ts +2050 -0
- package/node_modules/ethereum-cryptography/src/bip39/wordlists/simplified-chinese.ts +2050 -0
- package/node_modules/ethereum-cryptography/src/bip39/wordlists/spanish.ts +2050 -0
- package/node_modules/ethereum-cryptography/src/bip39/wordlists/traditional-chinese.ts +2050 -0
- package/node_modules/ethereum-cryptography/src/blake2b.ts +9 -0
- package/node_modules/ethereum-cryptography/src/hash-utils.ts +11 -0
- package/node_modules/ethereum-cryptography/src/hdkey.ts +5 -0
- package/node_modules/ethereum-cryptography/src/index.ts +3 -0
- package/node_modules/ethereum-cryptography/src/keccak.ts +19 -0
- package/node_modules/ethereum-cryptography/src/pbkdf2.ts +37 -0
- package/node_modules/ethereum-cryptography/src/pure/hdkey.ts +36 -0
- package/node_modules/ethereum-cryptography/src/pure/ripemd160.ts +5 -0
- package/node_modules/ethereum-cryptography/src/pure/sha256.ts +5 -0
- package/node_modules/ethereum-cryptography/src/pure/shims/hdkey-crypto.ts +42 -0
- package/node_modules/ethereum-cryptography/src/pure/shims/hdkey-secp256k1v3.ts +1 -0
- package/node_modules/ethereum-cryptography/src/pure/vendor/hdkey-without-crypto.js +255 -0
- package/node_modules/ethereum-cryptography/src/random.ts +18 -0
- package/node_modules/ethereum-cryptography/src/ripemd160.ts +7 -0
- package/node_modules/ethereum-cryptography/src/scrypt.ts +24 -0
- package/node_modules/ethereum-cryptography/src/secp256k1.ts +24 -0
- package/node_modules/ethereum-cryptography/src/sha256.ts +5 -0
- package/node_modules/ethereum-cryptography/src/shims/hdkey-crypto.ts +1 -0
- package/node_modules/ethereum-cryptography/src/shims/hdkey-secp256k1v3.ts +49 -0
- package/node_modules/ethereum-cryptography/src/vendor/bip39-without-wordlists.js +206 -0
- package/node_modules/ethereum-cryptography/src/vendor/hdkey-without-crypto.js +255 -0
- package/node_modules/ethereum-cryptography/vendor/bip39-without-wordlists.js +206 -0
- package/node_modules/ethereum-cryptography/vendor/hdkey-without-crypto.js +255 -0
- package/node_modules/ethereumjs-util/LICENSE +373 -0
- package/node_modules/ethereumjs-util/README.md +32 -0
- package/node_modules/ethereumjs-util/dist/account.d.ts +80 -0
- package/node_modules/ethereumjs-util/dist/account.js +168 -0
- package/node_modules/ethereumjs-util/dist/account.js.map +1 -0
- package/node_modules/ethereumjs-util/dist/bytes.d.ts +68 -0
- package/node_modules/ethereumjs-util/dist/bytes.js +158 -0
- package/node_modules/ethereumjs-util/dist/bytes.js.map +1 -0
- package/node_modules/ethereumjs-util/dist/constants.d.ts +34 -0
- package/node_modules/ethereumjs-util/dist/constants.js +37 -0
- package/node_modules/ethereumjs-util/dist/constants.js.map +1 -0
- package/node_modules/ethereumjs-util/dist/hash.d.ts +30 -0
- package/node_modules/ethereumjs-util/dist/hash.js +84 -0
- package/node_modules/ethereumjs-util/dist/hash.js.map +1 -0
- package/node_modules/ethereumjs-util/dist/index.d.ts +39 -0
- package/node_modules/ethereumjs-util/dist/index.js +46 -0
- package/node_modules/ethereumjs-util/dist/index.js.map +1 -0
- package/node_modules/ethereumjs-util/dist/object.d.ts +12 -0
- package/node_modules/ethereumjs-util/dist/object.js +106 -0
- package/node_modules/ethereumjs-util/dist/object.js.map +1 -0
- package/node_modules/ethereumjs-util/dist/secp256k1v3-adapter.d.ts +178 -0
- package/node_modules/ethereumjs-util/dist/secp256k1v3-adapter.js +300 -0
- package/node_modules/ethereumjs-util/dist/secp256k1v3-adapter.js.map +1 -0
- package/node_modules/ethereumjs-util/dist/secp256k1v3-lib/der.d.ts +1 -0
- package/node_modules/ethereumjs-util/dist/secp256k1v3-lib/der.js +634 -0
- package/node_modules/ethereumjs-util/dist/secp256k1v3-lib/der.js.map +1 -0
- package/node_modules/ethereumjs-util/dist/secp256k1v3-lib/index.d.ts +5 -0
- package/node_modules/ethereumjs-util/dist/secp256k1v3-lib/index.js +61 -0
- package/node_modules/ethereumjs-util/dist/secp256k1v3-lib/index.js.map +1 -0
- package/node_modules/ethereumjs-util/dist/signature.d.ts +37 -0
- package/node_modules/ethereumjs-util/dist/signature.js +107 -0
- package/node_modules/ethereumjs-util/dist/signature.js.map +1 -0
- package/node_modules/ethereumjs-util/package.json +131 -0
- package/node_modules/ethjs-util/LICENSE +21 -0
- package/node_modules/ethjs-util/README.md +143 -0
- package/node_modules/ethjs-util/dist/ethjs-util.js +2420 -0
- package/node_modules/ethjs-util/dist/ethjs-util.js.map +1 -0
- package/node_modules/ethjs-util/dist/ethjs-util.min.js +1 -0
- package/node_modules/ethjs-util/internals/webpack/webpack.config.js +58 -0
- package/node_modules/ethjs-util/lib/index.js +220 -0
- package/node_modules/ethjs-util/lib/tests/test.index.js +357 -0
- package/node_modules/ethjs-util/package.json +229 -0
- package/node_modules/ethjs-util/src/index.js +203 -0
- package/node_modules/ethjs-util/src/tests/test.index.js +382 -0
- package/node_modules/evp_bytestokey/LICENSE +21 -0
- package/node_modules/evp_bytestokey/README.md +51 -0
- package/node_modules/evp_bytestokey/index.js +45 -0
- package/node_modules/evp_bytestokey/package.json +49 -0
- package/node_modules/execa/index.js +361 -0
- package/node_modules/execa/lib/errname.js +39 -0
- package/node_modules/execa/lib/stdio.js +41 -0
- package/node_modules/execa/license +9 -0
- package/node_modules/execa/package.json +73 -0
- package/node_modules/execa/readme.md +327 -0
- package/node_modules/find-up/index.js +46 -0
- package/node_modules/find-up/license +9 -0
- package/node_modules/find-up/package.json +54 -0
- package/node_modules/find-up/readme.md +87 -0
- package/node_modules/get-caller-file/LICENSE.md +6 -0
- package/node_modules/get-caller-file/README.md +41 -0
- package/node_modules/get-caller-file/index.d.ts +2 -0
- package/node_modules/get-caller-file/index.js +22 -0
- package/node_modules/get-caller-file/index.js.map +1 -0
- package/node_modules/get-caller-file/package.json +46 -0
- package/node_modules/get-stream/buffer-stream.js +51 -0
- package/node_modules/get-stream/index.js +50 -0
- package/node_modules/get-stream/license +9 -0
- package/node_modules/get-stream/package.json +50 -0
- package/node_modules/get-stream/readme.md +123 -0
- package/node_modules/hash-base/LICENSE +21 -0
- package/node_modules/hash-base/README.md +48 -0
- package/node_modules/hash-base/index.js +95 -0
- package/node_modules/hash-base/package.json +46 -0
- package/node_modules/hash.js/.eslintrc.js +41 -0
- package/node_modules/hash.js/.travis.yml +10 -0
- package/node_modules/hash.js/README.md +48 -0
- package/node_modules/hash.js/lib/hash/common.js +92 -0
- package/node_modules/hash.js/lib/hash/hmac.js +47 -0
- package/node_modules/hash.js/lib/hash/ripemd.js +146 -0
- package/node_modules/hash.js/lib/hash/sha/1.js +74 -0
- package/node_modules/hash.js/lib/hash/sha/224.js +30 -0
- package/node_modules/hash.js/lib/hash/sha/256.js +105 -0
- package/node_modules/hash.js/lib/hash/sha/384.js +35 -0
- package/node_modules/hash.js/lib/hash/sha/512.js +330 -0
- package/node_modules/hash.js/lib/hash/sha/common.js +49 -0
- package/node_modules/hash.js/lib/hash/sha.js +7 -0
- package/node_modules/hash.js/lib/hash/utils.js +278 -0
- package/node_modules/hash.js/lib/hash.d.ts +106 -0
- package/node_modules/hash.js/lib/hash.js +15 -0
- package/node_modules/hash.js/package.json +39 -0
- package/node_modules/hash.js/test/hash-test.js +140 -0
- package/node_modules/hash.js/test/hmac-test.js +62 -0
- package/node_modules/hmac-drbg/.npmignore +2 -0
- package/node_modules/hmac-drbg/.travis.yml +11 -0
- package/node_modules/hmac-drbg/README.md +48 -0
- package/node_modules/hmac-drbg/lib/hmac-drbg.js +113 -0
- package/node_modules/hmac-drbg/package.json +36 -0
- package/node_modules/hmac-drbg/test/drbg-test.js +91 -0
- package/node_modules/hmac-drbg/test/fixtures/hmac-drbg-nist.json +332 -0
- package/node_modules/inherits/LICENSE +16 -0
- package/node_modules/inherits/README.md +42 -0
- package/node_modules/inherits/inherits.js +9 -0
- package/node_modules/inherits/inherits_browser.js +27 -0
- package/node_modules/inherits/package.json +33 -0
- package/node_modules/invert-kv/index.js +15 -0
- package/node_modules/invert-kv/license +9 -0
- package/node_modules/invert-kv/package.json +36 -0
- package/node_modules/invert-kv/readme.md +25 -0
- package/node_modules/is-fullwidth-code-point/index.js +46 -0
- package/node_modules/is-fullwidth-code-point/license +21 -0
- package/node_modules/is-fullwidth-code-point/package.json +49 -0
- package/node_modules/is-fullwidth-code-point/readme.md +39 -0
- package/node_modules/is-hex-prefixed/.editorconfig +7 -0
- package/node_modules/is-hex-prefixed/.gitattributes +106 -0
- package/node_modules/is-hex-prefixed/.npmignore +8 -0
- package/node_modules/is-hex-prefixed/.travis.yml +5 -0
- package/node_modules/is-hex-prefixed/CHANGELOG.md +7 -0
- package/node_modules/is-hex-prefixed/LICENSE +21 -0
- package/node_modules/is-hex-prefixed/README.md +101 -0
- package/node_modules/is-hex-prefixed/package.json +43 -0
- package/node_modules/is-hex-prefixed/src/index.js +13 -0
- package/node_modules/is-hex-prefixed/src/tests/test.index.js +66 -0
- package/node_modules/is-stream/index.js +21 -0
- package/node_modules/is-stream/license +21 -0
- package/node_modules/is-stream/package.json +42 -0
- package/node_modules/is-stream/readme.md +42 -0
- package/node_modules/isexe/.npmignore +2 -0
- package/node_modules/isexe/LICENSE +15 -0
- package/node_modules/isexe/README.md +51 -0
- package/node_modules/isexe/index.js +57 -0
- package/node_modules/isexe/mode.js +41 -0
- package/node_modules/isexe/package.json +35 -0
- package/node_modules/isexe/test/basic.js +221 -0
- package/node_modules/isexe/windows.js +42 -0
- package/node_modules/keccak/LICENSE +21 -0
- package/node_modules/keccak/README.md +64 -0
- package/node_modules/keccak/binding.gyp +78 -0
- package/node_modules/keccak/bindings.js +1 -0
- package/node_modules/keccak/index.js +5 -0
- package/node_modules/keccak/js.js +1 -0
- package/node_modules/keccak/lib/api/index.js +27 -0
- package/node_modules/keccak/lib/api/keccak.js +77 -0
- package/node_modules/keccak/lib/api/shake.js +68 -0
- package/node_modules/keccak/lib/keccak-state-reference.js +143 -0
- package/node_modules/keccak/lib/keccak-state-unroll.js +186 -0
- package/node_modules/keccak/lib/keccak.js +68 -0
- package/node_modules/keccak/package.json +41 -0
- package/node_modules/keccak/prebuilds/darwin-x64/node.napi.node +0 -0
- package/node_modules/keccak/prebuilds/linux-x64/node.napi.glibc.node +0 -0
- package/node_modules/keccak/prebuilds/linux-x64/node.napi.musl.node +0 -0
- package/node_modules/keccak/prebuilds/win32-x64/node.napi.node +0 -0
- package/node_modules/keccak/src/README.md +28 -0
- package/node_modules/keccak/src/addon.cc +98 -0
- package/node_modules/keccak/src/libkeccak-32/KeccakP-1600-SnP.h +38 -0
- package/node_modules/keccak/src/libkeccak-32/KeccakP-1600-inplace32BI.c +1162 -0
- package/node_modules/keccak/src/libkeccak-32/KeccakSponge-common.h +35 -0
- package/node_modules/keccak/src/libkeccak-32/KeccakSponge.inc +311 -0
- package/node_modules/keccak/src/libkeccak-32/KeccakSpongeWidth1600.c +54 -0
- package/node_modules/keccak/src/libkeccak-32/KeccakSpongeWidth1600.h +31 -0
- package/node_modules/keccak/src/libkeccak-32/SnP-Relaned.h +140 -0
- package/node_modules/keccak/src/libkeccak-32/align.h +32 -0
- package/node_modules/keccak/src/libkeccak-32/brg_endian.h +143 -0
- package/node_modules/keccak/src/libkeccak-64/KeccakP-1600-64.macros +745 -0
- package/node_modules/keccak/src/libkeccak-64/KeccakP-1600-SnP.h +51 -0
- package/node_modules/keccak/src/libkeccak-64/KeccakP-1600-opt64-config.h +6 -0
- package/node_modules/keccak/src/libkeccak-64/KeccakP-1600-opt64.c +564 -0
- package/node_modules/keccak/src/libkeccak-64/KeccakP-1600-unrolling.macros +302 -0
- package/node_modules/keccak/src/libkeccak-64/KeccakSponge-common.h +35 -0
- package/node_modules/keccak/src/libkeccak-64/KeccakSponge.inc +311 -0
- package/node_modules/keccak/src/libkeccak-64/KeccakSpongeWidth1600.c +54 -0
- package/node_modules/keccak/src/libkeccak-64/KeccakSpongeWidth1600.h +31 -0
- package/node_modules/keccak/src/libkeccak-64/SnP-Relaned.h +140 -0
- package/node_modules/keccak/src/libkeccak-64/align.h +32 -0
- package/node_modules/keccak/src/libkeccak-64/brg_endian.h +143 -0
- package/node_modules/lcid/index.js +23 -0
- package/node_modules/lcid/lcid.json +203 -0
- package/node_modules/lcid/license +9 -0
- package/node_modules/lcid/package.json +51 -0
- package/node_modules/lcid/readme.md +35 -0
- package/node_modules/locate-path/index.js +24 -0
- package/node_modules/locate-path/license +9 -0
- package/node_modules/locate-path/package.json +48 -0
- package/node_modules/locate-path/readme.md +99 -0
- package/node_modules/map-age-cleaner/dist/index.d.ts +20 -0
- package/node_modules/map-age-cleaner/dist/index.js +92 -0
- package/node_modules/map-age-cleaner/license +9 -0
- package/node_modules/map-age-cleaner/package.json +63 -0
- package/node_modules/map-age-cleaner/readme.md +67 -0
- package/node_modules/md5.js/LICENSE +21 -0
- package/node_modules/md5.js/README.md +29 -0
- package/node_modules/md5.js/index.js +146 -0
- package/node_modules/md5.js/package.json +42 -0
- package/node_modules/mem/index.d.ts +96 -0
- package/node_modules/mem/index.js +88 -0
- package/node_modules/mem/license +9 -0
- package/node_modules/mem/package.json +50 -0
- package/node_modules/mem/readme.md +167 -0
- package/node_modules/mimic-fn/index.d.ts +54 -0
- package/node_modules/mimic-fn/index.js +13 -0
- package/node_modules/mimic-fn/license +9 -0
- package/node_modules/mimic-fn/package.json +46 -0
- package/node_modules/mimic-fn/readme.md +69 -0
- package/node_modules/minimalistic-assert/LICENSE +13 -0
- package/node_modules/minimalistic-assert/index.js +11 -0
- package/node_modules/minimalistic-assert/package.json +23 -0
- package/node_modules/minimalistic-assert/readme.md +4 -0
- package/node_modules/minimalistic-crypto-utils/.npmignore +2 -0
- package/node_modules/minimalistic-crypto-utils/.travis.yml +11 -0
- package/node_modules/minimalistic-crypto-utils/README.md +47 -0
- package/node_modules/minimalistic-crypto-utils/lib/utils.js +58 -0
- package/node_modules/minimalistic-crypto-utils/package.json +31 -0
- package/node_modules/minimalistic-crypto-utils/test/utils-test.js +28 -0
- package/node_modules/nice-try/LICENSE +21 -0
- package/node_modules/nice-try/README.md +32 -0
- package/node_modules/nice-try/package.json +37 -0
- package/node_modules/nice-try/src/index.js +12 -0
- package/node_modules/node-addon-api/.editorconfig +8 -0
- package/node_modules/node-addon-api/.travis.yml +62 -0
- package/node_modules/node-addon-api/CHANGELOG.md +412 -0
- package/node_modules/node-addon-api/CODE_OF_CONDUCT.md +4 -0
- package/node_modules/node-addon-api/CONTRIBUTING.md +66 -0
- package/node_modules/node-addon-api/LICENSE.md +13 -0
- package/node_modules/node-addon-api/README.md +203 -0
- package/node_modules/node-addon-api/appveyor.yml +48 -0
- package/node_modules/node-addon-api/doc/Doxyfile +2450 -0
- package/node_modules/node-addon-api/doc/array_buffer.md +129 -0
- package/node_modules/node-addon-api/doc/async_context.md +86 -0
- package/node_modules/node-addon-api/doc/async_operations.md +31 -0
- package/node_modules/node-addon-api/doc/async_progress_worker.md +344 -0
- package/node_modules/node-addon-api/doc/async_worker.md +398 -0
- package/node_modules/node-addon-api/doc/basic_types.md +423 -0
- package/node_modules/node-addon-api/doc/bigint.md +92 -0
- package/node_modules/node-addon-api/doc/boolean.md +64 -0
- package/node_modules/node-addon-api/doc/buffer.md +140 -0
- package/node_modules/node-addon-api/doc/callback_scope.md +54 -0
- package/node_modules/node-addon-api/doc/callbackinfo.md +97 -0
- package/node_modules/node-addon-api/doc/checker-tool.md +32 -0
- package/node_modules/node-addon-api/doc/class_property_descriptor.md +117 -0
- package/node_modules/node-addon-api/doc/cmake-js.md +68 -0
- package/node_modules/node-addon-api/doc/conversion-tool.md +28 -0
- package/node_modules/node-addon-api/doc/creating_a_release.md +62 -0
- package/node_modules/node-addon-api/doc/dataview.md +244 -0
- package/node_modules/node-addon-api/doc/date.md +68 -0
- package/node_modules/node-addon-api/doc/env.md +63 -0
- package/node_modules/node-addon-api/doc/error.md +115 -0
- package/node_modules/node-addon-api/doc/error_handling.md +186 -0
- package/node_modules/node-addon-api/doc/escapable_handle_scope.md +82 -0
- package/node_modules/node-addon-api/doc/external.md +59 -0
- package/node_modules/node-addon-api/doc/function.md +294 -0
- package/node_modules/node-addon-api/doc/function_reference.md +238 -0
- package/node_modules/node-addon-api/doc/generator.md +13 -0
- package/node_modules/node-addon-api/doc/handle_scope.md +65 -0
- package/node_modules/node-addon-api/doc/memory_management.md +27 -0
- package/node_modules/node-addon-api/doc/node-gyp.md +82 -0
- package/node_modules/node-addon-api/doc/number.md +163 -0
- package/node_modules/node-addon-api/doc/object.md +236 -0
- package/node_modules/node-addon-api/doc/object_lifetime_management.md +83 -0
- package/node_modules/node-addon-api/doc/object_reference.md +117 -0
- package/node_modules/node-addon-api/doc/object_wrap.md +557 -0
- package/node_modules/node-addon-api/doc/prebuild_tools.md +16 -0
- package/node_modules/node-addon-api/doc/promises.md +74 -0
- package/node_modules/node-addon-api/doc/property_descriptor.md +231 -0
- package/node_modules/node-addon-api/doc/range_error.md +59 -0
- package/node_modules/node-addon-api/doc/reference.md +111 -0
- package/node_modules/node-addon-api/doc/setup.md +82 -0
- package/node_modules/node-addon-api/doc/string.md +89 -0
- package/node_modules/node-addon-api/doc/symbol.md +44 -0
- package/node_modules/node-addon-api/doc/threadsafe_function.md +320 -0
- package/node_modules/node-addon-api/doc/type_error.md +59 -0
- package/node_modules/node-addon-api/doc/typed_array.md +74 -0
- package/node_modules/node-addon-api/doc/typed_array_of.md +133 -0
- package/node_modules/node-addon-api/doc/value.md +278 -0
- package/node_modules/node-addon-api/doc/version_management.md +43 -0
- package/node_modules/node-addon-api/doc/working_with_javascript_values.md +14 -0
- package/node_modules/node-addon-api/external-napi/node_api.h +7 -0
- package/node_modules/node-addon-api/index.js +45 -0
- package/node_modules/node-addon-api/napi-inl.deprecated.h +192 -0
- package/node_modules/node-addon-api/napi-inl.h +4412 -0
- package/node_modules/node-addon-api/napi.h +2173 -0
- package/node_modules/node-addon-api/package.json +248 -0
- package/node_modules/node-addon-api/src/node_api.cc +3655 -0
- package/node_modules/node-addon-api/src/node_api.gyp +21 -0
- package/node_modules/node-addon-api/src/node_api.h +588 -0
- package/node_modules/node-addon-api/src/node_api_types.h +115 -0
- package/node_modules/node-addon-api/src/node_internals.cc +142 -0
- package/node_modules/node-addon-api/src/node_internals.h +157 -0
- package/node_modules/node-addon-api/src/nothing.c +0 -0
- package/node_modules/node-addon-api/src/util-inl.h +38 -0
- package/node_modules/node-addon-api/src/util.h +7 -0
- package/node_modules/node-addon-api/tools/README.md +67 -0
- package/node_modules/node-addon-api/tools/check-napi.js +100 -0
- package/node_modules/node-addon-api/tools/conversion.js +313 -0
- package/node_modules/node-gyp-build/LICENSE +21 -0
- package/node_modules/node-gyp-build/README.md +58 -0
- package/node_modules/node-gyp-build/bin.js +77 -0
- package/node_modules/node-gyp-build/build-test.js +19 -0
- package/node_modules/node-gyp-build/index.js +166 -0
- package/node_modules/node-gyp-build/optional.js +7 -0
- package/node_modules/node-gyp-build/package.json +33 -0
- package/node_modules/npm-run-path/index.js +39 -0
- package/node_modules/npm-run-path/license +21 -0
- package/node_modules/npm-run-path/package.json +49 -0
- package/node_modules/npm-run-path/readme.md +81 -0
- package/node_modules/once/LICENSE +15 -0
- package/node_modules/once/README.md +79 -0
- package/node_modules/once/once.js +42 -0
- package/node_modules/once/package.json +37 -0
- package/node_modules/os-locale/index.js +114 -0
- package/node_modules/os-locale/license +9 -0
- package/node_modules/os-locale/package.json +49 -0
- package/node_modules/os-locale/readme.md +71 -0
- package/node_modules/p-defer/index.js +11 -0
- package/node_modules/p-defer/license +21 -0
- package/node_modules/p-defer/package.json +45 -0
- package/node_modules/p-defer/readme.md +47 -0
- package/node_modules/p-finally/index.js +15 -0
- package/node_modules/p-finally/license +21 -0
- package/node_modules/p-finally/package.json +46 -0
- package/node_modules/p-finally/readme.md +47 -0
- package/node_modules/p-is-promise/index.d.ts +23 -0
- package/node_modules/p-is-promise/index.js +15 -0
- package/node_modules/p-is-promise/license +9 -0
- package/node_modules/p-is-promise/package.json +46 -0
- package/node_modules/p-is-promise/readme.md +43 -0
- package/node_modules/p-limit/index.d.ts +38 -0
- package/node_modules/p-limit/index.js +57 -0
- package/node_modules/p-limit/license +9 -0
- package/node_modules/p-limit/package.json +56 -0
- package/node_modules/p-limit/readme.md +101 -0
- package/node_modules/p-locate/index.js +34 -0
- package/node_modules/p-locate/license +9 -0
- package/node_modules/p-locate/package.json +55 -0
- package/node_modules/p-locate/readme.md +88 -0
- package/node_modules/p-try/index.d.ts +39 -0
- package/node_modules/p-try/index.js +9 -0
- package/node_modules/p-try/license +9 -0
- package/node_modules/p-try/package.json +46 -0
- package/node_modules/p-try/readme.md +58 -0
- package/node_modules/path-exists/index.js +17 -0
- package/node_modules/path-exists/license +21 -0
- package/node_modules/path-exists/package.json +44 -0
- package/node_modules/path-exists/readme.md +50 -0
- package/node_modules/path-key/index.js +13 -0
- package/node_modules/path-key/license +21 -0
- package/node_modules/path-key/package.json +43 -0
- package/node_modules/path-key/readme.md +51 -0
- package/node_modules/pbkdf2/LICENSE +21 -0
- package/node_modules/pbkdf2/README.md +30 -0
- package/node_modules/pbkdf2/browser.js +2 -0
- package/node_modules/pbkdf2/index.js +38 -0
- package/node_modules/pbkdf2/lib/async.js +102 -0
- package/node_modules/pbkdf2/lib/default-encoding.js +12 -0
- package/node_modules/pbkdf2/lib/precondition.js +19 -0
- package/node_modules/pbkdf2/lib/sync-browser.js +105 -0
- package/node_modules/pbkdf2/lib/sync.js +52 -0
- package/node_modules/pbkdf2/lib/to-buffer.js +13 -0
- package/node_modules/pbkdf2/package.json +74 -0
- package/node_modules/pump/.travis.yml +5 -0
- package/node_modules/pump/LICENSE +21 -0
- package/node_modules/pump/README.md +65 -0
- package/node_modules/pump/index.js +82 -0
- package/node_modules/pump/package.json +28 -0
- package/node_modules/pump/test-browser.js +66 -0
- package/node_modules/pump/test-node.js +53 -0
- package/node_modules/randombytes/.travis.yml +15 -0
- package/node_modules/randombytes/.zuul.yml +1 -0
- package/node_modules/randombytes/LICENSE +21 -0
- package/node_modules/randombytes/README.md +14 -0
- package/node_modules/randombytes/browser.js +50 -0
- package/node_modules/randombytes/index.js +1 -0
- package/node_modules/randombytes/package.json +40 -0
- package/node_modules/randombytes/test.js +81 -0
- package/node_modules/readable-stream/CONTRIBUTING.md +38 -0
- package/node_modules/readable-stream/GOVERNANCE.md +136 -0
- package/node_modules/readable-stream/LICENSE +47 -0
- package/node_modules/readable-stream/README.md +106 -0
- package/node_modules/readable-stream/errors-browser.js +127 -0
- package/node_modules/readable-stream/errors.js +116 -0
- package/node_modules/readable-stream/experimentalWarning.js +17 -0
- package/node_modules/readable-stream/lib/_stream_duplex.js +139 -0
- package/node_modules/readable-stream/lib/_stream_passthrough.js +39 -0
- package/node_modules/readable-stream/lib/_stream_readable.js +1124 -0
- package/node_modules/readable-stream/lib/_stream_transform.js +201 -0
- package/node_modules/readable-stream/lib/_stream_writable.js +697 -0
- package/node_modules/readable-stream/lib/internal/streams/async_iterator.js +207 -0
- package/node_modules/readable-stream/lib/internal/streams/buffer_list.js +210 -0
- package/node_modules/readable-stream/lib/internal/streams/destroy.js +105 -0
- package/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +104 -0
- package/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
- package/node_modules/readable-stream/lib/internal/streams/from.js +64 -0
- package/node_modules/readable-stream/lib/internal/streams/pipeline.js +97 -0
- package/node_modules/readable-stream/lib/internal/streams/state.js +27 -0
- package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
- package/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
- package/node_modules/readable-stream/package.json +72 -0
- package/node_modules/readable-stream/readable-browser.js +9 -0
- package/node_modules/readable-stream/readable.js +16 -0
- package/node_modules/require-directory/.jshintrc +67 -0
- package/node_modules/require-directory/.npmignore +1 -0
- package/node_modules/require-directory/.travis.yml +3 -0
- package/node_modules/require-directory/LICENSE +22 -0
- package/node_modules/require-directory/README.markdown +184 -0
- package/node_modules/require-directory/index.js +86 -0
- package/node_modules/require-directory/package.json +44 -0
- package/node_modules/require-main-filename/LICENSE.txt +14 -0
- package/node_modules/require-main-filename/README.md +26 -0
- package/node_modules/require-main-filename/index.js +18 -0
- package/node_modules/require-main-filename/package.json +39 -0
- package/node_modules/ripemd160/LICENSE +21 -0
- package/node_modules/ripemd160/README.md +27 -0
- package/node_modules/ripemd160/index.js +163 -0
- package/node_modules/ripemd160/package.json +41 -0
- package/node_modules/rlp/LICENSE +373 -0
- package/node_modules/rlp/README.md +58 -0
- package/node_modules/rlp/bin/rlp +35 -0
- package/node_modules/rlp/dist/index.d.ts +25 -0
- package/node_modules/rlp/dist/index.js +249 -0
- package/node_modules/rlp/dist/index.js.map +1 -0
- package/node_modules/rlp/dist/types.d.ts +9 -0
- package/node_modules/rlp/dist/types.js +3 -0
- package/node_modules/rlp/dist/types.js.map +1 -0
- package/node_modules/rlp/package.json +84 -0
- package/node_modules/safe-buffer/LICENSE +21 -0
- package/node_modules/safe-buffer/README.md +584 -0
- package/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/safe-buffer/index.js +65 -0
- package/node_modules/safe-buffer/package.json +55 -0
- package/node_modules/scrypt-js/LICENSE.txt +22 -0
- package/node_modules/scrypt-js/README.md +222 -0
- package/node_modules/scrypt-js/index.html +291 -0
- package/node_modules/scrypt-js/package.json +31 -0
- package/node_modules/scrypt-js/scrypt.d.ts +23 -0
- package/node_modules/scrypt-js/scrypt.js +488 -0
- package/node_modules/scrypt-js/thirdparty/buffer.js +1381 -0
- package/node_modules/scrypt-js/thirdparty/setImmediate.js +175 -0
- package/node_modules/scrypt-js/thirdparty/unorm.js +442 -0
- package/node_modules/secp256k1/API.md +116 -0
- package/node_modules/secp256k1/LICENSE +24 -0
- package/node_modules/secp256k1/README.md +117 -0
- package/node_modules/secp256k1/binding.gyp +100 -0
- package/node_modules/secp256k1/bindings.js +2 -0
- package/node_modules/secp256k1/elliptic.js +1 -0
- package/node_modules/secp256k1/index.js +5 -0
- package/node_modules/secp256k1/lib/elliptic.js +402 -0
- package/node_modules/secp256k1/lib/index.js +336 -0
- package/node_modules/secp256k1/package.json +47 -0
- package/node_modules/secp256k1/prebuilds/darwin-x64/node.napi.node +0 -0
- package/node_modules/secp256k1/prebuilds/linux-x64/node.napi.glibc.node +0 -0
- package/node_modules/secp256k1/prebuilds/linux-x64/node.napi.musl.node +0 -0
- package/node_modules/secp256k1/prebuilds/win32-x64/node.napi.node +0 -0
- package/node_modules/secp256k1/src/addon.cc +10 -0
- package/node_modules/secp256k1/src/secp256k1/.travis.yml +100 -0
- package/node_modules/secp256k1/src/secp256k1/COPYING +19 -0
- package/node_modules/secp256k1/src/secp256k1/Makefile.am +183 -0
- package/node_modules/secp256k1/src/secp256k1/README.md +78 -0
- package/node_modules/secp256k1/src/secp256k1/SECURITY.md +15 -0
- package/node_modules/secp256k1/src/secp256k1/TODO +3 -0
- package/node_modules/secp256k1/src/secp256k1/autogen.sh +3 -0
- package/node_modules/secp256k1/src/secp256k1/build-aux/m4/ax_jni_include_dir.m4 +145 -0
- package/node_modules/secp256k1/src/secp256k1/build-aux/m4/ax_prog_cc_for_build.m4 +125 -0
- package/node_modules/secp256k1/src/secp256k1/build-aux/m4/bitcoin_secp.m4 +68 -0
- package/node_modules/secp256k1/src/secp256k1/configure.ac +591 -0
- package/node_modules/secp256k1/src/secp256k1/contrib/lax_der_parsing.c +150 -0
- package/node_modules/secp256k1/src/secp256k1/contrib/lax_der_parsing.h +91 -0
- package/node_modules/secp256k1/src/secp256k1/contrib/lax_der_privatekey_parsing.c +113 -0
- package/node_modules/secp256k1/src/secp256k1/contrib/lax_der_privatekey_parsing.h +90 -0
- package/node_modules/secp256k1/src/secp256k1/include/secp256k1.h +708 -0
- package/node_modules/secp256k1/src/secp256k1/include/secp256k1_ecdh.h +55 -0
- package/node_modules/secp256k1/src/secp256k1/include/secp256k1_preallocated.h +128 -0
- package/node_modules/secp256k1/src/secp256k1/include/secp256k1_recovery.h +110 -0
- package/node_modules/secp256k1/src/secp256k1/libsecp256k1.pc.in +13 -0
- package/node_modules/secp256k1/src/secp256k1/sage/group_prover.sage +322 -0
- package/node_modules/secp256k1/src/secp256k1/sage/secp256k1.sage +306 -0
- package/node_modules/secp256k1/src/secp256k1/sage/weierstrass_prover.sage +264 -0
- package/node_modules/secp256k1/src/secp256k1/src/asm/field_10x26_arm.s +913 -0
- package/node_modules/secp256k1/src/secp256k1/src/basic-config.h +38 -0
- package/node_modules/secp256k1/src/secp256k1/src/bench.h +124 -0
- package/node_modules/secp256k1/src/secp256k1/src/bench_ecdh.c +54 -0
- package/node_modules/secp256k1/src/secp256k1/src/bench_ecmult.c +207 -0
- package/node_modules/secp256k1/src/secp256k1/src/bench_internal.c +379 -0
- package/node_modules/secp256k1/src/secp256k1/src/bench_recover.c +60 -0
- package/node_modules/secp256k1/src/secp256k1/src/bench_sign.c +56 -0
- package/node_modules/secp256k1/src/secp256k1/src/bench_verify.c +112 -0
- package/node_modules/secp256k1/src/secp256k1/src/ecdsa.h +21 -0
- package/node_modules/secp256k1/src/secp256k1/src/ecdsa_impl.h +319 -0
- package/node_modules/secp256k1/src/secp256k1/src/eckey.h +25 -0
- package/node_modules/secp256k1/src/secp256k1/src/eckey_impl.h +100 -0
- package/node_modules/secp256k1/src/secp256k1/src/ecmult.h +48 -0
- package/node_modules/secp256k1/src/secp256k1/src/ecmult_const.h +20 -0
- package/node_modules/secp256k1/src/secp256k1/src/ecmult_const_impl.h +261 -0
- package/node_modules/secp256k1/src/secp256k1/src/ecmult_gen.h +50 -0
- package/node_modules/secp256k1/src/secp256k1/src/ecmult_gen_impl.h +211 -0
- package/node_modules/secp256k1/src/secp256k1/src/ecmult_impl.h +1216 -0
- package/node_modules/secp256k1/src/secp256k1/src/field.h +132 -0
- package/node_modules/secp256k1/src/secp256k1/src/field_10x26.h +50 -0
- package/node_modules/secp256k1/src/secp256k1/src/field_10x26_impl.h +1162 -0
- package/node_modules/secp256k1/src/secp256k1/src/field_5x52.h +49 -0
- package/node_modules/secp256k1/src/secp256k1/src/field_5x52_asm_impl.h +502 -0
- package/node_modules/secp256k1/src/secp256k1/src/field_5x52_impl.h +496 -0
- package/node_modules/secp256k1/src/secp256k1/src/field_5x52_int128_impl.h +279 -0
- package/node_modules/secp256k1/src/secp256k1/src/field_impl.h +318 -0
- package/node_modules/secp256k1/src/secp256k1/src/gen_context.c +87 -0
- package/node_modules/secp256k1/src/secp256k1/src/group.h +142 -0
- package/node_modules/secp256k1/src/secp256k1/src/group_impl.h +705 -0
- package/node_modules/secp256k1/src/secp256k1/src/hash.h +41 -0
- package/node_modules/secp256k1/src/secp256k1/src/hash_impl.h +283 -0
- package/node_modules/secp256k1/src/secp256k1/src/java/org/bitcoin/NativeSecp256k1.java +446 -0
- package/node_modules/secp256k1/src/secp256k1/src/java/org/bitcoin/NativeSecp256k1Test.java +225 -0
- package/node_modules/secp256k1/src/secp256k1/src/java/org/bitcoin/NativeSecp256k1Util.java +45 -0
- package/node_modules/secp256k1/src/secp256k1/src/java/org/bitcoin/Secp256k1Context.java +51 -0
- package/node_modules/secp256k1/src/secp256k1/src/java/org_bitcoin_NativeSecp256k1.c +379 -0
- package/node_modules/secp256k1/src/secp256k1/src/java/org_bitcoin_NativeSecp256k1.h +119 -0
- package/node_modules/secp256k1/src/secp256k1/src/java/org_bitcoin_Secp256k1Context.c +15 -0
- package/node_modules/secp256k1/src/secp256k1/src/java/org_bitcoin_Secp256k1Context.h +22 -0
- package/node_modules/secp256k1/src/secp256k1/src/modules/ecdh/Makefile.am.include +8 -0
- package/node_modules/secp256k1/src/secp256k1/src/modules/ecdh/main_impl.h +67 -0
- package/node_modules/secp256k1/src/secp256k1/src/modules/ecdh/tests_impl.h +132 -0
- package/node_modules/secp256k1/src/secp256k1/src/modules/recovery/Makefile.am.include +8 -0
- package/node_modules/secp256k1/src/secp256k1/src/modules/recovery/main_impl.h +193 -0
- package/node_modules/secp256k1/src/secp256k1/src/modules/recovery/tests_impl.h +393 -0
- package/node_modules/secp256k1/src/secp256k1/src/num.h +74 -0
- package/node_modules/secp256k1/src/secp256k1/src/num_gmp.h +20 -0
- package/node_modules/secp256k1/src/secp256k1/src/num_gmp_impl.h +288 -0
- package/node_modules/secp256k1/src/secp256k1/src/num_impl.h +24 -0
- package/node_modules/secp256k1/src/secp256k1/src/scalar.h +106 -0
- package/node_modules/secp256k1/src/secp256k1/src/scalar_4x64.h +19 -0
- package/node_modules/secp256k1/src/secp256k1/src/scalar_4x64_impl.h +949 -0
- package/node_modules/secp256k1/src/secp256k1/src/scalar_8x32.h +19 -0
- package/node_modules/secp256k1/src/secp256k1/src/scalar_8x32_impl.h +721 -0
- package/node_modules/secp256k1/src/secp256k1/src/scalar_impl.h +333 -0
- package/node_modules/secp256k1/src/secp256k1/src/scalar_low.h +15 -0
- package/node_modules/secp256k1/src/secp256k1/src/scalar_low_impl.h +117 -0
- package/node_modules/secp256k1/src/secp256k1/src/scratch.h +42 -0
- package/node_modules/secp256k1/src/secp256k1/src/scratch_impl.h +88 -0
- package/node_modules/secp256k1/src/secp256k1/src/secp256k1.c +690 -0
- package/node_modules/secp256k1/src/secp256k1/src/testrand.h +38 -0
- package/node_modules/secp256k1/src/secp256k1/src/testrand_impl.h +110 -0
- package/node_modules/secp256k1/src/secp256k1/src/tests.c +5310 -0
- package/node_modules/secp256k1/src/secp256k1/src/tests_exhaustive.c +511 -0
- package/node_modules/secp256k1/src/secp256k1/src/util.h +162 -0
- package/node_modules/secp256k1/src/secp256k1.cc +415 -0
- package/node_modules/secp256k1/src/secp256k1.h +63 -0
- package/node_modules/semver/LICENSE +15 -0
- package/node_modules/semver/README.md +412 -0
- package/node_modules/semver/bin/semver +160 -0
- package/node_modules/semver/package.json +32 -0
- package/node_modules/semver/range.bnf +16 -0
- package/node_modules/semver/semver.js +1483 -0
- package/node_modules/set-blocking/LICENSE.txt +14 -0
- package/node_modules/set-blocking/README.md +31 -0
- package/node_modules/set-blocking/index.js +7 -0
- package/node_modules/set-blocking/package.json +46 -0
- package/node_modules/setimmediate/LICENSE.txt +20 -0
- package/node_modules/setimmediate/package.json +34 -0
- package/node_modules/setimmediate/setImmediate.js +186 -0
- package/node_modules/sha.js/.travis.yml +17 -0
- package/node_modules/sha.js/LICENSE +49 -0
- package/node_modules/sha.js/README.md +44 -0
- package/node_modules/sha.js/bin.js +41 -0
- package/node_modules/sha.js/hash.js +81 -0
- package/node_modules/sha.js/index.js +15 -0
- package/node_modules/sha.js/package.json +34 -0
- package/node_modules/sha.js/sha.js +94 -0
- package/node_modules/sha.js/sha1.js +99 -0
- package/node_modules/sha.js/sha224.js +53 -0
- package/node_modules/sha.js/sha256.js +135 -0
- package/node_modules/sha.js/sha384.js +57 -0
- package/node_modules/sha.js/sha512.js +260 -0
- package/node_modules/sha.js/test/hash.js +75 -0
- package/node_modules/sha.js/test/test.js +100 -0
- package/node_modules/sha.js/test/vectors.js +72 -0
- package/node_modules/shebang-command/index.js +19 -0
- package/node_modules/shebang-command/license +21 -0
- package/node_modules/shebang-command/package.json +43 -0
- package/node_modules/shebang-command/readme.md +39 -0
- package/node_modules/shebang-regex/index.js +2 -0
- package/node_modules/shebang-regex/license +21 -0
- package/node_modules/shebang-regex/package.json +36 -0
- package/node_modules/shebang-regex/readme.md +29 -0
- package/node_modules/signal-exit/LICENSE.txt +16 -0
- package/node_modules/signal-exit/README.md +39 -0
- package/node_modules/signal-exit/index.js +163 -0
- package/node_modules/signal-exit/package.json +42 -0
- package/node_modules/signal-exit/signals.js +53 -0
- package/node_modules/source-map/LICENSE +28 -0
- package/node_modules/source-map/README.md +742 -0
- package/node_modules/source-map/dist/source-map.debug.js +3234 -0
- package/node_modules/source-map/dist/source-map.js +3233 -0
- package/node_modules/source-map/dist/source-map.min.js +2 -0
- package/node_modules/source-map/dist/source-map.min.js.map +1 -0
- package/node_modules/source-map/lib/array-set.js +121 -0
- package/node_modules/source-map/lib/base64-vlq.js +140 -0
- package/node_modules/source-map/lib/base64.js +67 -0
- package/node_modules/source-map/lib/binary-search.js +111 -0
- package/node_modules/source-map/lib/mapping-list.js +79 -0
- package/node_modules/source-map/lib/quick-sort.js +114 -0
- package/node_modules/source-map/lib/source-map-consumer.js +1145 -0
- package/node_modules/source-map/lib/source-map-generator.js +425 -0
- package/node_modules/source-map/lib/source-node.js +413 -0
- package/node_modules/source-map/lib/util.js +488 -0
- package/node_modules/source-map/package.json +77 -0
- package/node_modules/source-map/source-map.d.ts +98 -0
- package/node_modules/source-map/source-map.js +8 -0
- package/node_modules/source-map-support/LICENSE.md +21 -0
- package/node_modules/source-map-support/README.md +284 -0
- package/node_modules/source-map-support/browser-source-map-support.js +113 -0
- package/node_modules/source-map-support/package.json +35 -0
- package/node_modules/source-map-support/register.js +1 -0
- package/node_modules/source-map-support/source-map-support.js +567 -0
- package/node_modules/string-width/index.js +39 -0
- package/node_modules/string-width/license +9 -0
- package/node_modules/string-width/package.json +60 -0
- package/node_modules/string-width/readme.md +45 -0
- package/node_modules/string_decoder/LICENSE +48 -0
- package/node_modules/string_decoder/README.md +47 -0
- package/node_modules/string_decoder/lib/string_decoder.js +296 -0
- package/node_modules/string_decoder/package.json +38 -0
- package/node_modules/strip-ansi/index.d.ts +15 -0
- package/node_modules/strip-ansi/index.js +7 -0
- package/node_modules/strip-ansi/license +9 -0
- package/node_modules/strip-ansi/package.json +58 -0
- package/node_modules/strip-ansi/readme.md +61 -0
- package/node_modules/strip-eof/index.js +15 -0
- package/node_modules/strip-eof/license +21 -0
- package/node_modules/strip-eof/package.json +43 -0
- package/node_modules/strip-eof/readme.md +28 -0
- package/node_modules/strip-hex-prefix/.editorconfig +7 -0
- package/node_modules/strip-hex-prefix/.gitattributes +106 -0
- package/node_modules/strip-hex-prefix/.npmignore +8 -0
- package/node_modules/strip-hex-prefix/.travis.yml +5 -0
- package/node_modules/strip-hex-prefix/CHANGELOG.md +7 -0
- package/node_modules/strip-hex-prefix/LICENSE +21 -0
- package/node_modules/strip-hex-prefix/README.md +106 -0
- package/node_modules/strip-hex-prefix/package.json +46 -0
- package/node_modules/strip-hex-prefix/src/index.js +14 -0
- package/node_modules/strip-hex-prefix/src/tests/test.index.js +47 -0
- package/node_modules/util-deprecate/History.md +16 -0
- package/node_modules/util-deprecate/LICENSE +24 -0
- package/node_modules/util-deprecate/README.md +53 -0
- package/node_modules/util-deprecate/browser.js +67 -0
- package/node_modules/util-deprecate/node.js +6 -0
- package/node_modules/util-deprecate/package.json +31 -0
- package/node_modules/which/LICENSE +15 -0
- package/node_modules/which/README.md +51 -0
- package/node_modules/which/bin/which +52 -0
- package/node_modules/which/package.json +34 -0
- package/node_modules/which/which.js +135 -0
- package/node_modules/which-module/LICENSE +13 -0
- package/node_modules/which-module/README.md +55 -0
- package/node_modules/which-module/index.js +9 -0
- package/node_modules/which-module/package.json +45 -0
- package/node_modules/wrap-ansi/index.js +188 -0
- package/node_modules/wrap-ansi/license +9 -0
- package/node_modules/wrap-ansi/package.json +65 -0
- package/node_modules/wrap-ansi/readme.md +108 -0
- package/node_modules/wrappy/LICENSE +15 -0
- package/node_modules/wrappy/README.md +36 -0
- package/node_modules/wrappy/package.json +33 -0
- package/node_modules/wrappy/wrappy.js +33 -0
- package/node_modules/y18n/LICENSE +13 -0
- package/node_modules/y18n/README.md +109 -0
- package/node_modules/y18n/index.js +188 -0
- package/node_modules/y18n/package.json +43 -0
- package/node_modules/yargs/LICENSE +22 -0
- package/node_modules/yargs/README.md +122 -0
- package/node_modules/yargs/index.js +32 -0
- package/node_modules/yargs/lib/apply-extends.js +53 -0
- package/node_modules/yargs/lib/argsert.js +68 -0
- package/node_modules/yargs/lib/command.js +437 -0
- package/node_modules/yargs/lib/completion-templates.js +49 -0
- package/node_modules/yargs/lib/completion.js +115 -0
- package/node_modules/yargs/lib/decamelize.js +32 -0
- package/node_modules/yargs/lib/is-promise.js +3 -0
- package/node_modules/yargs/lib/levenshtein.js +58 -0
- package/node_modules/yargs/lib/middleware.js +65 -0
- package/node_modules/yargs/lib/obj-filter.js +11 -0
- package/node_modules/yargs/lib/usage.js +540 -0
- package/node_modules/yargs/lib/validation.js +341 -0
- package/node_modules/yargs/lib/yerror.js +11 -0
- package/node_modules/yargs/locales/be.json +39 -0
- package/node_modules/yargs/locales/de.json +39 -0
- package/node_modules/yargs/locales/en.json +42 -0
- package/node_modules/yargs/locales/es.json +39 -0
- package/node_modules/yargs/locales/fr.json +37 -0
- package/node_modules/yargs/locales/hi.json +42 -0
- package/node_modules/yargs/locales/hu.json +39 -0
- package/node_modules/yargs/locales/id.json +43 -0
- package/node_modules/yargs/locales/it.json +39 -0
- package/node_modules/yargs/locales/ja.json +42 -0
- package/node_modules/yargs/locales/ko.json +42 -0
- package/node_modules/yargs/locales/nb.json +37 -0
- package/node_modules/yargs/locales/nl.json +42 -0
- package/node_modules/yargs/locales/nn.json +39 -0
- package/node_modules/yargs/locales/pirate.json +13 -0
- package/node_modules/yargs/locales/pl.json +42 -0
- package/node_modules/yargs/locales/pt.json +38 -0
- package/node_modules/yargs/locales/pt_BR.json +42 -0
- package/node_modules/yargs/locales/ru.json +39 -0
- package/node_modules/yargs/locales/th.json +39 -0
- package/node_modules/yargs/locales/tr.json +41 -0
- package/node_modules/yargs/locales/zh_CN.json +41 -0
- package/node_modules/yargs/locales/zh_TW.json +40 -0
- package/node_modules/yargs/package.json +83 -0
- package/node_modules/yargs/yargs.js +1205 -0
- package/node_modules/yargs-parser/LICENSE.txt +14 -0
- package/node_modules/yargs-parser/README.md +396 -0
- package/node_modules/yargs-parser/index.js +916 -0
- package/node_modules/yargs-parser/lib/tokenize-arg-string.js +40 -0
- package/node_modules/yargs-parser/package.json +51 -0
- package/package.json +73 -4
@@ -0,0 +1,1216 @@
|
|
1
|
+
/*****************************************************************************
|
2
|
+
* Copyright (c) 2013, 2014, 2017 Pieter Wuille, Andrew Poelstra, Jonas Nick *
|
3
|
+
* Distributed under the MIT software license, see the accompanying *
|
4
|
+
* file COPYING or http://www.opensource.org/licenses/mit-license.php. *
|
5
|
+
*****************************************************************************/
|
6
|
+
|
7
|
+
#ifndef SECP256K1_ECMULT_IMPL_H
|
8
|
+
#define SECP256K1_ECMULT_IMPL_H
|
9
|
+
|
10
|
+
#include <string.h>
|
11
|
+
#include <stdint.h>
|
12
|
+
|
13
|
+
#include "util.h"
|
14
|
+
#include "group.h"
|
15
|
+
#include "scalar.h"
|
16
|
+
#include "ecmult.h"
|
17
|
+
|
18
|
+
#if defined(EXHAUSTIVE_TEST_ORDER)
|
19
|
+
/* We need to lower these values for exhaustive tests because
|
20
|
+
* the tables cannot have infinities in them (this breaks the
|
21
|
+
* affine-isomorphism stuff which tracks z-ratios) */
|
22
|
+
# if EXHAUSTIVE_TEST_ORDER > 128
|
23
|
+
# define WINDOW_A 5
|
24
|
+
# define WINDOW_G 8
|
25
|
+
# elif EXHAUSTIVE_TEST_ORDER > 8
|
26
|
+
# define WINDOW_A 4
|
27
|
+
# define WINDOW_G 4
|
28
|
+
# else
|
29
|
+
# define WINDOW_A 2
|
30
|
+
# define WINDOW_G 2
|
31
|
+
# endif
|
32
|
+
#else
|
33
|
+
/* optimal for 128-bit and 256-bit exponents. */
|
34
|
+
# define WINDOW_A 5
|
35
|
+
/** Larger values for ECMULT_WINDOW_SIZE result in possibly better
|
36
|
+
* performance at the cost of an exponentially larger precomputed
|
37
|
+
* table. The exact table size is
|
38
|
+
* (1 << (WINDOW_G - 2)) * sizeof(secp256k1_ge_storage) bytes,
|
39
|
+
* where sizeof(secp256k1_ge_storage) is typically 64 bytes but can
|
40
|
+
* be larger due to platform-specific padding and alignment.
|
41
|
+
* If the endomorphism optimization is enabled (USE_ENDOMORMPHSIM)
|
42
|
+
* two tables of this size are used instead of only one.
|
43
|
+
*/
|
44
|
+
# define WINDOW_G ECMULT_WINDOW_SIZE
|
45
|
+
#endif
|
46
|
+
|
47
|
+
/* Noone will ever need more than a window size of 24. The code might
|
48
|
+
* be correct for larger values of ECMULT_WINDOW_SIZE but this is not
|
49
|
+
* not tested.
|
50
|
+
*
|
51
|
+
* The following limitations are known, and there are probably more:
|
52
|
+
* If WINDOW_G > 27 and size_t has 32 bits, then the code is incorrect
|
53
|
+
* because the size of the memory object that we allocate (in bytes)
|
54
|
+
* will not fit in a size_t.
|
55
|
+
* If WINDOW_G > 31 and int has 32 bits, then the code is incorrect
|
56
|
+
* because certain expressions will overflow.
|
57
|
+
*/
|
58
|
+
#if ECMULT_WINDOW_SIZE < 2 || ECMULT_WINDOW_SIZE > 24
|
59
|
+
# error Set ECMULT_WINDOW_SIZE to an integer in range [2..24].
|
60
|
+
#endif
|
61
|
+
|
62
|
+
#ifdef USE_ENDOMORPHISM
|
63
|
+
#define WNAF_BITS 128
|
64
|
+
#else
|
65
|
+
#define WNAF_BITS 256
|
66
|
+
#endif
|
67
|
+
#define WNAF_SIZE_BITS(bits, w) (((bits) + (w) - 1) / (w))
|
68
|
+
#define WNAF_SIZE(w) WNAF_SIZE_BITS(WNAF_BITS, w)
|
69
|
+
|
70
|
+
/** The number of entries a table with precomputed multiples needs to have. */
|
71
|
+
#define ECMULT_TABLE_SIZE(w) (1 << ((w)-2))
|
72
|
+
|
73
|
+
/* The number of objects allocated on the scratch space for ecmult_multi algorithms */
|
74
|
+
#define PIPPENGER_SCRATCH_OBJECTS 6
|
75
|
+
#define STRAUSS_SCRATCH_OBJECTS 6
|
76
|
+
|
77
|
+
#define PIPPENGER_MAX_BUCKET_WINDOW 12
|
78
|
+
|
79
|
+
/* Minimum number of points for which pippenger_wnaf is faster than strauss wnaf */
|
80
|
+
#ifdef USE_ENDOMORPHISM
|
81
|
+
#define ECMULT_PIPPENGER_THRESHOLD 88
|
82
|
+
#else
|
83
|
+
#define ECMULT_PIPPENGER_THRESHOLD 160
|
84
|
+
#endif
|
85
|
+
|
86
|
+
#ifdef USE_ENDOMORPHISM
|
87
|
+
#define ECMULT_MAX_POINTS_PER_BATCH 5000000
|
88
|
+
#else
|
89
|
+
#define ECMULT_MAX_POINTS_PER_BATCH 10000000
|
90
|
+
#endif
|
91
|
+
|
92
|
+
/** Fill a table 'prej' with precomputed odd multiples of a. Prej will contain
|
93
|
+
* the values [1*a,3*a,...,(2*n-1)*a], so it space for n values. zr[0] will
|
94
|
+
* contain prej[0].z / a.z. The other zr[i] values = prej[i].z / prej[i-1].z.
|
95
|
+
* Prej's Z values are undefined, except for the last value.
|
96
|
+
*/
|
97
|
+
static void secp256k1_ecmult_odd_multiples_table(int n, secp256k1_gej *prej, secp256k1_fe *zr, const secp256k1_gej *a) {
|
98
|
+
secp256k1_gej d;
|
99
|
+
secp256k1_ge a_ge, d_ge;
|
100
|
+
int i;
|
101
|
+
|
102
|
+
VERIFY_CHECK(!a->infinity);
|
103
|
+
|
104
|
+
secp256k1_gej_double_var(&d, a, NULL);
|
105
|
+
|
106
|
+
/*
|
107
|
+
* Perform the additions on an isomorphism where 'd' is affine: drop the z coordinate
|
108
|
+
* of 'd', and scale the 1P starting value's x/y coordinates without changing its z.
|
109
|
+
*/
|
110
|
+
d_ge.x = d.x;
|
111
|
+
d_ge.y = d.y;
|
112
|
+
d_ge.infinity = 0;
|
113
|
+
|
114
|
+
secp256k1_ge_set_gej_zinv(&a_ge, a, &d.z);
|
115
|
+
prej[0].x = a_ge.x;
|
116
|
+
prej[0].y = a_ge.y;
|
117
|
+
prej[0].z = a->z;
|
118
|
+
prej[0].infinity = 0;
|
119
|
+
|
120
|
+
zr[0] = d.z;
|
121
|
+
for (i = 1; i < n; i++) {
|
122
|
+
secp256k1_gej_add_ge_var(&prej[i], &prej[i-1], &d_ge, &zr[i]);
|
123
|
+
}
|
124
|
+
|
125
|
+
/*
|
126
|
+
* Each point in 'prej' has a z coordinate too small by a factor of 'd.z'. Only
|
127
|
+
* the final point's z coordinate is actually used though, so just update that.
|
128
|
+
*/
|
129
|
+
secp256k1_fe_mul(&prej[n-1].z, &prej[n-1].z, &d.z);
|
130
|
+
}
|
131
|
+
|
132
|
+
/** Fill a table 'pre' with precomputed odd multiples of a.
|
133
|
+
*
|
134
|
+
* There are two versions of this function:
|
135
|
+
* - secp256k1_ecmult_odd_multiples_table_globalz_windowa which brings its
|
136
|
+
* resulting point set to a single constant Z denominator, stores the X and Y
|
137
|
+
* coordinates as ge_storage points in pre, and stores the global Z in rz.
|
138
|
+
* It only operates on tables sized for WINDOW_A wnaf multiples.
|
139
|
+
* - secp256k1_ecmult_odd_multiples_table_storage_var, which converts its
|
140
|
+
* resulting point set to actually affine points, and stores those in pre.
|
141
|
+
* It operates on tables of any size.
|
142
|
+
*
|
143
|
+
* To compute a*P + b*G, we compute a table for P using the first function,
|
144
|
+
* and for G using the second (which requires an inverse, but it only needs to
|
145
|
+
* happen once).
|
146
|
+
*/
|
147
|
+
static void secp256k1_ecmult_odd_multiples_table_globalz_windowa(secp256k1_ge *pre, secp256k1_fe *globalz, const secp256k1_gej *a) {
|
148
|
+
secp256k1_gej prej[ECMULT_TABLE_SIZE(WINDOW_A)];
|
149
|
+
secp256k1_fe zr[ECMULT_TABLE_SIZE(WINDOW_A)];
|
150
|
+
|
151
|
+
/* Compute the odd multiples in Jacobian form. */
|
152
|
+
secp256k1_ecmult_odd_multiples_table(ECMULT_TABLE_SIZE(WINDOW_A), prej, zr, a);
|
153
|
+
/* Bring them to the same Z denominator. */
|
154
|
+
secp256k1_ge_globalz_set_table_gej(ECMULT_TABLE_SIZE(WINDOW_A), pre, globalz, prej, zr);
|
155
|
+
}
|
156
|
+
|
157
|
+
static void secp256k1_ecmult_odd_multiples_table_storage_var(const int n, secp256k1_ge_storage *pre, const secp256k1_gej *a) {
|
158
|
+
secp256k1_gej d;
|
159
|
+
secp256k1_ge d_ge, p_ge;
|
160
|
+
secp256k1_gej pj;
|
161
|
+
secp256k1_fe zi;
|
162
|
+
secp256k1_fe zr;
|
163
|
+
secp256k1_fe dx_over_dz_squared;
|
164
|
+
int i;
|
165
|
+
|
166
|
+
VERIFY_CHECK(!a->infinity);
|
167
|
+
|
168
|
+
secp256k1_gej_double_var(&d, a, NULL);
|
169
|
+
|
170
|
+
/* First, we perform all the additions in an isomorphic curve obtained by multiplying
|
171
|
+
* all `z` coordinates by 1/`d.z`. In these coordinates `d` is affine so we can use
|
172
|
+
* `secp256k1_gej_add_ge_var` to perform the additions. For each addition, we store
|
173
|
+
* the resulting y-coordinate and the z-ratio, since we only have enough memory to
|
174
|
+
* store two field elements. These are sufficient to efficiently undo the isomorphism
|
175
|
+
* and recompute all the `x`s.
|
176
|
+
*/
|
177
|
+
d_ge.x = d.x;
|
178
|
+
d_ge.y = d.y;
|
179
|
+
d_ge.infinity = 0;
|
180
|
+
|
181
|
+
secp256k1_ge_set_gej_zinv(&p_ge, a, &d.z);
|
182
|
+
pj.x = p_ge.x;
|
183
|
+
pj.y = p_ge.y;
|
184
|
+
pj.z = a->z;
|
185
|
+
pj.infinity = 0;
|
186
|
+
|
187
|
+
for (i = 0; i < (n - 1); i++) {
|
188
|
+
secp256k1_fe_normalize_var(&pj.y);
|
189
|
+
secp256k1_fe_to_storage(&pre[i].y, &pj.y);
|
190
|
+
secp256k1_gej_add_ge_var(&pj, &pj, &d_ge, &zr);
|
191
|
+
secp256k1_fe_normalize_var(&zr);
|
192
|
+
secp256k1_fe_to_storage(&pre[i].x, &zr);
|
193
|
+
}
|
194
|
+
|
195
|
+
/* Invert d.z in the same batch, preserving pj.z so we can extract 1/d.z */
|
196
|
+
secp256k1_fe_mul(&zi, &pj.z, &d.z);
|
197
|
+
secp256k1_fe_inv_var(&zi, &zi);
|
198
|
+
|
199
|
+
/* Directly set `pre[n - 1]` to `pj`, saving the inverted z-coordinate so
|
200
|
+
* that we can combine it with the saved z-ratios to compute the other zs
|
201
|
+
* without any more inversions. */
|
202
|
+
secp256k1_ge_set_gej_zinv(&p_ge, &pj, &zi);
|
203
|
+
secp256k1_ge_to_storage(&pre[n - 1], &p_ge);
|
204
|
+
|
205
|
+
/* Compute the actual x-coordinate of D, which will be needed below. */
|
206
|
+
secp256k1_fe_mul(&d.z, &zi, &pj.z); /* d.z = 1/d.z */
|
207
|
+
secp256k1_fe_sqr(&dx_over_dz_squared, &d.z);
|
208
|
+
secp256k1_fe_mul(&dx_over_dz_squared, &dx_over_dz_squared, &d.x);
|
209
|
+
|
210
|
+
/* Going into the second loop, we have set `pre[n-1]` to its final affine
|
211
|
+
* form, but still need to set `pre[i]` for `i` in 0 through `n-2`. We
|
212
|
+
* have `zi = (p.z * d.z)^-1`, where
|
213
|
+
*
|
214
|
+
* `p.z` is the z-coordinate of the point on the isomorphic curve
|
215
|
+
* which was ultimately assigned to `pre[n-1]`.
|
216
|
+
* `d.z` is the multiplier that must be applied to all z-coordinates
|
217
|
+
* to move from our isomorphic curve back to secp256k1; so the
|
218
|
+
* product `p.z * d.z` is the z-coordinate of the secp256k1
|
219
|
+
* point assigned to `pre[n-1]`.
|
220
|
+
*
|
221
|
+
* All subsequent inverse-z-coordinates can be obtained by multiplying this
|
222
|
+
* factor by successive z-ratios, which is much more efficient than directly
|
223
|
+
* computing each one.
|
224
|
+
*
|
225
|
+
* Importantly, these inverse-zs will be coordinates of points on secp256k1,
|
226
|
+
* while our other stored values come from computations on the isomorphic
|
227
|
+
* curve. So in the below loop, we will take care not to actually use `zi`
|
228
|
+
* or any derived values until we're back on secp256k1.
|
229
|
+
*/
|
230
|
+
i = n - 1;
|
231
|
+
while (i > 0) {
|
232
|
+
secp256k1_fe zi2, zi3;
|
233
|
+
const secp256k1_fe *rzr;
|
234
|
+
i--;
|
235
|
+
|
236
|
+
secp256k1_ge_from_storage(&p_ge, &pre[i]);
|
237
|
+
|
238
|
+
/* For each remaining point, we extract the z-ratio from the stored
|
239
|
+
* x-coordinate, compute its z^-1 from that, and compute the full
|
240
|
+
* point from that. */
|
241
|
+
rzr = &p_ge.x;
|
242
|
+
secp256k1_fe_mul(&zi, &zi, rzr);
|
243
|
+
secp256k1_fe_sqr(&zi2, &zi);
|
244
|
+
secp256k1_fe_mul(&zi3, &zi2, &zi);
|
245
|
+
/* To compute the actual x-coordinate, we use the stored z ratio and
|
246
|
+
* y-coordinate, which we obtained from `secp256k1_gej_add_ge_var`
|
247
|
+
* in the loop above, as well as the inverse of the square of its
|
248
|
+
* z-coordinate. We store the latter in the `zi2` variable, which is
|
249
|
+
* computed iteratively starting from the overall Z inverse then
|
250
|
+
* multiplying by each z-ratio in turn.
|
251
|
+
*
|
252
|
+
* Denoting the z-ratio as `rzr`, we observe that it is equal to `h`
|
253
|
+
* from the inside of the above `gej_add_ge_var` call. This satisfies
|
254
|
+
*
|
255
|
+
* rzr = d_x * z^2 - x * d_z^2
|
256
|
+
*
|
257
|
+
* where (`d_x`, `d_z`) are Jacobian coordinates of `D` and `(x, z)`
|
258
|
+
* are Jacobian coordinates of our desired point -- except both are on
|
259
|
+
* the isomorphic curve that we were using when we called `gej_add_ge_var`.
|
260
|
+
* To get back to secp256k1, we must multiply both `z`s by `d_z`, or
|
261
|
+
* equivalently divide both `x`s by `d_z^2`. Our equation then becomes
|
262
|
+
*
|
263
|
+
* rzr = d_x * z^2 / d_z^2 - x
|
264
|
+
*
|
265
|
+
* (The left-hand-side, being a ratio of z-coordinates, is unaffected
|
266
|
+
* by the isomorphism.)
|
267
|
+
*
|
268
|
+
* Rearranging to solve for `x`, we have
|
269
|
+
*
|
270
|
+
* x = d_x * z^2 / d_z^2 - rzr
|
271
|
+
*
|
272
|
+
* But what we actually want is the affine coordinate `X = x/z^2`,
|
273
|
+
* which will satisfy
|
274
|
+
*
|
275
|
+
* X = d_x / d_z^2 - rzr / z^2
|
276
|
+
* = dx_over_dz_squared - rzr * zi2
|
277
|
+
*/
|
278
|
+
secp256k1_fe_mul(&p_ge.x, rzr, &zi2);
|
279
|
+
secp256k1_fe_negate(&p_ge.x, &p_ge.x, 1);
|
280
|
+
secp256k1_fe_add(&p_ge.x, &dx_over_dz_squared);
|
281
|
+
/* y is stored_y/z^3, as we expect */
|
282
|
+
secp256k1_fe_mul(&p_ge.y, &p_ge.y, &zi3);
|
283
|
+
/* Store */
|
284
|
+
secp256k1_ge_to_storage(&pre[i], &p_ge);
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
/** The following two macro retrieves a particular odd multiple from a table
|
289
|
+
* of precomputed multiples. */
|
290
|
+
#define ECMULT_TABLE_GET_GE(r,pre,n,w) do { \
|
291
|
+
VERIFY_CHECK(((n) & 1) == 1); \
|
292
|
+
VERIFY_CHECK((n) >= -((1 << ((w)-1)) - 1)); \
|
293
|
+
VERIFY_CHECK((n) <= ((1 << ((w)-1)) - 1)); \
|
294
|
+
if ((n) > 0) { \
|
295
|
+
*(r) = (pre)[((n)-1)/2]; \
|
296
|
+
} else { \
|
297
|
+
*(r) = (pre)[(-(n)-1)/2]; \
|
298
|
+
secp256k1_fe_negate(&((r)->y), &((r)->y), 1); \
|
299
|
+
} \
|
300
|
+
} while(0)
|
301
|
+
|
302
|
+
#define ECMULT_TABLE_GET_GE_STORAGE(r,pre,n,w) do { \
|
303
|
+
VERIFY_CHECK(((n) & 1) == 1); \
|
304
|
+
VERIFY_CHECK((n) >= -((1 << ((w)-1)) - 1)); \
|
305
|
+
VERIFY_CHECK((n) <= ((1 << ((w)-1)) - 1)); \
|
306
|
+
if ((n) > 0) { \
|
307
|
+
secp256k1_ge_from_storage((r), &(pre)[((n)-1)/2]); \
|
308
|
+
} else { \
|
309
|
+
secp256k1_ge_from_storage((r), &(pre)[(-(n)-1)/2]); \
|
310
|
+
secp256k1_fe_negate(&((r)->y), &((r)->y), 1); \
|
311
|
+
} \
|
312
|
+
} while(0)
|
313
|
+
|
314
|
+
static const size_t SECP256K1_ECMULT_CONTEXT_PREALLOCATED_SIZE =
|
315
|
+
ROUND_TO_ALIGN(sizeof((*((secp256k1_ecmult_context*) NULL)->pre_g)[0]) * ECMULT_TABLE_SIZE(WINDOW_G))
|
316
|
+
#ifdef USE_ENDOMORPHISM
|
317
|
+
+ ROUND_TO_ALIGN(sizeof((*((secp256k1_ecmult_context*) NULL)->pre_g_128)[0]) * ECMULT_TABLE_SIZE(WINDOW_G))
|
318
|
+
#endif
|
319
|
+
;
|
320
|
+
|
321
|
+
static void secp256k1_ecmult_context_init(secp256k1_ecmult_context *ctx) {
|
322
|
+
ctx->pre_g = NULL;
|
323
|
+
#ifdef USE_ENDOMORPHISM
|
324
|
+
ctx->pre_g_128 = NULL;
|
325
|
+
#endif
|
326
|
+
}
|
327
|
+
|
328
|
+
static void secp256k1_ecmult_context_build(secp256k1_ecmult_context *ctx, void **prealloc) {
|
329
|
+
secp256k1_gej gj;
|
330
|
+
void* const base = *prealloc;
|
331
|
+
size_t const prealloc_size = SECP256K1_ECMULT_CONTEXT_PREALLOCATED_SIZE;
|
332
|
+
|
333
|
+
if (ctx->pre_g != NULL) {
|
334
|
+
return;
|
335
|
+
}
|
336
|
+
|
337
|
+
/* get the generator */
|
338
|
+
secp256k1_gej_set_ge(&gj, &secp256k1_ge_const_g);
|
339
|
+
|
340
|
+
{
|
341
|
+
size_t size = sizeof((*ctx->pre_g)[0]) * ((size_t)ECMULT_TABLE_SIZE(WINDOW_G));
|
342
|
+
/* check for overflow */
|
343
|
+
VERIFY_CHECK(size / sizeof((*ctx->pre_g)[0]) == ((size_t)ECMULT_TABLE_SIZE(WINDOW_G)));
|
344
|
+
ctx->pre_g = (secp256k1_ge_storage (*)[])manual_alloc(prealloc, sizeof((*ctx->pre_g)[0]) * ECMULT_TABLE_SIZE(WINDOW_G), base, prealloc_size);
|
345
|
+
}
|
346
|
+
|
347
|
+
/* precompute the tables with odd multiples */
|
348
|
+
secp256k1_ecmult_odd_multiples_table_storage_var(ECMULT_TABLE_SIZE(WINDOW_G), *ctx->pre_g, &gj);
|
349
|
+
|
350
|
+
#ifdef USE_ENDOMORPHISM
|
351
|
+
{
|
352
|
+
secp256k1_gej g_128j;
|
353
|
+
int i;
|
354
|
+
|
355
|
+
size_t size = sizeof((*ctx->pre_g_128)[0]) * ((size_t) ECMULT_TABLE_SIZE(WINDOW_G));
|
356
|
+
/* check for overflow */
|
357
|
+
VERIFY_CHECK(size / sizeof((*ctx->pre_g_128)[0]) == ((size_t)ECMULT_TABLE_SIZE(WINDOW_G)));
|
358
|
+
ctx->pre_g_128 = (secp256k1_ge_storage (*)[])manual_alloc(prealloc, sizeof((*ctx->pre_g_128)[0]) * ECMULT_TABLE_SIZE(WINDOW_G), base, prealloc_size);
|
359
|
+
|
360
|
+
/* calculate 2^128*generator */
|
361
|
+
g_128j = gj;
|
362
|
+
for (i = 0; i < 128; i++) {
|
363
|
+
secp256k1_gej_double_var(&g_128j, &g_128j, NULL);
|
364
|
+
}
|
365
|
+
secp256k1_ecmult_odd_multiples_table_storage_var(ECMULT_TABLE_SIZE(WINDOW_G), *ctx->pre_g_128, &g_128j);
|
366
|
+
}
|
367
|
+
#endif
|
368
|
+
}
|
369
|
+
|
370
|
+
static void secp256k1_ecmult_context_finalize_memcpy(secp256k1_ecmult_context *dst, const secp256k1_ecmult_context *src) {
|
371
|
+
if (src->pre_g != NULL) {
|
372
|
+
/* We cast to void* first to suppress a -Wcast-align warning. */
|
373
|
+
dst->pre_g = (secp256k1_ge_storage (*)[])(void*)((unsigned char*)dst + ((unsigned char*)(src->pre_g) - (unsigned char*)src));
|
374
|
+
}
|
375
|
+
#ifdef USE_ENDOMORPHISM
|
376
|
+
if (src->pre_g_128 != NULL) {
|
377
|
+
dst->pre_g_128 = (secp256k1_ge_storage (*)[])(void*)((unsigned char*)dst + ((unsigned char*)(src->pre_g_128) - (unsigned char*)src));
|
378
|
+
}
|
379
|
+
#endif
|
380
|
+
}
|
381
|
+
|
382
|
+
static int secp256k1_ecmult_context_is_built(const secp256k1_ecmult_context *ctx) {
|
383
|
+
return ctx->pre_g != NULL;
|
384
|
+
}
|
385
|
+
|
386
|
+
static void secp256k1_ecmult_context_clear(secp256k1_ecmult_context *ctx) {
|
387
|
+
secp256k1_ecmult_context_init(ctx);
|
388
|
+
}
|
389
|
+
|
390
|
+
/** Convert a number to WNAF notation. The number becomes represented by sum(2^i * wnaf[i], i=0..bits),
|
391
|
+
* with the following guarantees:
|
392
|
+
* - each wnaf[i] is either 0, or an odd integer between -(1<<(w-1) - 1) and (1<<(w-1) - 1)
|
393
|
+
* - two non-zero entries in wnaf are separated by at least w-1 zeroes.
|
394
|
+
* - the number of set values in wnaf is returned. This number is at most 256, and at most one more
|
395
|
+
* than the number of bits in the (absolute value) of the input.
|
396
|
+
*/
|
397
|
+
static int secp256k1_ecmult_wnaf(int *wnaf, int len, const secp256k1_scalar *a, int w) {
|
398
|
+
secp256k1_scalar s;
|
399
|
+
int last_set_bit = -1;
|
400
|
+
int bit = 0;
|
401
|
+
int sign = 1;
|
402
|
+
int carry = 0;
|
403
|
+
|
404
|
+
VERIFY_CHECK(wnaf != NULL);
|
405
|
+
VERIFY_CHECK(0 <= len && len <= 256);
|
406
|
+
VERIFY_CHECK(a != NULL);
|
407
|
+
VERIFY_CHECK(2 <= w && w <= 31);
|
408
|
+
|
409
|
+
memset(wnaf, 0, len * sizeof(wnaf[0]));
|
410
|
+
|
411
|
+
s = *a;
|
412
|
+
if (secp256k1_scalar_get_bits(&s, 255, 1)) {
|
413
|
+
secp256k1_scalar_negate(&s, &s);
|
414
|
+
sign = -1;
|
415
|
+
}
|
416
|
+
|
417
|
+
while (bit < len) {
|
418
|
+
int now;
|
419
|
+
int word;
|
420
|
+
if (secp256k1_scalar_get_bits(&s, bit, 1) == (unsigned int)carry) {
|
421
|
+
bit++;
|
422
|
+
continue;
|
423
|
+
}
|
424
|
+
|
425
|
+
now = w;
|
426
|
+
if (now > len - bit) {
|
427
|
+
now = len - bit;
|
428
|
+
}
|
429
|
+
|
430
|
+
word = secp256k1_scalar_get_bits_var(&s, bit, now) + carry;
|
431
|
+
|
432
|
+
carry = (word >> (w-1)) & 1;
|
433
|
+
word -= carry << w;
|
434
|
+
|
435
|
+
wnaf[bit] = sign * word;
|
436
|
+
last_set_bit = bit;
|
437
|
+
|
438
|
+
bit += now;
|
439
|
+
}
|
440
|
+
#ifdef VERIFY
|
441
|
+
CHECK(carry == 0);
|
442
|
+
while (bit < 256) {
|
443
|
+
CHECK(secp256k1_scalar_get_bits(&s, bit++, 1) == 0);
|
444
|
+
}
|
445
|
+
#endif
|
446
|
+
return last_set_bit + 1;
|
447
|
+
}
|
448
|
+
|
449
|
+
struct secp256k1_strauss_point_state {
|
450
|
+
#ifdef USE_ENDOMORPHISM
|
451
|
+
secp256k1_scalar na_1, na_lam;
|
452
|
+
int wnaf_na_1[130];
|
453
|
+
int wnaf_na_lam[130];
|
454
|
+
int bits_na_1;
|
455
|
+
int bits_na_lam;
|
456
|
+
#else
|
457
|
+
int wnaf_na[256];
|
458
|
+
int bits_na;
|
459
|
+
#endif
|
460
|
+
size_t input_pos;
|
461
|
+
};
|
462
|
+
|
463
|
+
struct secp256k1_strauss_state {
|
464
|
+
secp256k1_gej* prej;
|
465
|
+
secp256k1_fe* zr;
|
466
|
+
secp256k1_ge* pre_a;
|
467
|
+
#ifdef USE_ENDOMORPHISM
|
468
|
+
secp256k1_ge* pre_a_lam;
|
469
|
+
#endif
|
470
|
+
struct secp256k1_strauss_point_state* ps;
|
471
|
+
};
|
472
|
+
|
473
|
+
static void secp256k1_ecmult_strauss_wnaf(const secp256k1_ecmult_context *ctx, const struct secp256k1_strauss_state *state, secp256k1_gej *r, int num, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng) {
|
474
|
+
secp256k1_ge tmpa;
|
475
|
+
secp256k1_fe Z;
|
476
|
+
#ifdef USE_ENDOMORPHISM
|
477
|
+
/* Splitted G factors. */
|
478
|
+
secp256k1_scalar ng_1, ng_128;
|
479
|
+
int wnaf_ng_1[129];
|
480
|
+
int bits_ng_1 = 0;
|
481
|
+
int wnaf_ng_128[129];
|
482
|
+
int bits_ng_128 = 0;
|
483
|
+
#else
|
484
|
+
int wnaf_ng[256];
|
485
|
+
int bits_ng = 0;
|
486
|
+
#endif
|
487
|
+
int i;
|
488
|
+
int bits = 0;
|
489
|
+
int np;
|
490
|
+
int no = 0;
|
491
|
+
|
492
|
+
for (np = 0; np < num; ++np) {
|
493
|
+
if (secp256k1_scalar_is_zero(&na[np]) || secp256k1_gej_is_infinity(&a[np])) {
|
494
|
+
continue;
|
495
|
+
}
|
496
|
+
state->ps[no].input_pos = np;
|
497
|
+
#ifdef USE_ENDOMORPHISM
|
498
|
+
/* split na into na_1 and na_lam (where na = na_1 + na_lam*lambda, and na_1 and na_lam are ~128 bit) */
|
499
|
+
secp256k1_scalar_split_lambda(&state->ps[no].na_1, &state->ps[no].na_lam, &na[np]);
|
500
|
+
|
501
|
+
/* build wnaf representation for na_1 and na_lam. */
|
502
|
+
state->ps[no].bits_na_1 = secp256k1_ecmult_wnaf(state->ps[no].wnaf_na_1, 130, &state->ps[no].na_1, WINDOW_A);
|
503
|
+
state->ps[no].bits_na_lam = secp256k1_ecmult_wnaf(state->ps[no].wnaf_na_lam, 130, &state->ps[no].na_lam, WINDOW_A);
|
504
|
+
VERIFY_CHECK(state->ps[no].bits_na_1 <= 130);
|
505
|
+
VERIFY_CHECK(state->ps[no].bits_na_lam <= 130);
|
506
|
+
if (state->ps[no].bits_na_1 > bits) {
|
507
|
+
bits = state->ps[no].bits_na_1;
|
508
|
+
}
|
509
|
+
if (state->ps[no].bits_na_lam > bits) {
|
510
|
+
bits = state->ps[no].bits_na_lam;
|
511
|
+
}
|
512
|
+
#else
|
513
|
+
/* build wnaf representation for na. */
|
514
|
+
state->ps[no].bits_na = secp256k1_ecmult_wnaf(state->ps[no].wnaf_na, 256, &na[np], WINDOW_A);
|
515
|
+
if (state->ps[no].bits_na > bits) {
|
516
|
+
bits = state->ps[no].bits_na;
|
517
|
+
}
|
518
|
+
#endif
|
519
|
+
++no;
|
520
|
+
}
|
521
|
+
|
522
|
+
/* Calculate odd multiples of a.
|
523
|
+
* All multiples are brought to the same Z 'denominator', which is stored
|
524
|
+
* in Z. Due to secp256k1' isomorphism we can do all operations pretending
|
525
|
+
* that the Z coordinate was 1, use affine addition formulae, and correct
|
526
|
+
* the Z coordinate of the result once at the end.
|
527
|
+
* The exception is the precomputed G table points, which are actually
|
528
|
+
* affine. Compared to the base used for other points, they have a Z ratio
|
529
|
+
* of 1/Z, so we can use secp256k1_gej_add_zinv_var, which uses the same
|
530
|
+
* isomorphism to efficiently add with a known Z inverse.
|
531
|
+
*/
|
532
|
+
if (no > 0) {
|
533
|
+
/* Compute the odd multiples in Jacobian form. */
|
534
|
+
secp256k1_ecmult_odd_multiples_table(ECMULT_TABLE_SIZE(WINDOW_A), state->prej, state->zr, &a[state->ps[0].input_pos]);
|
535
|
+
for (np = 1; np < no; ++np) {
|
536
|
+
secp256k1_gej tmp = a[state->ps[np].input_pos];
|
537
|
+
#ifdef VERIFY
|
538
|
+
secp256k1_fe_normalize_var(&(state->prej[(np - 1) * ECMULT_TABLE_SIZE(WINDOW_A) + ECMULT_TABLE_SIZE(WINDOW_A) - 1].z));
|
539
|
+
#endif
|
540
|
+
secp256k1_gej_rescale(&tmp, &(state->prej[(np - 1) * ECMULT_TABLE_SIZE(WINDOW_A) + ECMULT_TABLE_SIZE(WINDOW_A) - 1].z));
|
541
|
+
secp256k1_ecmult_odd_multiples_table(ECMULT_TABLE_SIZE(WINDOW_A), state->prej + np * ECMULT_TABLE_SIZE(WINDOW_A), state->zr + np * ECMULT_TABLE_SIZE(WINDOW_A), &tmp);
|
542
|
+
secp256k1_fe_mul(state->zr + np * ECMULT_TABLE_SIZE(WINDOW_A), state->zr + np * ECMULT_TABLE_SIZE(WINDOW_A), &(a[state->ps[np].input_pos].z));
|
543
|
+
}
|
544
|
+
/* Bring them to the same Z denominator. */
|
545
|
+
secp256k1_ge_globalz_set_table_gej(ECMULT_TABLE_SIZE(WINDOW_A) * no, state->pre_a, &Z, state->prej, state->zr);
|
546
|
+
} else {
|
547
|
+
secp256k1_fe_set_int(&Z, 1);
|
548
|
+
}
|
549
|
+
|
550
|
+
#ifdef USE_ENDOMORPHISM
|
551
|
+
for (np = 0; np < no; ++np) {
|
552
|
+
for (i = 0; i < ECMULT_TABLE_SIZE(WINDOW_A); i++) {
|
553
|
+
secp256k1_ge_mul_lambda(&state->pre_a_lam[np * ECMULT_TABLE_SIZE(WINDOW_A) + i], &state->pre_a[np * ECMULT_TABLE_SIZE(WINDOW_A) + i]);
|
554
|
+
}
|
555
|
+
}
|
556
|
+
|
557
|
+
if (ng) {
|
558
|
+
/* split ng into ng_1 and ng_128 (where gn = gn_1 + gn_128*2^128, and gn_1 and gn_128 are ~128 bit) */
|
559
|
+
secp256k1_scalar_split_128(&ng_1, &ng_128, ng);
|
560
|
+
|
561
|
+
/* Build wnaf representation for ng_1 and ng_128 */
|
562
|
+
bits_ng_1 = secp256k1_ecmult_wnaf(wnaf_ng_1, 129, &ng_1, WINDOW_G);
|
563
|
+
bits_ng_128 = secp256k1_ecmult_wnaf(wnaf_ng_128, 129, &ng_128, WINDOW_G);
|
564
|
+
if (bits_ng_1 > bits) {
|
565
|
+
bits = bits_ng_1;
|
566
|
+
}
|
567
|
+
if (bits_ng_128 > bits) {
|
568
|
+
bits = bits_ng_128;
|
569
|
+
}
|
570
|
+
}
|
571
|
+
#else
|
572
|
+
if (ng) {
|
573
|
+
bits_ng = secp256k1_ecmult_wnaf(wnaf_ng, 256, ng, WINDOW_G);
|
574
|
+
if (bits_ng > bits) {
|
575
|
+
bits = bits_ng;
|
576
|
+
}
|
577
|
+
}
|
578
|
+
#endif
|
579
|
+
|
580
|
+
secp256k1_gej_set_infinity(r);
|
581
|
+
|
582
|
+
for (i = bits - 1; i >= 0; i--) {
|
583
|
+
int n;
|
584
|
+
secp256k1_gej_double_var(r, r, NULL);
|
585
|
+
#ifdef USE_ENDOMORPHISM
|
586
|
+
for (np = 0; np < no; ++np) {
|
587
|
+
if (i < state->ps[np].bits_na_1 && (n = state->ps[np].wnaf_na_1[i])) {
|
588
|
+
ECMULT_TABLE_GET_GE(&tmpa, state->pre_a + np * ECMULT_TABLE_SIZE(WINDOW_A), n, WINDOW_A);
|
589
|
+
secp256k1_gej_add_ge_var(r, r, &tmpa, NULL);
|
590
|
+
}
|
591
|
+
if (i < state->ps[np].bits_na_lam && (n = state->ps[np].wnaf_na_lam[i])) {
|
592
|
+
ECMULT_TABLE_GET_GE(&tmpa, state->pre_a_lam + np * ECMULT_TABLE_SIZE(WINDOW_A), n, WINDOW_A);
|
593
|
+
secp256k1_gej_add_ge_var(r, r, &tmpa, NULL);
|
594
|
+
}
|
595
|
+
}
|
596
|
+
if (i < bits_ng_1 && (n = wnaf_ng_1[i])) {
|
597
|
+
ECMULT_TABLE_GET_GE_STORAGE(&tmpa, *ctx->pre_g, n, WINDOW_G);
|
598
|
+
secp256k1_gej_add_zinv_var(r, r, &tmpa, &Z);
|
599
|
+
}
|
600
|
+
if (i < bits_ng_128 && (n = wnaf_ng_128[i])) {
|
601
|
+
ECMULT_TABLE_GET_GE_STORAGE(&tmpa, *ctx->pre_g_128, n, WINDOW_G);
|
602
|
+
secp256k1_gej_add_zinv_var(r, r, &tmpa, &Z);
|
603
|
+
}
|
604
|
+
#else
|
605
|
+
for (np = 0; np < no; ++np) {
|
606
|
+
if (i < state->ps[np].bits_na && (n = state->ps[np].wnaf_na[i])) {
|
607
|
+
ECMULT_TABLE_GET_GE(&tmpa, state->pre_a + np * ECMULT_TABLE_SIZE(WINDOW_A), n, WINDOW_A);
|
608
|
+
secp256k1_gej_add_ge_var(r, r, &tmpa, NULL);
|
609
|
+
}
|
610
|
+
}
|
611
|
+
if (i < bits_ng && (n = wnaf_ng[i])) {
|
612
|
+
ECMULT_TABLE_GET_GE_STORAGE(&tmpa, *ctx->pre_g, n, WINDOW_G);
|
613
|
+
secp256k1_gej_add_zinv_var(r, r, &tmpa, &Z);
|
614
|
+
}
|
615
|
+
#endif
|
616
|
+
}
|
617
|
+
|
618
|
+
if (!r->infinity) {
|
619
|
+
secp256k1_fe_mul(&r->z, &r->z, &Z);
|
620
|
+
}
|
621
|
+
}
|
622
|
+
|
623
|
+
static void secp256k1_ecmult(const secp256k1_ecmult_context *ctx, secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng) {
|
624
|
+
secp256k1_gej prej[ECMULT_TABLE_SIZE(WINDOW_A)];
|
625
|
+
secp256k1_fe zr[ECMULT_TABLE_SIZE(WINDOW_A)];
|
626
|
+
secp256k1_ge pre_a[ECMULT_TABLE_SIZE(WINDOW_A)];
|
627
|
+
struct secp256k1_strauss_point_state ps[1];
|
628
|
+
#ifdef USE_ENDOMORPHISM
|
629
|
+
secp256k1_ge pre_a_lam[ECMULT_TABLE_SIZE(WINDOW_A)];
|
630
|
+
#endif
|
631
|
+
struct secp256k1_strauss_state state;
|
632
|
+
|
633
|
+
state.prej = prej;
|
634
|
+
state.zr = zr;
|
635
|
+
state.pre_a = pre_a;
|
636
|
+
#ifdef USE_ENDOMORPHISM
|
637
|
+
state.pre_a_lam = pre_a_lam;
|
638
|
+
#endif
|
639
|
+
state.ps = ps;
|
640
|
+
secp256k1_ecmult_strauss_wnaf(ctx, &state, r, 1, a, na, ng);
|
641
|
+
}
|
642
|
+
|
643
|
+
static size_t secp256k1_strauss_scratch_size(size_t n_points) {
|
644
|
+
#ifdef USE_ENDOMORPHISM
|
645
|
+
static const size_t point_size = (2 * sizeof(secp256k1_ge) + sizeof(secp256k1_gej) + sizeof(secp256k1_fe)) * ECMULT_TABLE_SIZE(WINDOW_A) + sizeof(struct secp256k1_strauss_point_state) + sizeof(secp256k1_gej) + sizeof(secp256k1_scalar);
|
646
|
+
#else
|
647
|
+
static const size_t point_size = (sizeof(secp256k1_ge) + sizeof(secp256k1_gej) + sizeof(secp256k1_fe)) * ECMULT_TABLE_SIZE(WINDOW_A) + sizeof(struct secp256k1_strauss_point_state) + sizeof(secp256k1_gej) + sizeof(secp256k1_scalar);
|
648
|
+
#endif
|
649
|
+
return n_points*point_size;
|
650
|
+
}
|
651
|
+
|
652
|
+
static int secp256k1_ecmult_strauss_batch(const secp256k1_callback* error_callback, const secp256k1_ecmult_context *ctx, secp256k1_scratch *scratch, secp256k1_gej *r, const secp256k1_scalar *inp_g_sc, secp256k1_ecmult_multi_callback cb, void *cbdata, size_t n_points, size_t cb_offset) {
|
653
|
+
secp256k1_gej* points;
|
654
|
+
secp256k1_scalar* scalars;
|
655
|
+
struct secp256k1_strauss_state state;
|
656
|
+
size_t i;
|
657
|
+
const size_t scratch_checkpoint = secp256k1_scratch_checkpoint(error_callback, scratch);
|
658
|
+
|
659
|
+
secp256k1_gej_set_infinity(r);
|
660
|
+
if (inp_g_sc == NULL && n_points == 0) {
|
661
|
+
return 1;
|
662
|
+
}
|
663
|
+
|
664
|
+
points = (secp256k1_gej*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(secp256k1_gej));
|
665
|
+
scalars = (secp256k1_scalar*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(secp256k1_scalar));
|
666
|
+
state.prej = (secp256k1_gej*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_gej));
|
667
|
+
state.zr = (secp256k1_fe*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_fe));
|
668
|
+
#ifdef USE_ENDOMORPHISM
|
669
|
+
state.pre_a = (secp256k1_ge*)secp256k1_scratch_alloc(error_callback, scratch, n_points * 2 * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_ge));
|
670
|
+
state.pre_a_lam = state.pre_a + n_points * ECMULT_TABLE_SIZE(WINDOW_A);
|
671
|
+
#else
|
672
|
+
state.pre_a = (secp256k1_ge*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_ge));
|
673
|
+
#endif
|
674
|
+
state.ps = (struct secp256k1_strauss_point_state*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(struct secp256k1_strauss_point_state));
|
675
|
+
|
676
|
+
if (points == NULL || scalars == NULL || state.prej == NULL || state.zr == NULL || state.pre_a == NULL) {
|
677
|
+
secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
|
678
|
+
return 0;
|
679
|
+
}
|
680
|
+
|
681
|
+
for (i = 0; i < n_points; i++) {
|
682
|
+
secp256k1_ge point;
|
683
|
+
if (!cb(&scalars[i], &point, i+cb_offset, cbdata)) {
|
684
|
+
secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
|
685
|
+
return 0;
|
686
|
+
}
|
687
|
+
secp256k1_gej_set_ge(&points[i], &point);
|
688
|
+
}
|
689
|
+
secp256k1_ecmult_strauss_wnaf(ctx, &state, r, n_points, points, scalars, inp_g_sc);
|
690
|
+
secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
|
691
|
+
return 1;
|
692
|
+
}
|
693
|
+
|
694
|
+
/* Wrapper for secp256k1_ecmult_multi_func interface */
|
695
|
+
static int secp256k1_ecmult_strauss_batch_single(const secp256k1_callback* error_callback, const secp256k1_ecmult_context *actx, secp256k1_scratch *scratch, secp256k1_gej *r, const secp256k1_scalar *inp_g_sc, secp256k1_ecmult_multi_callback cb, void *cbdata, size_t n) {
|
696
|
+
return secp256k1_ecmult_strauss_batch(error_callback, actx, scratch, r, inp_g_sc, cb, cbdata, n, 0);
|
697
|
+
}
|
698
|
+
|
699
|
+
static size_t secp256k1_strauss_max_points(const secp256k1_callback* error_callback, secp256k1_scratch *scratch) {
|
700
|
+
return secp256k1_scratch_max_allocation(error_callback, scratch, STRAUSS_SCRATCH_OBJECTS) / secp256k1_strauss_scratch_size(1);
|
701
|
+
}
|
702
|
+
|
703
|
+
/** Convert a number to WNAF notation.
|
704
|
+
* The number becomes represented by sum(2^{wi} * wnaf[i], i=0..WNAF_SIZE(w)+1) - return_val.
|
705
|
+
* It has the following guarantees:
|
706
|
+
* - each wnaf[i] is either 0 or an odd integer between -(1 << w) and (1 << w)
|
707
|
+
* - the number of words set is always WNAF_SIZE(w)
|
708
|
+
* - the returned skew is 0 or 1
|
709
|
+
*/
|
710
|
+
static int secp256k1_wnaf_fixed(int *wnaf, const secp256k1_scalar *s, int w) {
|
711
|
+
int skew = 0;
|
712
|
+
int pos;
|
713
|
+
int max_pos;
|
714
|
+
int last_w;
|
715
|
+
const secp256k1_scalar *work = s;
|
716
|
+
|
717
|
+
if (secp256k1_scalar_is_zero(s)) {
|
718
|
+
for (pos = 0; pos < WNAF_SIZE(w); pos++) {
|
719
|
+
wnaf[pos] = 0;
|
720
|
+
}
|
721
|
+
return 0;
|
722
|
+
}
|
723
|
+
|
724
|
+
if (secp256k1_scalar_is_even(s)) {
|
725
|
+
skew = 1;
|
726
|
+
}
|
727
|
+
|
728
|
+
wnaf[0] = secp256k1_scalar_get_bits_var(work, 0, w) + skew;
|
729
|
+
/* Compute last window size. Relevant when window size doesn't divide the
|
730
|
+
* number of bits in the scalar */
|
731
|
+
last_w = WNAF_BITS - (WNAF_SIZE(w) - 1) * w;
|
732
|
+
|
733
|
+
/* Store the position of the first nonzero word in max_pos to allow
|
734
|
+
* skipping leading zeros when calculating the wnaf. */
|
735
|
+
for (pos = WNAF_SIZE(w) - 1; pos > 0; pos--) {
|
736
|
+
int val = secp256k1_scalar_get_bits_var(work, pos * w, pos == WNAF_SIZE(w)-1 ? last_w : w);
|
737
|
+
if(val != 0) {
|
738
|
+
break;
|
739
|
+
}
|
740
|
+
wnaf[pos] = 0;
|
741
|
+
}
|
742
|
+
max_pos = pos;
|
743
|
+
pos = 1;
|
744
|
+
|
745
|
+
while (pos <= max_pos) {
|
746
|
+
int val = secp256k1_scalar_get_bits_var(work, pos * w, pos == WNAF_SIZE(w)-1 ? last_w : w);
|
747
|
+
if ((val & 1) == 0) {
|
748
|
+
wnaf[pos - 1] -= (1 << w);
|
749
|
+
wnaf[pos] = (val + 1);
|
750
|
+
} else {
|
751
|
+
wnaf[pos] = val;
|
752
|
+
}
|
753
|
+
/* Set a coefficient to zero if it is 1 or -1 and the proceeding digit
|
754
|
+
* is strictly negative or strictly positive respectively. Only change
|
755
|
+
* coefficients at previous positions because above code assumes that
|
756
|
+
* wnaf[pos - 1] is odd.
|
757
|
+
*/
|
758
|
+
if (pos >= 2 && ((wnaf[pos - 1] == 1 && wnaf[pos - 2] < 0) || (wnaf[pos - 1] == -1 && wnaf[pos - 2] > 0))) {
|
759
|
+
if (wnaf[pos - 1] == 1) {
|
760
|
+
wnaf[pos - 2] += 1 << w;
|
761
|
+
} else {
|
762
|
+
wnaf[pos - 2] -= 1 << w;
|
763
|
+
}
|
764
|
+
wnaf[pos - 1] = 0;
|
765
|
+
}
|
766
|
+
++pos;
|
767
|
+
}
|
768
|
+
|
769
|
+
return skew;
|
770
|
+
}
|
771
|
+
|
772
|
+
struct secp256k1_pippenger_point_state {
|
773
|
+
int skew_na;
|
774
|
+
size_t input_pos;
|
775
|
+
};
|
776
|
+
|
777
|
+
struct secp256k1_pippenger_state {
|
778
|
+
int *wnaf_na;
|
779
|
+
struct secp256k1_pippenger_point_state* ps;
|
780
|
+
};
|
781
|
+
|
782
|
+
/*
|
783
|
+
* pippenger_wnaf computes the result of a multi-point multiplication as
|
784
|
+
* follows: The scalars are brought into wnaf with n_wnaf elements each. Then
|
785
|
+
* for every i < n_wnaf, first each point is added to a "bucket" corresponding
|
786
|
+
* to the point's wnaf[i]. Second, the buckets are added together such that
|
787
|
+
* r += 1*bucket[0] + 3*bucket[1] + 5*bucket[2] + ...
|
788
|
+
*/
|
789
|
+
static int secp256k1_ecmult_pippenger_wnaf(secp256k1_gej *buckets, int bucket_window, struct secp256k1_pippenger_state *state, secp256k1_gej *r, const secp256k1_scalar *sc, const secp256k1_ge *pt, size_t num) {
|
790
|
+
size_t n_wnaf = WNAF_SIZE(bucket_window+1);
|
791
|
+
size_t np;
|
792
|
+
size_t no = 0;
|
793
|
+
int i;
|
794
|
+
int j;
|
795
|
+
|
796
|
+
for (np = 0; np < num; ++np) {
|
797
|
+
if (secp256k1_scalar_is_zero(&sc[np]) || secp256k1_ge_is_infinity(&pt[np])) {
|
798
|
+
continue;
|
799
|
+
}
|
800
|
+
state->ps[no].input_pos = np;
|
801
|
+
state->ps[no].skew_na = secp256k1_wnaf_fixed(&state->wnaf_na[no*n_wnaf], &sc[np], bucket_window+1);
|
802
|
+
no++;
|
803
|
+
}
|
804
|
+
secp256k1_gej_set_infinity(r);
|
805
|
+
|
806
|
+
if (no == 0) {
|
807
|
+
return 1;
|
808
|
+
}
|
809
|
+
|
810
|
+
for (i = n_wnaf - 1; i >= 0; i--) {
|
811
|
+
secp256k1_gej running_sum;
|
812
|
+
|
813
|
+
for(j = 0; j < ECMULT_TABLE_SIZE(bucket_window+2); j++) {
|
814
|
+
secp256k1_gej_set_infinity(&buckets[j]);
|
815
|
+
}
|
816
|
+
|
817
|
+
for (np = 0; np < no; ++np) {
|
818
|
+
int n = state->wnaf_na[np*n_wnaf + i];
|
819
|
+
struct secp256k1_pippenger_point_state point_state = state->ps[np];
|
820
|
+
secp256k1_ge tmp;
|
821
|
+
int idx;
|
822
|
+
|
823
|
+
if (i == 0) {
|
824
|
+
/* correct for wnaf skew */
|
825
|
+
int skew = point_state.skew_na;
|
826
|
+
if (skew) {
|
827
|
+
secp256k1_ge_neg(&tmp, &pt[point_state.input_pos]);
|
828
|
+
secp256k1_gej_add_ge_var(&buckets[0], &buckets[0], &tmp, NULL);
|
829
|
+
}
|
830
|
+
}
|
831
|
+
if (n > 0) {
|
832
|
+
idx = (n - 1)/2;
|
833
|
+
secp256k1_gej_add_ge_var(&buckets[idx], &buckets[idx], &pt[point_state.input_pos], NULL);
|
834
|
+
} else if (n < 0) {
|
835
|
+
idx = -(n + 1)/2;
|
836
|
+
secp256k1_ge_neg(&tmp, &pt[point_state.input_pos]);
|
837
|
+
secp256k1_gej_add_ge_var(&buckets[idx], &buckets[idx], &tmp, NULL);
|
838
|
+
}
|
839
|
+
}
|
840
|
+
|
841
|
+
for(j = 0; j < bucket_window; j++) {
|
842
|
+
secp256k1_gej_double_var(r, r, NULL);
|
843
|
+
}
|
844
|
+
|
845
|
+
secp256k1_gej_set_infinity(&running_sum);
|
846
|
+
/* Accumulate the sum: bucket[0] + 3*bucket[1] + 5*bucket[2] + 7*bucket[3] + ...
|
847
|
+
* = bucket[0] + bucket[1] + bucket[2] + bucket[3] + ...
|
848
|
+
* + 2 * (bucket[1] + 2*bucket[2] + 3*bucket[3] + ...)
|
849
|
+
* using an intermediate running sum:
|
850
|
+
* running_sum = bucket[0] + bucket[1] + bucket[2] + ...
|
851
|
+
*
|
852
|
+
* The doubling is done implicitly by deferring the final window doubling (of 'r').
|
853
|
+
*/
|
854
|
+
for(j = ECMULT_TABLE_SIZE(bucket_window+2) - 1; j > 0; j--) {
|
855
|
+
secp256k1_gej_add_var(&running_sum, &running_sum, &buckets[j], NULL);
|
856
|
+
secp256k1_gej_add_var(r, r, &running_sum, NULL);
|
857
|
+
}
|
858
|
+
|
859
|
+
secp256k1_gej_add_var(&running_sum, &running_sum, &buckets[0], NULL);
|
860
|
+
secp256k1_gej_double_var(r, r, NULL);
|
861
|
+
secp256k1_gej_add_var(r, r, &running_sum, NULL);
|
862
|
+
}
|
863
|
+
return 1;
|
864
|
+
}
|
865
|
+
|
866
|
+
/**
|
867
|
+
* Returns optimal bucket_window (number of bits of a scalar represented by a
|
868
|
+
* set of buckets) for a given number of points.
|
869
|
+
*/
|
870
|
+
static int secp256k1_pippenger_bucket_window(size_t n) {
|
871
|
+
#ifdef USE_ENDOMORPHISM
|
872
|
+
if (n <= 1) {
|
873
|
+
return 1;
|
874
|
+
} else if (n <= 4) {
|
875
|
+
return 2;
|
876
|
+
} else if (n <= 20) {
|
877
|
+
return 3;
|
878
|
+
} else if (n <= 57) {
|
879
|
+
return 4;
|
880
|
+
} else if (n <= 136) {
|
881
|
+
return 5;
|
882
|
+
} else if (n <= 235) {
|
883
|
+
return 6;
|
884
|
+
} else if (n <= 1260) {
|
885
|
+
return 7;
|
886
|
+
} else if (n <= 4420) {
|
887
|
+
return 9;
|
888
|
+
} else if (n <= 7880) {
|
889
|
+
return 10;
|
890
|
+
} else if (n <= 16050) {
|
891
|
+
return 11;
|
892
|
+
} else {
|
893
|
+
return PIPPENGER_MAX_BUCKET_WINDOW;
|
894
|
+
}
|
895
|
+
#else
|
896
|
+
if (n <= 1) {
|
897
|
+
return 1;
|
898
|
+
} else if (n <= 11) {
|
899
|
+
return 2;
|
900
|
+
} else if (n <= 45) {
|
901
|
+
return 3;
|
902
|
+
} else if (n <= 100) {
|
903
|
+
return 4;
|
904
|
+
} else if (n <= 275) {
|
905
|
+
return 5;
|
906
|
+
} else if (n <= 625) {
|
907
|
+
return 6;
|
908
|
+
} else if (n <= 1850) {
|
909
|
+
return 7;
|
910
|
+
} else if (n <= 3400) {
|
911
|
+
return 8;
|
912
|
+
} else if (n <= 9630) {
|
913
|
+
return 9;
|
914
|
+
} else if (n <= 17900) {
|
915
|
+
return 10;
|
916
|
+
} else if (n <= 32800) {
|
917
|
+
return 11;
|
918
|
+
} else {
|
919
|
+
return PIPPENGER_MAX_BUCKET_WINDOW;
|
920
|
+
}
|
921
|
+
#endif
|
922
|
+
}
|
923
|
+
|
924
|
+
/**
|
925
|
+
* Returns the maximum optimal number of points for a bucket_window.
|
926
|
+
*/
|
927
|
+
static size_t secp256k1_pippenger_bucket_window_inv(int bucket_window) {
|
928
|
+
switch(bucket_window) {
|
929
|
+
#ifdef USE_ENDOMORPHISM
|
930
|
+
case 1: return 1;
|
931
|
+
case 2: return 4;
|
932
|
+
case 3: return 20;
|
933
|
+
case 4: return 57;
|
934
|
+
case 5: return 136;
|
935
|
+
case 6: return 235;
|
936
|
+
case 7: return 1260;
|
937
|
+
case 8: return 1260;
|
938
|
+
case 9: return 4420;
|
939
|
+
case 10: return 7880;
|
940
|
+
case 11: return 16050;
|
941
|
+
case PIPPENGER_MAX_BUCKET_WINDOW: return SIZE_MAX;
|
942
|
+
#else
|
943
|
+
case 1: return 1;
|
944
|
+
case 2: return 11;
|
945
|
+
case 3: return 45;
|
946
|
+
case 4: return 100;
|
947
|
+
case 5: return 275;
|
948
|
+
case 6: return 625;
|
949
|
+
case 7: return 1850;
|
950
|
+
case 8: return 3400;
|
951
|
+
case 9: return 9630;
|
952
|
+
case 10: return 17900;
|
953
|
+
case 11: return 32800;
|
954
|
+
case PIPPENGER_MAX_BUCKET_WINDOW: return SIZE_MAX;
|
955
|
+
#endif
|
956
|
+
}
|
957
|
+
return 0;
|
958
|
+
}
|
959
|
+
|
960
|
+
|
961
|
+
#ifdef USE_ENDOMORPHISM
|
962
|
+
SECP256K1_INLINE static void secp256k1_ecmult_endo_split(secp256k1_scalar *s1, secp256k1_scalar *s2, secp256k1_ge *p1, secp256k1_ge *p2) {
|
963
|
+
secp256k1_scalar tmp = *s1;
|
964
|
+
secp256k1_scalar_split_lambda(s1, s2, &tmp);
|
965
|
+
secp256k1_ge_mul_lambda(p2, p1);
|
966
|
+
|
967
|
+
if (secp256k1_scalar_is_high(s1)) {
|
968
|
+
secp256k1_scalar_negate(s1, s1);
|
969
|
+
secp256k1_ge_neg(p1, p1);
|
970
|
+
}
|
971
|
+
if (secp256k1_scalar_is_high(s2)) {
|
972
|
+
secp256k1_scalar_negate(s2, s2);
|
973
|
+
secp256k1_ge_neg(p2, p2);
|
974
|
+
}
|
975
|
+
}
|
976
|
+
#endif
|
977
|
+
|
978
|
+
/**
|
979
|
+
* Returns the scratch size required for a given number of points (excluding
|
980
|
+
* base point G) without considering alignment.
|
981
|
+
*/
|
982
|
+
static size_t secp256k1_pippenger_scratch_size(size_t n_points, int bucket_window) {
|
983
|
+
#ifdef USE_ENDOMORPHISM
|
984
|
+
size_t entries = 2*n_points + 2;
|
985
|
+
#else
|
986
|
+
size_t entries = n_points + 1;
|
987
|
+
#endif
|
988
|
+
size_t entry_size = sizeof(secp256k1_ge) + sizeof(secp256k1_scalar) + sizeof(struct secp256k1_pippenger_point_state) + (WNAF_SIZE(bucket_window+1)+1)*sizeof(int);
|
989
|
+
return (sizeof(secp256k1_gej) << bucket_window) + sizeof(struct secp256k1_pippenger_state) + entries * entry_size;
|
990
|
+
}
|
991
|
+
|
992
|
+
static int secp256k1_ecmult_pippenger_batch(const secp256k1_callback* error_callback, const secp256k1_ecmult_context *ctx, secp256k1_scratch *scratch, secp256k1_gej *r, const secp256k1_scalar *inp_g_sc, secp256k1_ecmult_multi_callback cb, void *cbdata, size_t n_points, size_t cb_offset) {
|
993
|
+
const size_t scratch_checkpoint = secp256k1_scratch_checkpoint(error_callback, scratch);
|
994
|
+
/* Use 2(n+1) with the endomorphism, n+1 without, when calculating batch
|
995
|
+
* sizes. The reason for +1 is that we add the G scalar to the list of
|
996
|
+
* other scalars. */
|
997
|
+
#ifdef USE_ENDOMORPHISM
|
998
|
+
size_t entries = 2*n_points + 2;
|
999
|
+
#else
|
1000
|
+
size_t entries = n_points + 1;
|
1001
|
+
#endif
|
1002
|
+
secp256k1_ge *points;
|
1003
|
+
secp256k1_scalar *scalars;
|
1004
|
+
secp256k1_gej *buckets;
|
1005
|
+
struct secp256k1_pippenger_state *state_space;
|
1006
|
+
size_t idx = 0;
|
1007
|
+
size_t point_idx = 0;
|
1008
|
+
int i, j;
|
1009
|
+
int bucket_window;
|
1010
|
+
|
1011
|
+
(void)ctx;
|
1012
|
+
secp256k1_gej_set_infinity(r);
|
1013
|
+
if (inp_g_sc == NULL && n_points == 0) {
|
1014
|
+
return 1;
|
1015
|
+
}
|
1016
|
+
|
1017
|
+
bucket_window = secp256k1_pippenger_bucket_window(n_points);
|
1018
|
+
points = (secp256k1_ge *) secp256k1_scratch_alloc(error_callback, scratch, entries * sizeof(*points));
|
1019
|
+
scalars = (secp256k1_scalar *) secp256k1_scratch_alloc(error_callback, scratch, entries * sizeof(*scalars));
|
1020
|
+
state_space = (struct secp256k1_pippenger_state *) secp256k1_scratch_alloc(error_callback, scratch, sizeof(*state_space));
|
1021
|
+
if (points == NULL || scalars == NULL || state_space == NULL) {
|
1022
|
+
secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
|
1023
|
+
return 0;
|
1024
|
+
}
|
1025
|
+
|
1026
|
+
state_space->ps = (struct secp256k1_pippenger_point_state *) secp256k1_scratch_alloc(error_callback, scratch, entries * sizeof(*state_space->ps));
|
1027
|
+
state_space->wnaf_na = (int *) secp256k1_scratch_alloc(error_callback, scratch, entries*(WNAF_SIZE(bucket_window+1)) * sizeof(int));
|
1028
|
+
buckets = (secp256k1_gej *) secp256k1_scratch_alloc(error_callback, scratch, (1<<bucket_window) * sizeof(*buckets));
|
1029
|
+
if (state_space->ps == NULL || state_space->wnaf_na == NULL || buckets == NULL) {
|
1030
|
+
secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
|
1031
|
+
return 0;
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
if (inp_g_sc != NULL) {
|
1035
|
+
scalars[0] = *inp_g_sc;
|
1036
|
+
points[0] = secp256k1_ge_const_g;
|
1037
|
+
idx++;
|
1038
|
+
#ifdef USE_ENDOMORPHISM
|
1039
|
+
secp256k1_ecmult_endo_split(&scalars[0], &scalars[1], &points[0], &points[1]);
|
1040
|
+
idx++;
|
1041
|
+
#endif
|
1042
|
+
}
|
1043
|
+
|
1044
|
+
while (point_idx < n_points) {
|
1045
|
+
if (!cb(&scalars[idx], &points[idx], point_idx + cb_offset, cbdata)) {
|
1046
|
+
secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
|
1047
|
+
return 0;
|
1048
|
+
}
|
1049
|
+
idx++;
|
1050
|
+
#ifdef USE_ENDOMORPHISM
|
1051
|
+
secp256k1_ecmult_endo_split(&scalars[idx - 1], &scalars[idx], &points[idx - 1], &points[idx]);
|
1052
|
+
idx++;
|
1053
|
+
#endif
|
1054
|
+
point_idx++;
|
1055
|
+
}
|
1056
|
+
|
1057
|
+
secp256k1_ecmult_pippenger_wnaf(buckets, bucket_window, state_space, r, scalars, points, idx);
|
1058
|
+
|
1059
|
+
/* Clear data */
|
1060
|
+
for(i = 0; (size_t)i < idx; i++) {
|
1061
|
+
secp256k1_scalar_clear(&scalars[i]);
|
1062
|
+
state_space->ps[i].skew_na = 0;
|
1063
|
+
for(j = 0; j < WNAF_SIZE(bucket_window+1); j++) {
|
1064
|
+
state_space->wnaf_na[i * WNAF_SIZE(bucket_window+1) + j] = 0;
|
1065
|
+
}
|
1066
|
+
}
|
1067
|
+
for(i = 0; i < 1<<bucket_window; i++) {
|
1068
|
+
secp256k1_gej_clear(&buckets[i]);
|
1069
|
+
}
|
1070
|
+
secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
|
1071
|
+
return 1;
|
1072
|
+
}
|
1073
|
+
|
1074
|
+
/* Wrapper for secp256k1_ecmult_multi_func interface */
|
1075
|
+
static int secp256k1_ecmult_pippenger_batch_single(const secp256k1_callback* error_callback, const secp256k1_ecmult_context *actx, secp256k1_scratch *scratch, secp256k1_gej *r, const secp256k1_scalar *inp_g_sc, secp256k1_ecmult_multi_callback cb, void *cbdata, size_t n) {
|
1076
|
+
return secp256k1_ecmult_pippenger_batch(error_callback, actx, scratch, r, inp_g_sc, cb, cbdata, n, 0);
|
1077
|
+
}
|
1078
|
+
|
1079
|
+
/**
|
1080
|
+
* Returns the maximum number of points in addition to G that can be used with
|
1081
|
+
* a given scratch space. The function ensures that fewer points may also be
|
1082
|
+
* used.
|
1083
|
+
*/
|
1084
|
+
static size_t secp256k1_pippenger_max_points(const secp256k1_callback* error_callback, secp256k1_scratch *scratch) {
|
1085
|
+
size_t max_alloc = secp256k1_scratch_max_allocation(error_callback, scratch, PIPPENGER_SCRATCH_OBJECTS);
|
1086
|
+
int bucket_window;
|
1087
|
+
size_t res = 0;
|
1088
|
+
|
1089
|
+
for (bucket_window = 1; bucket_window <= PIPPENGER_MAX_BUCKET_WINDOW; bucket_window++) {
|
1090
|
+
size_t n_points;
|
1091
|
+
size_t max_points = secp256k1_pippenger_bucket_window_inv(bucket_window);
|
1092
|
+
size_t space_for_points;
|
1093
|
+
size_t space_overhead;
|
1094
|
+
size_t entry_size = sizeof(secp256k1_ge) + sizeof(secp256k1_scalar) + sizeof(struct secp256k1_pippenger_point_state) + (WNAF_SIZE(bucket_window+1)+1)*sizeof(int);
|
1095
|
+
|
1096
|
+
#ifdef USE_ENDOMORPHISM
|
1097
|
+
entry_size = 2*entry_size;
|
1098
|
+
#endif
|
1099
|
+
space_overhead = (sizeof(secp256k1_gej) << bucket_window) + entry_size + sizeof(struct secp256k1_pippenger_state);
|
1100
|
+
if (space_overhead > max_alloc) {
|
1101
|
+
break;
|
1102
|
+
}
|
1103
|
+
space_for_points = max_alloc - space_overhead;
|
1104
|
+
|
1105
|
+
n_points = space_for_points/entry_size;
|
1106
|
+
n_points = n_points > max_points ? max_points : n_points;
|
1107
|
+
if (n_points > res) {
|
1108
|
+
res = n_points;
|
1109
|
+
}
|
1110
|
+
if (n_points < max_points) {
|
1111
|
+
/* A larger bucket_window may support even more points. But if we
|
1112
|
+
* would choose that then the caller couldn't safely use any number
|
1113
|
+
* smaller than what this function returns */
|
1114
|
+
break;
|
1115
|
+
}
|
1116
|
+
}
|
1117
|
+
return res;
|
1118
|
+
}
|
1119
|
+
|
1120
|
+
/* Computes ecmult_multi by simply multiplying and adding each point. Does not
|
1121
|
+
* require a scratch space */
|
1122
|
+
static int secp256k1_ecmult_multi_simple_var(const secp256k1_ecmult_context *ctx, secp256k1_gej *r, const secp256k1_scalar *inp_g_sc, secp256k1_ecmult_multi_callback cb, void *cbdata, size_t n_points) {
|
1123
|
+
size_t point_idx;
|
1124
|
+
secp256k1_scalar szero;
|
1125
|
+
secp256k1_gej tmpj;
|
1126
|
+
|
1127
|
+
secp256k1_scalar_set_int(&szero, 0);
|
1128
|
+
secp256k1_gej_set_infinity(r);
|
1129
|
+
secp256k1_gej_set_infinity(&tmpj);
|
1130
|
+
/* r = inp_g_sc*G */
|
1131
|
+
secp256k1_ecmult(ctx, r, &tmpj, &szero, inp_g_sc);
|
1132
|
+
for (point_idx = 0; point_idx < n_points; point_idx++) {
|
1133
|
+
secp256k1_ge point;
|
1134
|
+
secp256k1_gej pointj;
|
1135
|
+
secp256k1_scalar scalar;
|
1136
|
+
if (!cb(&scalar, &point, point_idx, cbdata)) {
|
1137
|
+
return 0;
|
1138
|
+
}
|
1139
|
+
/* r += scalar*point */
|
1140
|
+
secp256k1_gej_set_ge(&pointj, &point);
|
1141
|
+
secp256k1_ecmult(ctx, &tmpj, &pointj, &scalar, NULL);
|
1142
|
+
secp256k1_gej_add_var(r, r, &tmpj, NULL);
|
1143
|
+
}
|
1144
|
+
return 1;
|
1145
|
+
}
|
1146
|
+
|
1147
|
+
/* Compute the number of batches and the batch size given the maximum batch size and the
|
1148
|
+
* total number of points */
|
1149
|
+
static int secp256k1_ecmult_multi_batch_size_helper(size_t *n_batches, size_t *n_batch_points, size_t max_n_batch_points, size_t n) {
|
1150
|
+
if (max_n_batch_points == 0) {
|
1151
|
+
return 0;
|
1152
|
+
}
|
1153
|
+
if (max_n_batch_points > ECMULT_MAX_POINTS_PER_BATCH) {
|
1154
|
+
max_n_batch_points = ECMULT_MAX_POINTS_PER_BATCH;
|
1155
|
+
}
|
1156
|
+
if (n == 0) {
|
1157
|
+
*n_batches = 0;
|
1158
|
+
*n_batch_points = 0;
|
1159
|
+
return 1;
|
1160
|
+
}
|
1161
|
+
/* Compute ceil(n/max_n_batch_points) and ceil(n/n_batches) */
|
1162
|
+
*n_batches = 1 + (n - 1) / max_n_batch_points;
|
1163
|
+
*n_batch_points = 1 + (n - 1) / *n_batches;
|
1164
|
+
return 1;
|
1165
|
+
}
|
1166
|
+
|
1167
|
+
typedef int (*secp256k1_ecmult_multi_func)(const secp256k1_callback* error_callback, const secp256k1_ecmult_context*, secp256k1_scratch*, secp256k1_gej*, const secp256k1_scalar*, secp256k1_ecmult_multi_callback cb, void*, size_t);
|
1168
|
+
static int secp256k1_ecmult_multi_var(const secp256k1_callback* error_callback, const secp256k1_ecmult_context *ctx, secp256k1_scratch *scratch, secp256k1_gej *r, const secp256k1_scalar *inp_g_sc, secp256k1_ecmult_multi_callback cb, void *cbdata, size_t n) {
|
1169
|
+
size_t i;
|
1170
|
+
|
1171
|
+
int (*f)(const secp256k1_callback* error_callback, const secp256k1_ecmult_context*, secp256k1_scratch*, secp256k1_gej*, const secp256k1_scalar*, secp256k1_ecmult_multi_callback cb, void*, size_t, size_t);
|
1172
|
+
size_t n_batches;
|
1173
|
+
size_t n_batch_points;
|
1174
|
+
|
1175
|
+
secp256k1_gej_set_infinity(r);
|
1176
|
+
if (inp_g_sc == NULL && n == 0) {
|
1177
|
+
return 1;
|
1178
|
+
} else if (n == 0) {
|
1179
|
+
secp256k1_scalar szero;
|
1180
|
+
secp256k1_scalar_set_int(&szero, 0);
|
1181
|
+
secp256k1_ecmult(ctx, r, r, &szero, inp_g_sc);
|
1182
|
+
return 1;
|
1183
|
+
}
|
1184
|
+
if (scratch == NULL) {
|
1185
|
+
return secp256k1_ecmult_multi_simple_var(ctx, r, inp_g_sc, cb, cbdata, n);
|
1186
|
+
}
|
1187
|
+
|
1188
|
+
/* Compute the batch sizes for Pippenger's algorithm given a scratch space. If it's greater than
|
1189
|
+
* a threshold use Pippenger's algorithm. Otherwise use Strauss' algorithm.
|
1190
|
+
* As a first step check if there's enough space for Pippenger's algo (which requires less space
|
1191
|
+
* than Strauss' algo) and if not, use the simple algorithm. */
|
1192
|
+
if (!secp256k1_ecmult_multi_batch_size_helper(&n_batches, &n_batch_points, secp256k1_pippenger_max_points(error_callback, scratch), n)) {
|
1193
|
+
return secp256k1_ecmult_multi_simple_var(ctx, r, inp_g_sc, cb, cbdata, n);
|
1194
|
+
}
|
1195
|
+
if (n_batch_points >= ECMULT_PIPPENGER_THRESHOLD) {
|
1196
|
+
f = secp256k1_ecmult_pippenger_batch;
|
1197
|
+
} else {
|
1198
|
+
if (!secp256k1_ecmult_multi_batch_size_helper(&n_batches, &n_batch_points, secp256k1_strauss_max_points(error_callback, scratch), n)) {
|
1199
|
+
return secp256k1_ecmult_multi_simple_var(ctx, r, inp_g_sc, cb, cbdata, n);
|
1200
|
+
}
|
1201
|
+
f = secp256k1_ecmult_strauss_batch;
|
1202
|
+
}
|
1203
|
+
for(i = 0; i < n_batches; i++) {
|
1204
|
+
size_t nbp = n < n_batch_points ? n : n_batch_points;
|
1205
|
+
size_t offset = n_batch_points*i;
|
1206
|
+
secp256k1_gej tmp;
|
1207
|
+
if (!f(error_callback, ctx, scratch, &tmp, i == 0 ? inp_g_sc : NULL, cb, cbdata, nbp, offset)) {
|
1208
|
+
return 0;
|
1209
|
+
}
|
1210
|
+
secp256k1_gej_add_var(r, r, &tmp, NULL);
|
1211
|
+
n -= nbp;
|
1212
|
+
}
|
1213
|
+
return 1;
|
1214
|
+
}
|
1215
|
+
|
1216
|
+
#endif /* SECP256K1_ECMULT_IMPL_H */
|