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.

Files changed (1098) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +379 -3
  3. package/bcxrfopy.cjs +1 -0
  4. package/cli.js +245 -0
  5. package/node_modules/@types/bn.js/LICENSE +21 -0
  6. package/node_modules/@types/bn.js/README.md +16 -0
  7. package/node_modules/@types/bn.js/index.d.ts +586 -0
  8. package/node_modules/@types/bn.js/package.json +40 -0
  9. package/node_modules/@types/node/LICENSE +21 -0
  10. package/node_modules/@types/node/README.md +16 -0
  11. package/node_modules/@types/node/assert.d.ts +84 -0
  12. package/node_modules/@types/node/async_hooks.d.ts +226 -0
  13. package/node_modules/@types/node/base.d.ts +20 -0
  14. package/node_modules/@types/node/buffer.d.ts +22 -0
  15. package/node_modules/@types/node/child_process.d.ts +505 -0
  16. package/node_modules/@types/node/cluster.d.ts +262 -0
  17. package/node_modules/@types/node/console.d.ts +133 -0
  18. package/node_modules/@types/node/constants.d.ts +8 -0
  19. package/node_modules/@types/node/crypto.d.ts +707 -0
  20. package/node_modules/@types/node/dgram.d.ts +141 -0
  21. package/node_modules/@types/node/dns.d.ts +371 -0
  22. package/node_modules/@types/node/domain.d.ts +24 -0
  23. package/node_modules/@types/node/events.d.ts +83 -0
  24. package/node_modules/@types/node/fs/promises.d.ts +539 -0
  25. package/node_modules/@types/node/fs.d.ts +2156 -0
  26. package/node_modules/@types/node/globals.d.ts +606 -0
  27. package/node_modules/@types/node/globals.global.d.ts +1 -0
  28. package/node_modules/@types/node/http.d.ts +414 -0
  29. package/node_modules/@types/node/http2.d.ts +952 -0
  30. package/node_modules/@types/node/https.d.ts +37 -0
  31. package/node_modules/@types/node/index.d.ts +61 -0
  32. package/node_modules/@types/node/inspector.d.ts +3041 -0
  33. package/node_modules/@types/node/module.d.ts +52 -0
  34. package/node_modules/@types/node/net.d.ts +268 -0
  35. package/node_modules/@types/node/os.d.ts +239 -0
  36. package/node_modules/@types/node/package.json +255 -0
  37. package/node_modules/@types/node/path.d.ts +153 -0
  38. package/node_modules/@types/node/perf_hooks.d.ts +271 -0
  39. package/node_modules/@types/node/process.d.ts +406 -0
  40. package/node_modules/@types/node/punycode.d.ts +12 -0
  41. package/node_modules/@types/node/querystring.d.ts +28 -0
  42. package/node_modules/@types/node/readline.d.ts +171 -0
  43. package/node_modules/@types/node/repl.d.ts +387 -0
  44. package/node_modules/@types/node/stream.d.ts +351 -0
  45. package/node_modules/@types/node/string_decoder.d.ts +7 -0
  46. package/node_modules/@types/node/timers.d.ts +16 -0
  47. package/node_modules/@types/node/tls.d.ts +777 -0
  48. package/node_modules/@types/node/trace_events.d.ts +61 -0
  49. package/node_modules/@types/node/ts3.4/assert.d.ts +57 -0
  50. package/node_modules/@types/node/ts3.4/base.d.ts +56 -0
  51. package/node_modules/@types/node/ts3.4/globals.global.d.ts +1 -0
  52. package/node_modules/@types/node/ts3.4/index.d.ts +8 -0
  53. package/node_modules/@types/node/ts3.6/base.d.ts +23 -0
  54. package/node_modules/@types/node/ts3.6/index.d.ts +8 -0
  55. package/node_modules/@types/node/tty.d.ts +66 -0
  56. package/node_modules/@types/node/url.d.ts +110 -0
  57. package/node_modules/@types/node/util.d.ts +196 -0
  58. package/node_modules/@types/node/v8.d.ts +187 -0
  59. package/node_modules/@types/node/vm.d.ts +146 -0
  60. package/node_modules/@types/node/wasi.d.ts +52 -0
  61. package/node_modules/@types/node/worker_threads.d.ts +192 -0
  62. package/node_modules/@types/node/zlib.d.ts +352 -0
  63. package/node_modules/@types/pbkdf2/LICENSE +21 -0
  64. package/node_modules/@types/pbkdf2/README.md +16 -0
  65. package/node_modules/@types/pbkdf2/index.d.ts +41 -0
  66. package/node_modules/@types/pbkdf2/package.json +30 -0
  67. package/node_modules/@types/secp256k1/LICENSE +21 -0
  68. package/node_modules/@types/secp256k1/README.md +16 -0
  69. package/node_modules/@types/secp256k1/index.d.ts +141 -0
  70. package/node_modules/@types/secp256k1/package.json +30 -0
  71. package/node_modules/ansi-regex/index.js +14 -0
  72. package/node_modules/ansi-regex/license +9 -0
  73. package/node_modules/ansi-regex/package.json +57 -0
  74. package/node_modules/ansi-regex/readme.md +87 -0
  75. package/node_modules/ansi-styles/index.js +165 -0
  76. package/node_modules/ansi-styles/license +9 -0
  77. package/node_modules/ansi-styles/package.json +60 -0
  78. package/node_modules/ansi-styles/readme.md +147 -0
  79. package/node_modules/base-x/LICENSE.md +22 -0
  80. package/node_modules/base-x/README.md +67 -0
  81. package/node_modules/base-x/package.json +53 -0
  82. package/node_modules/base-x/src/index.d.ts +10 -0
  83. package/node_modules/base-x/src/index.js +123 -0
  84. package/node_modules/blakejs/.npmignore +1 -0
  85. package/node_modules/blakejs/.travis.yml +3 -0
  86. package/node_modules/blakejs/README.md +112 -0
  87. package/node_modules/blakejs/blake2b.js +273 -0
  88. package/node_modules/blakejs/blake2s.js +190 -0
  89. package/node_modules/blakejs/generated_test_vectors.txt +100 -0
  90. package/node_modules/blakejs/index.js +15 -0
  91. package/node_modules/blakejs/package.json +27 -0
  92. package/node_modules/blakejs/test_blake2b.js +88 -0
  93. package/node_modules/blakejs/test_blake2s.js +80 -0
  94. package/node_modules/blakejs/util.js +81 -0
  95. package/node_modules/bn.js/README.md +221 -0
  96. package/node_modules/bn.js/lib/bn.js +3433 -0
  97. package/node_modules/bn.js/package.json +40 -0
  98. package/node_modules/bn.js/util/genCombMulTo.js +65 -0
  99. package/node_modules/bn.js/util/genCombMulTo10.js +65 -0
  100. package/node_modules/brorand/.npmignore +2 -0
  101. package/node_modules/brorand/README.md +26 -0
  102. package/node_modules/brorand/index.js +65 -0
  103. package/node_modules/brorand/package.json +35 -0
  104. package/node_modules/brorand/test/api-test.js +8 -0
  105. package/node_modules/browserify-aes/.travis.yml +15 -0
  106. package/node_modules/browserify-aes/LICENSE +21 -0
  107. package/node_modules/browserify-aes/README.md +19 -0
  108. package/node_modules/browserify-aes/aes.js +228 -0
  109. package/node_modules/browserify-aes/authCipher.js +117 -0
  110. package/node_modules/browserify-aes/browser.js +13 -0
  111. package/node_modules/browserify-aes/decrypter.js +124 -0
  112. package/node_modules/browserify-aes/encrypter.js +114 -0
  113. package/node_modules/browserify-aes/ghash.js +89 -0
  114. package/node_modules/browserify-aes/incr32.js +15 -0
  115. package/node_modules/browserify-aes/index.js +7 -0
  116. package/node_modules/browserify-aes/modes/cbc.js +17 -0
  117. package/node_modules/browserify-aes/modes/cfb.js +33 -0
  118. package/node_modules/browserify-aes/modes/cfb1.js +42 -0
  119. package/node_modules/browserify-aes/modes/cfb8.js +25 -0
  120. package/node_modules/browserify-aes/modes/ctr.js +30 -0
  121. package/node_modules/browserify-aes/modes/ecb.js +7 -0
  122. package/node_modules/browserify-aes/modes/index.js +18 -0
  123. package/node_modules/browserify-aes/modes/list.json +191 -0
  124. package/node_modules/browserify-aes/modes/ofb.js +16 -0
  125. package/node_modules/browserify-aes/package.json +47 -0
  126. package/node_modules/browserify-aes/streamCipher.js +27 -0
  127. package/node_modules/bs58/README.md +71 -0
  128. package/node_modules/bs58/index.js +4 -0
  129. package/node_modules/bs58/package.json +41 -0
  130. package/node_modules/bs58check/LICENSE +21 -0
  131. package/node_modules/bs58check/README.md +27 -0
  132. package/node_modules/bs58check/base.js +50 -0
  133. package/node_modules/bs58check/index.js +12 -0
  134. package/node_modules/bs58check/package.json +56 -0
  135. package/node_modules/buffer-from/LICENSE +21 -0
  136. package/node_modules/buffer-from/index.js +69 -0
  137. package/node_modules/buffer-from/package.json +23 -0
  138. package/node_modules/buffer-from/readme.md +69 -0
  139. package/node_modules/buffer-xor/.npmignore +1 -0
  140. package/node_modules/buffer-xor/.travis.yml +9 -0
  141. package/node_modules/buffer-xor/LICENSE +21 -0
  142. package/node_modules/buffer-xor/README.md +41 -0
  143. package/node_modules/buffer-xor/index.js +10 -0
  144. package/node_modules/buffer-xor/inline.js +1 -0
  145. package/node_modules/buffer-xor/inplace.js +9 -0
  146. package/node_modules/buffer-xor/package.json +41 -0
  147. package/node_modules/buffer-xor/test/fixtures.json +23 -0
  148. package/node_modules/buffer-xor/test/index.js +38 -0
  149. package/node_modules/camelcase/index.d.ts +63 -0
  150. package/node_modules/camelcase/index.js +76 -0
  151. package/node_modules/camelcase/license +9 -0
  152. package/node_modules/camelcase/package.json +47 -0
  153. package/node_modules/camelcase/readme.md +99 -0
  154. package/node_modules/cipher-base/.eslintrc +3 -0
  155. package/node_modules/cipher-base/.npmignore +1 -0
  156. package/node_modules/cipher-base/.travis.yml +6 -0
  157. package/node_modules/cipher-base/LICENSE +21 -0
  158. package/node_modules/cipher-base/README.md +17 -0
  159. package/node_modules/cipher-base/index.js +99 -0
  160. package/node_modules/cipher-base/package.json +36 -0
  161. package/node_modules/cipher-base/test.js +111 -0
  162. package/node_modules/cliui/LICENSE.txt +14 -0
  163. package/node_modules/cliui/README.md +115 -0
  164. package/node_modules/cliui/index.js +324 -0
  165. package/node_modules/cliui/package.json +71 -0
  166. package/node_modules/color-convert/LICENSE +21 -0
  167. package/node_modules/color-convert/README.md +68 -0
  168. package/node_modules/color-convert/conversions.js +868 -0
  169. package/node_modules/color-convert/index.js +78 -0
  170. package/node_modules/color-convert/package.json +50 -0
  171. package/node_modules/color-convert/route.js +97 -0
  172. package/node_modules/color-name/.eslintrc.json +43 -0
  173. package/node_modules/color-name/.npmignore +107 -0
  174. package/node_modules/color-name/LICENSE +8 -0
  175. package/node_modules/color-name/README.md +11 -0
  176. package/node_modules/color-name/index.js +152 -0
  177. package/node_modules/color-name/package.json +29 -0
  178. package/node_modules/color-name/test.js +7 -0
  179. package/node_modules/create-hash/.travis.yml +17 -0
  180. package/node_modules/create-hash/LICENSE +21 -0
  181. package/node_modules/create-hash/README.md +19 -0
  182. package/node_modules/create-hash/browser.js +30 -0
  183. package/node_modules/create-hash/index.js +1 -0
  184. package/node_modules/create-hash/md5.js +5 -0
  185. package/node_modules/create-hash/package.json +43 -0
  186. package/node_modules/create-hash/test.js +41 -0
  187. package/node_modules/create-hmac/LICENSE +21 -0
  188. package/node_modules/create-hmac/README.md +20 -0
  189. package/node_modules/create-hmac/browser.js +62 -0
  190. package/node_modules/create-hmac/index.js +1 -0
  191. package/node_modules/create-hmac/legacy.js +46 -0
  192. package/node_modules/create-hmac/package.json +49 -0
  193. package/node_modules/cross-spawn/LICENSE +21 -0
  194. package/node_modules/cross-spawn/README.md +94 -0
  195. package/node_modules/cross-spawn/index.js +39 -0
  196. package/node_modules/cross-spawn/lib/enoent.js +59 -0
  197. package/node_modules/cross-spawn/lib/parse.js +125 -0
  198. package/node_modules/cross-spawn/lib/util/escape.js +45 -0
  199. package/node_modules/cross-spawn/lib/util/readShebang.js +32 -0
  200. package/node_modules/cross-spawn/lib/util/resolveCommand.js +47 -0
  201. package/node_modules/cross-spawn/package.json +80 -0
  202. package/node_modules/decamelize/index.js +13 -0
  203. package/node_modules/decamelize/license +21 -0
  204. package/node_modules/decamelize/package.json +42 -0
  205. package/node_modules/decamelize/readme.md +48 -0
  206. package/node_modules/elliptic/README.md +238 -0
  207. package/node_modules/elliptic/lib/elliptic/curve/base.js +376 -0
  208. package/node_modules/elliptic/lib/elliptic/curve/edwards.js +432 -0
  209. package/node_modules/elliptic/lib/elliptic/curve/index.js +8 -0
  210. package/node_modules/elliptic/lib/elliptic/curve/mont.js +178 -0
  211. package/node_modules/elliptic/lib/elliptic/curve/short.js +937 -0
  212. package/node_modules/elliptic/lib/elliptic/curves.js +206 -0
  213. package/node_modules/elliptic/lib/elliptic/ec/index.js +241 -0
  214. package/node_modules/elliptic/lib/elliptic/ec/key.js +118 -0
  215. package/node_modules/elliptic/lib/elliptic/ec/signature.js +166 -0
  216. package/node_modules/elliptic/lib/elliptic/eddsa/index.js +118 -0
  217. package/node_modules/elliptic/lib/elliptic/eddsa/key.js +95 -0
  218. package/node_modules/elliptic/lib/elliptic/eddsa/signature.js +65 -0
  219. package/node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js +780 -0
  220. package/node_modules/elliptic/lib/elliptic/utils.js +119 -0
  221. package/node_modules/elliptic/lib/elliptic.js +13 -0
  222. package/node_modules/elliptic/package.json +62 -0
  223. package/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
  224. package/node_modules/emoji-regex/README.md +73 -0
  225. package/node_modules/emoji-regex/es2015/index.js +6 -0
  226. package/node_modules/emoji-regex/es2015/text.js +6 -0
  227. package/node_modules/emoji-regex/index.d.ts +5 -0
  228. package/node_modules/emoji-regex/index.js +6 -0
  229. package/node_modules/emoji-regex/package.json +55 -0
  230. package/node_modules/emoji-regex/text.js +6 -0
  231. package/node_modules/end-of-stream/LICENSE +21 -0
  232. package/node_modules/end-of-stream/README.md +54 -0
  233. package/node_modules/end-of-stream/index.js +94 -0
  234. package/node_modules/end-of-stream/package.json +41 -0
  235. package/node_modules/ethereum-cryptography/LICENSE +26 -0
  236. package/node_modules/ethereum-cryptography/README.md +560 -0
  237. package/node_modules/ethereum-cryptography/aes.d.ts +4 -0
  238. package/node_modules/ethereum-cryptography/aes.d.ts.map +1 -0
  239. package/node_modules/ethereum-cryptography/aes.js +38 -0
  240. package/node_modules/ethereum-cryptography/aes.js.map +1 -0
  241. package/node_modules/ethereum-cryptography/bip39/index.d.ts +8 -0
  242. package/node_modules/ethereum-cryptography/bip39/index.d.ts.map +1 -0
  243. package/node_modules/ethereum-cryptography/bip39/index.js +71 -0
  244. package/node_modules/ethereum-cryptography/bip39/index.js.map +1 -0
  245. package/node_modules/ethereum-cryptography/bip39/wordlists/czech.d.ts +2 -0
  246. package/node_modules/ethereum-cryptography/bip39/wordlists/czech.d.ts.map +1 -0
  247. package/node_modules/ethereum-cryptography/bip39/wordlists/czech.js +2053 -0
  248. package/node_modules/ethereum-cryptography/bip39/wordlists/czech.js.map +1 -0
  249. package/node_modules/ethereum-cryptography/bip39/wordlists/english.d.ts +2 -0
  250. package/node_modules/ethereum-cryptography/bip39/wordlists/english.d.ts.map +1 -0
  251. package/node_modules/ethereum-cryptography/bip39/wordlists/english.js +2053 -0
  252. package/node_modules/ethereum-cryptography/bip39/wordlists/english.js.map +1 -0
  253. package/node_modules/ethereum-cryptography/bip39/wordlists/french.d.ts +2 -0
  254. package/node_modules/ethereum-cryptography/bip39/wordlists/french.d.ts.map +1 -0
  255. package/node_modules/ethereum-cryptography/bip39/wordlists/french.js +2053 -0
  256. package/node_modules/ethereum-cryptography/bip39/wordlists/french.js.map +1 -0
  257. package/node_modules/ethereum-cryptography/bip39/wordlists/italian.d.ts +2 -0
  258. package/node_modules/ethereum-cryptography/bip39/wordlists/italian.d.ts.map +1 -0
  259. package/node_modules/ethereum-cryptography/bip39/wordlists/italian.js +2053 -0
  260. package/node_modules/ethereum-cryptography/bip39/wordlists/italian.js.map +1 -0
  261. package/node_modules/ethereum-cryptography/bip39/wordlists/japanese.d.ts +2 -0
  262. package/node_modules/ethereum-cryptography/bip39/wordlists/japanese.d.ts.map +1 -0
  263. package/node_modules/ethereum-cryptography/bip39/wordlists/japanese.js +2053 -0
  264. package/node_modules/ethereum-cryptography/bip39/wordlists/japanese.js.map +1 -0
  265. package/node_modules/ethereum-cryptography/bip39/wordlists/korean.d.ts +2 -0
  266. package/node_modules/ethereum-cryptography/bip39/wordlists/korean.d.ts.map +1 -0
  267. package/node_modules/ethereum-cryptography/bip39/wordlists/korean.js +2053 -0
  268. package/node_modules/ethereum-cryptography/bip39/wordlists/korean.js.map +1 -0
  269. package/node_modules/ethereum-cryptography/bip39/wordlists/simplified-chinese.d.ts +2 -0
  270. package/node_modules/ethereum-cryptography/bip39/wordlists/simplified-chinese.d.ts.map +1 -0
  271. package/node_modules/ethereum-cryptography/bip39/wordlists/simplified-chinese.js +2053 -0
  272. package/node_modules/ethereum-cryptography/bip39/wordlists/simplified-chinese.js.map +1 -0
  273. package/node_modules/ethereum-cryptography/bip39/wordlists/spanish.d.ts +2 -0
  274. package/node_modules/ethereum-cryptography/bip39/wordlists/spanish.d.ts.map +1 -0
  275. package/node_modules/ethereum-cryptography/bip39/wordlists/spanish.js +2053 -0
  276. package/node_modules/ethereum-cryptography/bip39/wordlists/spanish.js.map +1 -0
  277. package/node_modules/ethereum-cryptography/bip39/wordlists/traditional-chinese.d.ts +2 -0
  278. package/node_modules/ethereum-cryptography/bip39/wordlists/traditional-chinese.d.ts.map +1 -0
  279. package/node_modules/ethereum-cryptography/bip39/wordlists/traditional-chinese.js +2053 -0
  280. package/node_modules/ethereum-cryptography/bip39/wordlists/traditional-chinese.js.map +1 -0
  281. package/node_modules/ethereum-cryptography/blake2b.d.ts +3 -0
  282. package/node_modules/ethereum-cryptography/blake2b.d.ts.map +1 -0
  283. package/node_modules/ethereum-cryptography/blake2b.js +12 -0
  284. package/node_modules/ethereum-cryptography/blake2b.js.map +1 -0
  285. package/node_modules/ethereum-cryptography/hash-utils.d.ts +4 -0
  286. package/node_modules/ethereum-cryptography/hash-utils.d.ts.map +1 -0
  287. package/node_modules/ethereum-cryptography/hash-utils.js +11 -0
  288. package/node_modules/ethereum-cryptography/hash-utils.js.map +1 -0
  289. package/node_modules/ethereum-cryptography/hdkey.d.ts +3 -0
  290. package/node_modules/ethereum-cryptography/hdkey.d.ts.map +1 -0
  291. package/node_modules/ethereum-cryptography/hdkey.js +5 -0
  292. package/node_modules/ethereum-cryptography/hdkey.js.map +1 -0
  293. package/node_modules/ethereum-cryptography/index.d.ts +1 -0
  294. package/node_modules/ethereum-cryptography/index.d.ts.map +1 -0
  295. package/node_modules/ethereum-cryptography/index.js +3 -0
  296. package/node_modules/ethereum-cryptography/index.js.map +1 -0
  297. package/node_modules/ethereum-cryptography/keccak.d.ts +6 -0
  298. package/node_modules/ethereum-cryptography/keccak.d.ts.map +1 -0
  299. package/node_modules/ethereum-cryptography/keccak.js +17 -0
  300. package/node_modules/ethereum-cryptography/keccak.js.map +1 -0
  301. package/node_modules/ethereum-cryptography/package.json +131 -0
  302. package/node_modules/ethereum-cryptography/pbkdf2.d.ts +4 -0
  303. package/node_modules/ethereum-cryptography/pbkdf2.d.ts.map +1 -0
  304. package/node_modules/ethereum-cryptography/pbkdf2.js +27 -0
  305. package/node_modules/ethereum-cryptography/pbkdf2.js.map +1 -0
  306. package/node_modules/ethereum-cryptography/pure/hdkey.d.ts +37 -0
  307. package/node_modules/ethereum-cryptography/pure/hdkey.d.ts.map +1 -0
  308. package/node_modules/ethereum-cryptography/pure/hdkey.js +5 -0
  309. package/node_modules/ethereum-cryptography/pure/hdkey.js.map +1 -0
  310. package/node_modules/ethereum-cryptography/pure/ripemd160.d.ts +3 -0
  311. package/node_modules/ethereum-cryptography/pure/ripemd160.d.ts.map +1 -0
  312. package/node_modules/ethereum-cryptography/pure/ripemd160.js +6 -0
  313. package/node_modules/ethereum-cryptography/pure/ripemd160.js.map +1 -0
  314. package/node_modules/ethereum-cryptography/pure/sha256.d.ts +3 -0
  315. package/node_modules/ethereum-cryptography/pure/sha256.d.ts.map +1 -0
  316. package/node_modules/ethereum-cryptography/pure/sha256.js +6 -0
  317. package/node_modules/ethereum-cryptography/pure/sha256.js.map +1 -0
  318. package/node_modules/ethereum-cryptography/pure/shims/hdkey-crypto.d.ts +13 -0
  319. package/node_modules/ethereum-cryptography/pure/shims/hdkey-crypto.d.ts.map +1 -0
  320. package/node_modules/ethereum-cryptography/pure/shims/hdkey-crypto.js +37 -0
  321. package/node_modules/ethereum-cryptography/pure/shims/hdkey-crypto.js.map +1 -0
  322. package/node_modules/ethereum-cryptography/pure/shims/hdkey-secp256k1v3.d.ts +2 -0
  323. package/node_modules/ethereum-cryptography/pure/shims/hdkey-secp256k1v3.d.ts.map +1 -0
  324. package/node_modules/ethereum-cryptography/pure/shims/hdkey-secp256k1v3.js +7 -0
  325. package/node_modules/ethereum-cryptography/pure/shims/hdkey-secp256k1v3.js.map +1 -0
  326. package/node_modules/ethereum-cryptography/pure/vendor/hdkey-without-crypto.js +255 -0
  327. package/node_modules/ethereum-cryptography/random.d.ts +4 -0
  328. package/node_modules/ethereum-cryptography/random.d.ts.map +1 -0
  329. package/node_modules/ethereum-cryptography/random.js +20 -0
  330. package/node_modules/ethereum-cryptography/random.js.map +1 -0
  331. package/node_modules/ethereum-cryptography/ripemd160.d.ts +3 -0
  332. package/node_modules/ethereum-cryptography/ripemd160.d.ts.map +1 -0
  333. package/node_modules/ethereum-cryptography/ripemd160.js +11 -0
  334. package/node_modules/ethereum-cryptography/ripemd160.js.map +1 -0
  335. package/node_modules/ethereum-cryptography/scrypt.d.ts +5 -0
  336. package/node_modules/ethereum-cryptography/scrypt.d.ts.map +1 -0
  337. package/node_modules/ethereum-cryptography/scrypt.js +59 -0
  338. package/node_modules/ethereum-cryptography/scrypt.js.map +1 -0
  339. package/node_modules/ethereum-cryptography/secp256k1.d.ts +4 -0
  340. package/node_modules/ethereum-cryptography/secp256k1.d.ts.map +1 -0
  341. package/node_modules/ethereum-cryptography/secp256k1.js +75 -0
  342. package/node_modules/ethereum-cryptography/secp256k1.js.map +1 -0
  343. package/node_modules/ethereum-cryptography/sha256.d.ts +3 -0
  344. package/node_modules/ethereum-cryptography/sha256.d.ts.map +1 -0
  345. package/node_modules/ethereum-cryptography/sha256.js +9 -0
  346. package/node_modules/ethereum-cryptography/sha256.js.map +1 -0
  347. package/node_modules/ethereum-cryptography/shims/hdkey-crypto.d.ts +2 -0
  348. package/node_modules/ethereum-cryptography/shims/hdkey-crypto.d.ts.map +1 -0
  349. package/node_modules/ethereum-cryptography/shims/hdkey-crypto.js +7 -0
  350. package/node_modules/ethereum-cryptography/shims/hdkey-crypto.js.map +1 -0
  351. package/node_modules/ethereum-cryptography/shims/hdkey-secp256k1v3.d.ts +13 -0
  352. package/node_modules/ethereum-cryptography/shims/hdkey-secp256k1v3.d.ts.map +1 -0
  353. package/node_modules/ethereum-cryptography/shims/hdkey-secp256k1v3.js +47 -0
  354. package/node_modules/ethereum-cryptography/shims/hdkey-secp256k1v3.js.map +1 -0
  355. package/node_modules/ethereum-cryptography/src/aes.ts +52 -0
  356. package/node_modules/ethereum-cryptography/src/bip39/index.ts +40 -0
  357. package/node_modules/ethereum-cryptography/src/bip39/wordlists/czech.ts +2050 -0
  358. package/node_modules/ethereum-cryptography/src/bip39/wordlists/english.ts +2050 -0
  359. package/node_modules/ethereum-cryptography/src/bip39/wordlists/french.ts +2050 -0
  360. package/node_modules/ethereum-cryptography/src/bip39/wordlists/italian.ts +2050 -0
  361. package/node_modules/ethereum-cryptography/src/bip39/wordlists/japanese.ts +2050 -0
  362. package/node_modules/ethereum-cryptography/src/bip39/wordlists/korean.ts +2050 -0
  363. package/node_modules/ethereum-cryptography/src/bip39/wordlists/simplified-chinese.ts +2050 -0
  364. package/node_modules/ethereum-cryptography/src/bip39/wordlists/spanish.ts +2050 -0
  365. package/node_modules/ethereum-cryptography/src/bip39/wordlists/traditional-chinese.ts +2050 -0
  366. package/node_modules/ethereum-cryptography/src/blake2b.ts +9 -0
  367. package/node_modules/ethereum-cryptography/src/hash-utils.ts +11 -0
  368. package/node_modules/ethereum-cryptography/src/hdkey.ts +5 -0
  369. package/node_modules/ethereum-cryptography/src/index.ts +3 -0
  370. package/node_modules/ethereum-cryptography/src/keccak.ts +19 -0
  371. package/node_modules/ethereum-cryptography/src/pbkdf2.ts +37 -0
  372. package/node_modules/ethereum-cryptography/src/pure/hdkey.ts +36 -0
  373. package/node_modules/ethereum-cryptography/src/pure/ripemd160.ts +5 -0
  374. package/node_modules/ethereum-cryptography/src/pure/sha256.ts +5 -0
  375. package/node_modules/ethereum-cryptography/src/pure/shims/hdkey-crypto.ts +42 -0
  376. package/node_modules/ethereum-cryptography/src/pure/shims/hdkey-secp256k1v3.ts +1 -0
  377. package/node_modules/ethereum-cryptography/src/pure/vendor/hdkey-without-crypto.js +255 -0
  378. package/node_modules/ethereum-cryptography/src/random.ts +18 -0
  379. package/node_modules/ethereum-cryptography/src/ripemd160.ts +7 -0
  380. package/node_modules/ethereum-cryptography/src/scrypt.ts +24 -0
  381. package/node_modules/ethereum-cryptography/src/secp256k1.ts +24 -0
  382. package/node_modules/ethereum-cryptography/src/sha256.ts +5 -0
  383. package/node_modules/ethereum-cryptography/src/shims/hdkey-crypto.ts +1 -0
  384. package/node_modules/ethereum-cryptography/src/shims/hdkey-secp256k1v3.ts +49 -0
  385. package/node_modules/ethereum-cryptography/src/vendor/bip39-without-wordlists.js +206 -0
  386. package/node_modules/ethereum-cryptography/src/vendor/hdkey-without-crypto.js +255 -0
  387. package/node_modules/ethereum-cryptography/vendor/bip39-without-wordlists.js +206 -0
  388. package/node_modules/ethereum-cryptography/vendor/hdkey-without-crypto.js +255 -0
  389. package/node_modules/ethereumjs-util/LICENSE +373 -0
  390. package/node_modules/ethereumjs-util/README.md +32 -0
  391. package/node_modules/ethereumjs-util/dist/account.d.ts +80 -0
  392. package/node_modules/ethereumjs-util/dist/account.js +168 -0
  393. package/node_modules/ethereumjs-util/dist/account.js.map +1 -0
  394. package/node_modules/ethereumjs-util/dist/bytes.d.ts +68 -0
  395. package/node_modules/ethereumjs-util/dist/bytes.js +158 -0
  396. package/node_modules/ethereumjs-util/dist/bytes.js.map +1 -0
  397. package/node_modules/ethereumjs-util/dist/constants.d.ts +34 -0
  398. package/node_modules/ethereumjs-util/dist/constants.js +37 -0
  399. package/node_modules/ethereumjs-util/dist/constants.js.map +1 -0
  400. package/node_modules/ethereumjs-util/dist/hash.d.ts +30 -0
  401. package/node_modules/ethereumjs-util/dist/hash.js +84 -0
  402. package/node_modules/ethereumjs-util/dist/hash.js.map +1 -0
  403. package/node_modules/ethereumjs-util/dist/index.d.ts +39 -0
  404. package/node_modules/ethereumjs-util/dist/index.js +46 -0
  405. package/node_modules/ethereumjs-util/dist/index.js.map +1 -0
  406. package/node_modules/ethereumjs-util/dist/object.d.ts +12 -0
  407. package/node_modules/ethereumjs-util/dist/object.js +106 -0
  408. package/node_modules/ethereumjs-util/dist/object.js.map +1 -0
  409. package/node_modules/ethereumjs-util/dist/secp256k1v3-adapter.d.ts +178 -0
  410. package/node_modules/ethereumjs-util/dist/secp256k1v3-adapter.js +300 -0
  411. package/node_modules/ethereumjs-util/dist/secp256k1v3-adapter.js.map +1 -0
  412. package/node_modules/ethereumjs-util/dist/secp256k1v3-lib/der.d.ts +1 -0
  413. package/node_modules/ethereumjs-util/dist/secp256k1v3-lib/der.js +634 -0
  414. package/node_modules/ethereumjs-util/dist/secp256k1v3-lib/der.js.map +1 -0
  415. package/node_modules/ethereumjs-util/dist/secp256k1v3-lib/index.d.ts +5 -0
  416. package/node_modules/ethereumjs-util/dist/secp256k1v3-lib/index.js +61 -0
  417. package/node_modules/ethereumjs-util/dist/secp256k1v3-lib/index.js.map +1 -0
  418. package/node_modules/ethereumjs-util/dist/signature.d.ts +37 -0
  419. package/node_modules/ethereumjs-util/dist/signature.js +107 -0
  420. package/node_modules/ethereumjs-util/dist/signature.js.map +1 -0
  421. package/node_modules/ethereumjs-util/package.json +131 -0
  422. package/node_modules/ethjs-util/LICENSE +21 -0
  423. package/node_modules/ethjs-util/README.md +143 -0
  424. package/node_modules/ethjs-util/dist/ethjs-util.js +2420 -0
  425. package/node_modules/ethjs-util/dist/ethjs-util.js.map +1 -0
  426. package/node_modules/ethjs-util/dist/ethjs-util.min.js +1 -0
  427. package/node_modules/ethjs-util/internals/webpack/webpack.config.js +58 -0
  428. package/node_modules/ethjs-util/lib/index.js +220 -0
  429. package/node_modules/ethjs-util/lib/tests/test.index.js +357 -0
  430. package/node_modules/ethjs-util/package.json +229 -0
  431. package/node_modules/ethjs-util/src/index.js +203 -0
  432. package/node_modules/ethjs-util/src/tests/test.index.js +382 -0
  433. package/node_modules/evp_bytestokey/LICENSE +21 -0
  434. package/node_modules/evp_bytestokey/README.md +51 -0
  435. package/node_modules/evp_bytestokey/index.js +45 -0
  436. package/node_modules/evp_bytestokey/package.json +49 -0
  437. package/node_modules/execa/index.js +361 -0
  438. package/node_modules/execa/lib/errname.js +39 -0
  439. package/node_modules/execa/lib/stdio.js +41 -0
  440. package/node_modules/execa/license +9 -0
  441. package/node_modules/execa/package.json +73 -0
  442. package/node_modules/execa/readme.md +327 -0
  443. package/node_modules/find-up/index.js +46 -0
  444. package/node_modules/find-up/license +9 -0
  445. package/node_modules/find-up/package.json +54 -0
  446. package/node_modules/find-up/readme.md +87 -0
  447. package/node_modules/get-caller-file/LICENSE.md +6 -0
  448. package/node_modules/get-caller-file/README.md +41 -0
  449. package/node_modules/get-caller-file/index.d.ts +2 -0
  450. package/node_modules/get-caller-file/index.js +22 -0
  451. package/node_modules/get-caller-file/index.js.map +1 -0
  452. package/node_modules/get-caller-file/package.json +46 -0
  453. package/node_modules/get-stream/buffer-stream.js +51 -0
  454. package/node_modules/get-stream/index.js +50 -0
  455. package/node_modules/get-stream/license +9 -0
  456. package/node_modules/get-stream/package.json +50 -0
  457. package/node_modules/get-stream/readme.md +123 -0
  458. package/node_modules/hash-base/LICENSE +21 -0
  459. package/node_modules/hash-base/README.md +48 -0
  460. package/node_modules/hash-base/index.js +95 -0
  461. package/node_modules/hash-base/package.json +46 -0
  462. package/node_modules/hash.js/.eslintrc.js +41 -0
  463. package/node_modules/hash.js/.travis.yml +10 -0
  464. package/node_modules/hash.js/README.md +48 -0
  465. package/node_modules/hash.js/lib/hash/common.js +92 -0
  466. package/node_modules/hash.js/lib/hash/hmac.js +47 -0
  467. package/node_modules/hash.js/lib/hash/ripemd.js +146 -0
  468. package/node_modules/hash.js/lib/hash/sha/1.js +74 -0
  469. package/node_modules/hash.js/lib/hash/sha/224.js +30 -0
  470. package/node_modules/hash.js/lib/hash/sha/256.js +105 -0
  471. package/node_modules/hash.js/lib/hash/sha/384.js +35 -0
  472. package/node_modules/hash.js/lib/hash/sha/512.js +330 -0
  473. package/node_modules/hash.js/lib/hash/sha/common.js +49 -0
  474. package/node_modules/hash.js/lib/hash/sha.js +7 -0
  475. package/node_modules/hash.js/lib/hash/utils.js +278 -0
  476. package/node_modules/hash.js/lib/hash.d.ts +106 -0
  477. package/node_modules/hash.js/lib/hash.js +15 -0
  478. package/node_modules/hash.js/package.json +39 -0
  479. package/node_modules/hash.js/test/hash-test.js +140 -0
  480. package/node_modules/hash.js/test/hmac-test.js +62 -0
  481. package/node_modules/hmac-drbg/.npmignore +2 -0
  482. package/node_modules/hmac-drbg/.travis.yml +11 -0
  483. package/node_modules/hmac-drbg/README.md +48 -0
  484. package/node_modules/hmac-drbg/lib/hmac-drbg.js +113 -0
  485. package/node_modules/hmac-drbg/package.json +36 -0
  486. package/node_modules/hmac-drbg/test/drbg-test.js +91 -0
  487. package/node_modules/hmac-drbg/test/fixtures/hmac-drbg-nist.json +332 -0
  488. package/node_modules/inherits/LICENSE +16 -0
  489. package/node_modules/inherits/README.md +42 -0
  490. package/node_modules/inherits/inherits.js +9 -0
  491. package/node_modules/inherits/inherits_browser.js +27 -0
  492. package/node_modules/inherits/package.json +33 -0
  493. package/node_modules/invert-kv/index.js +15 -0
  494. package/node_modules/invert-kv/license +9 -0
  495. package/node_modules/invert-kv/package.json +36 -0
  496. package/node_modules/invert-kv/readme.md +25 -0
  497. package/node_modules/is-fullwidth-code-point/index.js +46 -0
  498. package/node_modules/is-fullwidth-code-point/license +21 -0
  499. package/node_modules/is-fullwidth-code-point/package.json +49 -0
  500. package/node_modules/is-fullwidth-code-point/readme.md +39 -0
  501. package/node_modules/is-hex-prefixed/.editorconfig +7 -0
  502. package/node_modules/is-hex-prefixed/.gitattributes +106 -0
  503. package/node_modules/is-hex-prefixed/.npmignore +8 -0
  504. package/node_modules/is-hex-prefixed/.travis.yml +5 -0
  505. package/node_modules/is-hex-prefixed/CHANGELOG.md +7 -0
  506. package/node_modules/is-hex-prefixed/LICENSE +21 -0
  507. package/node_modules/is-hex-prefixed/README.md +101 -0
  508. package/node_modules/is-hex-prefixed/package.json +43 -0
  509. package/node_modules/is-hex-prefixed/src/index.js +13 -0
  510. package/node_modules/is-hex-prefixed/src/tests/test.index.js +66 -0
  511. package/node_modules/is-stream/index.js +21 -0
  512. package/node_modules/is-stream/license +21 -0
  513. package/node_modules/is-stream/package.json +42 -0
  514. package/node_modules/is-stream/readme.md +42 -0
  515. package/node_modules/isexe/.npmignore +2 -0
  516. package/node_modules/isexe/LICENSE +15 -0
  517. package/node_modules/isexe/README.md +51 -0
  518. package/node_modules/isexe/index.js +57 -0
  519. package/node_modules/isexe/mode.js +41 -0
  520. package/node_modules/isexe/package.json +35 -0
  521. package/node_modules/isexe/test/basic.js +221 -0
  522. package/node_modules/isexe/windows.js +42 -0
  523. package/node_modules/keccak/LICENSE +21 -0
  524. package/node_modules/keccak/README.md +64 -0
  525. package/node_modules/keccak/binding.gyp +78 -0
  526. package/node_modules/keccak/bindings.js +1 -0
  527. package/node_modules/keccak/index.js +5 -0
  528. package/node_modules/keccak/js.js +1 -0
  529. package/node_modules/keccak/lib/api/index.js +27 -0
  530. package/node_modules/keccak/lib/api/keccak.js +77 -0
  531. package/node_modules/keccak/lib/api/shake.js +68 -0
  532. package/node_modules/keccak/lib/keccak-state-reference.js +143 -0
  533. package/node_modules/keccak/lib/keccak-state-unroll.js +186 -0
  534. package/node_modules/keccak/lib/keccak.js +68 -0
  535. package/node_modules/keccak/package.json +41 -0
  536. package/node_modules/keccak/prebuilds/darwin-x64/node.napi.node +0 -0
  537. package/node_modules/keccak/prebuilds/linux-x64/node.napi.glibc.node +0 -0
  538. package/node_modules/keccak/prebuilds/linux-x64/node.napi.musl.node +0 -0
  539. package/node_modules/keccak/prebuilds/win32-x64/node.napi.node +0 -0
  540. package/node_modules/keccak/src/README.md +28 -0
  541. package/node_modules/keccak/src/addon.cc +98 -0
  542. package/node_modules/keccak/src/libkeccak-32/KeccakP-1600-SnP.h +38 -0
  543. package/node_modules/keccak/src/libkeccak-32/KeccakP-1600-inplace32BI.c +1162 -0
  544. package/node_modules/keccak/src/libkeccak-32/KeccakSponge-common.h +35 -0
  545. package/node_modules/keccak/src/libkeccak-32/KeccakSponge.inc +311 -0
  546. package/node_modules/keccak/src/libkeccak-32/KeccakSpongeWidth1600.c +54 -0
  547. package/node_modules/keccak/src/libkeccak-32/KeccakSpongeWidth1600.h +31 -0
  548. package/node_modules/keccak/src/libkeccak-32/SnP-Relaned.h +140 -0
  549. package/node_modules/keccak/src/libkeccak-32/align.h +32 -0
  550. package/node_modules/keccak/src/libkeccak-32/brg_endian.h +143 -0
  551. package/node_modules/keccak/src/libkeccak-64/KeccakP-1600-64.macros +745 -0
  552. package/node_modules/keccak/src/libkeccak-64/KeccakP-1600-SnP.h +51 -0
  553. package/node_modules/keccak/src/libkeccak-64/KeccakP-1600-opt64-config.h +6 -0
  554. package/node_modules/keccak/src/libkeccak-64/KeccakP-1600-opt64.c +564 -0
  555. package/node_modules/keccak/src/libkeccak-64/KeccakP-1600-unrolling.macros +302 -0
  556. package/node_modules/keccak/src/libkeccak-64/KeccakSponge-common.h +35 -0
  557. package/node_modules/keccak/src/libkeccak-64/KeccakSponge.inc +311 -0
  558. package/node_modules/keccak/src/libkeccak-64/KeccakSpongeWidth1600.c +54 -0
  559. package/node_modules/keccak/src/libkeccak-64/KeccakSpongeWidth1600.h +31 -0
  560. package/node_modules/keccak/src/libkeccak-64/SnP-Relaned.h +140 -0
  561. package/node_modules/keccak/src/libkeccak-64/align.h +32 -0
  562. package/node_modules/keccak/src/libkeccak-64/brg_endian.h +143 -0
  563. package/node_modules/lcid/index.js +23 -0
  564. package/node_modules/lcid/lcid.json +203 -0
  565. package/node_modules/lcid/license +9 -0
  566. package/node_modules/lcid/package.json +51 -0
  567. package/node_modules/lcid/readme.md +35 -0
  568. package/node_modules/locate-path/index.js +24 -0
  569. package/node_modules/locate-path/license +9 -0
  570. package/node_modules/locate-path/package.json +48 -0
  571. package/node_modules/locate-path/readme.md +99 -0
  572. package/node_modules/map-age-cleaner/dist/index.d.ts +20 -0
  573. package/node_modules/map-age-cleaner/dist/index.js +92 -0
  574. package/node_modules/map-age-cleaner/license +9 -0
  575. package/node_modules/map-age-cleaner/package.json +63 -0
  576. package/node_modules/map-age-cleaner/readme.md +67 -0
  577. package/node_modules/md5.js/LICENSE +21 -0
  578. package/node_modules/md5.js/README.md +29 -0
  579. package/node_modules/md5.js/index.js +146 -0
  580. package/node_modules/md5.js/package.json +42 -0
  581. package/node_modules/mem/index.d.ts +96 -0
  582. package/node_modules/mem/index.js +88 -0
  583. package/node_modules/mem/license +9 -0
  584. package/node_modules/mem/package.json +50 -0
  585. package/node_modules/mem/readme.md +167 -0
  586. package/node_modules/mimic-fn/index.d.ts +54 -0
  587. package/node_modules/mimic-fn/index.js +13 -0
  588. package/node_modules/mimic-fn/license +9 -0
  589. package/node_modules/mimic-fn/package.json +46 -0
  590. package/node_modules/mimic-fn/readme.md +69 -0
  591. package/node_modules/minimalistic-assert/LICENSE +13 -0
  592. package/node_modules/minimalistic-assert/index.js +11 -0
  593. package/node_modules/minimalistic-assert/package.json +23 -0
  594. package/node_modules/minimalistic-assert/readme.md +4 -0
  595. package/node_modules/minimalistic-crypto-utils/.npmignore +2 -0
  596. package/node_modules/minimalistic-crypto-utils/.travis.yml +11 -0
  597. package/node_modules/minimalistic-crypto-utils/README.md +47 -0
  598. package/node_modules/minimalistic-crypto-utils/lib/utils.js +58 -0
  599. package/node_modules/minimalistic-crypto-utils/package.json +31 -0
  600. package/node_modules/minimalistic-crypto-utils/test/utils-test.js +28 -0
  601. package/node_modules/nice-try/LICENSE +21 -0
  602. package/node_modules/nice-try/README.md +32 -0
  603. package/node_modules/nice-try/package.json +37 -0
  604. package/node_modules/nice-try/src/index.js +12 -0
  605. package/node_modules/node-addon-api/.editorconfig +8 -0
  606. package/node_modules/node-addon-api/.travis.yml +62 -0
  607. package/node_modules/node-addon-api/CHANGELOG.md +412 -0
  608. package/node_modules/node-addon-api/CODE_OF_CONDUCT.md +4 -0
  609. package/node_modules/node-addon-api/CONTRIBUTING.md +66 -0
  610. package/node_modules/node-addon-api/LICENSE.md +13 -0
  611. package/node_modules/node-addon-api/README.md +203 -0
  612. package/node_modules/node-addon-api/appveyor.yml +48 -0
  613. package/node_modules/node-addon-api/doc/Doxyfile +2450 -0
  614. package/node_modules/node-addon-api/doc/array_buffer.md +129 -0
  615. package/node_modules/node-addon-api/doc/async_context.md +86 -0
  616. package/node_modules/node-addon-api/doc/async_operations.md +31 -0
  617. package/node_modules/node-addon-api/doc/async_progress_worker.md +344 -0
  618. package/node_modules/node-addon-api/doc/async_worker.md +398 -0
  619. package/node_modules/node-addon-api/doc/basic_types.md +423 -0
  620. package/node_modules/node-addon-api/doc/bigint.md +92 -0
  621. package/node_modules/node-addon-api/doc/boolean.md +64 -0
  622. package/node_modules/node-addon-api/doc/buffer.md +140 -0
  623. package/node_modules/node-addon-api/doc/callback_scope.md +54 -0
  624. package/node_modules/node-addon-api/doc/callbackinfo.md +97 -0
  625. package/node_modules/node-addon-api/doc/checker-tool.md +32 -0
  626. package/node_modules/node-addon-api/doc/class_property_descriptor.md +117 -0
  627. package/node_modules/node-addon-api/doc/cmake-js.md +68 -0
  628. package/node_modules/node-addon-api/doc/conversion-tool.md +28 -0
  629. package/node_modules/node-addon-api/doc/creating_a_release.md +62 -0
  630. package/node_modules/node-addon-api/doc/dataview.md +244 -0
  631. package/node_modules/node-addon-api/doc/date.md +68 -0
  632. package/node_modules/node-addon-api/doc/env.md +63 -0
  633. package/node_modules/node-addon-api/doc/error.md +115 -0
  634. package/node_modules/node-addon-api/doc/error_handling.md +186 -0
  635. package/node_modules/node-addon-api/doc/escapable_handle_scope.md +82 -0
  636. package/node_modules/node-addon-api/doc/external.md +59 -0
  637. package/node_modules/node-addon-api/doc/function.md +294 -0
  638. package/node_modules/node-addon-api/doc/function_reference.md +238 -0
  639. package/node_modules/node-addon-api/doc/generator.md +13 -0
  640. package/node_modules/node-addon-api/doc/handle_scope.md +65 -0
  641. package/node_modules/node-addon-api/doc/memory_management.md +27 -0
  642. package/node_modules/node-addon-api/doc/node-gyp.md +82 -0
  643. package/node_modules/node-addon-api/doc/number.md +163 -0
  644. package/node_modules/node-addon-api/doc/object.md +236 -0
  645. package/node_modules/node-addon-api/doc/object_lifetime_management.md +83 -0
  646. package/node_modules/node-addon-api/doc/object_reference.md +117 -0
  647. package/node_modules/node-addon-api/doc/object_wrap.md +557 -0
  648. package/node_modules/node-addon-api/doc/prebuild_tools.md +16 -0
  649. package/node_modules/node-addon-api/doc/promises.md +74 -0
  650. package/node_modules/node-addon-api/doc/property_descriptor.md +231 -0
  651. package/node_modules/node-addon-api/doc/range_error.md +59 -0
  652. package/node_modules/node-addon-api/doc/reference.md +111 -0
  653. package/node_modules/node-addon-api/doc/setup.md +82 -0
  654. package/node_modules/node-addon-api/doc/string.md +89 -0
  655. package/node_modules/node-addon-api/doc/symbol.md +44 -0
  656. package/node_modules/node-addon-api/doc/threadsafe_function.md +320 -0
  657. package/node_modules/node-addon-api/doc/type_error.md +59 -0
  658. package/node_modules/node-addon-api/doc/typed_array.md +74 -0
  659. package/node_modules/node-addon-api/doc/typed_array_of.md +133 -0
  660. package/node_modules/node-addon-api/doc/value.md +278 -0
  661. package/node_modules/node-addon-api/doc/version_management.md +43 -0
  662. package/node_modules/node-addon-api/doc/working_with_javascript_values.md +14 -0
  663. package/node_modules/node-addon-api/external-napi/node_api.h +7 -0
  664. package/node_modules/node-addon-api/index.js +45 -0
  665. package/node_modules/node-addon-api/napi-inl.deprecated.h +192 -0
  666. package/node_modules/node-addon-api/napi-inl.h +4412 -0
  667. package/node_modules/node-addon-api/napi.h +2173 -0
  668. package/node_modules/node-addon-api/package.json +248 -0
  669. package/node_modules/node-addon-api/src/node_api.cc +3655 -0
  670. package/node_modules/node-addon-api/src/node_api.gyp +21 -0
  671. package/node_modules/node-addon-api/src/node_api.h +588 -0
  672. package/node_modules/node-addon-api/src/node_api_types.h +115 -0
  673. package/node_modules/node-addon-api/src/node_internals.cc +142 -0
  674. package/node_modules/node-addon-api/src/node_internals.h +157 -0
  675. package/node_modules/node-addon-api/src/nothing.c +0 -0
  676. package/node_modules/node-addon-api/src/util-inl.h +38 -0
  677. package/node_modules/node-addon-api/src/util.h +7 -0
  678. package/node_modules/node-addon-api/tools/README.md +67 -0
  679. package/node_modules/node-addon-api/tools/check-napi.js +100 -0
  680. package/node_modules/node-addon-api/tools/conversion.js +313 -0
  681. package/node_modules/node-gyp-build/LICENSE +21 -0
  682. package/node_modules/node-gyp-build/README.md +58 -0
  683. package/node_modules/node-gyp-build/bin.js +77 -0
  684. package/node_modules/node-gyp-build/build-test.js +19 -0
  685. package/node_modules/node-gyp-build/index.js +166 -0
  686. package/node_modules/node-gyp-build/optional.js +7 -0
  687. package/node_modules/node-gyp-build/package.json +33 -0
  688. package/node_modules/npm-run-path/index.js +39 -0
  689. package/node_modules/npm-run-path/license +21 -0
  690. package/node_modules/npm-run-path/package.json +49 -0
  691. package/node_modules/npm-run-path/readme.md +81 -0
  692. package/node_modules/once/LICENSE +15 -0
  693. package/node_modules/once/README.md +79 -0
  694. package/node_modules/once/once.js +42 -0
  695. package/node_modules/once/package.json +37 -0
  696. package/node_modules/os-locale/index.js +114 -0
  697. package/node_modules/os-locale/license +9 -0
  698. package/node_modules/os-locale/package.json +49 -0
  699. package/node_modules/os-locale/readme.md +71 -0
  700. package/node_modules/p-defer/index.js +11 -0
  701. package/node_modules/p-defer/license +21 -0
  702. package/node_modules/p-defer/package.json +45 -0
  703. package/node_modules/p-defer/readme.md +47 -0
  704. package/node_modules/p-finally/index.js +15 -0
  705. package/node_modules/p-finally/license +21 -0
  706. package/node_modules/p-finally/package.json +46 -0
  707. package/node_modules/p-finally/readme.md +47 -0
  708. package/node_modules/p-is-promise/index.d.ts +23 -0
  709. package/node_modules/p-is-promise/index.js +15 -0
  710. package/node_modules/p-is-promise/license +9 -0
  711. package/node_modules/p-is-promise/package.json +46 -0
  712. package/node_modules/p-is-promise/readme.md +43 -0
  713. package/node_modules/p-limit/index.d.ts +38 -0
  714. package/node_modules/p-limit/index.js +57 -0
  715. package/node_modules/p-limit/license +9 -0
  716. package/node_modules/p-limit/package.json +56 -0
  717. package/node_modules/p-limit/readme.md +101 -0
  718. package/node_modules/p-locate/index.js +34 -0
  719. package/node_modules/p-locate/license +9 -0
  720. package/node_modules/p-locate/package.json +55 -0
  721. package/node_modules/p-locate/readme.md +88 -0
  722. package/node_modules/p-try/index.d.ts +39 -0
  723. package/node_modules/p-try/index.js +9 -0
  724. package/node_modules/p-try/license +9 -0
  725. package/node_modules/p-try/package.json +46 -0
  726. package/node_modules/p-try/readme.md +58 -0
  727. package/node_modules/path-exists/index.js +17 -0
  728. package/node_modules/path-exists/license +21 -0
  729. package/node_modules/path-exists/package.json +44 -0
  730. package/node_modules/path-exists/readme.md +50 -0
  731. package/node_modules/path-key/index.js +13 -0
  732. package/node_modules/path-key/license +21 -0
  733. package/node_modules/path-key/package.json +43 -0
  734. package/node_modules/path-key/readme.md +51 -0
  735. package/node_modules/pbkdf2/LICENSE +21 -0
  736. package/node_modules/pbkdf2/README.md +30 -0
  737. package/node_modules/pbkdf2/browser.js +2 -0
  738. package/node_modules/pbkdf2/index.js +38 -0
  739. package/node_modules/pbkdf2/lib/async.js +102 -0
  740. package/node_modules/pbkdf2/lib/default-encoding.js +12 -0
  741. package/node_modules/pbkdf2/lib/precondition.js +19 -0
  742. package/node_modules/pbkdf2/lib/sync-browser.js +105 -0
  743. package/node_modules/pbkdf2/lib/sync.js +52 -0
  744. package/node_modules/pbkdf2/lib/to-buffer.js +13 -0
  745. package/node_modules/pbkdf2/package.json +74 -0
  746. package/node_modules/pump/.travis.yml +5 -0
  747. package/node_modules/pump/LICENSE +21 -0
  748. package/node_modules/pump/README.md +65 -0
  749. package/node_modules/pump/index.js +82 -0
  750. package/node_modules/pump/package.json +28 -0
  751. package/node_modules/pump/test-browser.js +66 -0
  752. package/node_modules/pump/test-node.js +53 -0
  753. package/node_modules/randombytes/.travis.yml +15 -0
  754. package/node_modules/randombytes/.zuul.yml +1 -0
  755. package/node_modules/randombytes/LICENSE +21 -0
  756. package/node_modules/randombytes/README.md +14 -0
  757. package/node_modules/randombytes/browser.js +50 -0
  758. package/node_modules/randombytes/index.js +1 -0
  759. package/node_modules/randombytes/package.json +40 -0
  760. package/node_modules/randombytes/test.js +81 -0
  761. package/node_modules/readable-stream/CONTRIBUTING.md +38 -0
  762. package/node_modules/readable-stream/GOVERNANCE.md +136 -0
  763. package/node_modules/readable-stream/LICENSE +47 -0
  764. package/node_modules/readable-stream/README.md +106 -0
  765. package/node_modules/readable-stream/errors-browser.js +127 -0
  766. package/node_modules/readable-stream/errors.js +116 -0
  767. package/node_modules/readable-stream/experimentalWarning.js +17 -0
  768. package/node_modules/readable-stream/lib/_stream_duplex.js +139 -0
  769. package/node_modules/readable-stream/lib/_stream_passthrough.js +39 -0
  770. package/node_modules/readable-stream/lib/_stream_readable.js +1124 -0
  771. package/node_modules/readable-stream/lib/_stream_transform.js +201 -0
  772. package/node_modules/readable-stream/lib/_stream_writable.js +697 -0
  773. package/node_modules/readable-stream/lib/internal/streams/async_iterator.js +207 -0
  774. package/node_modules/readable-stream/lib/internal/streams/buffer_list.js +210 -0
  775. package/node_modules/readable-stream/lib/internal/streams/destroy.js +105 -0
  776. package/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +104 -0
  777. package/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
  778. package/node_modules/readable-stream/lib/internal/streams/from.js +64 -0
  779. package/node_modules/readable-stream/lib/internal/streams/pipeline.js +97 -0
  780. package/node_modules/readable-stream/lib/internal/streams/state.js +27 -0
  781. package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
  782. package/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
  783. package/node_modules/readable-stream/package.json +72 -0
  784. package/node_modules/readable-stream/readable-browser.js +9 -0
  785. package/node_modules/readable-stream/readable.js +16 -0
  786. package/node_modules/require-directory/.jshintrc +67 -0
  787. package/node_modules/require-directory/.npmignore +1 -0
  788. package/node_modules/require-directory/.travis.yml +3 -0
  789. package/node_modules/require-directory/LICENSE +22 -0
  790. package/node_modules/require-directory/README.markdown +184 -0
  791. package/node_modules/require-directory/index.js +86 -0
  792. package/node_modules/require-directory/package.json +44 -0
  793. package/node_modules/require-main-filename/LICENSE.txt +14 -0
  794. package/node_modules/require-main-filename/README.md +26 -0
  795. package/node_modules/require-main-filename/index.js +18 -0
  796. package/node_modules/require-main-filename/package.json +39 -0
  797. package/node_modules/ripemd160/LICENSE +21 -0
  798. package/node_modules/ripemd160/README.md +27 -0
  799. package/node_modules/ripemd160/index.js +163 -0
  800. package/node_modules/ripemd160/package.json +41 -0
  801. package/node_modules/rlp/LICENSE +373 -0
  802. package/node_modules/rlp/README.md +58 -0
  803. package/node_modules/rlp/bin/rlp +35 -0
  804. package/node_modules/rlp/dist/index.d.ts +25 -0
  805. package/node_modules/rlp/dist/index.js +249 -0
  806. package/node_modules/rlp/dist/index.js.map +1 -0
  807. package/node_modules/rlp/dist/types.d.ts +9 -0
  808. package/node_modules/rlp/dist/types.js +3 -0
  809. package/node_modules/rlp/dist/types.js.map +1 -0
  810. package/node_modules/rlp/package.json +84 -0
  811. package/node_modules/safe-buffer/LICENSE +21 -0
  812. package/node_modules/safe-buffer/README.md +584 -0
  813. package/node_modules/safe-buffer/index.d.ts +187 -0
  814. package/node_modules/safe-buffer/index.js +65 -0
  815. package/node_modules/safe-buffer/package.json +55 -0
  816. package/node_modules/scrypt-js/LICENSE.txt +22 -0
  817. package/node_modules/scrypt-js/README.md +222 -0
  818. package/node_modules/scrypt-js/index.html +291 -0
  819. package/node_modules/scrypt-js/package.json +31 -0
  820. package/node_modules/scrypt-js/scrypt.d.ts +23 -0
  821. package/node_modules/scrypt-js/scrypt.js +488 -0
  822. package/node_modules/scrypt-js/thirdparty/buffer.js +1381 -0
  823. package/node_modules/scrypt-js/thirdparty/setImmediate.js +175 -0
  824. package/node_modules/scrypt-js/thirdparty/unorm.js +442 -0
  825. package/node_modules/secp256k1/API.md +116 -0
  826. package/node_modules/secp256k1/LICENSE +24 -0
  827. package/node_modules/secp256k1/README.md +117 -0
  828. package/node_modules/secp256k1/binding.gyp +100 -0
  829. package/node_modules/secp256k1/bindings.js +2 -0
  830. package/node_modules/secp256k1/elliptic.js +1 -0
  831. package/node_modules/secp256k1/index.js +5 -0
  832. package/node_modules/secp256k1/lib/elliptic.js +402 -0
  833. package/node_modules/secp256k1/lib/index.js +336 -0
  834. package/node_modules/secp256k1/package.json +47 -0
  835. package/node_modules/secp256k1/prebuilds/darwin-x64/node.napi.node +0 -0
  836. package/node_modules/secp256k1/prebuilds/linux-x64/node.napi.glibc.node +0 -0
  837. package/node_modules/secp256k1/prebuilds/linux-x64/node.napi.musl.node +0 -0
  838. package/node_modules/secp256k1/prebuilds/win32-x64/node.napi.node +0 -0
  839. package/node_modules/secp256k1/src/addon.cc +10 -0
  840. package/node_modules/secp256k1/src/secp256k1/.travis.yml +100 -0
  841. package/node_modules/secp256k1/src/secp256k1/COPYING +19 -0
  842. package/node_modules/secp256k1/src/secp256k1/Makefile.am +183 -0
  843. package/node_modules/secp256k1/src/secp256k1/README.md +78 -0
  844. package/node_modules/secp256k1/src/secp256k1/SECURITY.md +15 -0
  845. package/node_modules/secp256k1/src/secp256k1/TODO +3 -0
  846. package/node_modules/secp256k1/src/secp256k1/autogen.sh +3 -0
  847. package/node_modules/secp256k1/src/secp256k1/build-aux/m4/ax_jni_include_dir.m4 +145 -0
  848. package/node_modules/secp256k1/src/secp256k1/build-aux/m4/ax_prog_cc_for_build.m4 +125 -0
  849. package/node_modules/secp256k1/src/secp256k1/build-aux/m4/bitcoin_secp.m4 +68 -0
  850. package/node_modules/secp256k1/src/secp256k1/configure.ac +591 -0
  851. package/node_modules/secp256k1/src/secp256k1/contrib/lax_der_parsing.c +150 -0
  852. package/node_modules/secp256k1/src/secp256k1/contrib/lax_der_parsing.h +91 -0
  853. package/node_modules/secp256k1/src/secp256k1/contrib/lax_der_privatekey_parsing.c +113 -0
  854. package/node_modules/secp256k1/src/secp256k1/contrib/lax_der_privatekey_parsing.h +90 -0
  855. package/node_modules/secp256k1/src/secp256k1/include/secp256k1.h +708 -0
  856. package/node_modules/secp256k1/src/secp256k1/include/secp256k1_ecdh.h +55 -0
  857. package/node_modules/secp256k1/src/secp256k1/include/secp256k1_preallocated.h +128 -0
  858. package/node_modules/secp256k1/src/secp256k1/include/secp256k1_recovery.h +110 -0
  859. package/node_modules/secp256k1/src/secp256k1/libsecp256k1.pc.in +13 -0
  860. package/node_modules/secp256k1/src/secp256k1/sage/group_prover.sage +322 -0
  861. package/node_modules/secp256k1/src/secp256k1/sage/secp256k1.sage +306 -0
  862. package/node_modules/secp256k1/src/secp256k1/sage/weierstrass_prover.sage +264 -0
  863. package/node_modules/secp256k1/src/secp256k1/src/asm/field_10x26_arm.s +913 -0
  864. package/node_modules/secp256k1/src/secp256k1/src/basic-config.h +38 -0
  865. package/node_modules/secp256k1/src/secp256k1/src/bench.h +124 -0
  866. package/node_modules/secp256k1/src/secp256k1/src/bench_ecdh.c +54 -0
  867. package/node_modules/secp256k1/src/secp256k1/src/bench_ecmult.c +207 -0
  868. package/node_modules/secp256k1/src/secp256k1/src/bench_internal.c +379 -0
  869. package/node_modules/secp256k1/src/secp256k1/src/bench_recover.c +60 -0
  870. package/node_modules/secp256k1/src/secp256k1/src/bench_sign.c +56 -0
  871. package/node_modules/secp256k1/src/secp256k1/src/bench_verify.c +112 -0
  872. package/node_modules/secp256k1/src/secp256k1/src/ecdsa.h +21 -0
  873. package/node_modules/secp256k1/src/secp256k1/src/ecdsa_impl.h +319 -0
  874. package/node_modules/secp256k1/src/secp256k1/src/eckey.h +25 -0
  875. package/node_modules/secp256k1/src/secp256k1/src/eckey_impl.h +100 -0
  876. package/node_modules/secp256k1/src/secp256k1/src/ecmult.h +48 -0
  877. package/node_modules/secp256k1/src/secp256k1/src/ecmult_const.h +20 -0
  878. package/node_modules/secp256k1/src/secp256k1/src/ecmult_const_impl.h +261 -0
  879. package/node_modules/secp256k1/src/secp256k1/src/ecmult_gen.h +50 -0
  880. package/node_modules/secp256k1/src/secp256k1/src/ecmult_gen_impl.h +211 -0
  881. package/node_modules/secp256k1/src/secp256k1/src/ecmult_impl.h +1216 -0
  882. package/node_modules/secp256k1/src/secp256k1/src/field.h +132 -0
  883. package/node_modules/secp256k1/src/secp256k1/src/field_10x26.h +50 -0
  884. package/node_modules/secp256k1/src/secp256k1/src/field_10x26_impl.h +1162 -0
  885. package/node_modules/secp256k1/src/secp256k1/src/field_5x52.h +49 -0
  886. package/node_modules/secp256k1/src/secp256k1/src/field_5x52_asm_impl.h +502 -0
  887. package/node_modules/secp256k1/src/secp256k1/src/field_5x52_impl.h +496 -0
  888. package/node_modules/secp256k1/src/secp256k1/src/field_5x52_int128_impl.h +279 -0
  889. package/node_modules/secp256k1/src/secp256k1/src/field_impl.h +318 -0
  890. package/node_modules/secp256k1/src/secp256k1/src/gen_context.c +87 -0
  891. package/node_modules/secp256k1/src/secp256k1/src/group.h +142 -0
  892. package/node_modules/secp256k1/src/secp256k1/src/group_impl.h +705 -0
  893. package/node_modules/secp256k1/src/secp256k1/src/hash.h +41 -0
  894. package/node_modules/secp256k1/src/secp256k1/src/hash_impl.h +283 -0
  895. package/node_modules/secp256k1/src/secp256k1/src/java/org/bitcoin/NativeSecp256k1.java +446 -0
  896. package/node_modules/secp256k1/src/secp256k1/src/java/org/bitcoin/NativeSecp256k1Test.java +225 -0
  897. package/node_modules/secp256k1/src/secp256k1/src/java/org/bitcoin/NativeSecp256k1Util.java +45 -0
  898. package/node_modules/secp256k1/src/secp256k1/src/java/org/bitcoin/Secp256k1Context.java +51 -0
  899. package/node_modules/secp256k1/src/secp256k1/src/java/org_bitcoin_NativeSecp256k1.c +379 -0
  900. package/node_modules/secp256k1/src/secp256k1/src/java/org_bitcoin_NativeSecp256k1.h +119 -0
  901. package/node_modules/secp256k1/src/secp256k1/src/java/org_bitcoin_Secp256k1Context.c +15 -0
  902. package/node_modules/secp256k1/src/secp256k1/src/java/org_bitcoin_Secp256k1Context.h +22 -0
  903. package/node_modules/secp256k1/src/secp256k1/src/modules/ecdh/Makefile.am.include +8 -0
  904. package/node_modules/secp256k1/src/secp256k1/src/modules/ecdh/main_impl.h +67 -0
  905. package/node_modules/secp256k1/src/secp256k1/src/modules/ecdh/tests_impl.h +132 -0
  906. package/node_modules/secp256k1/src/secp256k1/src/modules/recovery/Makefile.am.include +8 -0
  907. package/node_modules/secp256k1/src/secp256k1/src/modules/recovery/main_impl.h +193 -0
  908. package/node_modules/secp256k1/src/secp256k1/src/modules/recovery/tests_impl.h +393 -0
  909. package/node_modules/secp256k1/src/secp256k1/src/num.h +74 -0
  910. package/node_modules/secp256k1/src/secp256k1/src/num_gmp.h +20 -0
  911. package/node_modules/secp256k1/src/secp256k1/src/num_gmp_impl.h +288 -0
  912. package/node_modules/secp256k1/src/secp256k1/src/num_impl.h +24 -0
  913. package/node_modules/secp256k1/src/secp256k1/src/scalar.h +106 -0
  914. package/node_modules/secp256k1/src/secp256k1/src/scalar_4x64.h +19 -0
  915. package/node_modules/secp256k1/src/secp256k1/src/scalar_4x64_impl.h +949 -0
  916. package/node_modules/secp256k1/src/secp256k1/src/scalar_8x32.h +19 -0
  917. package/node_modules/secp256k1/src/secp256k1/src/scalar_8x32_impl.h +721 -0
  918. package/node_modules/secp256k1/src/secp256k1/src/scalar_impl.h +333 -0
  919. package/node_modules/secp256k1/src/secp256k1/src/scalar_low.h +15 -0
  920. package/node_modules/secp256k1/src/secp256k1/src/scalar_low_impl.h +117 -0
  921. package/node_modules/secp256k1/src/secp256k1/src/scratch.h +42 -0
  922. package/node_modules/secp256k1/src/secp256k1/src/scratch_impl.h +88 -0
  923. package/node_modules/secp256k1/src/secp256k1/src/secp256k1.c +690 -0
  924. package/node_modules/secp256k1/src/secp256k1/src/testrand.h +38 -0
  925. package/node_modules/secp256k1/src/secp256k1/src/testrand_impl.h +110 -0
  926. package/node_modules/secp256k1/src/secp256k1/src/tests.c +5310 -0
  927. package/node_modules/secp256k1/src/secp256k1/src/tests_exhaustive.c +511 -0
  928. package/node_modules/secp256k1/src/secp256k1/src/util.h +162 -0
  929. package/node_modules/secp256k1/src/secp256k1.cc +415 -0
  930. package/node_modules/secp256k1/src/secp256k1.h +63 -0
  931. package/node_modules/semver/LICENSE +15 -0
  932. package/node_modules/semver/README.md +412 -0
  933. package/node_modules/semver/bin/semver +160 -0
  934. package/node_modules/semver/package.json +32 -0
  935. package/node_modules/semver/range.bnf +16 -0
  936. package/node_modules/semver/semver.js +1483 -0
  937. package/node_modules/set-blocking/LICENSE.txt +14 -0
  938. package/node_modules/set-blocking/README.md +31 -0
  939. package/node_modules/set-blocking/index.js +7 -0
  940. package/node_modules/set-blocking/package.json +46 -0
  941. package/node_modules/setimmediate/LICENSE.txt +20 -0
  942. package/node_modules/setimmediate/package.json +34 -0
  943. package/node_modules/setimmediate/setImmediate.js +186 -0
  944. package/node_modules/sha.js/.travis.yml +17 -0
  945. package/node_modules/sha.js/LICENSE +49 -0
  946. package/node_modules/sha.js/README.md +44 -0
  947. package/node_modules/sha.js/bin.js +41 -0
  948. package/node_modules/sha.js/hash.js +81 -0
  949. package/node_modules/sha.js/index.js +15 -0
  950. package/node_modules/sha.js/package.json +34 -0
  951. package/node_modules/sha.js/sha.js +94 -0
  952. package/node_modules/sha.js/sha1.js +99 -0
  953. package/node_modules/sha.js/sha224.js +53 -0
  954. package/node_modules/sha.js/sha256.js +135 -0
  955. package/node_modules/sha.js/sha384.js +57 -0
  956. package/node_modules/sha.js/sha512.js +260 -0
  957. package/node_modules/sha.js/test/hash.js +75 -0
  958. package/node_modules/sha.js/test/test.js +100 -0
  959. package/node_modules/sha.js/test/vectors.js +72 -0
  960. package/node_modules/shebang-command/index.js +19 -0
  961. package/node_modules/shebang-command/license +21 -0
  962. package/node_modules/shebang-command/package.json +43 -0
  963. package/node_modules/shebang-command/readme.md +39 -0
  964. package/node_modules/shebang-regex/index.js +2 -0
  965. package/node_modules/shebang-regex/license +21 -0
  966. package/node_modules/shebang-regex/package.json +36 -0
  967. package/node_modules/shebang-regex/readme.md +29 -0
  968. package/node_modules/signal-exit/LICENSE.txt +16 -0
  969. package/node_modules/signal-exit/README.md +39 -0
  970. package/node_modules/signal-exit/index.js +163 -0
  971. package/node_modules/signal-exit/package.json +42 -0
  972. package/node_modules/signal-exit/signals.js +53 -0
  973. package/node_modules/source-map/LICENSE +28 -0
  974. package/node_modules/source-map/README.md +742 -0
  975. package/node_modules/source-map/dist/source-map.debug.js +3234 -0
  976. package/node_modules/source-map/dist/source-map.js +3233 -0
  977. package/node_modules/source-map/dist/source-map.min.js +2 -0
  978. package/node_modules/source-map/dist/source-map.min.js.map +1 -0
  979. package/node_modules/source-map/lib/array-set.js +121 -0
  980. package/node_modules/source-map/lib/base64-vlq.js +140 -0
  981. package/node_modules/source-map/lib/base64.js +67 -0
  982. package/node_modules/source-map/lib/binary-search.js +111 -0
  983. package/node_modules/source-map/lib/mapping-list.js +79 -0
  984. package/node_modules/source-map/lib/quick-sort.js +114 -0
  985. package/node_modules/source-map/lib/source-map-consumer.js +1145 -0
  986. package/node_modules/source-map/lib/source-map-generator.js +425 -0
  987. package/node_modules/source-map/lib/source-node.js +413 -0
  988. package/node_modules/source-map/lib/util.js +488 -0
  989. package/node_modules/source-map/package.json +77 -0
  990. package/node_modules/source-map/source-map.d.ts +98 -0
  991. package/node_modules/source-map/source-map.js +8 -0
  992. package/node_modules/source-map-support/LICENSE.md +21 -0
  993. package/node_modules/source-map-support/README.md +284 -0
  994. package/node_modules/source-map-support/browser-source-map-support.js +113 -0
  995. package/node_modules/source-map-support/package.json +35 -0
  996. package/node_modules/source-map-support/register.js +1 -0
  997. package/node_modules/source-map-support/source-map-support.js +567 -0
  998. package/node_modules/string-width/index.js +39 -0
  999. package/node_modules/string-width/license +9 -0
  1000. package/node_modules/string-width/package.json +60 -0
  1001. package/node_modules/string-width/readme.md +45 -0
  1002. package/node_modules/string_decoder/LICENSE +48 -0
  1003. package/node_modules/string_decoder/README.md +47 -0
  1004. package/node_modules/string_decoder/lib/string_decoder.js +296 -0
  1005. package/node_modules/string_decoder/package.json +38 -0
  1006. package/node_modules/strip-ansi/index.d.ts +15 -0
  1007. package/node_modules/strip-ansi/index.js +7 -0
  1008. package/node_modules/strip-ansi/license +9 -0
  1009. package/node_modules/strip-ansi/package.json +58 -0
  1010. package/node_modules/strip-ansi/readme.md +61 -0
  1011. package/node_modules/strip-eof/index.js +15 -0
  1012. package/node_modules/strip-eof/license +21 -0
  1013. package/node_modules/strip-eof/package.json +43 -0
  1014. package/node_modules/strip-eof/readme.md +28 -0
  1015. package/node_modules/strip-hex-prefix/.editorconfig +7 -0
  1016. package/node_modules/strip-hex-prefix/.gitattributes +106 -0
  1017. package/node_modules/strip-hex-prefix/.npmignore +8 -0
  1018. package/node_modules/strip-hex-prefix/.travis.yml +5 -0
  1019. package/node_modules/strip-hex-prefix/CHANGELOG.md +7 -0
  1020. package/node_modules/strip-hex-prefix/LICENSE +21 -0
  1021. package/node_modules/strip-hex-prefix/README.md +106 -0
  1022. package/node_modules/strip-hex-prefix/package.json +46 -0
  1023. package/node_modules/strip-hex-prefix/src/index.js +14 -0
  1024. package/node_modules/strip-hex-prefix/src/tests/test.index.js +47 -0
  1025. package/node_modules/util-deprecate/History.md +16 -0
  1026. package/node_modules/util-deprecate/LICENSE +24 -0
  1027. package/node_modules/util-deprecate/README.md +53 -0
  1028. package/node_modules/util-deprecate/browser.js +67 -0
  1029. package/node_modules/util-deprecate/node.js +6 -0
  1030. package/node_modules/util-deprecate/package.json +31 -0
  1031. package/node_modules/which/LICENSE +15 -0
  1032. package/node_modules/which/README.md +51 -0
  1033. package/node_modules/which/bin/which +52 -0
  1034. package/node_modules/which/package.json +34 -0
  1035. package/node_modules/which/which.js +135 -0
  1036. package/node_modules/which-module/LICENSE +13 -0
  1037. package/node_modules/which-module/README.md +55 -0
  1038. package/node_modules/which-module/index.js +9 -0
  1039. package/node_modules/which-module/package.json +45 -0
  1040. package/node_modules/wrap-ansi/index.js +188 -0
  1041. package/node_modules/wrap-ansi/license +9 -0
  1042. package/node_modules/wrap-ansi/package.json +65 -0
  1043. package/node_modules/wrap-ansi/readme.md +108 -0
  1044. package/node_modules/wrappy/LICENSE +15 -0
  1045. package/node_modules/wrappy/README.md +36 -0
  1046. package/node_modules/wrappy/package.json +33 -0
  1047. package/node_modules/wrappy/wrappy.js +33 -0
  1048. package/node_modules/y18n/LICENSE +13 -0
  1049. package/node_modules/y18n/README.md +109 -0
  1050. package/node_modules/y18n/index.js +188 -0
  1051. package/node_modules/y18n/package.json +43 -0
  1052. package/node_modules/yargs/LICENSE +22 -0
  1053. package/node_modules/yargs/README.md +122 -0
  1054. package/node_modules/yargs/index.js +32 -0
  1055. package/node_modules/yargs/lib/apply-extends.js +53 -0
  1056. package/node_modules/yargs/lib/argsert.js +68 -0
  1057. package/node_modules/yargs/lib/command.js +437 -0
  1058. package/node_modules/yargs/lib/completion-templates.js +49 -0
  1059. package/node_modules/yargs/lib/completion.js +115 -0
  1060. package/node_modules/yargs/lib/decamelize.js +32 -0
  1061. package/node_modules/yargs/lib/is-promise.js +3 -0
  1062. package/node_modules/yargs/lib/levenshtein.js +58 -0
  1063. package/node_modules/yargs/lib/middleware.js +65 -0
  1064. package/node_modules/yargs/lib/obj-filter.js +11 -0
  1065. package/node_modules/yargs/lib/usage.js +540 -0
  1066. package/node_modules/yargs/lib/validation.js +341 -0
  1067. package/node_modules/yargs/lib/yerror.js +11 -0
  1068. package/node_modules/yargs/locales/be.json +39 -0
  1069. package/node_modules/yargs/locales/de.json +39 -0
  1070. package/node_modules/yargs/locales/en.json +42 -0
  1071. package/node_modules/yargs/locales/es.json +39 -0
  1072. package/node_modules/yargs/locales/fr.json +37 -0
  1073. package/node_modules/yargs/locales/hi.json +42 -0
  1074. package/node_modules/yargs/locales/hu.json +39 -0
  1075. package/node_modules/yargs/locales/id.json +43 -0
  1076. package/node_modules/yargs/locales/it.json +39 -0
  1077. package/node_modules/yargs/locales/ja.json +42 -0
  1078. package/node_modules/yargs/locales/ko.json +42 -0
  1079. package/node_modules/yargs/locales/nb.json +37 -0
  1080. package/node_modules/yargs/locales/nl.json +42 -0
  1081. package/node_modules/yargs/locales/nn.json +39 -0
  1082. package/node_modules/yargs/locales/pirate.json +13 -0
  1083. package/node_modules/yargs/locales/pl.json +42 -0
  1084. package/node_modules/yargs/locales/pt.json +38 -0
  1085. package/node_modules/yargs/locales/pt_BR.json +42 -0
  1086. package/node_modules/yargs/locales/ru.json +39 -0
  1087. package/node_modules/yargs/locales/th.json +39 -0
  1088. package/node_modules/yargs/locales/tr.json +41 -0
  1089. package/node_modules/yargs/locales/zh_CN.json +41 -0
  1090. package/node_modules/yargs/locales/zh_TW.json +40 -0
  1091. package/node_modules/yargs/package.json +83 -0
  1092. package/node_modules/yargs/yargs.js +1205 -0
  1093. package/node_modules/yargs-parser/LICENSE.txt +14 -0
  1094. package/node_modules/yargs-parser/README.md +396 -0
  1095. package/node_modules/yargs-parser/index.js +916 -0
  1096. package/node_modules/yargs-parser/lib/tokenize-arg-string.js +40 -0
  1097. package/node_modules/yargs-parser/package.json +51 -0
  1098. package/package.json +73 -4
@@ -0,0 +1,3433 @@
1
+ (function (module, exports) {
2
+ 'use strict';
3
+
4
+ // Utils
5
+ function assert (val, msg) {
6
+ if (!val) throw new Error(msg || 'Assertion failed');
7
+ }
8
+
9
+ // Could use `inherits` module, but don't want to move from single file
10
+ // architecture yet.
11
+ function inherits (ctor, superCtor) {
12
+ ctor.super_ = superCtor;
13
+ var TempCtor = function () {};
14
+ TempCtor.prototype = superCtor.prototype;
15
+ ctor.prototype = new TempCtor();
16
+ ctor.prototype.constructor = ctor;
17
+ }
18
+
19
+ // BN
20
+
21
+ function BN (number, base, endian) {
22
+ if (BN.isBN(number)) {
23
+ return number;
24
+ }
25
+
26
+ this.negative = 0;
27
+ this.words = null;
28
+ this.length = 0;
29
+
30
+ // Reduction context
31
+ this.red = null;
32
+
33
+ if (number !== null) {
34
+ if (base === 'le' || base === 'be') {
35
+ endian = base;
36
+ base = 10;
37
+ }
38
+
39
+ this._init(number || 0, base || 10, endian || 'be');
40
+ }
41
+ }
42
+ if (typeof module === 'object') {
43
+ module.exports = BN;
44
+ } else {
45
+ exports.BN = BN;
46
+ }
47
+
48
+ BN.BN = BN;
49
+ BN.wordSize = 26;
50
+
51
+ var Buffer;
52
+ try {
53
+ Buffer = require('buffer').Buffer;
54
+ } catch (e) {
55
+ }
56
+
57
+ BN.isBN = function isBN (num) {
58
+ if (num instanceof BN) {
59
+ return true;
60
+ }
61
+
62
+ return num !== null && typeof num === 'object' &&
63
+ num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);
64
+ };
65
+
66
+ BN.max = function max (left, right) {
67
+ if (left.cmp(right) > 0) return left;
68
+ return right;
69
+ };
70
+
71
+ BN.min = function min (left, right) {
72
+ if (left.cmp(right) < 0) return left;
73
+ return right;
74
+ };
75
+
76
+ BN.prototype._init = function init (number, base, endian) {
77
+ if (typeof number === 'number') {
78
+ return this._initNumber(number, base, endian);
79
+ }
80
+
81
+ if (typeof number === 'object') {
82
+ return this._initArray(number, base, endian);
83
+ }
84
+
85
+ if (base === 'hex') {
86
+ base = 16;
87
+ }
88
+ assert(base === (base | 0) && base >= 2 && base <= 36);
89
+
90
+ number = number.toString().replace(/\s+/g, '');
91
+ var start = 0;
92
+ if (number[0] === '-') {
93
+ start++;
94
+ }
95
+
96
+ if (base === 16) {
97
+ this._parseHex(number, start);
98
+ } else {
99
+ this._parseBase(number, base, start);
100
+ }
101
+
102
+ if (number[0] === '-') {
103
+ this.negative = 1;
104
+ }
105
+
106
+ this.strip();
107
+
108
+ if (endian !== 'le') return;
109
+
110
+ this._initArray(this.toArray(), base, endian);
111
+ };
112
+
113
+ BN.prototype._initNumber = function _initNumber (number, base, endian) {
114
+ if (number < 0) {
115
+ this.negative = 1;
116
+ number = -number;
117
+ }
118
+ if (number < 0x4000000) {
119
+ this.words = [ number & 0x3ffffff ];
120
+ this.length = 1;
121
+ } else if (number < 0x10000000000000) {
122
+ this.words = [
123
+ number & 0x3ffffff,
124
+ (number / 0x4000000) & 0x3ffffff
125
+ ];
126
+ this.length = 2;
127
+ } else {
128
+ assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)
129
+ this.words = [
130
+ number & 0x3ffffff,
131
+ (number / 0x4000000) & 0x3ffffff,
132
+ 1
133
+ ];
134
+ this.length = 3;
135
+ }
136
+
137
+ if (endian !== 'le') return;
138
+
139
+ // Reverse the bytes
140
+ this._initArray(this.toArray(), base, endian);
141
+ };
142
+
143
+ BN.prototype._initArray = function _initArray (number, base, endian) {
144
+ // Perhaps a Uint8Array
145
+ assert(typeof number.length === 'number');
146
+ if (number.length <= 0) {
147
+ this.words = [ 0 ];
148
+ this.length = 1;
149
+ return this;
150
+ }
151
+
152
+ this.length = Math.ceil(number.length / 3);
153
+ this.words = new Array(this.length);
154
+ for (var i = 0; i < this.length; i++) {
155
+ this.words[i] = 0;
156
+ }
157
+
158
+ var j, w;
159
+ var off = 0;
160
+ if (endian === 'be') {
161
+ for (i = number.length - 1, j = 0; i >= 0; i -= 3) {
162
+ w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);
163
+ this.words[j] |= (w << off) & 0x3ffffff;
164
+ this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
165
+ off += 24;
166
+ if (off >= 26) {
167
+ off -= 26;
168
+ j++;
169
+ }
170
+ }
171
+ } else if (endian === 'le') {
172
+ for (i = 0, j = 0; i < number.length; i += 3) {
173
+ w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);
174
+ this.words[j] |= (w << off) & 0x3ffffff;
175
+ this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
176
+ off += 24;
177
+ if (off >= 26) {
178
+ off -= 26;
179
+ j++;
180
+ }
181
+ }
182
+ }
183
+ return this.strip();
184
+ };
185
+
186
+ function parseHex (str, start, end) {
187
+ var r = 0;
188
+ var len = Math.min(str.length, end);
189
+ for (var i = start; i < len; i++) {
190
+ var c = str.charCodeAt(i) - 48;
191
+
192
+ r <<= 4;
193
+
194
+ // 'a' - 'f'
195
+ if (c >= 49 && c <= 54) {
196
+ r |= c - 49 + 0xa;
197
+
198
+ // 'A' - 'F'
199
+ } else if (c >= 17 && c <= 22) {
200
+ r |= c - 17 + 0xa;
201
+
202
+ // '0' - '9'
203
+ } else {
204
+ r |= c & 0xf;
205
+ }
206
+ }
207
+ return r;
208
+ }
209
+
210
+ BN.prototype._parseHex = function _parseHex (number, start) {
211
+ // Create possibly bigger array to ensure that it fits the number
212
+ this.length = Math.ceil((number.length - start) / 6);
213
+ this.words = new Array(this.length);
214
+ for (var i = 0; i < this.length; i++) {
215
+ this.words[i] = 0;
216
+ }
217
+
218
+ var j, w;
219
+ // Scan 24-bit chunks and add them to the number
220
+ var off = 0;
221
+ for (i = number.length - 6, j = 0; i >= start; i -= 6) {
222
+ w = parseHex(number, i, i + 6);
223
+ this.words[j] |= (w << off) & 0x3ffffff;
224
+ // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb
225
+ this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;
226
+ off += 24;
227
+ if (off >= 26) {
228
+ off -= 26;
229
+ j++;
230
+ }
231
+ }
232
+ if (i + 6 !== start) {
233
+ w = parseHex(number, start, i + 6);
234
+ this.words[j] |= (w << off) & 0x3ffffff;
235
+ this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;
236
+ }
237
+ this.strip();
238
+ };
239
+
240
+ function parseBase (str, start, end, mul) {
241
+ var r = 0;
242
+ var len = Math.min(str.length, end);
243
+ for (var i = start; i < len; i++) {
244
+ var c = str.charCodeAt(i) - 48;
245
+
246
+ r *= mul;
247
+
248
+ // 'a'
249
+ if (c >= 49) {
250
+ r += c - 49 + 0xa;
251
+
252
+ // 'A'
253
+ } else if (c >= 17) {
254
+ r += c - 17 + 0xa;
255
+
256
+ // '0' - '9'
257
+ } else {
258
+ r += c;
259
+ }
260
+ }
261
+ return r;
262
+ }
263
+
264
+ BN.prototype._parseBase = function _parseBase (number, base, start) {
265
+ // Initialize as zero
266
+ this.words = [ 0 ];
267
+ this.length = 1;
268
+
269
+ // Find length of limb in base
270
+ for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {
271
+ limbLen++;
272
+ }
273
+ limbLen--;
274
+ limbPow = (limbPow / base) | 0;
275
+
276
+ var total = number.length - start;
277
+ var mod = total % limbLen;
278
+ var end = Math.min(total, total - mod) + start;
279
+
280
+ var word = 0;
281
+ for (var i = start; i < end; i += limbLen) {
282
+ word = parseBase(number, i, i + limbLen, base);
283
+
284
+ this.imuln(limbPow);
285
+ if (this.words[0] + word < 0x4000000) {
286
+ this.words[0] += word;
287
+ } else {
288
+ this._iaddn(word);
289
+ }
290
+ }
291
+
292
+ if (mod !== 0) {
293
+ var pow = 1;
294
+ word = parseBase(number, i, number.length, base);
295
+
296
+ for (i = 0; i < mod; i++) {
297
+ pow *= base;
298
+ }
299
+
300
+ this.imuln(pow);
301
+ if (this.words[0] + word < 0x4000000) {
302
+ this.words[0] += word;
303
+ } else {
304
+ this._iaddn(word);
305
+ }
306
+ }
307
+ };
308
+
309
+ BN.prototype.copy = function copy (dest) {
310
+ dest.words = new Array(this.length);
311
+ for (var i = 0; i < this.length; i++) {
312
+ dest.words[i] = this.words[i];
313
+ }
314
+ dest.length = this.length;
315
+ dest.negative = this.negative;
316
+ dest.red = this.red;
317
+ };
318
+
319
+ BN.prototype.clone = function clone () {
320
+ var r = new BN(null);
321
+ this.copy(r);
322
+ return r;
323
+ };
324
+
325
+ BN.prototype._expand = function _expand (size) {
326
+ while (this.length < size) {
327
+ this.words[this.length++] = 0;
328
+ }
329
+ return this;
330
+ };
331
+
332
+ // Remove leading `0` from `this`
333
+ BN.prototype.strip = function strip () {
334
+ while (this.length > 1 && this.words[this.length - 1] === 0) {
335
+ this.length--;
336
+ }
337
+ return this._normSign();
338
+ };
339
+
340
+ BN.prototype._normSign = function _normSign () {
341
+ // -0 = 0
342
+ if (this.length === 1 && this.words[0] === 0) {
343
+ this.negative = 0;
344
+ }
345
+ return this;
346
+ };
347
+
348
+ BN.prototype.inspect = function inspect () {
349
+ return (this.red ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>';
350
+ };
351
+
352
+ /*
353
+
354
+ var zeros = [];
355
+ var groupSizes = [];
356
+ var groupBases = [];
357
+
358
+ var s = '';
359
+ var i = -1;
360
+ while (++i < BN.wordSize) {
361
+ zeros[i] = s;
362
+ s += '0';
363
+ }
364
+ groupSizes[0] = 0;
365
+ groupSizes[1] = 0;
366
+ groupBases[0] = 0;
367
+ groupBases[1] = 0;
368
+ var base = 2 - 1;
369
+ while (++base < 36 + 1) {
370
+ var groupSize = 0;
371
+ var groupBase = 1;
372
+ while (groupBase < (1 << BN.wordSize) / base) {
373
+ groupBase *= base;
374
+ groupSize += 1;
375
+ }
376
+ groupSizes[base] = groupSize;
377
+ groupBases[base] = groupBase;
378
+ }
379
+
380
+ */
381
+
382
+ var zeros = [
383
+ '',
384
+ '0',
385
+ '00',
386
+ '000',
387
+ '0000',
388
+ '00000',
389
+ '000000',
390
+ '0000000',
391
+ '00000000',
392
+ '000000000',
393
+ '0000000000',
394
+ '00000000000',
395
+ '000000000000',
396
+ '0000000000000',
397
+ '00000000000000',
398
+ '000000000000000',
399
+ '0000000000000000',
400
+ '00000000000000000',
401
+ '000000000000000000',
402
+ '0000000000000000000',
403
+ '00000000000000000000',
404
+ '000000000000000000000',
405
+ '0000000000000000000000',
406
+ '00000000000000000000000',
407
+ '000000000000000000000000',
408
+ '0000000000000000000000000'
409
+ ];
410
+
411
+ var groupSizes = [
412
+ 0, 0,
413
+ 25, 16, 12, 11, 10, 9, 8,
414
+ 8, 7, 7, 7, 7, 6, 6,
415
+ 6, 6, 6, 6, 6, 5, 5,
416
+ 5, 5, 5, 5, 5, 5, 5,
417
+ 5, 5, 5, 5, 5, 5, 5
418
+ ];
419
+
420
+ var groupBases = [
421
+ 0, 0,
422
+ 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,
423
+ 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,
424
+ 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,
425
+ 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,
426
+ 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176
427
+ ];
428
+
429
+ BN.prototype.toString = function toString (base, padding) {
430
+ base = base || 10;
431
+ padding = padding | 0 || 1;
432
+
433
+ var out;
434
+ if (base === 16 || base === 'hex') {
435
+ out = '';
436
+ var off = 0;
437
+ var carry = 0;
438
+ for (var i = 0; i < this.length; i++) {
439
+ var w = this.words[i];
440
+ var word = (((w << off) | carry) & 0xffffff).toString(16);
441
+ carry = (w >>> (24 - off)) & 0xffffff;
442
+ if (carry !== 0 || i !== this.length - 1) {
443
+ out = zeros[6 - word.length] + word + out;
444
+ } else {
445
+ out = word + out;
446
+ }
447
+ off += 2;
448
+ if (off >= 26) {
449
+ off -= 26;
450
+ i--;
451
+ }
452
+ }
453
+ if (carry !== 0) {
454
+ out = carry.toString(16) + out;
455
+ }
456
+ while (out.length % padding !== 0) {
457
+ out = '0' + out;
458
+ }
459
+ if (this.negative !== 0) {
460
+ out = '-' + out;
461
+ }
462
+ return out;
463
+ }
464
+
465
+ if (base === (base | 0) && base >= 2 && base <= 36) {
466
+ // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));
467
+ var groupSize = groupSizes[base];
468
+ // var groupBase = Math.pow(base, groupSize);
469
+ var groupBase = groupBases[base];
470
+ out = '';
471
+ var c = this.clone();
472
+ c.negative = 0;
473
+ while (!c.isZero()) {
474
+ var r = c.modn(groupBase).toString(base);
475
+ c = c.idivn(groupBase);
476
+
477
+ if (!c.isZero()) {
478
+ out = zeros[groupSize - r.length] + r + out;
479
+ } else {
480
+ out = r + out;
481
+ }
482
+ }
483
+ if (this.isZero()) {
484
+ out = '0' + out;
485
+ }
486
+ while (out.length % padding !== 0) {
487
+ out = '0' + out;
488
+ }
489
+ if (this.negative !== 0) {
490
+ out = '-' + out;
491
+ }
492
+ return out;
493
+ }
494
+
495
+ assert(false, 'Base should be between 2 and 36');
496
+ };
497
+
498
+ BN.prototype.toNumber = function toNumber () {
499
+ var ret = this.words[0];
500
+ if (this.length === 2) {
501
+ ret += this.words[1] * 0x4000000;
502
+ } else if (this.length === 3 && this.words[2] === 0x01) {
503
+ // NOTE: at this stage it is known that the top bit is set
504
+ ret += 0x10000000000000 + (this.words[1] * 0x4000000);
505
+ } else if (this.length > 2) {
506
+ assert(false, 'Number can only safely store up to 53 bits');
507
+ }
508
+ return (this.negative !== 0) ? -ret : ret;
509
+ };
510
+
511
+ BN.prototype.toJSON = function toJSON () {
512
+ return this.toString(16);
513
+ };
514
+
515
+ BN.prototype.toBuffer = function toBuffer (endian, length) {
516
+ assert(typeof Buffer !== 'undefined');
517
+ return this.toArrayLike(Buffer, endian, length);
518
+ };
519
+
520
+ BN.prototype.toArray = function toArray (endian, length) {
521
+ return this.toArrayLike(Array, endian, length);
522
+ };
523
+
524
+ BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {
525
+ var byteLength = this.byteLength();
526
+ var reqLength = length || Math.max(1, byteLength);
527
+ assert(byteLength <= reqLength, 'byte array longer than desired length');
528
+ assert(reqLength > 0, 'Requested array length <= 0');
529
+
530
+ this.strip();
531
+ var littleEndian = endian === 'le';
532
+ var res = new ArrayType(reqLength);
533
+
534
+ var b, i;
535
+ var q = this.clone();
536
+ if (!littleEndian) {
537
+ // Assume big-endian
538
+ for (i = 0; i < reqLength - byteLength; i++) {
539
+ res[i] = 0;
540
+ }
541
+
542
+ for (i = 0; !q.isZero(); i++) {
543
+ b = q.andln(0xff);
544
+ q.iushrn(8);
545
+
546
+ res[reqLength - i - 1] = b;
547
+ }
548
+ } else {
549
+ for (i = 0; !q.isZero(); i++) {
550
+ b = q.andln(0xff);
551
+ q.iushrn(8);
552
+
553
+ res[i] = b;
554
+ }
555
+
556
+ for (; i < reqLength; i++) {
557
+ res[i] = 0;
558
+ }
559
+ }
560
+
561
+ return res;
562
+ };
563
+
564
+ if (Math.clz32) {
565
+ BN.prototype._countBits = function _countBits (w) {
566
+ return 32 - Math.clz32(w);
567
+ };
568
+ } else {
569
+ BN.prototype._countBits = function _countBits (w) {
570
+ var t = w;
571
+ var r = 0;
572
+ if (t >= 0x1000) {
573
+ r += 13;
574
+ t >>>= 13;
575
+ }
576
+ if (t >= 0x40) {
577
+ r += 7;
578
+ t >>>= 7;
579
+ }
580
+ if (t >= 0x8) {
581
+ r += 4;
582
+ t >>>= 4;
583
+ }
584
+ if (t >= 0x02) {
585
+ r += 2;
586
+ t >>>= 2;
587
+ }
588
+ return r + t;
589
+ };
590
+ }
591
+
592
+ BN.prototype._zeroBits = function _zeroBits (w) {
593
+ // Short-cut
594
+ if (w === 0) return 26;
595
+
596
+ var t = w;
597
+ var r = 0;
598
+ if ((t & 0x1fff) === 0) {
599
+ r += 13;
600
+ t >>>= 13;
601
+ }
602
+ if ((t & 0x7f) === 0) {
603
+ r += 7;
604
+ t >>>= 7;
605
+ }
606
+ if ((t & 0xf) === 0) {
607
+ r += 4;
608
+ t >>>= 4;
609
+ }
610
+ if ((t & 0x3) === 0) {
611
+ r += 2;
612
+ t >>>= 2;
613
+ }
614
+ if ((t & 0x1) === 0) {
615
+ r++;
616
+ }
617
+ return r;
618
+ };
619
+
620
+ // Return number of used bits in a BN
621
+ BN.prototype.bitLength = function bitLength () {
622
+ var w = this.words[this.length - 1];
623
+ var hi = this._countBits(w);
624
+ return (this.length - 1) * 26 + hi;
625
+ };
626
+
627
+ function toBitArray (num) {
628
+ var w = new Array(num.bitLength());
629
+
630
+ for (var bit = 0; bit < w.length; bit++) {
631
+ var off = (bit / 26) | 0;
632
+ var wbit = bit % 26;
633
+
634
+ w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;
635
+ }
636
+
637
+ return w;
638
+ }
639
+
640
+ // Number of trailing zero bits
641
+ BN.prototype.zeroBits = function zeroBits () {
642
+ if (this.isZero()) return 0;
643
+
644
+ var r = 0;
645
+ for (var i = 0; i < this.length; i++) {
646
+ var b = this._zeroBits(this.words[i]);
647
+ r += b;
648
+ if (b !== 26) break;
649
+ }
650
+ return r;
651
+ };
652
+
653
+ BN.prototype.byteLength = function byteLength () {
654
+ return Math.ceil(this.bitLength() / 8);
655
+ };
656
+
657
+ BN.prototype.toTwos = function toTwos (width) {
658
+ if (this.negative !== 0) {
659
+ return this.abs().inotn(width).iaddn(1);
660
+ }
661
+ return this.clone();
662
+ };
663
+
664
+ BN.prototype.fromTwos = function fromTwos (width) {
665
+ if (this.testn(width - 1)) {
666
+ return this.notn(width).iaddn(1).ineg();
667
+ }
668
+ return this.clone();
669
+ };
670
+
671
+ BN.prototype.isNeg = function isNeg () {
672
+ return this.negative !== 0;
673
+ };
674
+
675
+ // Return negative clone of `this`
676
+ BN.prototype.neg = function neg () {
677
+ return this.clone().ineg();
678
+ };
679
+
680
+ BN.prototype.ineg = function ineg () {
681
+ if (!this.isZero()) {
682
+ this.negative ^= 1;
683
+ }
684
+
685
+ return this;
686
+ };
687
+
688
+ // Or `num` with `this` in-place
689
+ BN.prototype.iuor = function iuor (num) {
690
+ while (this.length < num.length) {
691
+ this.words[this.length++] = 0;
692
+ }
693
+
694
+ for (var i = 0; i < num.length; i++) {
695
+ this.words[i] = this.words[i] | num.words[i];
696
+ }
697
+
698
+ return this.strip();
699
+ };
700
+
701
+ BN.prototype.ior = function ior (num) {
702
+ assert((this.negative | num.negative) === 0);
703
+ return this.iuor(num);
704
+ };
705
+
706
+ // Or `num` with `this`
707
+ BN.prototype.or = function or (num) {
708
+ if (this.length > num.length) return this.clone().ior(num);
709
+ return num.clone().ior(this);
710
+ };
711
+
712
+ BN.prototype.uor = function uor (num) {
713
+ if (this.length > num.length) return this.clone().iuor(num);
714
+ return num.clone().iuor(this);
715
+ };
716
+
717
+ // And `num` with `this` in-place
718
+ BN.prototype.iuand = function iuand (num) {
719
+ // b = min-length(num, this)
720
+ var b;
721
+ if (this.length > num.length) {
722
+ b = num;
723
+ } else {
724
+ b = this;
725
+ }
726
+
727
+ for (var i = 0; i < b.length; i++) {
728
+ this.words[i] = this.words[i] & num.words[i];
729
+ }
730
+
731
+ this.length = b.length;
732
+
733
+ return this.strip();
734
+ };
735
+
736
+ BN.prototype.iand = function iand (num) {
737
+ assert((this.negative | num.negative) === 0);
738
+ return this.iuand(num);
739
+ };
740
+
741
+ // And `num` with `this`
742
+ BN.prototype.and = function and (num) {
743
+ if (this.length > num.length) return this.clone().iand(num);
744
+ return num.clone().iand(this);
745
+ };
746
+
747
+ BN.prototype.uand = function uand (num) {
748
+ if (this.length > num.length) return this.clone().iuand(num);
749
+ return num.clone().iuand(this);
750
+ };
751
+
752
+ // Xor `num` with `this` in-place
753
+ BN.prototype.iuxor = function iuxor (num) {
754
+ // a.length > b.length
755
+ var a;
756
+ var b;
757
+ if (this.length > num.length) {
758
+ a = this;
759
+ b = num;
760
+ } else {
761
+ a = num;
762
+ b = this;
763
+ }
764
+
765
+ for (var i = 0; i < b.length; i++) {
766
+ this.words[i] = a.words[i] ^ b.words[i];
767
+ }
768
+
769
+ if (this !== a) {
770
+ for (; i < a.length; i++) {
771
+ this.words[i] = a.words[i];
772
+ }
773
+ }
774
+
775
+ this.length = a.length;
776
+
777
+ return this.strip();
778
+ };
779
+
780
+ BN.prototype.ixor = function ixor (num) {
781
+ assert((this.negative | num.negative) === 0);
782
+ return this.iuxor(num);
783
+ };
784
+
785
+ // Xor `num` with `this`
786
+ BN.prototype.xor = function xor (num) {
787
+ if (this.length > num.length) return this.clone().ixor(num);
788
+ return num.clone().ixor(this);
789
+ };
790
+
791
+ BN.prototype.uxor = function uxor (num) {
792
+ if (this.length > num.length) return this.clone().iuxor(num);
793
+ return num.clone().iuxor(this);
794
+ };
795
+
796
+ // Not ``this`` with ``width`` bitwidth
797
+ BN.prototype.inotn = function inotn (width) {
798
+ assert(typeof width === 'number' && width >= 0);
799
+
800
+ var bytesNeeded = Math.ceil(width / 26) | 0;
801
+ var bitsLeft = width % 26;
802
+
803
+ // Extend the buffer with leading zeroes
804
+ this._expand(bytesNeeded);
805
+
806
+ if (bitsLeft > 0) {
807
+ bytesNeeded--;
808
+ }
809
+
810
+ // Handle complete words
811
+ for (var i = 0; i < bytesNeeded; i++) {
812
+ this.words[i] = ~this.words[i] & 0x3ffffff;
813
+ }
814
+
815
+ // Handle the residue
816
+ if (bitsLeft > 0) {
817
+ this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));
818
+ }
819
+
820
+ // And remove leading zeroes
821
+ return this.strip();
822
+ };
823
+
824
+ BN.prototype.notn = function notn (width) {
825
+ return this.clone().inotn(width);
826
+ };
827
+
828
+ // Set `bit` of `this`
829
+ BN.prototype.setn = function setn (bit, val) {
830
+ assert(typeof bit === 'number' && bit >= 0);
831
+
832
+ var off = (bit / 26) | 0;
833
+ var wbit = bit % 26;
834
+
835
+ this._expand(off + 1);
836
+
837
+ if (val) {
838
+ this.words[off] = this.words[off] | (1 << wbit);
839
+ } else {
840
+ this.words[off] = this.words[off] & ~(1 << wbit);
841
+ }
842
+
843
+ return this.strip();
844
+ };
845
+
846
+ // Add `num` to `this` in-place
847
+ BN.prototype.iadd = function iadd (num) {
848
+ var r;
849
+
850
+ // negative + positive
851
+ if (this.negative !== 0 && num.negative === 0) {
852
+ this.negative = 0;
853
+ r = this.isub(num);
854
+ this.negative ^= 1;
855
+ return this._normSign();
856
+
857
+ // positive + negative
858
+ } else if (this.negative === 0 && num.negative !== 0) {
859
+ num.negative = 0;
860
+ r = this.isub(num);
861
+ num.negative = 1;
862
+ return r._normSign();
863
+ }
864
+
865
+ // a.length > b.length
866
+ var a, b;
867
+ if (this.length > num.length) {
868
+ a = this;
869
+ b = num;
870
+ } else {
871
+ a = num;
872
+ b = this;
873
+ }
874
+
875
+ var carry = 0;
876
+ for (var i = 0; i < b.length; i++) {
877
+ r = (a.words[i] | 0) + (b.words[i] | 0) + carry;
878
+ this.words[i] = r & 0x3ffffff;
879
+ carry = r >>> 26;
880
+ }
881
+ for (; carry !== 0 && i < a.length; i++) {
882
+ r = (a.words[i] | 0) + carry;
883
+ this.words[i] = r & 0x3ffffff;
884
+ carry = r >>> 26;
885
+ }
886
+
887
+ this.length = a.length;
888
+ if (carry !== 0) {
889
+ this.words[this.length] = carry;
890
+ this.length++;
891
+ // Copy the rest of the words
892
+ } else if (a !== this) {
893
+ for (; i < a.length; i++) {
894
+ this.words[i] = a.words[i];
895
+ }
896
+ }
897
+
898
+ return this;
899
+ };
900
+
901
+ // Add `num` to `this`
902
+ BN.prototype.add = function add (num) {
903
+ var res;
904
+ if (num.negative !== 0 && this.negative === 0) {
905
+ num.negative = 0;
906
+ res = this.sub(num);
907
+ num.negative ^= 1;
908
+ return res;
909
+ } else if (num.negative === 0 && this.negative !== 0) {
910
+ this.negative = 0;
911
+ res = num.sub(this);
912
+ this.negative = 1;
913
+ return res;
914
+ }
915
+
916
+ if (this.length > num.length) return this.clone().iadd(num);
917
+
918
+ return num.clone().iadd(this);
919
+ };
920
+
921
+ // Subtract `num` from `this` in-place
922
+ BN.prototype.isub = function isub (num) {
923
+ // this - (-num) = this + num
924
+ if (num.negative !== 0) {
925
+ num.negative = 0;
926
+ var r = this.iadd(num);
927
+ num.negative = 1;
928
+ return r._normSign();
929
+
930
+ // -this - num = -(this + num)
931
+ } else if (this.negative !== 0) {
932
+ this.negative = 0;
933
+ this.iadd(num);
934
+ this.negative = 1;
935
+ return this._normSign();
936
+ }
937
+
938
+ // At this point both numbers are positive
939
+ var cmp = this.cmp(num);
940
+
941
+ // Optimization - zeroify
942
+ if (cmp === 0) {
943
+ this.negative = 0;
944
+ this.length = 1;
945
+ this.words[0] = 0;
946
+ return this;
947
+ }
948
+
949
+ // a > b
950
+ var a, b;
951
+ if (cmp > 0) {
952
+ a = this;
953
+ b = num;
954
+ } else {
955
+ a = num;
956
+ b = this;
957
+ }
958
+
959
+ var carry = 0;
960
+ for (var i = 0; i < b.length; i++) {
961
+ r = (a.words[i] | 0) - (b.words[i] | 0) + carry;
962
+ carry = r >> 26;
963
+ this.words[i] = r & 0x3ffffff;
964
+ }
965
+ for (; carry !== 0 && i < a.length; i++) {
966
+ r = (a.words[i] | 0) + carry;
967
+ carry = r >> 26;
968
+ this.words[i] = r & 0x3ffffff;
969
+ }
970
+
971
+ // Copy rest of the words
972
+ if (carry === 0 && i < a.length && a !== this) {
973
+ for (; i < a.length; i++) {
974
+ this.words[i] = a.words[i];
975
+ }
976
+ }
977
+
978
+ this.length = Math.max(this.length, i);
979
+
980
+ if (a !== this) {
981
+ this.negative = 1;
982
+ }
983
+
984
+ return this.strip();
985
+ };
986
+
987
+ // Subtract `num` from `this`
988
+ BN.prototype.sub = function sub (num) {
989
+ return this.clone().isub(num);
990
+ };
991
+
992
+ function smallMulTo (self, num, out) {
993
+ out.negative = num.negative ^ self.negative;
994
+ var len = (self.length + num.length) | 0;
995
+ out.length = len;
996
+ len = (len - 1) | 0;
997
+
998
+ // Peel one iteration (compiler can't do it, because of code complexity)
999
+ var a = self.words[0] | 0;
1000
+ var b = num.words[0] | 0;
1001
+ var r = a * b;
1002
+
1003
+ var lo = r & 0x3ffffff;
1004
+ var carry = (r / 0x4000000) | 0;
1005
+ out.words[0] = lo;
1006
+
1007
+ for (var k = 1; k < len; k++) {
1008
+ // Sum all words with the same `i + j = k` and accumulate `ncarry`,
1009
+ // note that ncarry could be >= 0x3ffffff
1010
+ var ncarry = carry >>> 26;
1011
+ var rword = carry & 0x3ffffff;
1012
+ var maxJ = Math.min(k, num.length - 1);
1013
+ for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
1014
+ var i = (k - j) | 0;
1015
+ a = self.words[i] | 0;
1016
+ b = num.words[j] | 0;
1017
+ r = a * b + rword;
1018
+ ncarry += (r / 0x4000000) | 0;
1019
+ rword = r & 0x3ffffff;
1020
+ }
1021
+ out.words[k] = rword | 0;
1022
+ carry = ncarry | 0;
1023
+ }
1024
+ if (carry !== 0) {
1025
+ out.words[k] = carry | 0;
1026
+ } else {
1027
+ out.length--;
1028
+ }
1029
+
1030
+ return out.strip();
1031
+ }
1032
+
1033
+ // TODO(indutny): it may be reasonable to omit it for users who don't need
1034
+ // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit
1035
+ // multiplication (like elliptic secp256k1).
1036
+ var comb10MulTo = function comb10MulTo (self, num, out) {
1037
+ var a = self.words;
1038
+ var b = num.words;
1039
+ var o = out.words;
1040
+ var c = 0;
1041
+ var lo;
1042
+ var mid;
1043
+ var hi;
1044
+ var a0 = a[0] | 0;
1045
+ var al0 = a0 & 0x1fff;
1046
+ var ah0 = a0 >>> 13;
1047
+ var a1 = a[1] | 0;
1048
+ var al1 = a1 & 0x1fff;
1049
+ var ah1 = a1 >>> 13;
1050
+ var a2 = a[2] | 0;
1051
+ var al2 = a2 & 0x1fff;
1052
+ var ah2 = a2 >>> 13;
1053
+ var a3 = a[3] | 0;
1054
+ var al3 = a3 & 0x1fff;
1055
+ var ah3 = a3 >>> 13;
1056
+ var a4 = a[4] | 0;
1057
+ var al4 = a4 & 0x1fff;
1058
+ var ah4 = a4 >>> 13;
1059
+ var a5 = a[5] | 0;
1060
+ var al5 = a5 & 0x1fff;
1061
+ var ah5 = a5 >>> 13;
1062
+ var a6 = a[6] | 0;
1063
+ var al6 = a6 & 0x1fff;
1064
+ var ah6 = a6 >>> 13;
1065
+ var a7 = a[7] | 0;
1066
+ var al7 = a7 & 0x1fff;
1067
+ var ah7 = a7 >>> 13;
1068
+ var a8 = a[8] | 0;
1069
+ var al8 = a8 & 0x1fff;
1070
+ var ah8 = a8 >>> 13;
1071
+ var a9 = a[9] | 0;
1072
+ var al9 = a9 & 0x1fff;
1073
+ var ah9 = a9 >>> 13;
1074
+ var b0 = b[0] | 0;
1075
+ var bl0 = b0 & 0x1fff;
1076
+ var bh0 = b0 >>> 13;
1077
+ var b1 = b[1] | 0;
1078
+ var bl1 = b1 & 0x1fff;
1079
+ var bh1 = b1 >>> 13;
1080
+ var b2 = b[2] | 0;
1081
+ var bl2 = b2 & 0x1fff;
1082
+ var bh2 = b2 >>> 13;
1083
+ var b3 = b[3] | 0;
1084
+ var bl3 = b3 & 0x1fff;
1085
+ var bh3 = b3 >>> 13;
1086
+ var b4 = b[4] | 0;
1087
+ var bl4 = b4 & 0x1fff;
1088
+ var bh4 = b4 >>> 13;
1089
+ var b5 = b[5] | 0;
1090
+ var bl5 = b5 & 0x1fff;
1091
+ var bh5 = b5 >>> 13;
1092
+ var b6 = b[6] | 0;
1093
+ var bl6 = b6 & 0x1fff;
1094
+ var bh6 = b6 >>> 13;
1095
+ var b7 = b[7] | 0;
1096
+ var bl7 = b7 & 0x1fff;
1097
+ var bh7 = b7 >>> 13;
1098
+ var b8 = b[8] | 0;
1099
+ var bl8 = b8 & 0x1fff;
1100
+ var bh8 = b8 >>> 13;
1101
+ var b9 = b[9] | 0;
1102
+ var bl9 = b9 & 0x1fff;
1103
+ var bh9 = b9 >>> 13;
1104
+
1105
+ out.negative = self.negative ^ num.negative;
1106
+ out.length = 19;
1107
+ /* k = 0 */
1108
+ lo = Math.imul(al0, bl0);
1109
+ mid = Math.imul(al0, bh0);
1110
+ mid = (mid + Math.imul(ah0, bl0)) | 0;
1111
+ hi = Math.imul(ah0, bh0);
1112
+ var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1113
+ c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;
1114
+ w0 &= 0x3ffffff;
1115
+ /* k = 1 */
1116
+ lo = Math.imul(al1, bl0);
1117
+ mid = Math.imul(al1, bh0);
1118
+ mid = (mid + Math.imul(ah1, bl0)) | 0;
1119
+ hi = Math.imul(ah1, bh0);
1120
+ lo = (lo + Math.imul(al0, bl1)) | 0;
1121
+ mid = (mid + Math.imul(al0, bh1)) | 0;
1122
+ mid = (mid + Math.imul(ah0, bl1)) | 0;
1123
+ hi = (hi + Math.imul(ah0, bh1)) | 0;
1124
+ var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1125
+ c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;
1126
+ w1 &= 0x3ffffff;
1127
+ /* k = 2 */
1128
+ lo = Math.imul(al2, bl0);
1129
+ mid = Math.imul(al2, bh0);
1130
+ mid = (mid + Math.imul(ah2, bl0)) | 0;
1131
+ hi = Math.imul(ah2, bh0);
1132
+ lo = (lo + Math.imul(al1, bl1)) | 0;
1133
+ mid = (mid + Math.imul(al1, bh1)) | 0;
1134
+ mid = (mid + Math.imul(ah1, bl1)) | 0;
1135
+ hi = (hi + Math.imul(ah1, bh1)) | 0;
1136
+ lo = (lo + Math.imul(al0, bl2)) | 0;
1137
+ mid = (mid + Math.imul(al0, bh2)) | 0;
1138
+ mid = (mid + Math.imul(ah0, bl2)) | 0;
1139
+ hi = (hi + Math.imul(ah0, bh2)) | 0;
1140
+ var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1141
+ c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;
1142
+ w2 &= 0x3ffffff;
1143
+ /* k = 3 */
1144
+ lo = Math.imul(al3, bl0);
1145
+ mid = Math.imul(al3, bh0);
1146
+ mid = (mid + Math.imul(ah3, bl0)) | 0;
1147
+ hi = Math.imul(ah3, bh0);
1148
+ lo = (lo + Math.imul(al2, bl1)) | 0;
1149
+ mid = (mid + Math.imul(al2, bh1)) | 0;
1150
+ mid = (mid + Math.imul(ah2, bl1)) | 0;
1151
+ hi = (hi + Math.imul(ah2, bh1)) | 0;
1152
+ lo = (lo + Math.imul(al1, bl2)) | 0;
1153
+ mid = (mid + Math.imul(al1, bh2)) | 0;
1154
+ mid = (mid + Math.imul(ah1, bl2)) | 0;
1155
+ hi = (hi + Math.imul(ah1, bh2)) | 0;
1156
+ lo = (lo + Math.imul(al0, bl3)) | 0;
1157
+ mid = (mid + Math.imul(al0, bh3)) | 0;
1158
+ mid = (mid + Math.imul(ah0, bl3)) | 0;
1159
+ hi = (hi + Math.imul(ah0, bh3)) | 0;
1160
+ var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1161
+ c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;
1162
+ w3 &= 0x3ffffff;
1163
+ /* k = 4 */
1164
+ lo = Math.imul(al4, bl0);
1165
+ mid = Math.imul(al4, bh0);
1166
+ mid = (mid + Math.imul(ah4, bl0)) | 0;
1167
+ hi = Math.imul(ah4, bh0);
1168
+ lo = (lo + Math.imul(al3, bl1)) | 0;
1169
+ mid = (mid + Math.imul(al3, bh1)) | 0;
1170
+ mid = (mid + Math.imul(ah3, bl1)) | 0;
1171
+ hi = (hi + Math.imul(ah3, bh1)) | 0;
1172
+ lo = (lo + Math.imul(al2, bl2)) | 0;
1173
+ mid = (mid + Math.imul(al2, bh2)) | 0;
1174
+ mid = (mid + Math.imul(ah2, bl2)) | 0;
1175
+ hi = (hi + Math.imul(ah2, bh2)) | 0;
1176
+ lo = (lo + Math.imul(al1, bl3)) | 0;
1177
+ mid = (mid + Math.imul(al1, bh3)) | 0;
1178
+ mid = (mid + Math.imul(ah1, bl3)) | 0;
1179
+ hi = (hi + Math.imul(ah1, bh3)) | 0;
1180
+ lo = (lo + Math.imul(al0, bl4)) | 0;
1181
+ mid = (mid + Math.imul(al0, bh4)) | 0;
1182
+ mid = (mid + Math.imul(ah0, bl4)) | 0;
1183
+ hi = (hi + Math.imul(ah0, bh4)) | 0;
1184
+ var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1185
+ c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;
1186
+ w4 &= 0x3ffffff;
1187
+ /* k = 5 */
1188
+ lo = Math.imul(al5, bl0);
1189
+ mid = Math.imul(al5, bh0);
1190
+ mid = (mid + Math.imul(ah5, bl0)) | 0;
1191
+ hi = Math.imul(ah5, bh0);
1192
+ lo = (lo + Math.imul(al4, bl1)) | 0;
1193
+ mid = (mid + Math.imul(al4, bh1)) | 0;
1194
+ mid = (mid + Math.imul(ah4, bl1)) | 0;
1195
+ hi = (hi + Math.imul(ah4, bh1)) | 0;
1196
+ lo = (lo + Math.imul(al3, bl2)) | 0;
1197
+ mid = (mid + Math.imul(al3, bh2)) | 0;
1198
+ mid = (mid + Math.imul(ah3, bl2)) | 0;
1199
+ hi = (hi + Math.imul(ah3, bh2)) | 0;
1200
+ lo = (lo + Math.imul(al2, bl3)) | 0;
1201
+ mid = (mid + Math.imul(al2, bh3)) | 0;
1202
+ mid = (mid + Math.imul(ah2, bl3)) | 0;
1203
+ hi = (hi + Math.imul(ah2, bh3)) | 0;
1204
+ lo = (lo + Math.imul(al1, bl4)) | 0;
1205
+ mid = (mid + Math.imul(al1, bh4)) | 0;
1206
+ mid = (mid + Math.imul(ah1, bl4)) | 0;
1207
+ hi = (hi + Math.imul(ah1, bh4)) | 0;
1208
+ lo = (lo + Math.imul(al0, bl5)) | 0;
1209
+ mid = (mid + Math.imul(al0, bh5)) | 0;
1210
+ mid = (mid + Math.imul(ah0, bl5)) | 0;
1211
+ hi = (hi + Math.imul(ah0, bh5)) | 0;
1212
+ var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1213
+ c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;
1214
+ w5 &= 0x3ffffff;
1215
+ /* k = 6 */
1216
+ lo = Math.imul(al6, bl0);
1217
+ mid = Math.imul(al6, bh0);
1218
+ mid = (mid + Math.imul(ah6, bl0)) | 0;
1219
+ hi = Math.imul(ah6, bh0);
1220
+ lo = (lo + Math.imul(al5, bl1)) | 0;
1221
+ mid = (mid + Math.imul(al5, bh1)) | 0;
1222
+ mid = (mid + Math.imul(ah5, bl1)) | 0;
1223
+ hi = (hi + Math.imul(ah5, bh1)) | 0;
1224
+ lo = (lo + Math.imul(al4, bl2)) | 0;
1225
+ mid = (mid + Math.imul(al4, bh2)) | 0;
1226
+ mid = (mid + Math.imul(ah4, bl2)) | 0;
1227
+ hi = (hi + Math.imul(ah4, bh2)) | 0;
1228
+ lo = (lo + Math.imul(al3, bl3)) | 0;
1229
+ mid = (mid + Math.imul(al3, bh3)) | 0;
1230
+ mid = (mid + Math.imul(ah3, bl3)) | 0;
1231
+ hi = (hi + Math.imul(ah3, bh3)) | 0;
1232
+ lo = (lo + Math.imul(al2, bl4)) | 0;
1233
+ mid = (mid + Math.imul(al2, bh4)) | 0;
1234
+ mid = (mid + Math.imul(ah2, bl4)) | 0;
1235
+ hi = (hi + Math.imul(ah2, bh4)) | 0;
1236
+ lo = (lo + Math.imul(al1, bl5)) | 0;
1237
+ mid = (mid + Math.imul(al1, bh5)) | 0;
1238
+ mid = (mid + Math.imul(ah1, bl5)) | 0;
1239
+ hi = (hi + Math.imul(ah1, bh5)) | 0;
1240
+ lo = (lo + Math.imul(al0, bl6)) | 0;
1241
+ mid = (mid + Math.imul(al0, bh6)) | 0;
1242
+ mid = (mid + Math.imul(ah0, bl6)) | 0;
1243
+ hi = (hi + Math.imul(ah0, bh6)) | 0;
1244
+ var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1245
+ c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;
1246
+ w6 &= 0x3ffffff;
1247
+ /* k = 7 */
1248
+ lo = Math.imul(al7, bl0);
1249
+ mid = Math.imul(al7, bh0);
1250
+ mid = (mid + Math.imul(ah7, bl0)) | 0;
1251
+ hi = Math.imul(ah7, bh0);
1252
+ lo = (lo + Math.imul(al6, bl1)) | 0;
1253
+ mid = (mid + Math.imul(al6, bh1)) | 0;
1254
+ mid = (mid + Math.imul(ah6, bl1)) | 0;
1255
+ hi = (hi + Math.imul(ah6, bh1)) | 0;
1256
+ lo = (lo + Math.imul(al5, bl2)) | 0;
1257
+ mid = (mid + Math.imul(al5, bh2)) | 0;
1258
+ mid = (mid + Math.imul(ah5, bl2)) | 0;
1259
+ hi = (hi + Math.imul(ah5, bh2)) | 0;
1260
+ lo = (lo + Math.imul(al4, bl3)) | 0;
1261
+ mid = (mid + Math.imul(al4, bh3)) | 0;
1262
+ mid = (mid + Math.imul(ah4, bl3)) | 0;
1263
+ hi = (hi + Math.imul(ah4, bh3)) | 0;
1264
+ lo = (lo + Math.imul(al3, bl4)) | 0;
1265
+ mid = (mid + Math.imul(al3, bh4)) | 0;
1266
+ mid = (mid + Math.imul(ah3, bl4)) | 0;
1267
+ hi = (hi + Math.imul(ah3, bh4)) | 0;
1268
+ lo = (lo + Math.imul(al2, bl5)) | 0;
1269
+ mid = (mid + Math.imul(al2, bh5)) | 0;
1270
+ mid = (mid + Math.imul(ah2, bl5)) | 0;
1271
+ hi = (hi + Math.imul(ah2, bh5)) | 0;
1272
+ lo = (lo + Math.imul(al1, bl6)) | 0;
1273
+ mid = (mid + Math.imul(al1, bh6)) | 0;
1274
+ mid = (mid + Math.imul(ah1, bl6)) | 0;
1275
+ hi = (hi + Math.imul(ah1, bh6)) | 0;
1276
+ lo = (lo + Math.imul(al0, bl7)) | 0;
1277
+ mid = (mid + Math.imul(al0, bh7)) | 0;
1278
+ mid = (mid + Math.imul(ah0, bl7)) | 0;
1279
+ hi = (hi + Math.imul(ah0, bh7)) | 0;
1280
+ var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1281
+ c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;
1282
+ w7 &= 0x3ffffff;
1283
+ /* k = 8 */
1284
+ lo = Math.imul(al8, bl0);
1285
+ mid = Math.imul(al8, bh0);
1286
+ mid = (mid + Math.imul(ah8, bl0)) | 0;
1287
+ hi = Math.imul(ah8, bh0);
1288
+ lo = (lo + Math.imul(al7, bl1)) | 0;
1289
+ mid = (mid + Math.imul(al7, bh1)) | 0;
1290
+ mid = (mid + Math.imul(ah7, bl1)) | 0;
1291
+ hi = (hi + Math.imul(ah7, bh1)) | 0;
1292
+ lo = (lo + Math.imul(al6, bl2)) | 0;
1293
+ mid = (mid + Math.imul(al6, bh2)) | 0;
1294
+ mid = (mid + Math.imul(ah6, bl2)) | 0;
1295
+ hi = (hi + Math.imul(ah6, bh2)) | 0;
1296
+ lo = (lo + Math.imul(al5, bl3)) | 0;
1297
+ mid = (mid + Math.imul(al5, bh3)) | 0;
1298
+ mid = (mid + Math.imul(ah5, bl3)) | 0;
1299
+ hi = (hi + Math.imul(ah5, bh3)) | 0;
1300
+ lo = (lo + Math.imul(al4, bl4)) | 0;
1301
+ mid = (mid + Math.imul(al4, bh4)) | 0;
1302
+ mid = (mid + Math.imul(ah4, bl4)) | 0;
1303
+ hi = (hi + Math.imul(ah4, bh4)) | 0;
1304
+ lo = (lo + Math.imul(al3, bl5)) | 0;
1305
+ mid = (mid + Math.imul(al3, bh5)) | 0;
1306
+ mid = (mid + Math.imul(ah3, bl5)) | 0;
1307
+ hi = (hi + Math.imul(ah3, bh5)) | 0;
1308
+ lo = (lo + Math.imul(al2, bl6)) | 0;
1309
+ mid = (mid + Math.imul(al2, bh6)) | 0;
1310
+ mid = (mid + Math.imul(ah2, bl6)) | 0;
1311
+ hi = (hi + Math.imul(ah2, bh6)) | 0;
1312
+ lo = (lo + Math.imul(al1, bl7)) | 0;
1313
+ mid = (mid + Math.imul(al1, bh7)) | 0;
1314
+ mid = (mid + Math.imul(ah1, bl7)) | 0;
1315
+ hi = (hi + Math.imul(ah1, bh7)) | 0;
1316
+ lo = (lo + Math.imul(al0, bl8)) | 0;
1317
+ mid = (mid + Math.imul(al0, bh8)) | 0;
1318
+ mid = (mid + Math.imul(ah0, bl8)) | 0;
1319
+ hi = (hi + Math.imul(ah0, bh8)) | 0;
1320
+ var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1321
+ c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;
1322
+ w8 &= 0x3ffffff;
1323
+ /* k = 9 */
1324
+ lo = Math.imul(al9, bl0);
1325
+ mid = Math.imul(al9, bh0);
1326
+ mid = (mid + Math.imul(ah9, bl0)) | 0;
1327
+ hi = Math.imul(ah9, bh0);
1328
+ lo = (lo + Math.imul(al8, bl1)) | 0;
1329
+ mid = (mid + Math.imul(al8, bh1)) | 0;
1330
+ mid = (mid + Math.imul(ah8, bl1)) | 0;
1331
+ hi = (hi + Math.imul(ah8, bh1)) | 0;
1332
+ lo = (lo + Math.imul(al7, bl2)) | 0;
1333
+ mid = (mid + Math.imul(al7, bh2)) | 0;
1334
+ mid = (mid + Math.imul(ah7, bl2)) | 0;
1335
+ hi = (hi + Math.imul(ah7, bh2)) | 0;
1336
+ lo = (lo + Math.imul(al6, bl3)) | 0;
1337
+ mid = (mid + Math.imul(al6, bh3)) | 0;
1338
+ mid = (mid + Math.imul(ah6, bl3)) | 0;
1339
+ hi = (hi + Math.imul(ah6, bh3)) | 0;
1340
+ lo = (lo + Math.imul(al5, bl4)) | 0;
1341
+ mid = (mid + Math.imul(al5, bh4)) | 0;
1342
+ mid = (mid + Math.imul(ah5, bl4)) | 0;
1343
+ hi = (hi + Math.imul(ah5, bh4)) | 0;
1344
+ lo = (lo + Math.imul(al4, bl5)) | 0;
1345
+ mid = (mid + Math.imul(al4, bh5)) | 0;
1346
+ mid = (mid + Math.imul(ah4, bl5)) | 0;
1347
+ hi = (hi + Math.imul(ah4, bh5)) | 0;
1348
+ lo = (lo + Math.imul(al3, bl6)) | 0;
1349
+ mid = (mid + Math.imul(al3, bh6)) | 0;
1350
+ mid = (mid + Math.imul(ah3, bl6)) | 0;
1351
+ hi = (hi + Math.imul(ah3, bh6)) | 0;
1352
+ lo = (lo + Math.imul(al2, bl7)) | 0;
1353
+ mid = (mid + Math.imul(al2, bh7)) | 0;
1354
+ mid = (mid + Math.imul(ah2, bl7)) | 0;
1355
+ hi = (hi + Math.imul(ah2, bh7)) | 0;
1356
+ lo = (lo + Math.imul(al1, bl8)) | 0;
1357
+ mid = (mid + Math.imul(al1, bh8)) | 0;
1358
+ mid = (mid + Math.imul(ah1, bl8)) | 0;
1359
+ hi = (hi + Math.imul(ah1, bh8)) | 0;
1360
+ lo = (lo + Math.imul(al0, bl9)) | 0;
1361
+ mid = (mid + Math.imul(al0, bh9)) | 0;
1362
+ mid = (mid + Math.imul(ah0, bl9)) | 0;
1363
+ hi = (hi + Math.imul(ah0, bh9)) | 0;
1364
+ var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1365
+ c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;
1366
+ w9 &= 0x3ffffff;
1367
+ /* k = 10 */
1368
+ lo = Math.imul(al9, bl1);
1369
+ mid = Math.imul(al9, bh1);
1370
+ mid = (mid + Math.imul(ah9, bl1)) | 0;
1371
+ hi = Math.imul(ah9, bh1);
1372
+ lo = (lo + Math.imul(al8, bl2)) | 0;
1373
+ mid = (mid + Math.imul(al8, bh2)) | 0;
1374
+ mid = (mid + Math.imul(ah8, bl2)) | 0;
1375
+ hi = (hi + Math.imul(ah8, bh2)) | 0;
1376
+ lo = (lo + Math.imul(al7, bl3)) | 0;
1377
+ mid = (mid + Math.imul(al7, bh3)) | 0;
1378
+ mid = (mid + Math.imul(ah7, bl3)) | 0;
1379
+ hi = (hi + Math.imul(ah7, bh3)) | 0;
1380
+ lo = (lo + Math.imul(al6, bl4)) | 0;
1381
+ mid = (mid + Math.imul(al6, bh4)) | 0;
1382
+ mid = (mid + Math.imul(ah6, bl4)) | 0;
1383
+ hi = (hi + Math.imul(ah6, bh4)) | 0;
1384
+ lo = (lo + Math.imul(al5, bl5)) | 0;
1385
+ mid = (mid + Math.imul(al5, bh5)) | 0;
1386
+ mid = (mid + Math.imul(ah5, bl5)) | 0;
1387
+ hi = (hi + Math.imul(ah5, bh5)) | 0;
1388
+ lo = (lo + Math.imul(al4, bl6)) | 0;
1389
+ mid = (mid + Math.imul(al4, bh6)) | 0;
1390
+ mid = (mid + Math.imul(ah4, bl6)) | 0;
1391
+ hi = (hi + Math.imul(ah4, bh6)) | 0;
1392
+ lo = (lo + Math.imul(al3, bl7)) | 0;
1393
+ mid = (mid + Math.imul(al3, bh7)) | 0;
1394
+ mid = (mid + Math.imul(ah3, bl7)) | 0;
1395
+ hi = (hi + Math.imul(ah3, bh7)) | 0;
1396
+ lo = (lo + Math.imul(al2, bl8)) | 0;
1397
+ mid = (mid + Math.imul(al2, bh8)) | 0;
1398
+ mid = (mid + Math.imul(ah2, bl8)) | 0;
1399
+ hi = (hi + Math.imul(ah2, bh8)) | 0;
1400
+ lo = (lo + Math.imul(al1, bl9)) | 0;
1401
+ mid = (mid + Math.imul(al1, bh9)) | 0;
1402
+ mid = (mid + Math.imul(ah1, bl9)) | 0;
1403
+ hi = (hi + Math.imul(ah1, bh9)) | 0;
1404
+ var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1405
+ c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;
1406
+ w10 &= 0x3ffffff;
1407
+ /* k = 11 */
1408
+ lo = Math.imul(al9, bl2);
1409
+ mid = Math.imul(al9, bh2);
1410
+ mid = (mid + Math.imul(ah9, bl2)) | 0;
1411
+ hi = Math.imul(ah9, bh2);
1412
+ lo = (lo + Math.imul(al8, bl3)) | 0;
1413
+ mid = (mid + Math.imul(al8, bh3)) | 0;
1414
+ mid = (mid + Math.imul(ah8, bl3)) | 0;
1415
+ hi = (hi + Math.imul(ah8, bh3)) | 0;
1416
+ lo = (lo + Math.imul(al7, bl4)) | 0;
1417
+ mid = (mid + Math.imul(al7, bh4)) | 0;
1418
+ mid = (mid + Math.imul(ah7, bl4)) | 0;
1419
+ hi = (hi + Math.imul(ah7, bh4)) | 0;
1420
+ lo = (lo + Math.imul(al6, bl5)) | 0;
1421
+ mid = (mid + Math.imul(al6, bh5)) | 0;
1422
+ mid = (mid + Math.imul(ah6, bl5)) | 0;
1423
+ hi = (hi + Math.imul(ah6, bh5)) | 0;
1424
+ lo = (lo + Math.imul(al5, bl6)) | 0;
1425
+ mid = (mid + Math.imul(al5, bh6)) | 0;
1426
+ mid = (mid + Math.imul(ah5, bl6)) | 0;
1427
+ hi = (hi + Math.imul(ah5, bh6)) | 0;
1428
+ lo = (lo + Math.imul(al4, bl7)) | 0;
1429
+ mid = (mid + Math.imul(al4, bh7)) | 0;
1430
+ mid = (mid + Math.imul(ah4, bl7)) | 0;
1431
+ hi = (hi + Math.imul(ah4, bh7)) | 0;
1432
+ lo = (lo + Math.imul(al3, bl8)) | 0;
1433
+ mid = (mid + Math.imul(al3, bh8)) | 0;
1434
+ mid = (mid + Math.imul(ah3, bl8)) | 0;
1435
+ hi = (hi + Math.imul(ah3, bh8)) | 0;
1436
+ lo = (lo + Math.imul(al2, bl9)) | 0;
1437
+ mid = (mid + Math.imul(al2, bh9)) | 0;
1438
+ mid = (mid + Math.imul(ah2, bl9)) | 0;
1439
+ hi = (hi + Math.imul(ah2, bh9)) | 0;
1440
+ var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1441
+ c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;
1442
+ w11 &= 0x3ffffff;
1443
+ /* k = 12 */
1444
+ lo = Math.imul(al9, bl3);
1445
+ mid = Math.imul(al9, bh3);
1446
+ mid = (mid + Math.imul(ah9, bl3)) | 0;
1447
+ hi = Math.imul(ah9, bh3);
1448
+ lo = (lo + Math.imul(al8, bl4)) | 0;
1449
+ mid = (mid + Math.imul(al8, bh4)) | 0;
1450
+ mid = (mid + Math.imul(ah8, bl4)) | 0;
1451
+ hi = (hi + Math.imul(ah8, bh4)) | 0;
1452
+ lo = (lo + Math.imul(al7, bl5)) | 0;
1453
+ mid = (mid + Math.imul(al7, bh5)) | 0;
1454
+ mid = (mid + Math.imul(ah7, bl5)) | 0;
1455
+ hi = (hi + Math.imul(ah7, bh5)) | 0;
1456
+ lo = (lo + Math.imul(al6, bl6)) | 0;
1457
+ mid = (mid + Math.imul(al6, bh6)) | 0;
1458
+ mid = (mid + Math.imul(ah6, bl6)) | 0;
1459
+ hi = (hi + Math.imul(ah6, bh6)) | 0;
1460
+ lo = (lo + Math.imul(al5, bl7)) | 0;
1461
+ mid = (mid + Math.imul(al5, bh7)) | 0;
1462
+ mid = (mid + Math.imul(ah5, bl7)) | 0;
1463
+ hi = (hi + Math.imul(ah5, bh7)) | 0;
1464
+ lo = (lo + Math.imul(al4, bl8)) | 0;
1465
+ mid = (mid + Math.imul(al4, bh8)) | 0;
1466
+ mid = (mid + Math.imul(ah4, bl8)) | 0;
1467
+ hi = (hi + Math.imul(ah4, bh8)) | 0;
1468
+ lo = (lo + Math.imul(al3, bl9)) | 0;
1469
+ mid = (mid + Math.imul(al3, bh9)) | 0;
1470
+ mid = (mid + Math.imul(ah3, bl9)) | 0;
1471
+ hi = (hi + Math.imul(ah3, bh9)) | 0;
1472
+ var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1473
+ c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;
1474
+ w12 &= 0x3ffffff;
1475
+ /* k = 13 */
1476
+ lo = Math.imul(al9, bl4);
1477
+ mid = Math.imul(al9, bh4);
1478
+ mid = (mid + Math.imul(ah9, bl4)) | 0;
1479
+ hi = Math.imul(ah9, bh4);
1480
+ lo = (lo + Math.imul(al8, bl5)) | 0;
1481
+ mid = (mid + Math.imul(al8, bh5)) | 0;
1482
+ mid = (mid + Math.imul(ah8, bl5)) | 0;
1483
+ hi = (hi + Math.imul(ah8, bh5)) | 0;
1484
+ lo = (lo + Math.imul(al7, bl6)) | 0;
1485
+ mid = (mid + Math.imul(al7, bh6)) | 0;
1486
+ mid = (mid + Math.imul(ah7, bl6)) | 0;
1487
+ hi = (hi + Math.imul(ah7, bh6)) | 0;
1488
+ lo = (lo + Math.imul(al6, bl7)) | 0;
1489
+ mid = (mid + Math.imul(al6, bh7)) | 0;
1490
+ mid = (mid + Math.imul(ah6, bl7)) | 0;
1491
+ hi = (hi + Math.imul(ah6, bh7)) | 0;
1492
+ lo = (lo + Math.imul(al5, bl8)) | 0;
1493
+ mid = (mid + Math.imul(al5, bh8)) | 0;
1494
+ mid = (mid + Math.imul(ah5, bl8)) | 0;
1495
+ hi = (hi + Math.imul(ah5, bh8)) | 0;
1496
+ lo = (lo + Math.imul(al4, bl9)) | 0;
1497
+ mid = (mid + Math.imul(al4, bh9)) | 0;
1498
+ mid = (mid + Math.imul(ah4, bl9)) | 0;
1499
+ hi = (hi + Math.imul(ah4, bh9)) | 0;
1500
+ var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1501
+ c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;
1502
+ w13 &= 0x3ffffff;
1503
+ /* k = 14 */
1504
+ lo = Math.imul(al9, bl5);
1505
+ mid = Math.imul(al9, bh5);
1506
+ mid = (mid + Math.imul(ah9, bl5)) | 0;
1507
+ hi = Math.imul(ah9, bh5);
1508
+ lo = (lo + Math.imul(al8, bl6)) | 0;
1509
+ mid = (mid + Math.imul(al8, bh6)) | 0;
1510
+ mid = (mid + Math.imul(ah8, bl6)) | 0;
1511
+ hi = (hi + Math.imul(ah8, bh6)) | 0;
1512
+ lo = (lo + Math.imul(al7, bl7)) | 0;
1513
+ mid = (mid + Math.imul(al7, bh7)) | 0;
1514
+ mid = (mid + Math.imul(ah7, bl7)) | 0;
1515
+ hi = (hi + Math.imul(ah7, bh7)) | 0;
1516
+ lo = (lo + Math.imul(al6, bl8)) | 0;
1517
+ mid = (mid + Math.imul(al6, bh8)) | 0;
1518
+ mid = (mid + Math.imul(ah6, bl8)) | 0;
1519
+ hi = (hi + Math.imul(ah6, bh8)) | 0;
1520
+ lo = (lo + Math.imul(al5, bl9)) | 0;
1521
+ mid = (mid + Math.imul(al5, bh9)) | 0;
1522
+ mid = (mid + Math.imul(ah5, bl9)) | 0;
1523
+ hi = (hi + Math.imul(ah5, bh9)) | 0;
1524
+ var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1525
+ c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;
1526
+ w14 &= 0x3ffffff;
1527
+ /* k = 15 */
1528
+ lo = Math.imul(al9, bl6);
1529
+ mid = Math.imul(al9, bh6);
1530
+ mid = (mid + Math.imul(ah9, bl6)) | 0;
1531
+ hi = Math.imul(ah9, bh6);
1532
+ lo = (lo + Math.imul(al8, bl7)) | 0;
1533
+ mid = (mid + Math.imul(al8, bh7)) | 0;
1534
+ mid = (mid + Math.imul(ah8, bl7)) | 0;
1535
+ hi = (hi + Math.imul(ah8, bh7)) | 0;
1536
+ lo = (lo + Math.imul(al7, bl8)) | 0;
1537
+ mid = (mid + Math.imul(al7, bh8)) | 0;
1538
+ mid = (mid + Math.imul(ah7, bl8)) | 0;
1539
+ hi = (hi + Math.imul(ah7, bh8)) | 0;
1540
+ lo = (lo + Math.imul(al6, bl9)) | 0;
1541
+ mid = (mid + Math.imul(al6, bh9)) | 0;
1542
+ mid = (mid + Math.imul(ah6, bl9)) | 0;
1543
+ hi = (hi + Math.imul(ah6, bh9)) | 0;
1544
+ var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1545
+ c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;
1546
+ w15 &= 0x3ffffff;
1547
+ /* k = 16 */
1548
+ lo = Math.imul(al9, bl7);
1549
+ mid = Math.imul(al9, bh7);
1550
+ mid = (mid + Math.imul(ah9, bl7)) | 0;
1551
+ hi = Math.imul(ah9, bh7);
1552
+ lo = (lo + Math.imul(al8, bl8)) | 0;
1553
+ mid = (mid + Math.imul(al8, bh8)) | 0;
1554
+ mid = (mid + Math.imul(ah8, bl8)) | 0;
1555
+ hi = (hi + Math.imul(ah8, bh8)) | 0;
1556
+ lo = (lo + Math.imul(al7, bl9)) | 0;
1557
+ mid = (mid + Math.imul(al7, bh9)) | 0;
1558
+ mid = (mid + Math.imul(ah7, bl9)) | 0;
1559
+ hi = (hi + Math.imul(ah7, bh9)) | 0;
1560
+ var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1561
+ c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;
1562
+ w16 &= 0x3ffffff;
1563
+ /* k = 17 */
1564
+ lo = Math.imul(al9, bl8);
1565
+ mid = Math.imul(al9, bh8);
1566
+ mid = (mid + Math.imul(ah9, bl8)) | 0;
1567
+ hi = Math.imul(ah9, bh8);
1568
+ lo = (lo + Math.imul(al8, bl9)) | 0;
1569
+ mid = (mid + Math.imul(al8, bh9)) | 0;
1570
+ mid = (mid + Math.imul(ah8, bl9)) | 0;
1571
+ hi = (hi + Math.imul(ah8, bh9)) | 0;
1572
+ var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1573
+ c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;
1574
+ w17 &= 0x3ffffff;
1575
+ /* k = 18 */
1576
+ lo = Math.imul(al9, bl9);
1577
+ mid = Math.imul(al9, bh9);
1578
+ mid = (mid + Math.imul(ah9, bl9)) | 0;
1579
+ hi = Math.imul(ah9, bh9);
1580
+ var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
1581
+ c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;
1582
+ w18 &= 0x3ffffff;
1583
+ o[0] = w0;
1584
+ o[1] = w1;
1585
+ o[2] = w2;
1586
+ o[3] = w3;
1587
+ o[4] = w4;
1588
+ o[5] = w5;
1589
+ o[6] = w6;
1590
+ o[7] = w7;
1591
+ o[8] = w8;
1592
+ o[9] = w9;
1593
+ o[10] = w10;
1594
+ o[11] = w11;
1595
+ o[12] = w12;
1596
+ o[13] = w13;
1597
+ o[14] = w14;
1598
+ o[15] = w15;
1599
+ o[16] = w16;
1600
+ o[17] = w17;
1601
+ o[18] = w18;
1602
+ if (c !== 0) {
1603
+ o[19] = c;
1604
+ out.length++;
1605
+ }
1606
+ return out;
1607
+ };
1608
+
1609
+ // Polyfill comb
1610
+ if (!Math.imul) {
1611
+ comb10MulTo = smallMulTo;
1612
+ }
1613
+
1614
+ function bigMulTo (self, num, out) {
1615
+ out.negative = num.negative ^ self.negative;
1616
+ out.length = self.length + num.length;
1617
+
1618
+ var carry = 0;
1619
+ var hncarry = 0;
1620
+ for (var k = 0; k < out.length - 1; k++) {
1621
+ // Sum all words with the same `i + j = k` and accumulate `ncarry`,
1622
+ // note that ncarry could be >= 0x3ffffff
1623
+ var ncarry = hncarry;
1624
+ hncarry = 0;
1625
+ var rword = carry & 0x3ffffff;
1626
+ var maxJ = Math.min(k, num.length - 1);
1627
+ for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
1628
+ var i = k - j;
1629
+ var a = self.words[i] | 0;
1630
+ var b = num.words[j] | 0;
1631
+ var r = a * b;
1632
+
1633
+ var lo = r & 0x3ffffff;
1634
+ ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;
1635
+ lo = (lo + rword) | 0;
1636
+ rword = lo & 0x3ffffff;
1637
+ ncarry = (ncarry + (lo >>> 26)) | 0;
1638
+
1639
+ hncarry += ncarry >>> 26;
1640
+ ncarry &= 0x3ffffff;
1641
+ }
1642
+ out.words[k] = rword;
1643
+ carry = ncarry;
1644
+ ncarry = hncarry;
1645
+ }
1646
+ if (carry !== 0) {
1647
+ out.words[k] = carry;
1648
+ } else {
1649
+ out.length--;
1650
+ }
1651
+
1652
+ return out.strip();
1653
+ }
1654
+
1655
+ function jumboMulTo (self, num, out) {
1656
+ var fftm = new FFTM();
1657
+ return fftm.mulp(self, num, out);
1658
+ }
1659
+
1660
+ BN.prototype.mulTo = function mulTo (num, out) {
1661
+ var res;
1662
+ var len = this.length + num.length;
1663
+ if (this.length === 10 && num.length === 10) {
1664
+ res = comb10MulTo(this, num, out);
1665
+ } else if (len < 63) {
1666
+ res = smallMulTo(this, num, out);
1667
+ } else if (len < 1024) {
1668
+ res = bigMulTo(this, num, out);
1669
+ } else {
1670
+ res = jumboMulTo(this, num, out);
1671
+ }
1672
+
1673
+ return res;
1674
+ };
1675
+
1676
+ // Cooley-Tukey algorithm for FFT
1677
+ // slightly revisited to rely on looping instead of recursion
1678
+
1679
+ function FFTM (x, y) {
1680
+ this.x = x;
1681
+ this.y = y;
1682
+ }
1683
+
1684
+ FFTM.prototype.makeRBT = function makeRBT (N) {
1685
+ var t = new Array(N);
1686
+ var l = BN.prototype._countBits(N) - 1;
1687
+ for (var i = 0; i < N; i++) {
1688
+ t[i] = this.revBin(i, l, N);
1689
+ }
1690
+
1691
+ return t;
1692
+ };
1693
+
1694
+ // Returns binary-reversed representation of `x`
1695
+ FFTM.prototype.revBin = function revBin (x, l, N) {
1696
+ if (x === 0 || x === N - 1) return x;
1697
+
1698
+ var rb = 0;
1699
+ for (var i = 0; i < l; i++) {
1700
+ rb |= (x & 1) << (l - i - 1);
1701
+ x >>= 1;
1702
+ }
1703
+
1704
+ return rb;
1705
+ };
1706
+
1707
+ // Performs "tweedling" phase, therefore 'emulating'
1708
+ // behaviour of the recursive algorithm
1709
+ FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {
1710
+ for (var i = 0; i < N; i++) {
1711
+ rtws[i] = rws[rbt[i]];
1712
+ itws[i] = iws[rbt[i]];
1713
+ }
1714
+ };
1715
+
1716
+ FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {
1717
+ this.permute(rbt, rws, iws, rtws, itws, N);
1718
+
1719
+ for (var s = 1; s < N; s <<= 1) {
1720
+ var l = s << 1;
1721
+
1722
+ var rtwdf = Math.cos(2 * Math.PI / l);
1723
+ var itwdf = Math.sin(2 * Math.PI / l);
1724
+
1725
+ for (var p = 0; p < N; p += l) {
1726
+ var rtwdf_ = rtwdf;
1727
+ var itwdf_ = itwdf;
1728
+
1729
+ for (var j = 0; j < s; j++) {
1730
+ var re = rtws[p + j];
1731
+ var ie = itws[p + j];
1732
+
1733
+ var ro = rtws[p + j + s];
1734
+ var io = itws[p + j + s];
1735
+
1736
+ var rx = rtwdf_ * ro - itwdf_ * io;
1737
+
1738
+ io = rtwdf_ * io + itwdf_ * ro;
1739
+ ro = rx;
1740
+
1741
+ rtws[p + j] = re + ro;
1742
+ itws[p + j] = ie + io;
1743
+
1744
+ rtws[p + j + s] = re - ro;
1745
+ itws[p + j + s] = ie - io;
1746
+
1747
+ /* jshint maxdepth : false */
1748
+ if (j !== l) {
1749
+ rx = rtwdf * rtwdf_ - itwdf * itwdf_;
1750
+
1751
+ itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;
1752
+ rtwdf_ = rx;
1753
+ }
1754
+ }
1755
+ }
1756
+ }
1757
+ };
1758
+
1759
+ FFTM.prototype.guessLen13b = function guessLen13b (n, m) {
1760
+ var N = Math.max(m, n) | 1;
1761
+ var odd = N & 1;
1762
+ var i = 0;
1763
+ for (N = N / 2 | 0; N; N = N >>> 1) {
1764
+ i++;
1765
+ }
1766
+
1767
+ return 1 << i + 1 + odd;
1768
+ };
1769
+
1770
+ FFTM.prototype.conjugate = function conjugate (rws, iws, N) {
1771
+ if (N <= 1) return;
1772
+
1773
+ for (var i = 0; i < N / 2; i++) {
1774
+ var t = rws[i];
1775
+
1776
+ rws[i] = rws[N - i - 1];
1777
+ rws[N - i - 1] = t;
1778
+
1779
+ t = iws[i];
1780
+
1781
+ iws[i] = -iws[N - i - 1];
1782
+ iws[N - i - 1] = -t;
1783
+ }
1784
+ };
1785
+
1786
+ FFTM.prototype.normalize13b = function normalize13b (ws, N) {
1787
+ var carry = 0;
1788
+ for (var i = 0; i < N / 2; i++) {
1789
+ var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +
1790
+ Math.round(ws[2 * i] / N) +
1791
+ carry;
1792
+
1793
+ ws[i] = w & 0x3ffffff;
1794
+
1795
+ if (w < 0x4000000) {
1796
+ carry = 0;
1797
+ } else {
1798
+ carry = w / 0x4000000 | 0;
1799
+ }
1800
+ }
1801
+
1802
+ return ws;
1803
+ };
1804
+
1805
+ FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {
1806
+ var carry = 0;
1807
+ for (var i = 0; i < len; i++) {
1808
+ carry = carry + (ws[i] | 0);
1809
+
1810
+ rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;
1811
+ rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;
1812
+ }
1813
+
1814
+ // Pad with zeroes
1815
+ for (i = 2 * len; i < N; ++i) {
1816
+ rws[i] = 0;
1817
+ }
1818
+
1819
+ assert(carry === 0);
1820
+ assert((carry & ~0x1fff) === 0);
1821
+ };
1822
+
1823
+ FFTM.prototype.stub = function stub (N) {
1824
+ var ph = new Array(N);
1825
+ for (var i = 0; i < N; i++) {
1826
+ ph[i] = 0;
1827
+ }
1828
+
1829
+ return ph;
1830
+ };
1831
+
1832
+ FFTM.prototype.mulp = function mulp (x, y, out) {
1833
+ var N = 2 * this.guessLen13b(x.length, y.length);
1834
+
1835
+ var rbt = this.makeRBT(N);
1836
+
1837
+ var _ = this.stub(N);
1838
+
1839
+ var rws = new Array(N);
1840
+ var rwst = new Array(N);
1841
+ var iwst = new Array(N);
1842
+
1843
+ var nrws = new Array(N);
1844
+ var nrwst = new Array(N);
1845
+ var niwst = new Array(N);
1846
+
1847
+ var rmws = out.words;
1848
+ rmws.length = N;
1849
+
1850
+ this.convert13b(x.words, x.length, rws, N);
1851
+ this.convert13b(y.words, y.length, nrws, N);
1852
+
1853
+ this.transform(rws, _, rwst, iwst, N, rbt);
1854
+ this.transform(nrws, _, nrwst, niwst, N, rbt);
1855
+
1856
+ for (var i = 0; i < N; i++) {
1857
+ var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];
1858
+ iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];
1859
+ rwst[i] = rx;
1860
+ }
1861
+
1862
+ this.conjugate(rwst, iwst, N);
1863
+ this.transform(rwst, iwst, rmws, _, N, rbt);
1864
+ this.conjugate(rmws, _, N);
1865
+ this.normalize13b(rmws, N);
1866
+
1867
+ out.negative = x.negative ^ y.negative;
1868
+ out.length = x.length + y.length;
1869
+ return out.strip();
1870
+ };
1871
+
1872
+ // Multiply `this` by `num`
1873
+ BN.prototype.mul = function mul (num) {
1874
+ var out = new BN(null);
1875
+ out.words = new Array(this.length + num.length);
1876
+ return this.mulTo(num, out);
1877
+ };
1878
+
1879
+ // Multiply employing FFT
1880
+ BN.prototype.mulf = function mulf (num) {
1881
+ var out = new BN(null);
1882
+ out.words = new Array(this.length + num.length);
1883
+ return jumboMulTo(this, num, out);
1884
+ };
1885
+
1886
+ // In-place Multiplication
1887
+ BN.prototype.imul = function imul (num) {
1888
+ return this.clone().mulTo(num, this);
1889
+ };
1890
+
1891
+ BN.prototype.imuln = function imuln (num) {
1892
+ assert(typeof num === 'number');
1893
+ assert(num < 0x4000000);
1894
+
1895
+ // Carry
1896
+ var carry = 0;
1897
+ for (var i = 0; i < this.length; i++) {
1898
+ var w = (this.words[i] | 0) * num;
1899
+ var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);
1900
+ carry >>= 26;
1901
+ carry += (w / 0x4000000) | 0;
1902
+ // NOTE: lo is 27bit maximum
1903
+ carry += lo >>> 26;
1904
+ this.words[i] = lo & 0x3ffffff;
1905
+ }
1906
+
1907
+ if (carry !== 0) {
1908
+ this.words[i] = carry;
1909
+ this.length++;
1910
+ }
1911
+
1912
+ return this;
1913
+ };
1914
+
1915
+ BN.prototype.muln = function muln (num) {
1916
+ return this.clone().imuln(num);
1917
+ };
1918
+
1919
+ // `this` * `this`
1920
+ BN.prototype.sqr = function sqr () {
1921
+ return this.mul(this);
1922
+ };
1923
+
1924
+ // `this` * `this` in-place
1925
+ BN.prototype.isqr = function isqr () {
1926
+ return this.imul(this.clone());
1927
+ };
1928
+
1929
+ // Math.pow(`this`, `num`)
1930
+ BN.prototype.pow = function pow (num) {
1931
+ var w = toBitArray(num);
1932
+ if (w.length === 0) return new BN(1);
1933
+
1934
+ // Skip leading zeroes
1935
+ var res = this;
1936
+ for (var i = 0; i < w.length; i++, res = res.sqr()) {
1937
+ if (w[i] !== 0) break;
1938
+ }
1939
+
1940
+ if (++i < w.length) {
1941
+ for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {
1942
+ if (w[i] === 0) continue;
1943
+
1944
+ res = res.mul(q);
1945
+ }
1946
+ }
1947
+
1948
+ return res;
1949
+ };
1950
+
1951
+ // Shift-left in-place
1952
+ BN.prototype.iushln = function iushln (bits) {
1953
+ assert(typeof bits === 'number' && bits >= 0);
1954
+ var r = bits % 26;
1955
+ var s = (bits - r) / 26;
1956
+ var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);
1957
+ var i;
1958
+
1959
+ if (r !== 0) {
1960
+ var carry = 0;
1961
+
1962
+ for (i = 0; i < this.length; i++) {
1963
+ var newCarry = this.words[i] & carryMask;
1964
+ var c = ((this.words[i] | 0) - newCarry) << r;
1965
+ this.words[i] = c | carry;
1966
+ carry = newCarry >>> (26 - r);
1967
+ }
1968
+
1969
+ if (carry) {
1970
+ this.words[i] = carry;
1971
+ this.length++;
1972
+ }
1973
+ }
1974
+
1975
+ if (s !== 0) {
1976
+ for (i = this.length - 1; i >= 0; i--) {
1977
+ this.words[i + s] = this.words[i];
1978
+ }
1979
+
1980
+ for (i = 0; i < s; i++) {
1981
+ this.words[i] = 0;
1982
+ }
1983
+
1984
+ this.length += s;
1985
+ }
1986
+
1987
+ return this.strip();
1988
+ };
1989
+
1990
+ BN.prototype.ishln = function ishln (bits) {
1991
+ // TODO(indutny): implement me
1992
+ assert(this.negative === 0);
1993
+ return this.iushln(bits);
1994
+ };
1995
+
1996
+ // Shift-right in-place
1997
+ // NOTE: `hint` is a lowest bit before trailing zeroes
1998
+ // NOTE: if `extended` is present - it will be filled with destroyed bits
1999
+ BN.prototype.iushrn = function iushrn (bits, hint, extended) {
2000
+ assert(typeof bits === 'number' && bits >= 0);
2001
+ var h;
2002
+ if (hint) {
2003
+ h = (hint - (hint % 26)) / 26;
2004
+ } else {
2005
+ h = 0;
2006
+ }
2007
+
2008
+ var r = bits % 26;
2009
+ var s = Math.min((bits - r) / 26, this.length);
2010
+ var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
2011
+ var maskedWords = extended;
2012
+
2013
+ h -= s;
2014
+ h = Math.max(0, h);
2015
+
2016
+ // Extended mode, copy masked part
2017
+ if (maskedWords) {
2018
+ for (var i = 0; i < s; i++) {
2019
+ maskedWords.words[i] = this.words[i];
2020
+ }
2021
+ maskedWords.length = s;
2022
+ }
2023
+
2024
+ if (s === 0) {
2025
+ // No-op, we should not move anything at all
2026
+ } else if (this.length > s) {
2027
+ this.length -= s;
2028
+ for (i = 0; i < this.length; i++) {
2029
+ this.words[i] = this.words[i + s];
2030
+ }
2031
+ } else {
2032
+ this.words[0] = 0;
2033
+ this.length = 1;
2034
+ }
2035
+
2036
+ var carry = 0;
2037
+ for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
2038
+ var word = this.words[i] | 0;
2039
+ this.words[i] = (carry << (26 - r)) | (word >>> r);
2040
+ carry = word & mask;
2041
+ }
2042
+
2043
+ // Push carried bits as a mask
2044
+ if (maskedWords && carry !== 0) {
2045
+ maskedWords.words[maskedWords.length++] = carry;
2046
+ }
2047
+
2048
+ if (this.length === 0) {
2049
+ this.words[0] = 0;
2050
+ this.length = 1;
2051
+ }
2052
+
2053
+ return this.strip();
2054
+ };
2055
+
2056
+ BN.prototype.ishrn = function ishrn (bits, hint, extended) {
2057
+ // TODO(indutny): implement me
2058
+ assert(this.negative === 0);
2059
+ return this.iushrn(bits, hint, extended);
2060
+ };
2061
+
2062
+ // Shift-left
2063
+ BN.prototype.shln = function shln (bits) {
2064
+ return this.clone().ishln(bits);
2065
+ };
2066
+
2067
+ BN.prototype.ushln = function ushln (bits) {
2068
+ return this.clone().iushln(bits);
2069
+ };
2070
+
2071
+ // Shift-right
2072
+ BN.prototype.shrn = function shrn (bits) {
2073
+ return this.clone().ishrn(bits);
2074
+ };
2075
+
2076
+ BN.prototype.ushrn = function ushrn (bits) {
2077
+ return this.clone().iushrn(bits);
2078
+ };
2079
+
2080
+ // Test if n bit is set
2081
+ BN.prototype.testn = function testn (bit) {
2082
+ assert(typeof bit === 'number' && bit >= 0);
2083
+ var r = bit % 26;
2084
+ var s = (bit - r) / 26;
2085
+ var q = 1 << r;
2086
+
2087
+ // Fast case: bit is much higher than all existing words
2088
+ if (this.length <= s) return false;
2089
+
2090
+ // Check bit and return
2091
+ var w = this.words[s];
2092
+
2093
+ return !!(w & q);
2094
+ };
2095
+
2096
+ // Return only lowers bits of number (in-place)
2097
+ BN.prototype.imaskn = function imaskn (bits) {
2098
+ assert(typeof bits === 'number' && bits >= 0);
2099
+ var r = bits % 26;
2100
+ var s = (bits - r) / 26;
2101
+
2102
+ assert(this.negative === 0, 'imaskn works only with positive numbers');
2103
+
2104
+ if (this.length <= s) {
2105
+ return this;
2106
+ }
2107
+
2108
+ if (r !== 0) {
2109
+ s++;
2110
+ }
2111
+ this.length = Math.min(s, this.length);
2112
+
2113
+ if (r !== 0) {
2114
+ var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
2115
+ this.words[this.length - 1] &= mask;
2116
+ }
2117
+
2118
+ return this.strip();
2119
+ };
2120
+
2121
+ // Return only lowers bits of number
2122
+ BN.prototype.maskn = function maskn (bits) {
2123
+ return this.clone().imaskn(bits);
2124
+ };
2125
+
2126
+ // Add plain number `num` to `this`
2127
+ BN.prototype.iaddn = function iaddn (num) {
2128
+ assert(typeof num === 'number');
2129
+ assert(num < 0x4000000);
2130
+ if (num < 0) return this.isubn(-num);
2131
+
2132
+ // Possible sign change
2133
+ if (this.negative !== 0) {
2134
+ if (this.length === 1 && (this.words[0] | 0) < num) {
2135
+ this.words[0] = num - (this.words[0] | 0);
2136
+ this.negative = 0;
2137
+ return this;
2138
+ }
2139
+
2140
+ this.negative = 0;
2141
+ this.isubn(num);
2142
+ this.negative = 1;
2143
+ return this;
2144
+ }
2145
+
2146
+ // Add without checks
2147
+ return this._iaddn(num);
2148
+ };
2149
+
2150
+ BN.prototype._iaddn = function _iaddn (num) {
2151
+ this.words[0] += num;
2152
+
2153
+ // Carry
2154
+ for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {
2155
+ this.words[i] -= 0x4000000;
2156
+ if (i === this.length - 1) {
2157
+ this.words[i + 1] = 1;
2158
+ } else {
2159
+ this.words[i + 1]++;
2160
+ }
2161
+ }
2162
+ this.length = Math.max(this.length, i + 1);
2163
+
2164
+ return this;
2165
+ };
2166
+
2167
+ // Subtract plain number `num` from `this`
2168
+ BN.prototype.isubn = function isubn (num) {
2169
+ assert(typeof num === 'number');
2170
+ assert(num < 0x4000000);
2171
+ if (num < 0) return this.iaddn(-num);
2172
+
2173
+ if (this.negative !== 0) {
2174
+ this.negative = 0;
2175
+ this.iaddn(num);
2176
+ this.negative = 1;
2177
+ return this;
2178
+ }
2179
+
2180
+ this.words[0] -= num;
2181
+
2182
+ if (this.length === 1 && this.words[0] < 0) {
2183
+ this.words[0] = -this.words[0];
2184
+ this.negative = 1;
2185
+ } else {
2186
+ // Carry
2187
+ for (var i = 0; i < this.length && this.words[i] < 0; i++) {
2188
+ this.words[i] += 0x4000000;
2189
+ this.words[i + 1] -= 1;
2190
+ }
2191
+ }
2192
+
2193
+ return this.strip();
2194
+ };
2195
+
2196
+ BN.prototype.addn = function addn (num) {
2197
+ return this.clone().iaddn(num);
2198
+ };
2199
+
2200
+ BN.prototype.subn = function subn (num) {
2201
+ return this.clone().isubn(num);
2202
+ };
2203
+
2204
+ BN.prototype.iabs = function iabs () {
2205
+ this.negative = 0;
2206
+
2207
+ return this;
2208
+ };
2209
+
2210
+ BN.prototype.abs = function abs () {
2211
+ return this.clone().iabs();
2212
+ };
2213
+
2214
+ BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {
2215
+ var len = num.length + shift;
2216
+ var i;
2217
+
2218
+ this._expand(len);
2219
+
2220
+ var w;
2221
+ var carry = 0;
2222
+ for (i = 0; i < num.length; i++) {
2223
+ w = (this.words[i + shift] | 0) + carry;
2224
+ var right = (num.words[i] | 0) * mul;
2225
+ w -= right & 0x3ffffff;
2226
+ carry = (w >> 26) - ((right / 0x4000000) | 0);
2227
+ this.words[i + shift] = w & 0x3ffffff;
2228
+ }
2229
+ for (; i < this.length - shift; i++) {
2230
+ w = (this.words[i + shift] | 0) + carry;
2231
+ carry = w >> 26;
2232
+ this.words[i + shift] = w & 0x3ffffff;
2233
+ }
2234
+
2235
+ if (carry === 0) return this.strip();
2236
+
2237
+ // Subtraction overflow
2238
+ assert(carry === -1);
2239
+ carry = 0;
2240
+ for (i = 0; i < this.length; i++) {
2241
+ w = -(this.words[i] | 0) + carry;
2242
+ carry = w >> 26;
2243
+ this.words[i] = w & 0x3ffffff;
2244
+ }
2245
+ this.negative = 1;
2246
+
2247
+ return this.strip();
2248
+ };
2249
+
2250
+ BN.prototype._wordDiv = function _wordDiv (num, mode) {
2251
+ var shift = this.length - num.length;
2252
+
2253
+ var a = this.clone();
2254
+ var b = num;
2255
+
2256
+ // Normalize
2257
+ var bhi = b.words[b.length - 1] | 0;
2258
+ var bhiBits = this._countBits(bhi);
2259
+ shift = 26 - bhiBits;
2260
+ if (shift !== 0) {
2261
+ b = b.ushln(shift);
2262
+ a.iushln(shift);
2263
+ bhi = b.words[b.length - 1] | 0;
2264
+ }
2265
+
2266
+ // Initialize quotient
2267
+ var m = a.length - b.length;
2268
+ var q;
2269
+
2270
+ if (mode !== 'mod') {
2271
+ q = new BN(null);
2272
+ q.length = m + 1;
2273
+ q.words = new Array(q.length);
2274
+ for (var i = 0; i < q.length; i++) {
2275
+ q.words[i] = 0;
2276
+ }
2277
+ }
2278
+
2279
+ var diff = a.clone()._ishlnsubmul(b, 1, m);
2280
+ if (diff.negative === 0) {
2281
+ a = diff;
2282
+ if (q) {
2283
+ q.words[m] = 1;
2284
+ }
2285
+ }
2286
+
2287
+ for (var j = m - 1; j >= 0; j--) {
2288
+ var qj = (a.words[b.length + j] | 0) * 0x4000000 +
2289
+ (a.words[b.length + j - 1] | 0);
2290
+
2291
+ // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max
2292
+ // (0x7ffffff)
2293
+ qj = Math.min((qj / bhi) | 0, 0x3ffffff);
2294
+
2295
+ a._ishlnsubmul(b, qj, j);
2296
+ while (a.negative !== 0) {
2297
+ qj--;
2298
+ a.negative = 0;
2299
+ a._ishlnsubmul(b, 1, j);
2300
+ if (!a.isZero()) {
2301
+ a.negative ^= 1;
2302
+ }
2303
+ }
2304
+ if (q) {
2305
+ q.words[j] = qj;
2306
+ }
2307
+ }
2308
+ if (q) {
2309
+ q.strip();
2310
+ }
2311
+ a.strip();
2312
+
2313
+ // Denormalize
2314
+ if (mode !== 'div' && shift !== 0) {
2315
+ a.iushrn(shift);
2316
+ }
2317
+
2318
+ return {
2319
+ div: q || null,
2320
+ mod: a
2321
+ };
2322
+ };
2323
+
2324
+ // NOTE: 1) `mode` can be set to `mod` to request mod only,
2325
+ // to `div` to request div only, or be absent to
2326
+ // request both div & mod
2327
+ // 2) `positive` is true if unsigned mod is requested
2328
+ BN.prototype.divmod = function divmod (num, mode, positive) {
2329
+ assert(!num.isZero());
2330
+
2331
+ if (this.isZero()) {
2332
+ return {
2333
+ div: new BN(0),
2334
+ mod: new BN(0)
2335
+ };
2336
+ }
2337
+
2338
+ var div, mod, res;
2339
+ if (this.negative !== 0 && num.negative === 0) {
2340
+ res = this.neg().divmod(num, mode);
2341
+
2342
+ if (mode !== 'mod') {
2343
+ div = res.div.neg();
2344
+ }
2345
+
2346
+ if (mode !== 'div') {
2347
+ mod = res.mod.neg();
2348
+ if (positive && mod.negative !== 0) {
2349
+ mod.iadd(num);
2350
+ }
2351
+ }
2352
+
2353
+ return {
2354
+ div: div,
2355
+ mod: mod
2356
+ };
2357
+ }
2358
+
2359
+ if (this.negative === 0 && num.negative !== 0) {
2360
+ res = this.divmod(num.neg(), mode);
2361
+
2362
+ if (mode !== 'mod') {
2363
+ div = res.div.neg();
2364
+ }
2365
+
2366
+ return {
2367
+ div: div,
2368
+ mod: res.mod
2369
+ };
2370
+ }
2371
+
2372
+ if ((this.negative & num.negative) !== 0) {
2373
+ res = this.neg().divmod(num.neg(), mode);
2374
+
2375
+ if (mode !== 'div') {
2376
+ mod = res.mod.neg();
2377
+ if (positive && mod.negative !== 0) {
2378
+ mod.isub(num);
2379
+ }
2380
+ }
2381
+
2382
+ return {
2383
+ div: res.div,
2384
+ mod: mod
2385
+ };
2386
+ }
2387
+
2388
+ // Both numbers are positive at this point
2389
+
2390
+ // Strip both numbers to approximate shift value
2391
+ if (num.length > this.length || this.cmp(num) < 0) {
2392
+ return {
2393
+ div: new BN(0),
2394
+ mod: this
2395
+ };
2396
+ }
2397
+
2398
+ // Very short reduction
2399
+ if (num.length === 1) {
2400
+ if (mode === 'div') {
2401
+ return {
2402
+ div: this.divn(num.words[0]),
2403
+ mod: null
2404
+ };
2405
+ }
2406
+
2407
+ if (mode === 'mod') {
2408
+ return {
2409
+ div: null,
2410
+ mod: new BN(this.modn(num.words[0]))
2411
+ };
2412
+ }
2413
+
2414
+ return {
2415
+ div: this.divn(num.words[0]),
2416
+ mod: new BN(this.modn(num.words[0]))
2417
+ };
2418
+ }
2419
+
2420
+ return this._wordDiv(num, mode);
2421
+ };
2422
+
2423
+ // Find `this` / `num`
2424
+ BN.prototype.div = function div (num) {
2425
+ return this.divmod(num, 'div', false).div;
2426
+ };
2427
+
2428
+ // Find `this` % `num`
2429
+ BN.prototype.mod = function mod (num) {
2430
+ return this.divmod(num, 'mod', false).mod;
2431
+ };
2432
+
2433
+ BN.prototype.umod = function umod (num) {
2434
+ return this.divmod(num, 'mod', true).mod;
2435
+ };
2436
+
2437
+ // Find Round(`this` / `num`)
2438
+ BN.prototype.divRound = function divRound (num) {
2439
+ var dm = this.divmod(num);
2440
+
2441
+ // Fast case - exact division
2442
+ if (dm.mod.isZero()) return dm.div;
2443
+
2444
+ var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;
2445
+
2446
+ var half = num.ushrn(1);
2447
+ var r2 = num.andln(1);
2448
+ var cmp = mod.cmp(half);
2449
+
2450
+ // Round down
2451
+ if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div;
2452
+
2453
+ // Round up
2454
+ return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
2455
+ };
2456
+
2457
+ BN.prototype.modn = function modn (num) {
2458
+ assert(num <= 0x3ffffff);
2459
+ var p = (1 << 26) % num;
2460
+
2461
+ var acc = 0;
2462
+ for (var i = this.length - 1; i >= 0; i--) {
2463
+ acc = (p * acc + (this.words[i] | 0)) % num;
2464
+ }
2465
+
2466
+ return acc;
2467
+ };
2468
+
2469
+ // In-place division by number
2470
+ BN.prototype.idivn = function idivn (num) {
2471
+ assert(num <= 0x3ffffff);
2472
+
2473
+ var carry = 0;
2474
+ for (var i = this.length - 1; i >= 0; i--) {
2475
+ var w = (this.words[i] | 0) + carry * 0x4000000;
2476
+ this.words[i] = (w / num) | 0;
2477
+ carry = w % num;
2478
+ }
2479
+
2480
+ return this.strip();
2481
+ };
2482
+
2483
+ BN.prototype.divn = function divn (num) {
2484
+ return this.clone().idivn(num);
2485
+ };
2486
+
2487
+ BN.prototype.egcd = function egcd (p) {
2488
+ assert(p.negative === 0);
2489
+ assert(!p.isZero());
2490
+
2491
+ var x = this;
2492
+ var y = p.clone();
2493
+
2494
+ if (x.negative !== 0) {
2495
+ x = x.umod(p);
2496
+ } else {
2497
+ x = x.clone();
2498
+ }
2499
+
2500
+ // A * x + B * y = x
2501
+ var A = new BN(1);
2502
+ var B = new BN(0);
2503
+
2504
+ // C * x + D * y = y
2505
+ var C = new BN(0);
2506
+ var D = new BN(1);
2507
+
2508
+ var g = 0;
2509
+
2510
+ while (x.isEven() && y.isEven()) {
2511
+ x.iushrn(1);
2512
+ y.iushrn(1);
2513
+ ++g;
2514
+ }
2515
+
2516
+ var yp = y.clone();
2517
+ var xp = x.clone();
2518
+
2519
+ while (!x.isZero()) {
2520
+ for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
2521
+ if (i > 0) {
2522
+ x.iushrn(i);
2523
+ while (i-- > 0) {
2524
+ if (A.isOdd() || B.isOdd()) {
2525
+ A.iadd(yp);
2526
+ B.isub(xp);
2527
+ }
2528
+
2529
+ A.iushrn(1);
2530
+ B.iushrn(1);
2531
+ }
2532
+ }
2533
+
2534
+ for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
2535
+ if (j > 0) {
2536
+ y.iushrn(j);
2537
+ while (j-- > 0) {
2538
+ if (C.isOdd() || D.isOdd()) {
2539
+ C.iadd(yp);
2540
+ D.isub(xp);
2541
+ }
2542
+
2543
+ C.iushrn(1);
2544
+ D.iushrn(1);
2545
+ }
2546
+ }
2547
+
2548
+ if (x.cmp(y) >= 0) {
2549
+ x.isub(y);
2550
+ A.isub(C);
2551
+ B.isub(D);
2552
+ } else {
2553
+ y.isub(x);
2554
+ C.isub(A);
2555
+ D.isub(B);
2556
+ }
2557
+ }
2558
+
2559
+ return {
2560
+ a: C,
2561
+ b: D,
2562
+ gcd: y.iushln(g)
2563
+ };
2564
+ };
2565
+
2566
+ // This is reduced incarnation of the binary EEA
2567
+ // above, designated to invert members of the
2568
+ // _prime_ fields F(p) at a maximal speed
2569
+ BN.prototype._invmp = function _invmp (p) {
2570
+ assert(p.negative === 0);
2571
+ assert(!p.isZero());
2572
+
2573
+ var a = this;
2574
+ var b = p.clone();
2575
+
2576
+ if (a.negative !== 0) {
2577
+ a = a.umod(p);
2578
+ } else {
2579
+ a = a.clone();
2580
+ }
2581
+
2582
+ var x1 = new BN(1);
2583
+ var x2 = new BN(0);
2584
+
2585
+ var delta = b.clone();
2586
+
2587
+ while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {
2588
+ for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
2589
+ if (i > 0) {
2590
+ a.iushrn(i);
2591
+ while (i-- > 0) {
2592
+ if (x1.isOdd()) {
2593
+ x1.iadd(delta);
2594
+ }
2595
+
2596
+ x1.iushrn(1);
2597
+ }
2598
+ }
2599
+
2600
+ for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
2601
+ if (j > 0) {
2602
+ b.iushrn(j);
2603
+ while (j-- > 0) {
2604
+ if (x2.isOdd()) {
2605
+ x2.iadd(delta);
2606
+ }
2607
+
2608
+ x2.iushrn(1);
2609
+ }
2610
+ }
2611
+
2612
+ if (a.cmp(b) >= 0) {
2613
+ a.isub(b);
2614
+ x1.isub(x2);
2615
+ } else {
2616
+ b.isub(a);
2617
+ x2.isub(x1);
2618
+ }
2619
+ }
2620
+
2621
+ var res;
2622
+ if (a.cmpn(1) === 0) {
2623
+ res = x1;
2624
+ } else {
2625
+ res = x2;
2626
+ }
2627
+
2628
+ if (res.cmpn(0) < 0) {
2629
+ res.iadd(p);
2630
+ }
2631
+
2632
+ return res;
2633
+ };
2634
+
2635
+ BN.prototype.gcd = function gcd (num) {
2636
+ if (this.isZero()) return num.abs();
2637
+ if (num.isZero()) return this.abs();
2638
+
2639
+ var a = this.clone();
2640
+ var b = num.clone();
2641
+ a.negative = 0;
2642
+ b.negative = 0;
2643
+
2644
+ // Remove common factor of two
2645
+ for (var shift = 0; a.isEven() && b.isEven(); shift++) {
2646
+ a.iushrn(1);
2647
+ b.iushrn(1);
2648
+ }
2649
+
2650
+ do {
2651
+ while (a.isEven()) {
2652
+ a.iushrn(1);
2653
+ }
2654
+ while (b.isEven()) {
2655
+ b.iushrn(1);
2656
+ }
2657
+
2658
+ var r = a.cmp(b);
2659
+ if (r < 0) {
2660
+ // Swap `a` and `b` to make `a` always bigger than `b`
2661
+ var t = a;
2662
+ a = b;
2663
+ b = t;
2664
+ } else if (r === 0 || b.cmpn(1) === 0) {
2665
+ break;
2666
+ }
2667
+
2668
+ a.isub(b);
2669
+ } while (true);
2670
+
2671
+ return b.iushln(shift);
2672
+ };
2673
+
2674
+ // Invert number in the field F(num)
2675
+ BN.prototype.invm = function invm (num) {
2676
+ return this.egcd(num).a.umod(num);
2677
+ };
2678
+
2679
+ BN.prototype.isEven = function isEven () {
2680
+ return (this.words[0] & 1) === 0;
2681
+ };
2682
+
2683
+ BN.prototype.isOdd = function isOdd () {
2684
+ return (this.words[0] & 1) === 1;
2685
+ };
2686
+
2687
+ // And first word and num
2688
+ BN.prototype.andln = function andln (num) {
2689
+ return this.words[0] & num;
2690
+ };
2691
+
2692
+ // Increment at the bit position in-line
2693
+ BN.prototype.bincn = function bincn (bit) {
2694
+ assert(typeof bit === 'number');
2695
+ var r = bit % 26;
2696
+ var s = (bit - r) / 26;
2697
+ var q = 1 << r;
2698
+
2699
+ // Fast case: bit is much higher than all existing words
2700
+ if (this.length <= s) {
2701
+ this._expand(s + 1);
2702
+ this.words[s] |= q;
2703
+ return this;
2704
+ }
2705
+
2706
+ // Add bit and propagate, if needed
2707
+ var carry = q;
2708
+ for (var i = s; carry !== 0 && i < this.length; i++) {
2709
+ var w = this.words[i] | 0;
2710
+ w += carry;
2711
+ carry = w >>> 26;
2712
+ w &= 0x3ffffff;
2713
+ this.words[i] = w;
2714
+ }
2715
+ if (carry !== 0) {
2716
+ this.words[i] = carry;
2717
+ this.length++;
2718
+ }
2719
+ return this;
2720
+ };
2721
+
2722
+ BN.prototype.isZero = function isZero () {
2723
+ return this.length === 1 && this.words[0] === 0;
2724
+ };
2725
+
2726
+ BN.prototype.cmpn = function cmpn (num) {
2727
+ var negative = num < 0;
2728
+
2729
+ if (this.negative !== 0 && !negative) return -1;
2730
+ if (this.negative === 0 && negative) return 1;
2731
+
2732
+ this.strip();
2733
+
2734
+ var res;
2735
+ if (this.length > 1) {
2736
+ res = 1;
2737
+ } else {
2738
+ if (negative) {
2739
+ num = -num;
2740
+ }
2741
+
2742
+ assert(num <= 0x3ffffff, 'Number is too big');
2743
+
2744
+ var w = this.words[0] | 0;
2745
+ res = w === num ? 0 : w < num ? -1 : 1;
2746
+ }
2747
+ if (this.negative !== 0) return -res | 0;
2748
+ return res;
2749
+ };
2750
+
2751
+ // Compare two numbers and return:
2752
+ // 1 - if `this` > `num`
2753
+ // 0 - if `this` == `num`
2754
+ // -1 - if `this` < `num`
2755
+ BN.prototype.cmp = function cmp (num) {
2756
+ if (this.negative !== 0 && num.negative === 0) return -1;
2757
+ if (this.negative === 0 && num.negative !== 0) return 1;
2758
+
2759
+ var res = this.ucmp(num);
2760
+ if (this.negative !== 0) return -res | 0;
2761
+ return res;
2762
+ };
2763
+
2764
+ // Unsigned comparison
2765
+ BN.prototype.ucmp = function ucmp (num) {
2766
+ // At this point both numbers have the same sign
2767
+ if (this.length > num.length) return 1;
2768
+ if (this.length < num.length) return -1;
2769
+
2770
+ var res = 0;
2771
+ for (var i = this.length - 1; i >= 0; i--) {
2772
+ var a = this.words[i] | 0;
2773
+ var b = num.words[i] | 0;
2774
+
2775
+ if (a === b) continue;
2776
+ if (a < b) {
2777
+ res = -1;
2778
+ } else if (a > b) {
2779
+ res = 1;
2780
+ }
2781
+ break;
2782
+ }
2783
+ return res;
2784
+ };
2785
+
2786
+ BN.prototype.gtn = function gtn (num) {
2787
+ return this.cmpn(num) === 1;
2788
+ };
2789
+
2790
+ BN.prototype.gt = function gt (num) {
2791
+ return this.cmp(num) === 1;
2792
+ };
2793
+
2794
+ BN.prototype.gten = function gten (num) {
2795
+ return this.cmpn(num) >= 0;
2796
+ };
2797
+
2798
+ BN.prototype.gte = function gte (num) {
2799
+ return this.cmp(num) >= 0;
2800
+ };
2801
+
2802
+ BN.prototype.ltn = function ltn (num) {
2803
+ return this.cmpn(num) === -1;
2804
+ };
2805
+
2806
+ BN.prototype.lt = function lt (num) {
2807
+ return this.cmp(num) === -1;
2808
+ };
2809
+
2810
+ BN.prototype.lten = function lten (num) {
2811
+ return this.cmpn(num) <= 0;
2812
+ };
2813
+
2814
+ BN.prototype.lte = function lte (num) {
2815
+ return this.cmp(num) <= 0;
2816
+ };
2817
+
2818
+ BN.prototype.eqn = function eqn (num) {
2819
+ return this.cmpn(num) === 0;
2820
+ };
2821
+
2822
+ BN.prototype.eq = function eq (num) {
2823
+ return this.cmp(num) === 0;
2824
+ };
2825
+
2826
+ //
2827
+ // A reduce context, could be using montgomery or something better, depending
2828
+ // on the `m` itself.
2829
+ //
2830
+ BN.red = function red (num) {
2831
+ return new Red(num);
2832
+ };
2833
+
2834
+ BN.prototype.toRed = function toRed (ctx) {
2835
+ assert(!this.red, 'Already a number in reduction context');
2836
+ assert(this.negative === 0, 'red works only with positives');
2837
+ return ctx.convertTo(this)._forceRed(ctx);
2838
+ };
2839
+
2840
+ BN.prototype.fromRed = function fromRed () {
2841
+ assert(this.red, 'fromRed works only with numbers in reduction context');
2842
+ return this.red.convertFrom(this);
2843
+ };
2844
+
2845
+ BN.prototype._forceRed = function _forceRed (ctx) {
2846
+ this.red = ctx;
2847
+ return this;
2848
+ };
2849
+
2850
+ BN.prototype.forceRed = function forceRed (ctx) {
2851
+ assert(!this.red, 'Already a number in reduction context');
2852
+ return this._forceRed(ctx);
2853
+ };
2854
+
2855
+ BN.prototype.redAdd = function redAdd (num) {
2856
+ assert(this.red, 'redAdd works only with red numbers');
2857
+ return this.red.add(this, num);
2858
+ };
2859
+
2860
+ BN.prototype.redIAdd = function redIAdd (num) {
2861
+ assert(this.red, 'redIAdd works only with red numbers');
2862
+ return this.red.iadd(this, num);
2863
+ };
2864
+
2865
+ BN.prototype.redSub = function redSub (num) {
2866
+ assert(this.red, 'redSub works only with red numbers');
2867
+ return this.red.sub(this, num);
2868
+ };
2869
+
2870
+ BN.prototype.redISub = function redISub (num) {
2871
+ assert(this.red, 'redISub works only with red numbers');
2872
+ return this.red.isub(this, num);
2873
+ };
2874
+
2875
+ BN.prototype.redShl = function redShl (num) {
2876
+ assert(this.red, 'redShl works only with red numbers');
2877
+ return this.red.shl(this, num);
2878
+ };
2879
+
2880
+ BN.prototype.redMul = function redMul (num) {
2881
+ assert(this.red, 'redMul works only with red numbers');
2882
+ this.red._verify2(this, num);
2883
+ return this.red.mul(this, num);
2884
+ };
2885
+
2886
+ BN.prototype.redIMul = function redIMul (num) {
2887
+ assert(this.red, 'redMul works only with red numbers');
2888
+ this.red._verify2(this, num);
2889
+ return this.red.imul(this, num);
2890
+ };
2891
+
2892
+ BN.prototype.redSqr = function redSqr () {
2893
+ assert(this.red, 'redSqr works only with red numbers');
2894
+ this.red._verify1(this);
2895
+ return this.red.sqr(this);
2896
+ };
2897
+
2898
+ BN.prototype.redISqr = function redISqr () {
2899
+ assert(this.red, 'redISqr works only with red numbers');
2900
+ this.red._verify1(this);
2901
+ return this.red.isqr(this);
2902
+ };
2903
+
2904
+ // Square root over p
2905
+ BN.prototype.redSqrt = function redSqrt () {
2906
+ assert(this.red, 'redSqrt works only with red numbers');
2907
+ this.red._verify1(this);
2908
+ return this.red.sqrt(this);
2909
+ };
2910
+
2911
+ BN.prototype.redInvm = function redInvm () {
2912
+ assert(this.red, 'redInvm works only with red numbers');
2913
+ this.red._verify1(this);
2914
+ return this.red.invm(this);
2915
+ };
2916
+
2917
+ // Return negative clone of `this` % `red modulo`
2918
+ BN.prototype.redNeg = function redNeg () {
2919
+ assert(this.red, 'redNeg works only with red numbers');
2920
+ this.red._verify1(this);
2921
+ return this.red.neg(this);
2922
+ };
2923
+
2924
+ BN.prototype.redPow = function redPow (num) {
2925
+ assert(this.red && !num.red, 'redPow(normalNum)');
2926
+ this.red._verify1(this);
2927
+ return this.red.pow(this, num);
2928
+ };
2929
+
2930
+ // Prime numbers with efficient reduction
2931
+ var primes = {
2932
+ k256: null,
2933
+ p224: null,
2934
+ p192: null,
2935
+ p25519: null
2936
+ };
2937
+
2938
+ // Pseudo-Mersenne prime
2939
+ function MPrime (name, p) {
2940
+ // P = 2 ^ N - K
2941
+ this.name = name;
2942
+ this.p = new BN(p, 16);
2943
+ this.n = this.p.bitLength();
2944
+ this.k = new BN(1).iushln(this.n).isub(this.p);
2945
+
2946
+ this.tmp = this._tmp();
2947
+ }
2948
+
2949
+ MPrime.prototype._tmp = function _tmp () {
2950
+ var tmp = new BN(null);
2951
+ tmp.words = new Array(Math.ceil(this.n / 13));
2952
+ return tmp;
2953
+ };
2954
+
2955
+ MPrime.prototype.ireduce = function ireduce (num) {
2956
+ // Assumes that `num` is less than `P^2`
2957
+ // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)
2958
+ var r = num;
2959
+ var rlen;
2960
+
2961
+ do {
2962
+ this.split(r, this.tmp);
2963
+ r = this.imulK(r);
2964
+ r = r.iadd(this.tmp);
2965
+ rlen = r.bitLength();
2966
+ } while (rlen > this.n);
2967
+
2968
+ var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
2969
+ if (cmp === 0) {
2970
+ r.words[0] = 0;
2971
+ r.length = 1;
2972
+ } else if (cmp > 0) {
2973
+ r.isub(this.p);
2974
+ } else {
2975
+ if (r.strip !== undefined) {
2976
+ // r is BN v4 instance
2977
+ r.strip();
2978
+ } else {
2979
+ // r is BN v5 instance
2980
+ r._strip();
2981
+ }
2982
+ }
2983
+
2984
+ return r;
2985
+ };
2986
+
2987
+ MPrime.prototype.split = function split (input, out) {
2988
+ input.iushrn(this.n, 0, out);
2989
+ };
2990
+
2991
+ MPrime.prototype.imulK = function imulK (num) {
2992
+ return num.imul(this.k);
2993
+ };
2994
+
2995
+ function K256 () {
2996
+ MPrime.call(
2997
+ this,
2998
+ 'k256',
2999
+ 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');
3000
+ }
3001
+ inherits(K256, MPrime);
3002
+
3003
+ K256.prototype.split = function split (input, output) {
3004
+ // 256 = 9 * 26 + 22
3005
+ var mask = 0x3fffff;
3006
+
3007
+ var outLen = Math.min(input.length, 9);
3008
+ for (var i = 0; i < outLen; i++) {
3009
+ output.words[i] = input.words[i];
3010
+ }
3011
+ output.length = outLen;
3012
+
3013
+ if (input.length <= 9) {
3014
+ input.words[0] = 0;
3015
+ input.length = 1;
3016
+ return;
3017
+ }
3018
+
3019
+ // Shift by 9 limbs
3020
+ var prev = input.words[9];
3021
+ output.words[output.length++] = prev & mask;
3022
+
3023
+ for (i = 10; i < input.length; i++) {
3024
+ var next = input.words[i] | 0;
3025
+ input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);
3026
+ prev = next;
3027
+ }
3028
+ prev >>>= 22;
3029
+ input.words[i - 10] = prev;
3030
+ if (prev === 0 && input.length > 10) {
3031
+ input.length -= 10;
3032
+ } else {
3033
+ input.length -= 9;
3034
+ }
3035
+ };
3036
+
3037
+ K256.prototype.imulK = function imulK (num) {
3038
+ // K = 0x1000003d1 = [ 0x40, 0x3d1 ]
3039
+ num.words[num.length] = 0;
3040
+ num.words[num.length + 1] = 0;
3041
+ num.length += 2;
3042
+
3043
+ // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390
3044
+ var lo = 0;
3045
+ for (var i = 0; i < num.length; i++) {
3046
+ var w = num.words[i] | 0;
3047
+ lo += w * 0x3d1;
3048
+ num.words[i] = lo & 0x3ffffff;
3049
+ lo = w * 0x40 + ((lo / 0x4000000) | 0);
3050
+ }
3051
+
3052
+ // Fast length reduction
3053
+ if (num.words[num.length - 1] === 0) {
3054
+ num.length--;
3055
+ if (num.words[num.length - 1] === 0) {
3056
+ num.length--;
3057
+ }
3058
+ }
3059
+ return num;
3060
+ };
3061
+
3062
+ function P224 () {
3063
+ MPrime.call(
3064
+ this,
3065
+ 'p224',
3066
+ 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');
3067
+ }
3068
+ inherits(P224, MPrime);
3069
+
3070
+ function P192 () {
3071
+ MPrime.call(
3072
+ this,
3073
+ 'p192',
3074
+ 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');
3075
+ }
3076
+ inherits(P192, MPrime);
3077
+
3078
+ function P25519 () {
3079
+ // 2 ^ 255 - 19
3080
+ MPrime.call(
3081
+ this,
3082
+ '25519',
3083
+ '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');
3084
+ }
3085
+ inherits(P25519, MPrime);
3086
+
3087
+ P25519.prototype.imulK = function imulK (num) {
3088
+ // K = 0x13
3089
+ var carry = 0;
3090
+ for (var i = 0; i < num.length; i++) {
3091
+ var hi = (num.words[i] | 0) * 0x13 + carry;
3092
+ var lo = hi & 0x3ffffff;
3093
+ hi >>>= 26;
3094
+
3095
+ num.words[i] = lo;
3096
+ carry = hi;
3097
+ }
3098
+ if (carry !== 0) {
3099
+ num.words[num.length++] = carry;
3100
+ }
3101
+ return num;
3102
+ };
3103
+
3104
+ // Exported mostly for testing purposes, use plain name instead
3105
+ BN._prime = function prime (name) {
3106
+ // Cached version of prime
3107
+ if (primes[name]) return primes[name];
3108
+
3109
+ var prime;
3110
+ if (name === 'k256') {
3111
+ prime = new K256();
3112
+ } else if (name === 'p224') {
3113
+ prime = new P224();
3114
+ } else if (name === 'p192') {
3115
+ prime = new P192();
3116
+ } else if (name === 'p25519') {
3117
+ prime = new P25519();
3118
+ } else {
3119
+ throw new Error('Unknown prime ' + name);
3120
+ }
3121
+ primes[name] = prime;
3122
+
3123
+ return prime;
3124
+ };
3125
+
3126
+ //
3127
+ // Base reduction engine
3128
+ //
3129
+ function Red (m) {
3130
+ if (typeof m === 'string') {
3131
+ var prime = BN._prime(m);
3132
+ this.m = prime.p;
3133
+ this.prime = prime;
3134
+ } else {
3135
+ assert(m.gtn(1), 'modulus must be greater than 1');
3136
+ this.m = m;
3137
+ this.prime = null;
3138
+ }
3139
+ }
3140
+
3141
+ Red.prototype._verify1 = function _verify1 (a) {
3142
+ assert(a.negative === 0, 'red works only with positives');
3143
+ assert(a.red, 'red works only with red numbers');
3144
+ };
3145
+
3146
+ Red.prototype._verify2 = function _verify2 (a, b) {
3147
+ assert((a.negative | b.negative) === 0, 'red works only with positives');
3148
+ assert(a.red && a.red === b.red,
3149
+ 'red works only with red numbers');
3150
+ };
3151
+
3152
+ Red.prototype.imod = function imod (a) {
3153
+ if (this.prime) return this.prime.ireduce(a)._forceRed(this);
3154
+ return a.umod(this.m)._forceRed(this);
3155
+ };
3156
+
3157
+ Red.prototype.neg = function neg (a) {
3158
+ if (a.isZero()) {
3159
+ return a.clone();
3160
+ }
3161
+
3162
+ return this.m.sub(a)._forceRed(this);
3163
+ };
3164
+
3165
+ Red.prototype.add = function add (a, b) {
3166
+ this._verify2(a, b);
3167
+
3168
+ var res = a.add(b);
3169
+ if (res.cmp(this.m) >= 0) {
3170
+ res.isub(this.m);
3171
+ }
3172
+ return res._forceRed(this);
3173
+ };
3174
+
3175
+ Red.prototype.iadd = function iadd (a, b) {
3176
+ this._verify2(a, b);
3177
+
3178
+ var res = a.iadd(b);
3179
+ if (res.cmp(this.m) >= 0) {
3180
+ res.isub(this.m);
3181
+ }
3182
+ return res;
3183
+ };
3184
+
3185
+ Red.prototype.sub = function sub (a, b) {
3186
+ this._verify2(a, b);
3187
+
3188
+ var res = a.sub(b);
3189
+ if (res.cmpn(0) < 0) {
3190
+ res.iadd(this.m);
3191
+ }
3192
+ return res._forceRed(this);
3193
+ };
3194
+
3195
+ Red.prototype.isub = function isub (a, b) {
3196
+ this._verify2(a, b);
3197
+
3198
+ var res = a.isub(b);
3199
+ if (res.cmpn(0) < 0) {
3200
+ res.iadd(this.m);
3201
+ }
3202
+ return res;
3203
+ };
3204
+
3205
+ Red.prototype.shl = function shl (a, num) {
3206
+ this._verify1(a);
3207
+ return this.imod(a.ushln(num));
3208
+ };
3209
+
3210
+ Red.prototype.imul = function imul (a, b) {
3211
+ this._verify2(a, b);
3212
+ return this.imod(a.imul(b));
3213
+ };
3214
+
3215
+ Red.prototype.mul = function mul (a, b) {
3216
+ this._verify2(a, b);
3217
+ return this.imod(a.mul(b));
3218
+ };
3219
+
3220
+ Red.prototype.isqr = function isqr (a) {
3221
+ return this.imul(a, a.clone());
3222
+ };
3223
+
3224
+ Red.prototype.sqr = function sqr (a) {
3225
+ return this.mul(a, a);
3226
+ };
3227
+
3228
+ Red.prototype.sqrt = function sqrt (a) {
3229
+ if (a.isZero()) return a.clone();
3230
+
3231
+ var mod3 = this.m.andln(3);
3232
+ assert(mod3 % 2 === 1);
3233
+
3234
+ // Fast case
3235
+ if (mod3 === 3) {
3236
+ var pow = this.m.add(new BN(1)).iushrn(2);
3237
+ return this.pow(a, pow);
3238
+ }
3239
+
3240
+ // Tonelli-Shanks algorithm (Totally unoptimized and slow)
3241
+ //
3242
+ // Find Q and S, that Q * 2 ^ S = (P - 1)
3243
+ var q = this.m.subn(1);
3244
+ var s = 0;
3245
+ while (!q.isZero() && q.andln(1) === 0) {
3246
+ s++;
3247
+ q.iushrn(1);
3248
+ }
3249
+ assert(!q.isZero());
3250
+
3251
+ var one = new BN(1).toRed(this);
3252
+ var nOne = one.redNeg();
3253
+
3254
+ // Find quadratic non-residue
3255
+ // NOTE: Max is such because of generalized Riemann hypothesis.
3256
+ var lpow = this.m.subn(1).iushrn(1);
3257
+ var z = this.m.bitLength();
3258
+ z = new BN(2 * z * z).toRed(this);
3259
+
3260
+ while (this.pow(z, lpow).cmp(nOne) !== 0) {
3261
+ z.redIAdd(nOne);
3262
+ }
3263
+
3264
+ var c = this.pow(z, q);
3265
+ var r = this.pow(a, q.addn(1).iushrn(1));
3266
+ var t = this.pow(a, q);
3267
+ var m = s;
3268
+ while (t.cmp(one) !== 0) {
3269
+ var tmp = t;
3270
+ for (var i = 0; tmp.cmp(one) !== 0; i++) {
3271
+ tmp = tmp.redSqr();
3272
+ }
3273
+ assert(i < m);
3274
+ var b = this.pow(c, new BN(1).iushln(m - i - 1));
3275
+
3276
+ r = r.redMul(b);
3277
+ c = b.redSqr();
3278
+ t = t.redMul(c);
3279
+ m = i;
3280
+ }
3281
+
3282
+ return r;
3283
+ };
3284
+
3285
+ Red.prototype.invm = function invm (a) {
3286
+ var inv = a._invmp(this.m);
3287
+ if (inv.negative !== 0) {
3288
+ inv.negative = 0;
3289
+ return this.imod(inv).redNeg();
3290
+ } else {
3291
+ return this.imod(inv);
3292
+ }
3293
+ };
3294
+
3295
+ Red.prototype.pow = function pow (a, num) {
3296
+ if (num.isZero()) return new BN(1).toRed(this);
3297
+ if (num.cmpn(1) === 0) return a.clone();
3298
+
3299
+ var windowSize = 4;
3300
+ var wnd = new Array(1 << windowSize);
3301
+ wnd[0] = new BN(1).toRed(this);
3302
+ wnd[1] = a;
3303
+ for (var i = 2; i < wnd.length; i++) {
3304
+ wnd[i] = this.mul(wnd[i - 1], a);
3305
+ }
3306
+
3307
+ var res = wnd[0];
3308
+ var current = 0;
3309
+ var currentLen = 0;
3310
+ var start = num.bitLength() % 26;
3311
+ if (start === 0) {
3312
+ start = 26;
3313
+ }
3314
+
3315
+ for (i = num.length - 1; i >= 0; i--) {
3316
+ var word = num.words[i];
3317
+ for (var j = start - 1; j >= 0; j--) {
3318
+ var bit = (word >> j) & 1;
3319
+ if (res !== wnd[0]) {
3320
+ res = this.sqr(res);
3321
+ }
3322
+
3323
+ if (bit === 0 && current === 0) {
3324
+ currentLen = 0;
3325
+ continue;
3326
+ }
3327
+
3328
+ current <<= 1;
3329
+ current |= bit;
3330
+ currentLen++;
3331
+ if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;
3332
+
3333
+ res = this.mul(res, wnd[current]);
3334
+ currentLen = 0;
3335
+ current = 0;
3336
+ }
3337
+ start = 26;
3338
+ }
3339
+
3340
+ return res;
3341
+ };
3342
+
3343
+ Red.prototype.convertTo = function convertTo (num) {
3344
+ var r = num.umod(this.m);
3345
+
3346
+ return r === num ? r.clone() : r;
3347
+ };
3348
+
3349
+ Red.prototype.convertFrom = function convertFrom (num) {
3350
+ var res = num.clone();
3351
+ res.red = null;
3352
+ return res;
3353
+ };
3354
+
3355
+ //
3356
+ // Montgomery method engine
3357
+ //
3358
+
3359
+ BN.mont = function mont (num) {
3360
+ return new Mont(num);
3361
+ };
3362
+
3363
+ function Mont (m) {
3364
+ Red.call(this, m);
3365
+
3366
+ this.shift = this.m.bitLength();
3367
+ if (this.shift % 26 !== 0) {
3368
+ this.shift += 26 - (this.shift % 26);
3369
+ }
3370
+
3371
+ this.r = new BN(1).iushln(this.shift);
3372
+ this.r2 = this.imod(this.r.sqr());
3373
+ this.rinv = this.r._invmp(this.m);
3374
+
3375
+ this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);
3376
+ this.minv = this.minv.umod(this.r);
3377
+ this.minv = this.r.sub(this.minv);
3378
+ }
3379
+ inherits(Mont, Red);
3380
+
3381
+ Mont.prototype.convertTo = function convertTo (num) {
3382
+ return this.imod(num.ushln(this.shift));
3383
+ };
3384
+
3385
+ Mont.prototype.convertFrom = function convertFrom (num) {
3386
+ var r = this.imod(num.mul(this.rinv));
3387
+ r.red = null;
3388
+ return r;
3389
+ };
3390
+
3391
+ Mont.prototype.imul = function imul (a, b) {
3392
+ if (a.isZero() || b.isZero()) {
3393
+ a.words[0] = 0;
3394
+ a.length = 1;
3395
+ return a;
3396
+ }
3397
+
3398
+ var t = a.imul(b);
3399
+ var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
3400
+ var u = t.isub(c).iushrn(this.shift);
3401
+ var res = u;
3402
+
3403
+ if (u.cmp(this.m) >= 0) {
3404
+ res = u.isub(this.m);
3405
+ } else if (u.cmpn(0) < 0) {
3406
+ res = u.iadd(this.m);
3407
+ }
3408
+
3409
+ return res._forceRed(this);
3410
+ };
3411
+
3412
+ Mont.prototype.mul = function mul (a, b) {
3413
+ if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
3414
+
3415
+ var t = a.mul(b);
3416
+ var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
3417
+ var u = t.isub(c).iushrn(this.shift);
3418
+ var res = u;
3419
+ if (u.cmp(this.m) >= 0) {
3420
+ res = u.isub(this.m);
3421
+ } else if (u.cmpn(0) < 0) {
3422
+ res = u.iadd(this.m);
3423
+ }
3424
+
3425
+ return res._forceRed(this);
3426
+ };
3427
+
3428
+ Mont.prototype.invm = function invm (a) {
3429
+ // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R
3430
+ var res = this.imod(a._invmp(this.m).mul(this.r2));
3431
+ return res._forceRed(this);
3432
+ };
3433
+ })(typeof module === 'undefined' || module, this);