1 line
159 KiB
Plaintext
1 line
159 KiB
Plaintext
{"version":3,"file":"cryptico.iife.js","sources":["../src/aes.ts","../src/random.ts","../src/jsbn.ts","../src/hash/native.ts","../src/hash/index.ts","../src/hash/node.ts","../src/rsa.ts","../src/api.ts"],"sourcesContent":["/*\n * jsaes version 0.1 - Copyright 2006 B. Poettering\n *\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License as\n * published by the Free Software Foundation; either version 2 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA\n * 02111-1307 USA\n */\n\n// later modifications by wwwtyro@github\n\nimport { ByteArray } from './type'\n\nexport type AESKey = ByteArray\n\nexport const aes = <const>{\n // eslint-disable-next-line prettier/prettier\n Sbox: [\n 99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118,\n 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114,\n 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49,\n 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9,\n 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209,\n 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170,\n 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143,\n 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236,\n 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34,\n 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6,\n 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213,\n 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166,\n 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3,\n 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217,\n 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230,\n 66, 104, 65, 153, 45, 15, 176, 84, 187, 22,\n ] as ByteArray,\n\n ShiftRowTab: [\n 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, 1, 6, 11,\n ] as ByteArray,\n\n Sbox_Inv: new Array<number>(256),\n ShiftRowTab_Inv: new Array<number>(16),\n xtime: new Array<number>(256),\n\n Init() {\n for (let i = 0; i < 256; i++) this.Sbox_Inv[this.Sbox[i]] = i\n\n for (let i = 0; i < 16; i++) this.ShiftRowTab_Inv[this.ShiftRowTab[i]] = i\n\n for (let i = 0; i < 128; i++) {\n this.xtime[i] = i << 1\n this.xtime[128 + i] = (i << 1) ^ 0x1b\n }\n },\n\n Done() {\n this.Sbox_Inv.length = 0\n this.Sbox_Inv.length = 256\n this.ShiftRowTab_Inv.length = 0\n this.ShiftRowTab_Inv.length = 16\n this.xtime.length = 0\n this.xtime.length = 256\n },\n\n ExpandKey(key: AESKey) {\n const kl = key.length\n let ks,\n Rcon = 1\n switch (kl) {\n case 16:\n ks = 16 * (10 + 1)\n break\n case 24:\n ks = 16 * (12 + 1)\n break\n case 32:\n ks = 16 * (14 + 1)\n break\n default:\n throw 'my.ExpandKey: Only key lengths of 16, 24 or 32 bytes allowed!'\n }\n for (let i = kl; i < ks; i += 4) {\n let temp = key.slice(i - 4, i)\n if (i % kl === 0) {\n temp = [\n aes.Sbox[temp[1]] ^ Rcon,\n aes.Sbox[temp[2]],\n aes.Sbox[temp[3]],\n aes.Sbox[temp[0]],\n ]\n if ((Rcon <<= 1) >= 256) Rcon ^= 0x11b\n } else if (kl > 24 && i % kl === 16)\n temp = [\n aes.Sbox[temp[0]],\n aes.Sbox[temp[1]],\n aes.Sbox[temp[2]],\n aes.Sbox[temp[3]],\n ]\n for (let j = 0; j < 4; j++) key[i + j] = key[i + j - kl] ^ temp[j]\n }\n },\n\n Encrypt(block: ByteArray, key: AESKey) {\n const l = key.length\n aes.AddRoundKey(block, key.slice(0, 16))\n let i\n for (i = 16; i < l - 16; i += 16) {\n aes.SubBytes(block, aes.Sbox)\n aes.ShiftRows(block, aes.ShiftRowTab)\n aes.MixColumns(block)\n aes.AddRoundKey(block, key.slice(i, i + 16))\n }\n aes.SubBytes(block, aes.Sbox)\n aes.ShiftRows(block, aes.ShiftRowTab)\n aes.AddRoundKey(block, key.slice(i, l))\n },\n\n Decrypt(block: ByteArray, key: AESKey) {\n const l = key.length\n aes.AddRoundKey(block, key.slice(l - 16, l))\n aes.ShiftRows(block, aes.ShiftRowTab_Inv)\n aes.SubBytes(block, aes.Sbox_Inv)\n for (let i = l - 32; i >= 16; i -= 16) {\n aes.AddRoundKey(block, key.slice(i, i + 16))\n aes.MixColumns_Inv(block)\n aes.ShiftRows(block, aes.ShiftRowTab_Inv)\n aes.SubBytes(block, aes.Sbox_Inv)\n }\n aes.AddRoundKey(block, key.slice(0, 16))\n },\n\n SubBytes(state: ByteArray, sbox: ByteArray) {\n for (let i = 0; i < 16; i++) state[i] = sbox[state[i]]\n },\n\n AddRoundKey(state: ByteArray, rkey: ByteArray) {\n for (let i = 0; i < 16; i++) state[i] ^= rkey[i]\n },\n\n ShiftRows(state: ByteArray, shifttab: number[]) {\n const h = new Array<number>().concat(state)\n for (let i = 0; i < 16; i++) state[i] = h[shifttab[i]]\n },\n\n MixColumns(state: ByteArray) {\n for (let i = 0; i < 16; i += 4) {\n const s0 = state[i + 0],\n s1 = state[i + 1]\n const s2 = state[i + 2],\n s3 = state[i + 3]\n const h = s0 ^ s1 ^ s2 ^ s3\n state[i + 0] ^= h ^ aes.xtime[s0 ^ s1]\n state[i + 1] ^= h ^ aes.xtime[s1 ^ s2]\n state[i + 2] ^= h ^ aes.xtime[s2 ^ s3]\n state[i + 3] ^= h ^ aes.xtime[s3 ^ s0]\n }\n },\n\n MixColumns_Inv(state: ByteArray) {\n for (let i = 0; i < 16; i += 4) {\n const s0 = state[i + 0],\n s1 = state[i + 1]\n const s2 = state[i + 2],\n s3 = state[i + 3]\n const h = s0 ^ s1 ^ s2 ^ s3\n const xh = aes.xtime[h]\n const h1 = aes.xtime[aes.xtime[xh ^ s0 ^ s2]] ^ h\n const h2 = aes.xtime[aes.xtime[xh ^ s1 ^ s3]] ^ h\n state[i + 0] ^= h1 ^ aes.xtime[s0 ^ s1]\n state[i + 1] ^= h2 ^ aes.xtime[s1 ^ s2]\n state[i + 2] ^= h1 ^ aes.xtime[s2 ^ s3]\n state[i + 3] ^= h2 ^ aes.xtime[s3 ^ s0]\n }\n },\n}\n","// seedrandom.js version 2.0.\n// Author: David Bau 4/2/2011\n//\n// Defines a method math.seedrandom() that, when called, substitutes\n// an explicitly seeded RC4-based algorithm for math.random(). Also\n// supports automatic seeding from local or network sources of entropy.\n//\n// Usage:\n//\n// <script src=http://davidbau.com/encode/seedrandom-min.js></script>\n//\n// Math.seedrandom('yipee'); Sets math.random to a function that is\n// initialized using the given explicit seed.\n//\n// Math.seedrandom(); Sets math.random to a function that is\n// seeded using the current time, dom state,\n// and other accumulated local entropy.\n// The generated seed string is returned.\n//\n// Math.seedrandom('yowza', true);\n// Seeds using the given explicit seed mixed\n// together with accumulated entropy.\n//\n// <script src=\"http://bit.ly/srandom-512\"></script>\n// Seeds using physical random bits downloaded\n// from random.org.\n//\n// <script src=\"https://jsonlib.appspot.com/urandom?callback=Math.seedrandom\">\n// </script> Seeds using urandom bits from call.jsonlib.com,\n// which is faster than random.org.\n//\n// Examples:\n//\n// math.seedrandom(\"hello\"); // Use \"hello\" as the seed.\n// document.write(math.random()); // Always 0.5463663768140734\n// document.write(math.random()); // Always 0.43973793770592234\n// let rng1 = math.random; // Remember the current prng.\n//\n// let autoseed = math.seedrandom(); // New prng with an automatic seed.\n// document.write(math.random()); // Pretty much unpredictable.\n//\n// math.random = rng1; // Continue \"hello\" prng sequence.\n// document.write(math.random()); // Always 0.554769432473455\n//\n// Math.seedrandom(autoseed); // Restart at the previous seed.\n// document.write(math.random()); // Repeat the 'unpredictable' value.\n//\n// Notes:\n//\n// Each time seedrandom('arg') is called, entropy from the passed seed\n// is accumulated in a pool to help generate future seeds for the\n// zero-argument form of Math.seedrandom, so entropy can be injected over\n// time by calling seedrandom with explicit data repeatedly.\n//\n// On speed - This javascript implementation of math.random() is about\n// 3-10x slower than the built-in Math.random() because it is not native\n// code, but this is typically fast enough anyway. Seeding is more expensive,\n// especially if you use auto-seeding. Some details (timings on Chrome 4):\n//\n// Our math.random() - avg less than 0.002 milliseconds per call\n// seedrandom('explicit') - avg less than 0.5 milliseconds per call\n// seedrandom('explicit', true) - avg less than 2 milliseconds per call\n// seedrandom() - avg about 38 milliseconds per call\n//\n// LICENSE (BSD):\n//\n// Copyright 2010 David Bau, all rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are met:\n//\n// 1. Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//\n// 2. Redistributions in binary form must reproduce the above copyright\n// notice, this list of conditions and the following disclaimer in the\n// documentation and/or other materials provided with the distribution.\n//\n// 3. Neither the name of this module nor the names of its contributors may\n// be used to endorse or promote products derived from this software\n// without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n\nimport { ByteArray } from './type'\n\nconst pool: number[] = [] // pool: entropy pool starts empty\nconst width = 256 // width: each RC4 output is 0 <= x < 256\nconst chunks = 6 // chunks: at least six RC4 outputs for each double\n//\n// The following constants are related to IEEE 754 limits.\n//\nconst significance = Math.pow(2, 52) // significance: there are 52 significant digits in a double\nconst overflow = significance * 2\nconst startdenom = Math.pow(width, chunks)\n\nexport const math = {\n //\n // seedrandom()\n // This is the seedrandom function described above.\n //\n seedrandom(seed: string, use_entropy = false): string {\n const key: number[] = []\n\n // Flatten the seed string or build one from local entropy if needed.\n seed = mixkey(\n flatten(\n use_entropy\n ? [seed, pool]\n : arguments.length\n ? seed\n : [new Date().getTime(), pool],\n 3,\n ),\n key,\n )\n\n // Use the seed to initialize an ARC4 generator.\n const arc4 = new ARC4(key)\n\n // Mix the randomness into accumulated entropy.\n mixkey(arc4.S, pool)\n\n // Override math.random\n // This function returns a random double in [0, 1) that contains\n // randomness in every bit of the mantissa of the IEEE 754 value.\n math.random = function (): number {\n // Closure to return a random double:\n let n = arc4.g(chunks) // Start with a numerator n < 2 ^ 48\n let d = startdenom // and denominator d = 2 ^ 48.\n let x = 0 // and no 'extra last byte'.\n while (n < significance) {\n // Fill up all significant digits by\n n = (n + x) * width // shifting numerator and\n d *= width // denominator and generating a\n x = arc4.g(1) // new least-significant-byte.\n }\n while (n >= overflow) {\n // To avoid rounding up, before adding\n n /= 2 // last byte, shift everything\n d /= 2 // right using integer math until\n x >>>= 1 // we have exactly the desired bits.\n }\n return (n + x) / d // Form the number within [0, 1).\n }\n\n // Return the seed that was used\n return seed\n },\n\n random: function (): number {\n return Math.random()\n },\n}\n\n//\n// ARC4\n//\n// An ARC4 implementation. The constructor takes a key in the form of\n// an array of at most (width) integers that should be 0 <= x < (width).\n//\n// The g(count) method returns a pseudorandom integer that concatenates\n// the next (count) outputs from ARC4. Its return value is a number x\n// that is in the range 0 <= x < (width ^ count).\n//\n/** @constructor */\nclass ARC4 {\n i = 0\n j = 0\n S: number[] = []\n c: number[] = []\n\n constructor(key: number[]) {\n let t,\n u,\n keylen = key.length\n let i = 0,\n j = 0\n\n // The empty key [] is treated as [0].\n if (!keylen) {\n key = [keylen++]\n }\n\n // Set up S using the standard key scheduling algorithm.\n while (i < width) {\n this.S[i] = i++\n }\n for (i = 0; i < width; i++) {\n t = this.S[i]\n j = lowbits(j + t + key[i % keylen])\n u = this.S[j]\n this.S[i] = u\n this.S[j] = t\n }\n\n // For robust unpredictability discard an initial batch of values.\n // See http://www.rsa.com/rsalabs/node.asp?id=2009\n this.g(width)\n }\n\n // The \"g\" method returns the next (count) outputs as one number.\n g(count: number): number {\n const s = this.S\n let i = lowbits(this.i + 1)\n let t = s[i]\n let j = lowbits(this.j + t)\n let u = s[j]\n s[i] = u\n s[j] = t\n let r = s[lowbits(t + u)]\n while (--count) {\n i = lowbits(i + 1)\n t = s[i]\n j = lowbits(j + t)\n u = s[j]\n s[i] = u\n s[j] = t\n r = r * width + s[lowbits(t + u)]\n }\n this.i = i\n this.j = j\n return r\n }\n}\n\ntype NestedStrArray = (string | NestedStrArray)[]\n\n//\n// flatten()\n// Converts an object tree to nested arrays of strings.\n//\n/** @param {Object=} result\n * @param {string=} prop\n * @param {string=} typ */\nfunction flatten(obj: unknown, depth: number): NestedStrArray | string {\n const result: NestedStrArray = []\n const typ = typeof obj\n if (depth && typ === 'object') {\n for (const prop in obj as Record<string, unknown>) {\n if (prop.indexOf('S') < 5) {\n // Avoid FF3 bug (local/sessionStorage)\n try {\n result.push(\n flatten((obj as Record<string, unknown>)[prop], depth - 1),\n )\n } catch (e) {\n console.error(e)\n }\n }\n }\n }\n return result.length ? result : obj + (typ !== 'string' ? '\\0' : '')\n}\n\n//\n// mixkey()\n// Mixes a string seed into a key that is an array of integers, and\n// returns a shortened string seed that is equivalent to the result key.\n//\n/** @param {number=} smear\n * @param {number=} j */\nfunction mixkey(seed: unknown, key: number[]): string {\n const seedStr = seed + '' // Ensure the seed is a string\n let smear = 0\n for (let i = 0; i < seedStr.length; i++) {\n key[lowbits(i)] = lowbits(\n (smear ^= key[lowbits(i)] * 19) + seedStr.charCodeAt(i),\n )\n }\n let mixed = ''\n key.forEach((v) => (mixed += String.fromCharCode(v)))\n return mixed\n}\n\n//\n// lowbits()\n// A quick \"n mod width\" for width a power of 2.\n//\nfunction lowbits(n: number): number {\n return n & (width - 1)\n}\n\n//\n// When seedrandom.js is loaded, we immediately mix a few bits\n// from the built-in RNG into the entropy pool. Because we do\n// not want to intefere with determinstic PRNG state later,\n// seedrandom will not call math.random on its own again after\n// initialization.\n//\nmixkey(Math.random(), pool)\n\n// This is not really a random number generator object, and two SeededRandom\n// objects will conflict with one another, but it's good enough for generating\n// the rsa key.\nexport class SeededRandom {\n nextBytes(ba: number[]): void {\n for (let i = 0; i < ba.length; i++) {\n ba[i] = Math.floor(math.random() * 256)\n }\n }\n}\n\n// prng4.js - uses Arcfour as a PRNG\nclass Arcfour {\n i = 0\n j = 0\n S: number[] = []\n\n // Initialize arcfour context from key, an array of ints, each from [0..255]\n init(key: number[]): void {\n let i, j, t\n for (i = 0; i < 256; ++i) this.S[i] = i\n j = 0\n for (i = 0; i < 256; ++i) {\n j = (j + this.S[i] + key[i % key.length]) & 255\n t = this.S[i]\n this.S[i] = this.S[j]\n this.S[j] = t\n }\n this.i = 0\n this.j = 0\n }\n\n next(): number {\n this.i = (this.i + 1) & 255\n this.j = (this.j + this.S[this.i]) & 255\n const t = this.S[this.i]\n this.S[this.i] = this.S[this.j]\n this.S[this.j] = t\n return this.S[(t + this.S[this.i]) & 255]\n }\n}\n\n// Plug in your RNG constructor here\nfunction prng_newstate(): Arcfour {\n return new Arcfour()\n}\n\n// Pool size must be a multiple of 4 and greater than 32.\n// An array of bytes the size of the pool will be passed to init()\nconst rng_psize = 256\n\n// Random number generator - requires a PRNG backend, e.g. prng4.js\n\n// For best results, put code like\n// <body onClick='rng_seed_time();' onKeyPress='rng_seed_time();'>\n// in your main HTML document.\n\nlet rng_state: Arcfour\nlet rng_pool: number[] = []\nlet rng_pptr: number\n\n// Mix in a 32-bit integer into the pool\nfunction rng_seed_int(x: number): void {\n rng_pool[rng_pptr++] ^= x & 255\n rng_pool[rng_pptr++] ^= (x >> 8) & 255\n rng_pool[rng_pptr++] ^= (x >> 16) & 255\n rng_pool[rng_pptr++] ^= (x >> 24) & 255\n if (rng_pptr >= rng_psize) rng_pptr -= rng_psize\n}\n\n// Mix in the current time (w/milliseconds) into the pool\nfunction rng_seed_time(): void {\n rng_seed_int(new Date().getTime())\n}\n\n// Initialize the pool with junk if needed.\nif (!rng_pool) {\n rng_pool = []\n rng_pptr = 0\n let t\n while (rng_pptr < rng_psize) {\n // extract some randomness from Math.random()\n t = Math.floor(65536 * Math.random())\n rng_pool[rng_pptr++] = t >>> 8\n rng_pool[rng_pptr++] = t & 255\n }\n rng_pptr = 0\n rng_seed_time()\n //rng_seed_int(window.screenX);\n //rng_seed_int(window.screenY);\n}\n\nfunction rng_get_byte(): number {\n if (!rng_state) {\n rng_seed_time()\n rng_state = prng_newstate()\n rng_state.init(rng_pool)\n for (rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr)\n rng_pool[rng_pptr] = 0\n rng_pptr = 0\n //rng_pool = null;\n }\n // TODO: allow reseeding after first request\n return rng_state.next()\n}\n\nexport class SecureRandom {\n nextBytes(ba: ByteArray): void {\n let i\n for (i = 0; i < ba.length; ++i) ba[i] = rng_get_byte()\n }\n}\n","// Copyright (c) 2005 Tom Wu\n// All Rights Reserved.\n// See \"LICENSE\" for details.\n// Basic JavaScript BN library - subset useful for RSA encryption.\n\n// (public) Constructor\n\nimport { math, SeededRandom } from './random'\nimport { ByteArray } from './type'\n\nexport type Op = (x: number, y: number) => number\nexport const op_and: Op = (x, y) => x & y\nexport const op_or: Op = (x, y) => x | y\nexport const op_xor: Op = (x, y) => x ^ y\nexport const op_andnot: Op = (x, y) => x & ~y\n\nconst dbits = 30\nconst BI_FP = 52\n\nexport class BigInteger {\n static DB = dbits\n static DM = (1 << dbits) - 1\n static DV = 1 << dbits\n static FV = Math.pow(2, BI_FP)\n static F1 = BI_FP - dbits\n static F2 = 2 * dbits - BI_FP\n // \"constants\"\n static ZERO = new BigInteger(0)\n static ONE = new BigInteger(1)\n\n // FIXME: ;\n s = 0\n t = 0;\n [k: number]: number\n\n constructor(\n a?: number | string | number[],\n b?: number | SeededRandom,\n c?: number | SeededRandom,\n ) {\n if (a) {\n if ('number' === typeof a) {\n if (b) {\n this.fromNumber(a, b, c as number)\n } else {\n // return bigint initialized to value\n this.fromInt(a)\n }\n } else {\n this.fromString(a, (b as number) || 256)\n }\n }\n }\n\n // am avoids a big mult-and-extract completely.\n // Max digit bits should be <= 30 because we do bitwise ops\n // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\n am(\n i: number,\n x: number,\n w: BigInteger,\n j: number,\n c: number,\n n: number,\n ): number {\n const xl = x & 0x7fff,\n xh = x >> 15\n while (--n >= 0) {\n let l = this[i] & 0x7fff\n const h = this[i++] >> 15\n const m = xh * l + h * xl\n l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff)\n c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30)\n w[j++] = l & 0x3fffffff\n }\n return c\n }\n\n // copy this to r\n copyTo(r: BigInteger): void {\n for (let i = this.t - 1; i >= 0; --i) r[i] = this[i]\n r.t = this.t\n r.s = this.s\n }\n\n // set from integer value x, -DV <= x < DV\n fromInt(x: number): void {\n this.t = 1\n this.s = x < 0 ? -1 : 0\n if (x > 0) this[0] = x\n else if (x < -1) this[0] = x + BigInteger.DV\n else this.t = 0\n }\n\n // set from string and radix\n fromString(s: string | number[], b: number): void {\n let k\n if (b === 16) k = 4\n else if (b === 8) k = 3\n else if (b === 256) k = 8\n // byte array\n else if (b === 2) k = 1\n else if (b === 32) k = 5\n else if (b === 4) k = 2\n else {\n this.fromRadix(s as string, b)\n return\n }\n this.t = 0\n this.s = 0\n let i = s.length,\n mi = false,\n sh = 0\n while (--i >= 0) {\n const x = k === 8 ? (s[i] as number & 0xff) : intAt(s as string, i)\n if (x < 0) {\n if ((s as string).charAt(i) === '-') mi = true\n continue\n }\n mi = false\n if (sh === 0) this[this.t++] = x\n else if (sh + k > BigInteger.DB) {\n this[this.t - 1] |= (x & ((1 << (BigInteger.DB - sh)) - 1)) << sh\n this[this.t++] = x >> (BigInteger.DB - sh)\n } else this[this.t - 1] |= x << sh\n sh += k\n if (sh >= BigInteger.DB) sh -= BigInteger.DB\n }\n if (k === 8 && ((s[0] as number) & 0x80) !== 0) {\n this.s = -1\n if (sh > 0) this[this.t - 1] |= ((1 << (BigInteger.DB - sh)) - 1) << sh\n }\n this.clamp()\n if (mi) BigInteger.ZERO.subTo(this, this)\n }\n\n // clamp off excess high words\n clamp(): void {\n const c = this.s & BigInteger.DM\n while (this.t > 0 && this[this.t - 1] === c) --this.t\n }\n\n // return string representation in given radix (default to 16)\n toString(b = 16): string {\n if (this.s < 0) return '-' + this.negate().toString(b)\n let k\n if (b === 16) k = 4\n else if (b === 8) k = 3\n else if (b === 2) k = 1\n else if (b === 32) k = 5\n else if (b === 64) k = 6\n else if (b === 4) k = 2\n else return this.toRadix(b)\n const km = (1 << k) - 1\n let d,\n m = false,\n r = '',\n i = this.t\n let p = BigInteger.DB - ((i * BigInteger.DB) % k)\n if (i-- > 0) {\n if (p < BigInteger.DB && (d = this[i] >> p) > 0) {\n m = true\n r = int2char(d)\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p)\n d |= this[--i] >> (p += BigInteger.DB - k)\n } else {\n d = (this[i] >> (p -= k)) & km\n if (p <= 0) {\n p += BigInteger.DB\n --i\n }\n }\n if (d > 0) m = true\n if (m) r += int2char(d)\n }\n }\n return m ? r : '0'\n }\n\n // -this\n negate(): BigInteger {\n const r = new BigInteger()\n BigInteger.ZERO.subTo(this, r)\n return r\n }\n\n // |this|\n abs(): BigInteger {\n return this.s < 0 ? this.negate() : this\n }\n\n // return + if this > a, - if this < a, 0 if equal\n compareTo(a: BigInteger): number {\n let r = this.s - a.s\n if (r !== 0) return r\n let i = this.t\n r = i - a.t\n if (r !== 0) return r\n while (--i >= 0) if ((r = this[i] - a[i]) !== 0) return r\n return 0\n }\n\n // return the number of bits in \"this\"\n bitLength(): number {\n if (this.t <= 0) return 0\n return (\n BigInteger.DB * (this.t - 1) +\n nbits(this[this.t - 1] ^ (this.s & BigInteger.DM))\n )\n }\n\n // r = this << n*DB\n dlShiftTo(n: number, r: BigInteger): void {\n let i\n for (i = this.t - 1; i >= 0; --i) r[i + n] = this[i]\n for (i = n - 1; i >= 0; --i) r[i] = 0\n r.t = this.t + n\n r.s = this.s\n }\n\n // r = this >> n*DB\n drShiftTo(n: number, r: BigInteger): void {\n for (let i = n; i < this.t; ++i) r[i - n] = this[i]\n r.t = Math.max(this.t - n, 0)\n r.s = this.s\n }\n\n // r = this << n\n lShiftTo(n: number, r: BigInteger): void {\n const bs = n % BigInteger.DB\n const cbs = BigInteger.DB - bs\n const bm = (1 << cbs) - 1\n const ds = Math.floor(n / BigInteger.DB)\n let c = (this.s << bs) & BigInteger.DM,\n i\n for (i = this.t - 1; i >= 0; --i) {\n r[i + ds + 1] = (this[i] >> cbs) | c\n c = (this[i] & bm) << bs\n }\n for (i = ds - 1; i >= 0; --i) r[i] = 0\n r[ds] = c\n r.t = this.t + ds + 1\n r.s = this.s\n r.clamp()\n }\n\n // r = this >> n\n rShiftTo(n: number, r: BigInteger): void {\n r.s = this.s\n const ds = Math.floor(n / BigInteger.DB)\n if (ds >= this.t) {\n r.t = 0\n return\n }\n const bs = n % BigInteger.DB\n const cbs = BigInteger.DB - bs\n const bm = (1 << bs) - 1\n r[0] = this[ds] >> bs\n for (let i = ds + 1; i < this.t; ++i) {\n r[i - ds - 1] |= (this[i] & bm) << cbs\n r[i - ds] = this[i] >> bs\n }\n if (bs > 0) r[this.t - ds - 1] |= (this.s & bm) << cbs\n r.t = this.t - ds\n r.clamp()\n }\n\n // r = this - a\n subTo(a: BigInteger, r: BigInteger): void {\n const m = Math.min(a.t, this.t)\n let i = 0,\n c = 0\n while (i < m) {\n c += this[i] - a[i]\n r[i++] = c & BigInteger.DM\n c >>= BigInteger.DB\n }\n if (a.t < this.t) {\n c -= a.s\n while (i < this.t) {\n c += this[i]\n r[i++] = c & BigInteger.DM\n c >>= BigInteger.DB\n }\n c += this.s\n } else {\n c += this.s\n while (i < a.t) {\n c -= a[i]\n r[i++] = c & BigInteger.DM\n c >>= BigInteger.DB\n }\n c -= a.s\n }\n r.s = c < 0 ? -1 : 0\n if (c < -1) r[i++] = BigInteger.DV + c\n else if (c > 0) r[i++] = c\n r.t = i\n r.clamp()\n }\n\n // r = this * a, r !== this,a (HAC 14.12)\n // \"this\" should be the larger one if appropriate.\n multiplyTo(a: BigInteger, r: BigInteger): void {\n const x = this.abs(),\n y = a.abs()\n let i = x.t\n r.t = i + y.t\n while (--i >= 0) r[i] = 0\n for (i = 0; i < y.t; ++i) r[i + x.t] = x.am(0, y[i], r, i, 0, x.t)\n r.s = 0\n r.clamp()\n if (this.s !== a.s) BigInteger.ZERO.subTo(r, r)\n }\n\n // r = this^2, r !== this (HAC 14.16)\n squareTo(r: BigInteger): void {\n const x = this.abs()\n let i = (r.t = 2 * x.t)\n while (--i >= 0) r[i] = 0\n for (i = 0; i < x.t - 1; ++i) {\n const c = x.am(i, x[i], r, 2 * i, 0, 1)\n if (\n (r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >=\n BigInteger.DV\n ) {\n r[i + x.t] -= BigInteger.DV\n r[i + x.t + 1] = 1\n }\n }\n if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1)\n r.s = 0\n r.clamp()\n }\n\n // divide this by m, quotient and remainder to q, r (HAC 14.20)\n // r !== q, this !== m. q or r may be null.\n divRemTo(m: BigInteger, q?: BigInteger, r?: BigInteger): void {\n const pm = m.abs()\n if (pm.t <= 0) return\n const pt = this.abs()\n if (pt.t < pm.t) {\n if (q) q.fromInt(0)\n if (r) this.copyTo(r)\n return\n }\n if (!r) r = new BigInteger()\n const y = new BigInteger(),\n ts = this.s,\n ms = m.s\n const nsh = BigInteger.DB - nbits(pm[pm.t - 1]) // normalize modulus\n if (nsh > 0) {\n pm.lShiftTo(nsh, y)\n pt.lShiftTo(nsh, r)\n } else {\n pm.copyTo(y)\n pt.copyTo(r)\n }\n const ys = y.t\n const y0 = y[ys - 1]\n if (y0 === 0) return\n const yt =\n y0 * (1 << BigInteger.F1) + (ys > 1 ? y[ys - 2] >> BigInteger.F2 : 0)\n const d1 = BigInteger.FV / yt,\n d2 = (1 << BigInteger.F1) / yt,\n e = 1 << BigInteger.F2,\n t = q || new BigInteger()\n let i = r.t,\n j = i - ys\n y.dlShiftTo(j, t)\n if (r.compareTo(t) >= 0) {\n r[r.t++] = 1\n r.subTo(t, r)\n }\n BigInteger.ONE.dlShiftTo(ys, t)\n t.subTo(y, y) // \"negative\" y so we can replace sub with am later\n while (y.t < ys) y[y.t++] = 0\n while (--j >= 0) {\n // Estimate quotient digit\n let qd =\n r[--i] === y0\n ? BigInteger.DM\n : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2)\n if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) {\n // Try it out\n y.dlShiftTo(j, t)\n r.subTo(t, r)\n while (r[i] < --qd) r.subTo(t, r)\n }\n }\n if (q) {\n r.drShiftTo(ys, q)\n if (ts !== ms) BigInteger.ZERO.subTo(q, q)\n }\n r.t = ys\n r.clamp()\n if (nsh > 0) r.rShiftTo(nsh, r) // Denormalize remainder\n if (ts < 0) BigInteger.ZERO.subTo(r, r)\n }\n\n // this mod a\n mod(a: BigInteger): BigInteger {\n const r = new BigInteger()\n this.abs().divRemTo(a, undefined, r)\n if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r)\n return r\n }\n\n // return \"-1/this % 2^DB\"; useful for Mont. reduction\n // justification:\n // xy === 1 (mod m)\n // xy = 1+km\n // xy(2-xy) = (1+km)(1-km)\n // x[y(2-xy)] = 1-k^2m^2\n // x[y(2-xy)] === 1 (mod m^2)\n // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\n // should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\n // JS multiply \"overflows\" differently from C/C++, so care is needed here.\n invDigit(): number {\n if (this.t < 1) return 0\n const x = this[0]\n if ((x & 1) === 0) return 0\n let y = x & 3 // y === 1/x mod 2^2\n y = (y * (2 - (x & 0xf) * y)) & 0xf // y === 1/x mod 2^4\n y = (y * (2 - (x & 0xff) * y)) & 0xff // y === 1/x mod 2^8\n y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff // y === 1/x mod 2^16\n // last step - calculate inverse mod DV directly;\n // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n y = (y * (2 - ((x * y) % BigInteger.DV))) % BigInteger.DV // y === 1/x mod 2^dbits\n // we really want the negative inverse, and -DV < y < DV\n return y > 0 ? BigInteger.DV - y : -y\n }\n\n // true iff this is even\n isEven(): boolean {\n return (this.t > 0 ? this[0] & 1 : this.s) === 0\n }\n\n // this^e, e < 2^32, doing sqr and mul with \"r\" (HAC 14.79)\n exp(e: number, z: Reducer): BigInteger {\n if (e > 0xffffffff || e < 1) return BigInteger.ONE\n const g = z.convert(this)\n let r = new BigInteger(),\n r2 = new BigInteger(),\n i = nbits(e) - 1\n g.copyTo(r)\n while (--i >= 0) {\n z.sqrTo(r, r2)\n if ((e & (1 << i)) > 0) z.mulTo(r2, g, r)\n else {\n const t = r\n r = r2\n r2 = t\n }\n }\n return z.revert(r)\n }\n\n // this^e % m, 0 <= e < 2^32\n modPowInt(e: number, m: BigInteger): BigInteger {\n let z\n if (e < 256 || m.isEven()) z = new Classic(m)\n else z = new Montgomery(m)\n return this.exp(e, z)\n }\n\n clone(): BigInteger {\n const r = new BigInteger()\n this.copyTo(r)\n return r\n }\n\n // return value as integer\n intValue(): number {\n if (this.s < 0) {\n if (this.t === 1) return this[0] - BigInteger.DV\n else if (this.t === 0) return -1\n } else if (this.t === 1) return this[0]\n else if (this.t === 0) return 0\n // assumes 16 < DB < 32\n return (\n ((this[1] & ((1 << (32 - BigInteger.DB)) - 1)) << BigInteger.DB) | this[0]\n )\n }\n\n // return value as byte\n byteValue(): number {\n return this.t === 0 ? this.s : (this[0] << 24) >> 24\n }\n\n // return value as short (assumes DB>=16)\n shortValue(): number {\n return this.t === 0 ? this.s : (this[0] << 16) >> 16\n }\n\n // return x s.t. r^x < DV\n chunkSize(r: number): number {\n return Math.floor((Math.LN2 * BigInteger.DB) / Math.log(r))\n }\n\n // 0 if this === 0, 1 if this > 0, -1 if this < 0\n signum(): -1 | 0 | 1 {\n if (this.s < 0) return -1\n else if (this.t <= 0 || (this.t === 1 && this[0] <= 0)) return 0\n else return 1\n }\n\n // convert to radix string\n toRadix(b: number): string {\n if (!b) b = 10\n if (this.signum() === 0 || b < 2 || b > 36) return '0'\n const cs = this.chunkSize(b)\n const a = Math.pow(b, cs)\n const d = new BigInteger(a),\n y = new BigInteger(),\n z = new BigInteger()\n let r = ''\n this.divRemTo(d, y, z)\n while (y.signum() > 0) {\n r = (a + z.intValue()).toString(b).substr(1) + r\n y.divRemTo(d, y, z)\n }\n return z.intValue().toString(b) + r\n }\n\n // convert from radix string\n fromRadix(s: string, b: number): void {\n this.fromInt(0)\n if (!b) b = 10\n const cs = this.chunkSize(b)\n const d = Math.pow(b, cs)\n let mi = false,\n j = 0,\n w = 0\n for (let i = 0; i < s.length; ++i) {\n const x = intAt(s, i)\n if (x < 0) {\n if (s.charAt(i) === '-' && this.signum() === 0) mi = true\n continue\n }\n w = b * w + x\n if (++j >= cs) {\n this.dMultiply(d)\n this.dAddOffset(w, 0)\n j = 0\n w = 0\n }\n }\n if (j > 0) {\n this.dMultiply(Math.pow(b, j))\n this.dAddOffset(w, 0)\n }\n if (mi) BigInteger.ZERO.subTo(this, this)\n }\n\n // alternate constructor\n fromNumber(a: number, b: number | SeededRandom, c?: number): void {\n if ('number' === typeof b) {\n // new BigInteger(int,int,RNG)\n if (a < 2) this.fromInt(1)\n else {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.fromNumber(a, c!)\n if (!this.testBit(a - 1))\n // force MSB set\n this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this)\n if (this.isEven()) this.dAddOffset(1, 0) // force odd\n while (!this.isProbablePrime(b)) {\n this.dAddOffset(2, 0)\n if (this.bitLength() > a)\n this.subTo(BigInteger.ONE.shiftLeft(a - 1), this)\n }\n }\n } else {\n // new BigInteger(int,RNG)\n const x: number[] = [],\n t = a & 7\n x.length = (a >> 3) + 1\n b.nextBytes(x)\n if (t > 0) x[0] &= (1 << t) - 1\n else x[0] = 0\n this.fromString(x, 256)\n }\n }\n\n // convert to bigendian byte array\n toByteArray(): ByteArray {\n const r = []\n let i = this.t\n r[0] = this.s\n let p = BigInteger.DB - ((i * BigInteger.DB) % 8),\n d,\n k = 0\n if (i-- > 0) {\n if (\n p < BigInteger.DB &&\n (d = this[i] >> p) !== (this.s & BigInteger.DM) >> p\n )\n r[k++] = d | (this.s << (BigInteger.DB - p))\n while (i >= 0) {\n if (p < 8) {\n d = (this[i] & ((1 << p) - 1)) << (8 - p)\n d |= this[--i] >> (p += BigInteger.DB - 8)\n } else {\n d = (this[i] >> (p -= 8)) & 0xff\n if (p <= 0) {\n p += BigInteger.DB\n --i\n }\n }\n if ((d & 0x80) !== 0) d |= -256\n if (k === 0 && (this.s & 0x80) !== (d & 0x80)) ++k\n if (k > 0 || d !== this.s) r[k++] = d\n }\n }\n return r\n }\n\n equals(a: BigInteger): boolean {\n return this.compareTo(a) === 0\n }\n\n min(a: BigInteger): BigInteger {\n return this.compareTo(a) < 0 ? this : a\n }\n\n max(a: BigInteger): BigInteger {\n return this.compareTo(a) > 0 ? this : a\n }\n\n // r = this op a (bitwise)\n bitwiseTo(a: BigInteger, op: Op, r: BigInteger): void {\n const m = Math.min(a.t, this.t)\n let f\n for (let i = 0; i < m; ++i) r[i] = op(this[i], a[i])\n if (a.t < this.t) {\n f = a.s & BigInteger.DM\n for (let i = m; i < this.t; ++i) r[i] = op(this[i], f)\n r.t = this.t\n } else {\n f = this.s & BigInteger.DM\n for (let i = m; i < a.t; ++i) r[i] = op(f, a[i])\n r.t = a.t\n }\n r.s = op(this.s, a.s)\n r.clamp()\n }\n\n // this & a\n and(a: BigInteger): BigInteger {\n const r = new BigInteger()\n this.bitwiseTo(a, op_and, r)\n return r\n }\n\n // this | a\n or(a: BigInteger): BigInteger {\n const r = new BigInteger()\n this.bitwiseTo(a, op_or, r)\n return r\n }\n\n // this ^ a\n xor(a: BigInteger): BigInteger {\n const r = new BigInteger()\n this.bitwiseTo(a, op_xor, r)\n return r\n }\n\n // this & ~a\n andNot(a: BigInteger): BigInteger {\n const r = new BigInteger()\n this.bitwiseTo(a, op_andnot, r)\n return r\n }\n\n // ~this\n not(): BigInteger {\n const r = new BigInteger()\n for (let i = 0; i < this.t; ++i) r[i] = BigInteger.DM & ~this[i]\n r.t = this.t\n r.s = ~this.s\n return r\n }\n\n // this << n\n shiftLeft(n: number): BigInteger {\n const r = new BigInteger()\n if (n < 0) this.rShiftTo(-n, r)\n else this.lShiftTo(n, r)\n return r\n }\n\n // this >> n\n shiftRight(n: number): BigInteger {\n const r = new BigInteger()\n if (n < 0) this.lShiftTo(-n, r)\n else this.rShiftTo(n, r)\n return r\n }\n\n // returns index of lowest 1-bit (or -1 if none)\n getLowestSetBit(): number {\n for (let i = 0; i < this.t; ++i)\n if (this[i] !== 0) return i * BigInteger.DB + lbit(this[i])\n if (this.s < 0) return this.t * BigInteger.DB\n return -1\n }\n\n // return number of set bits\n bitCount(): number {\n const x = this.s & BigInteger.DM\n let r = 0\n for (let i = 0; i < this.t; ++i) r += cbit(this[i] ^ x)\n return r\n }\n\n // true iff nth bit is set\n testBit(n: number): boolean {\n const j = Math.floor(n / BigInteger.DB)\n if (j >= this.t) return this.s !== 0\n return (this[j] & (1 << n % BigInteger.DB)) !== 0\n }\n\n // this op (1<<n)\n changeBit(n: number, op: Op): BigInteger {\n const r = BigInteger.ONE.shiftLeft(n)\n this.bitwiseTo(r, op, r)\n return r\n }\n\n // this | (1<<n)\n setBit(n: number): BigInteger {\n return this.changeBit(n, op_or)\n }\n\n // this & ~(1<<n)\n clearBit(n: number): BigInteger {\n return this.changeBit(n, op_andnot)\n }\n\n // this ^ (1<<n)\n flipBit(n: number): BigInteger {\n return this.changeBit(n, op_xor)\n }\n\n // r = this + a\n addTo(a: BigInteger, r: BigInteger): void {\n const m = Math.min(a.t, this.t)\n let i = 0,\n c = 0\n while (i < m) {\n c += this[i] + a[i]\n r[i++] = c & BigInteger.DM\n c >>= BigInteger.DB\n }\n if (a.t < this.t) {\n c += a.s\n while (i < this.t) {\n c += this[i]\n r[i++] = c & BigInteger.DM\n c >>= BigInteger.DB\n }\n c += this.s\n } else {\n c += this.s\n while (i < a.t) {\n c += a[i]\n r[i++] = c & BigInteger.DM\n c >>= BigInteger.DB\n }\n c += a.s\n }\n r.s = c < 0 ? -1 : 0\n if (c > 0) r[i++] = c\n else if (c < -1) r[i++] = BigInteger.DV + c\n r.t = i\n r.clamp()\n }\n\n // this + a\n add(a: BigInteger): BigInteger {\n const r = new BigInteger()\n this.addTo(a, r)\n return r\n }\n\n // this - a\n subtract(a: BigInteger): BigInteger {\n const r = new BigInteger()\n this.subTo(a, r)\n return r\n }\n\n // this * a\n multiply(a: BigInteger): BigInteger {\n const r = new BigInteger()\n this.multiplyTo(a, r)\n return r\n }\n\n // JSBN-specific extension\n // this^2\n square(): BigInteger {\n const r = new BigInteger()\n this.squareTo(r)\n return r\n }\n\n // this / a\n divide(a: BigInteger): BigInteger {\n const r = new BigInteger()\n this.divRemTo(a, r, undefined)\n return r\n }\n\n // this % a\n remainder(a: BigInteger): BigInteger {\n const r = new BigInteger()\n this.divRemTo(a, undefined, r)\n return r\n }\n\n // [this/a,this%a]\n divideAndRemainder(a: BigInteger): [BigInteger, BigInteger] {\n const q = new BigInteger(),\n r = new BigInteger()\n this.divRemTo(a, q, r)\n return [q, r]\n }\n\n // this *= n, this >= 0, 1 < n < DV\n protected dMultiply(n: number): void {\n this[this.t] = this.am(0, n - 1, this, 0, 0, this.t)\n ++this.t\n this.clamp()\n }\n\n // this += n << w words, this >= 0\n dAddOffset(n: number, w: number): void {\n if (n === 0) return\n while (this.t <= w) this[this.t++] = 0\n this[w] += n\n while (this[w] >= BigInteger.DV) {\n this[w] -= BigInteger.DV\n if (++w >= this.t) this[this.t++] = 0\n ++this[w]\n }\n }\n\n // this^e\n pow(e: number): BigInteger {\n return this.exp(e, new NullExp())\n }\n\n // r = lower n words of \"this * a\", a.t <= n\n // \"this\" should be the larger one if appropriate.\n multiplyLowerTo(a: BigInteger, n: number, r: BigInteger): void {\n let i = Math.min(this.t + a.t, n)\n r.s = 0 // assumes a,this >= 0\n r.t = i\n while (i > 0) r[--i] = 0\n let j\n for (j = r.t - this.t; i < j; ++i)\n r[i + this.t] = this.am(0, a[i], r, i, 0, this.t)\n for (j = Math.min(a.t, n); i < j; ++i) this.am(0, a[i], r, i, 0, n - i)\n r.clamp()\n }\n\n // r = \"this * a\" without lower n words, n > 0\n // \"this\" should be the larger one if appropriate.\n multiplyUpperTo(a: BigInteger, n: number, r: BigInteger): void {\n --n\n let i = (r.t = this.t + a.t - n)\n r.s = 0 // assumes a,this >= 0\n while (--i >= 0) r[i] = 0\n for (i = Math.max(n - this.t, 0); i < a.t; ++i)\n r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n)\n r.clamp()\n r.drShiftTo(1, r)\n }\n\n // this^e % m (HAC 14.85)\n modPow(e: BigInteger, m: BigInteger): BigInteger {\n let i = e.bitLength(),\n k,\n r = new BigInteger(1),\n z\n if (i <= 0) return r\n else if (i < 18) k = 1\n else if (i < 48) k = 3\n else if (i < 144) k = 4\n else if (i < 768) k = 5\n else k = 6\n if (i < 8) z = new Classic(m)\n else if (m.isEven()) z = new Barrett(m)\n else z = new Montgomery(m)\n\n // precomputation\n const g: BigInteger[] = [],\n k1 = k - 1,\n km = (1 << k) - 1\n let n = 3\n g[1] = z.convert(this)\n if (k > 1) {\n const g2 = new BigInteger()\n z.sqrTo(g[1], g2)\n while (n <= km) {\n g[n] = new BigInteger()\n z.mulTo(g2, g[n - 2], g[n])\n n += 2\n }\n }\n\n let j = e.t - 1,\n w,\n is1 = true,\n r2 = new BigInteger(),\n t\n i = nbits(e[j]) - 1\n while (j >= 0) {\n if (i >= k1) w = (e[j] >> (i - k1)) & km\n else {\n w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i)\n if (j > 0) w |= e[j - 1] >> (BigInteger.DB + i - k1)\n }\n\n n = k\n while ((w & 1) === 0) {\n w >>= 1\n --n\n }\n if ((i -= n) < 0) {\n i += BigInteger.DB\n --j\n }\n if (is1) {\n // ret === 1, don't bother squaring or multiplying it\n g[w].copyTo(r)\n is1 = false\n } else {\n while (n > 1) {\n z.sqrTo(r, r2)\n z.sqrTo(r2, r)\n n -= 2\n }\n if (n > 0) z.sqrTo(r, r2)\n else {\n t = r\n r = r2\n r2 = t\n }\n z.mulTo(r2, g[w], r)\n }\n\n while (j >= 0 && (e[j] & (1 << i)) === 0) {\n z.sqrTo(r, r2)\n t = r\n r = r2\n r2 = t\n if (--i < 0) {\n i = BigInteger.DB - 1\n --j\n }\n }\n }\n return z.revert(r)\n }\n\n // gcd(this,a) (HAC 14.54)\n gcd(a: BigInteger): BigInteger {\n let x = this.s < 0 ? this.negate() : this.clone()\n let y = a.s < 0 ? a.negate() : a.clone()\n if (x.compareTo(y) < 0) {\n const t = x\n x = y\n y = t\n }\n let i = x.getLowestSetBit(),\n g = y.getLowestSetBit()\n if (g < 0) return x\n if (i < g) g = i\n if (g > 0) {\n x.rShiftTo(g, x)\n y.rShiftTo(g, y)\n }\n while (x.signum() > 0) {\n if ((i = x.getLowestSetBit()) > 0) x.rShiftTo(i, x)\n if ((i = y.getLowestSetBit()) > 0) y.rShiftTo(i, y)\n if (x.compareTo(y) >= 0) {\n x.subTo(y, x)\n x.rShiftTo(1, x)\n } else {\n y.subTo(x, y)\n y.rShiftTo(1, y)\n }\n }\n if (g > 0) y.lShiftTo(g, y)\n return y\n }\n\n // this % n, n < 2^26\n modInt(n: number): number {\n if (n <= 0) return 0\n const d = BigInteger.DV % n\n let r = this.s < 0 ? n - 1 : 0\n if (this.t > 0)\n if (d === 0) r = this[0] % n\n else for (let i = this.t - 1; i >= 0; --i) r = (d * r + this[i]) % n\n return r\n }\n\n // 1/this % m (HAC 14.61)\n modInverse(m: BigInteger): BigInteger {\n const ac = m.isEven()\n if ((this.isEven() && ac) || m.signum() === 0) return BigInteger.ZERO\n const u = m.clone(),\n v = this.clone()\n const a = new BigInteger(1),\n b = new BigInteger(0),\n c = new BigInteger(0),\n d = new BigInteger(1)\n while (u.signum() !== 0) {\n while (u.isEven()) {\n u.rShiftTo(1, u)\n if (ac) {\n if (!a.isEven() || !b.isEven()) {\n a.addTo(this, a)\n b.subTo(m, b)\n }\n a.rShiftTo(1, a)\n } else if (!b.isEven()) b.subTo(m, b)\n b.rShiftTo(1, b)\n }\n while (v.isEven()) {\n v.rShiftTo(1, v)\n if (ac) {\n if (!c.isEven() || !d.isEven()) {\n c.addTo(this, c)\n d.subTo(m, d)\n }\n c.rShiftTo(1, c)\n } else if (!d.isEven()) d.subTo(m, d)\n d.rShiftTo(1, d)\n }\n if (u.compareTo(v) >= 0) {\n u.subTo(v, u)\n if (ac) a.subTo(c, a)\n b.subTo(d, b)\n } else {\n v.subTo(u, v)\n if (ac) c.subTo(a, c)\n d.subTo(b, d)\n }\n }\n if (v.compareTo(BigInteger.ONE) !== 0) return BigInteger.ZERO\n if (d.compareTo(m) >= 0) return d.subtract(m)\n if (d.signum() < 0) d.addTo(m, d)\n else return d\n if (d.signum() < 0) return d.add(m)\n else return d\n }\n\n static lowprimes = [\n 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,\n 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,\n 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233,\n 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317,\n 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419,\n 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503,\n 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607,\n 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701,\n 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811,\n 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,\n 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997,\n ]\n static lplim =\n (1 << 26) / BigInteger.lowprimes[BigInteger.lowprimes.length - 1]\n\n // test primality with certainty >= 1-.5^t\n isProbablePrime(t: number): boolean {\n const x = this.abs()\n let i\n if (\n x.t === 1 &&\n x[0] <= BigInteger.lowprimes[BigInteger.lowprimes.length - 1]\n ) {\n for (i = 0; i < BigInteger.lowprimes.length; ++i)\n if (x[0] === BigInteger.lowprimes[i]) return true\n return false\n }\n if (x.isEven()) return false\n i = 1\n while (i < BigInteger.lowprimes.length) {\n let m = BigInteger.lowprimes[i],\n j = i + 1\n while (j < BigInteger.lowprimes.length && m < BigInteger.lplim)\n m *= BigInteger.lowprimes[j++]\n m = x.modInt(m)\n while (i < j) if (m % BigInteger.lowprimes[i++] === 0) return false\n }\n return x.millerRabin(t)\n }\n\n // true if probably prime (HAC 4.24, Miller-Rabin)\n millerRabin(t: number): boolean {\n const n1 = this.subtract(BigInteger.ONE)\n const k = n1.getLowestSetBit()\n if (k <= 0) return false\n const r = n1.shiftRight(k)\n t = (t + 1) >> 1\n if (t > BigInteger.lowprimes.length) t = BigInteger.lowprimes.length\n const a = new BigInteger()\n for (let i = 0; i < t; ++i) {\n //Pick bases at random, instead of starting at 2\n a.fromInt(\n BigInteger.lowprimes[\n Math.floor(math.random() * BigInteger.lowprimes.length)\n ],\n )\n let y = a.modPow(r, this)\n if (y.compareTo(BigInteger.ONE) !== 0 && y.compareTo(n1) !== 0) {\n let j = 1\n while (j++ < k && y.compareTo(n1) !== 0) {\n y = y.modPowInt(2, this)\n if (y.compareTo(BigInteger.ONE) === 0) return false\n }\n if (y.compareTo(n1) !== 0) return false\n }\n }\n return true\n }\n}\n\n// Digit conversions\nconst BI_RM = '0123456789abcdefghijklmnopqrstuvwxyz'\nconst BI_RC: number[] = []\nlet rr, vv\nrr = '0'.charCodeAt(0)\nfor (vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv\nrr = 'a'.charCodeAt(0)\nfor (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv\nrr = 'A'.charCodeAt(0)\nfor (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv\n\nexport function int2char(n: number): string {\n return BI_RM.charAt(n)\n}\n\nfunction intAt(s: string, i: number): number {\n const c = BI_RC[s.charCodeAt(i)]\n return c == null ? -1 : c\n}\n\n// returns bit length of the integer x\nfunction nbits(x: number): number {\n let r = 1,\n t\n if ((t = x >>> 16) !== 0) {\n x = t\n r += 16\n }\n if ((t = x >> 8) !== 0) {\n x = t\n r += 8\n }\n if ((t = x >> 4) !== 0) {\n x = t\n r += 4\n }\n if ((t = x >> 2) !== 0) {\n x = t\n r += 2\n }\n if ((t = x >> 1) !== 0) {\n // x = t\n r += 1\n }\n return r\n}\n\ninterface Reducer {\n convert(x: BigInteger): BigInteger\n revert(x: BigInteger): BigInteger\n reduce(x: BigInteger): void\n mulTo(x: BigInteger, y: BigInteger, r: BigInteger): void\n sqrTo(x: BigInteger, r: BigInteger): void\n}\n\n// Modular reduction using \"classic\" algorithm\nclass Classic implements Reducer {\n constructor(private readonly m: BigInteger) {}\n\n convert(x: BigInteger): BigInteger {\n if (x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m)\n else return x\n }\n\n revert(x: BigInteger): BigInteger {\n return x\n }\n\n reduce(x: BigInteger): void {\n x.divRemTo(this.m, undefined, x)\n }\n\n mulTo(x: BigInteger, y: BigInteger, r: BigInteger): void {\n x.multiplyTo(y, r)\n this.reduce(r)\n }\n\n sqrTo(x: BigInteger, r: BigInteger): void {\n x.squareTo(r)\n this.reduce(r)\n }\n}\n\n// Montgomery reduction\nclass Montgomery implements Reducer {\n private readonly m: BigInteger\n private readonly mp: number\n private readonly mpl: number\n private readonly mph: number\n private readonly um: number\n private readonly mt2: number\n\n constructor(m: BigInteger) {\n this.m = m\n this.mp = m.invDigit()\n this.mpl = this.mp & 0x7fff\n this.mph = this.mp >> 15\n this.um = (1 << (BigInteger.DB - 15)) - 1\n this.mt2 = 2 * m.t\n }\n\n // xR mod m\n convert(x: BigInteger): BigInteger {\n const r = new BigInteger()\n x.abs().dlShiftTo(this.m.t, r)\n r.divRemTo(this.m, undefined, r)\n if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r)\n return r\n }\n\n // x/R mod m\n revert(x: BigInteger): BigInteger {\n const r = new BigInteger()\n x.copyTo(r)\n this.reduce(r)\n return r\n }\n\n // x = x/R mod m (HAC 14.32)\n reduce(x: BigInteger): void {\n while (x.t <= this.mt2)\n // pad x so am has enough room later\n x[x.t++] = 0\n for (let i = 0; i < this.m.t; ++i) {\n // faster way of calculating u0 = x[i]*mp mod DV\n let j = x[i] & 0x7fff\n const u0 =\n (j * this.mpl +\n (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) &\n BigInteger.DM\n // use am to combine the multiply-shift-add into one call\n j = i + this.m.t\n x[j] += this.m.am(0, u0, x, i, 0, this.m.t)\n // propagate carry\n while (x[j] >= BigInteger.DV) {\n x[j] -= BigInteger.DV\n x[++j]++\n }\n }\n x.clamp()\n x.drShiftTo(this.m.t, x)\n if (x.compareTo(this.m) >= 0) x.subTo(this.m, x)\n }\n\n // r = \"x^2/R mod m\"; x !== r\n sqrTo(x: BigInteger, r: BigInteger): void {\n x.squareTo(r)\n this.reduce(r)\n }\n\n // r = \"xy/R mod m\"; x,y !== r\n mulTo(x: BigInteger, y: BigInteger, r: BigInteger): void {\n x.multiplyTo(y, r)\n this.reduce(r)\n }\n}\n\n// return index of lowest 1-bit in x, x < 2^31\nfunction lbit(x: number): number {\n if (x === 0) return -1\n let r = 0\n if ((x & 0xffff) === 0) {\n x >>= 16\n r += 16\n }\n if ((x & 0xff) === 0) {\n x >>= 8\n r += 8\n }\n if ((x & 0xf) === 0) {\n x >>= 4\n r += 4\n }\n if ((x & 3) === 0) {\n x >>= 2\n r += 2\n }\n if ((x & 1) === 0) ++r\n return r\n}\n\n// return number of 1 bits in x\nfunction cbit(x: number): number {\n let r = 0\n while (x !== 0) {\n x &= x - 1\n ++r\n }\n return r\n}\n\n// A \"null\" reducer\nclass NullExp implements Reducer {\n convert = nNop\n revert = nNop\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n reduce = (): void => {}\n\n mulTo(x: BigInteger, y: BigInteger, r: BigInteger): void {\n x.multiplyTo(y, r)\n }\n\n sqrTo(x: BigInteger, r: BigInteger): void {\n x.squareTo(r)\n }\n}\n\nfunction nNop(x: BigInteger): BigInteger {\n return x\n}\n\n// Barrett modular reduction\n\nclass Barrett implements Reducer {\n private readonly r2: BigInteger\n private readonly q3: BigInteger\n private readonly mu: BigInteger\n private readonly m: BigInteger\n\n constructor(m: BigInteger) {\n // setup Barrett\n this.r2 = new BigInteger()\n this.q3 = new BigInteger()\n BigInteger.ONE.dlShiftTo(2 * m.t, this.r2)\n this.mu = this.r2.divide(m)\n this.m = m\n }\n\n convert(x: BigInteger): BigInteger {\n if (x.s < 0 || x.t > 2 * this.m.t) return x.mod(this.m)\n else if (x.compareTo(this.m) < 0) return x\n else {\n const r = new BigInteger()\n x.copyTo(r)\n this.reduce(r)\n return r\n }\n }\n\n revert(x: BigInteger): BigInteger {\n return x\n }\n\n // x = x mod m (HAC 14.42)\n reduce(x: BigInteger): void {\n x.drShiftTo(this.m.t - 1, this.r2)\n if (x.t > this.m.t + 1) {\n x.t = this.m.t + 1\n x.clamp()\n }\n this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3)\n this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2)\n while (x.compareTo(this.r2) < 0) x.dAddOffset(1, this.m.t + 1)\n x.subTo(this.r2, x)\n while (x.compareTo(this.m) >= 0) x.subTo(this.m, x)\n }\n\n // r = x^2 mod m; x !== r\n sqrTo(x: BigInteger, r: BigInteger): void {\n x.squareTo(r)\n this.reduce(r)\n }\n\n // r = x*y mod m; x,y !== r\n mulTo(x: BigInteger, y: BigInteger, r: BigInteger): void {\n x.multiplyTo(y, r)\n this.reduce(r)\n }\n}\n","// From: https://github.com/tracker1/cryptico-js/blob/57b32417967b9c9b75c47c04971f72a120b59a67/src/hash.js\n\nimport { ByteArray } from '../type'\n\n/**\n *\n * Secure Hash Algorithm (SHA256)\n * http://www.webtoolkit.info/\n *\n * Original code by Angel Marin, Paul Johnston.\n *\n **/\nexport function sha256(msg: string): string {\n const chrsz = 8\n const hexcase = 0\n\n function safe_add(x: number, y: number): number {\n const lsw = (x & 0xffff) + (y & 0xffff)\n const msw = (x >> 16) + (y >> 16) + (lsw >> 16)\n return (msw << 16) | (lsw & 0xffff)\n }\n\n function S(X: number, n: number): number {\n return (X >>> n) | (X << (32 - n))\n }\n function R(X: number, n: number): number {\n return X >>> n\n }\n function Ch(x: number, y: number, z: number): number {\n return (x & y) ^ (~x & z)\n }\n function Maj(x: number, y: number, z: number): number {\n return (x & y) ^ (x & z) ^ (y & z)\n }\n function Sigma0256(x: number): number {\n return S(x, 2) ^ S(x, 13) ^ S(x, 22)\n }\n function Sigma1256(x: number): number {\n return S(x, 6) ^ S(x, 11) ^ S(x, 25)\n }\n function Gamma0256(x: number): number {\n return S(x, 7) ^ S(x, 18) ^ R(x, 3)\n }\n function Gamma1256(x: number): number {\n return S(x, 17) ^ S(x, 19) ^ R(x, 10)\n }\n\n function core_sha256(m: ByteArray, l: number): ByteArray {\n const K = [\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,\n 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,\n 0xfc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,\n 0x6ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,\n 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,\n 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,\n ]\n const HASH = [\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c,\n 0x1f83d9ab, 0x5be0cd19,\n ]\n const W = new Array(64)\n let a, b, c, d, e, f, g, h\n let T1, T2\n\n m[l >> 5] |= 0x80 << (24 - (l % 32))\n m[(((l + 64) >> 9) << 4) + 15] = l\n\n for (let i = 0; i < m.length; i += 16) {\n a = HASH[0]\n b = HASH[1]\n c = HASH[2]\n d = HASH[3]\n e = HASH[4]\n f = HASH[5]\n g = HASH[6]\n h = HASH[7]\n\n for (let j = 0; j < 64; j++) {\n if (j < 16) W[j] = m[j + i]\n else\n W[j] = safe_add(\n safe_add(\n safe_add(Gamma1256(W[j - 2]), W[j - 7]),\n Gamma0256(W[j - 15]),\n ),\n W[j - 16],\n )\n\n T1 = safe_add(\n safe_add(safe_add(safe_add(h, Sigma1256(e)), Ch(e, f, g)), K[j]),\n W[j],\n )\n T2 = safe_add(Sigma0256(a), Maj(a, b, c))\n\n h = g\n g = f\n f = e\n e = safe_add(d, T1)\n d = c\n c = b\n b = a\n a = safe_add(T1, T2)\n }\n\n HASH[0] = safe_add(a, HASH[0])\n HASH[1] = safe_add(b, HASH[1])\n HASH[2] = safe_add(c, HASH[2])\n HASH[3] = safe_add(d, HASH[3])\n HASH[4] = safe_add(e, HASH[4])\n HASH[5] = safe_add(f, HASH[5])\n HASH[6] = safe_add(g, HASH[6])\n HASH[7] = safe_add(h, HASH[7])\n }\n return HASH\n }\n\n function str2binb(str: string): ByteArray {\n const bin: ByteArray = []\n const mask = (1 << chrsz) - 1\n for (let i = 0; i < str.length * chrsz; i += chrsz) {\n bin[i >> 5] |= (str.charCodeAt(i / chrsz) & mask) << (24 - (i % 32))\n }\n return bin\n }\n\n function binb2hex(binarray: ByteArray): string {\n const hex_tab = hexcase ? '0123456789ABCDEF' : '0123456789abcdef'\n let str = ''\n for (let i = 0; i < binarray.length * 4; i++) {\n str +=\n hex_tab.charAt((binarray[i >> 2] >> ((3 - (i % 4)) * 8 + 4)) & 0xf) +\n hex_tab.charAt((binarray[i >> 2] >> ((3 - (i % 4)) * 8)) & 0xf)\n }\n return str\n }\n\n msg = Utf8Encode(msg)\n return binb2hex(core_sha256(str2binb(msg), msg.length * chrsz))\n}\n\n/**\n *\n * Secure Hash Algorithm (SHA1)\n * http://www.webtoolkit.info/\n *\n **/\nexport function sha1(msg: string): string {\n function rotate_left(n: number, s: number): number {\n const t4 = (n << s) | (n >>> (32 - s))\n return t4\n }\n\n // function lsb_hex(val: number): string {\n // let str = ''\n // let vh\n // let vl\n //\n // for (let i = 0; i <= 6; i += 2) {\n // vh = (val >>> (i * 4 + 4)) & 0x0f\n // vl = (val >>> (i * 4)) & 0x0f\n // str += vh.toString(16) + vl.toString(16)\n // }\n // return str\n // }\n\n function cvt_hex(val: number): string {\n let str = ''\n let v\n\n for (let i = 7; i >= 0; i--) {\n v = (val >>> (i * 4)) & 0x0f\n str += v.toString(16)\n }\n return str\n }\n\n let blockstart\n let i, j\n const W = new Array(80)\n let H0 = 0x67452301\n let H1 = 0xefcdab89\n let H2 = 0x98badcfe\n let H3 = 0x10325476\n let H4 = 0xc3d2e1f0\n let A, B, C, D, E\n let temp\n\n msg = Utf8Encode(msg)\n\n const msg_len = msg.length\n\n const word_array = []\n for (i = 0; i < msg_len - 3; i += 4) {\n j =\n (msg.charCodeAt(i) << 24) |\n (msg.charCodeAt(i + 1) << 16) |\n (msg.charCodeAt(i + 2) << 8) |\n msg.charCodeAt(i + 3)\n word_array.push(j)\n }\n\n switch (msg_len % 4) {\n case 0:\n i = 0x080000000\n break\n case 1:\n i = (msg.charCodeAt(msg_len - 1) << 24) | 0x0800000\n break\n\n case 2:\n i =\n (msg.charCodeAt(msg_len - 2) << 24) |\n (msg.charCodeAt(msg_len - 1) << 16) |\n 0x08000\n break\n\n case 3:\n i =\n (msg.charCodeAt(msg_len - 3) << 24) |\n (msg.charCodeAt(msg_len - 2) << 16) |\n (msg.charCodeAt(msg_len - 1) << 8) |\n 0x80\n break\n }\n\n word_array.push(i)\n\n while (word_array.length % 16 !== 14) word_array.push(0)\n\n word_array.push(msg_len >>> 29)\n word_array.push((msg_len << 3) & 0x0ffffffff)\n\n for (blockstart = 0; blockstart < word_array.length; blockstart += 16) {\n for (i = 0; i < 16; i++) W[i] = word_array[blockstart + i]\n for (i = 16; i <= 79; i++)\n W[i] = rotate_left(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1)\n\n A = H0\n B = H1\n C = H2\n D = H3\n E = H4\n\n for (i = 0; i <= 19; i++) {\n temp =\n (rotate_left(A, 5) + ((B & C) | (~B & D)) + E + W[i] + 0x5a827999) &\n 0x0ffffffff\n E = D\n D = C\n C = rotate_left(B, 30)\n B = A\n A = temp\n }\n\n for (i = 20; i <= 39; i++) {\n temp =\n (rotate_left(A, 5) + (B ^ C ^ D) + E + W[i] + 0x6ed9eba1) & 0x0ffffffff\n E = D\n D = C\n C = rotate_left(B, 30)\n B = A\n A = temp\n }\n\n for (i = 40; i <= 59; i++) {\n temp =\n (rotate_left(A, 5) +\n ((B & C) | (B & D) | (C & D)) +\n E +\n W[i] +\n 0x8f1bbcdc) &\n 0x0ffffffff\n E = D\n D = C\n C = rotate_left(B, 30)\n B = A\n A = temp\n }\n\n for (i = 60; i <= 79; i++) {\n temp =\n (rotate_left(A, 5) + (B ^ C ^ D) + E + W[i] + 0xca62c1d6) & 0x0ffffffff\n E = D\n D = C\n C = rotate_left(B, 30)\n B = A\n A = temp\n }\n\n H0 = (H0 + A) & 0x0ffffffff\n H1 = (H1 + B) & 0x0ffffffff\n H2 = (H2 + C) & 0x0ffffffff\n H3 = (H3 + D) & 0x0ffffffff\n H4 = (H4 + E) & 0x0ffffffff\n }\n\n const ret =\n cvt_hex(H0) + cvt_hex(H1) + cvt_hex(H2) + cvt_hex(H3) + cvt_hex(H4)\n\n return ret.toLowerCase()\n}\n\n/**\n *\n * MD5 (Message-Digest Algorithm)\n * http://www.webtoolkit.info/\n *\n **/\nexport function md5(msg: string): string {\n function RotateLeft(lValue: number, iShiftBits: number): number {\n return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits))\n }\n\n function AddUnsigned(lX: number, lY: number): number {\n const lX8 = lX & 0x80000000\n const lY8 = lY & 0x80000000\n const lX4 = lX & 0x40000000\n const lY4 = lY & 0x40000000\n const lResult = (lX & 0x3fffffff) + (lY & 0x3fffffff)\n if (lX4 & lY4) {\n return lResult ^ 0x80000000 ^ lX8 ^ lY8\n }\n if (lX4 | lY4) {\n if (lResult & 0x40000000) {\n return lResult ^ 0xc0000000 ^ lX8 ^ lY8\n } else {\n return lResult ^ 0x40000000 ^ lX8 ^ lY8\n }\n } else {\n return lResult ^ lX8 ^ lY8\n }\n }\n\n function F(x: number, y: number, z: number): number {\n return (x & y) | (~x & z)\n }\n function G(x: number, y: number, z: number): number {\n return (x & z) | (y & ~z)\n }\n function H(x: number, y: number, z: number): number {\n return x ^ y ^ z\n }\n function I(x: number, y: number, z: number): number {\n return y ^ (x | ~z)\n }\n\n function FF(\n a: number,\n b: number,\n c: number,\n d: number,\n x: number,\n s: number,\n ac: number,\n ): number {\n a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac))\n return AddUnsigned(RotateLeft(a, s), b)\n }\n\n function GG(\n a: number,\n b: number,\n c: number,\n d: number,\n x: number,\n s: number,\n ac: number,\n ): number {\n a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac))\n return AddUnsigned(RotateLeft(a, s), b)\n }\n\n function HH(\n a: number,\n b: number,\n c: number,\n d: number,\n x: number,\n s: number,\n ac: number,\n ): number {\n a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac))\n return AddUnsigned(RotateLeft(a, s), b)\n }\n\n function II(\n a: number,\n b: number,\n c: number,\n d: number,\n x: number,\n s: number,\n ac: number,\n ): number {\n a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac))\n return AddUnsigned(RotateLeft(a, s), b)\n }\n\n function ConvertToWordArray(str: string): ByteArray {\n let lWordCount\n const lMessageLength = str.length\n const lNumberOfWords_temp1 = lMessageLength + 8\n const lNumberOfWords_temp2 =\n (lNumberOfWords_temp1 - (lNumberOfWords_temp1 % 64)) / 64\n const lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16\n const lWordArray: ByteArray = Array<number>(lNumberOfWords - 1)\n let lBytePosition = 0\n let lByteCount = 0\n while (lByteCount < lMessageLength) {\n lWordCount = (lByteCount - (lByteCount % 4)) / 4\n lBytePosition = (lByteCount % 4) * 8\n lWordArray[lWordCount] =\n lWordArray[lWordCount] | (str.charCodeAt(lByteCount) << lBytePosition)\n lByteCount++\n }\n lWordCount = (lByteCount - (lByteCount % 4)) / 4\n lBytePosition = (lByteCount % 4) * 8\n lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition)\n lWordArray[lNumberOfWords - 2] = lMessageLength << 3\n lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29\n return lWordArray\n }\n\n function WordToHex(lValue: number): string {\n let WordToHexValue = '',\n WordToHexValue_temp = '',\n lByte,\n lCount\n for (lCount = 0; lCount <= 3; lCount++) {\n lByte = (lValue >>> (lCount * 8)) & 255\n WordToHexValue_temp = '0' + lByte.toString(16)\n WordToHexValue =\n WordToHexValue +\n WordToHexValue_temp.substr(WordToHexValue_temp.length - 2, 2)\n }\n return WordToHexValue\n }\n\n let k, AA, BB, CC, DD, a, b, c, d\n const S11 = 7,\n S12 = 12,\n S13 = 17,\n S14 = 22\n const S21 = 5,\n S22 = 9,\n S23 = 14,\n S24 = 20\n const S31 = 4,\n S32 = 11,\n S33 = 16,\n S34 = 23\n const S41 = 6,\n S42 = 10,\n S43 = 15,\n S44 = 21\n\n msg = Utf8Encode(msg)\n\n const x = ConvertToWordArray(msg)\n\n a = 0x67452301\n b = 0xefcdab89\n c = 0x98badcfe\n d = 0x10325476\n\n for (k = 0; k < x.length; k += 16) {\n AA = a\n BB = b\n CC = c\n DD = d\n a = FF(a, b, c, d, x[k + 0], S11, 0xd76aa478)\n d = FF(d, a, b, c, x[k + 1], S12, 0xe8c7b756)\n c = FF(c, d, a, b, x[k + 2], S13, 0x242070db)\n b = FF(b, c, d, a, x[k + 3], S14, 0xc1bdceee)\n a = FF(a, b, c, d, x[k + 4], S11, 0xf57c0faf)\n d = FF(d, a, b, c, x[k + 5], S12, 0x4787c62a)\n c = FF(c, d, a, b, x[k + 6], S13, 0xa8304613)\n b = FF(b, c, d, a, x[k + 7], S14, 0xfd469501)\n a = FF(a, b, c, d, x[k + 8], S11, 0x698098d8)\n d = FF(d, a, b, c, x[k + 9], S12, 0x8b44f7af)\n c = FF(c, d, a, b, x[k + 10], S13, 0xffff5bb1)\n b = FF(b, c, d, a, x[k + 11], S14, 0x895cd7be)\n a = FF(a, b, c, d, x[k + 12], S11, 0x6b901122)\n d = FF(d, a, b, c, x[k + 13], S12, 0xfd987193)\n c = FF(c, d, a, b, x[k + 14], S13, 0xa679438e)\n b = FF(b, c, d, a, x[k + 15], S14, 0x49b40821)\n a = GG(a, b, c, d, x[k + 1], S21, 0xf61e2562)\n d = GG(d, a, b, c, x[k + 6], S22, 0xc040b340)\n c = GG(c, d, a, b, x[k + 11], S23, 0x265e5a51)\n b = GG(b, c, d, a, x[k + 0], S24, 0xe9b6c7aa)\n a = GG(a, b, c, d, x[k + 5], S21, 0xd62f105d)\n d = GG(d, a, b, c, x[k + 10], S22, 0x2441453)\n c = GG(c, d, a, b, x[k + 15], S23, 0xd8a1e681)\n b = GG(b, c, d, a, x[k + 4], S24, 0xe7d3fbc8)\n a = GG(a, b, c, d, x[k + 9], S21, 0x21e1cde6)\n d = GG(d, a, b, c, x[k + 14], S22, 0xc33707d6)\n c = GG(c, d, a, b, x[k + 3], S23, 0xf4d50d87)\n b = GG(b, c, d, a, x[k + 8], S24, 0x455a14ed)\n a = GG(a, b, c, d, x[k + 13], S21, 0xa9e3e905)\n d = GG(d, a, b, c, x[k + 2], S22, 0xfcefa3f8)\n c = GG(c, d, a, b, x[k + 7], S23, 0x676f02d9)\n b = GG(b, c, d, a, x[k + 12], S24, 0x8d2a4c8a)\n a = HH(a, b, c, d, x[k + 5], S31, 0xfffa3942)\n d = HH(d, a, b, c, x[k + 8], S32, 0x8771f681)\n c = HH(c, d, a, b, x[k + 11], S33, 0x6d9d6122)\n b = HH(b, c, d, a, x[k + 14], S34, 0xfde5380c)\n a = HH(a, b, c, d, x[k + 1], S31, 0xa4beea44)\n d = HH(d, a, b, c, x[k + 4], S32, 0x4bdecfa9)\n c = HH(c, d, a, b, x[k + 7], S33, 0xf6bb4b60)\n b = HH(b, c, d, a, x[k + 10], S34, 0xbebfbc70)\n a = HH(a, b, c, d, x[k + 13], S31, 0x289b7ec6)\n d = HH(d, a, b, c, x[k + 0], S32, 0xeaa127fa)\n c = HH(c, d, a, b, x[k + 3], S33, 0xd4ef3085)\n b = HH(b, c, d, a, x[k + 6], S34, 0x4881d05)\n a = HH(a, b, c, d, x[k + 9], S31, 0xd9d4d039)\n d = HH(d, a, b, c, x[k + 12], S32, 0xe6db99e5)\n c = HH(c, d, a, b, x[k + 15], S33, 0x1fa27cf8)\n b = HH(b, c, d, a, x[k + 2], S34, 0xc4ac5665)\n a = II(a, b, c, d, x[k + 0], S41, 0xf4292244)\n d = II(d, a, b, c, x[k + 7], S42, 0x432aff97)\n c = II(c, d, a, b, x[k + 14], S43, 0xab9423a7)\n b = II(b, c, d, a, x[k + 5], S44, 0xfc93a039)\n a = II(a, b, c, d, x[k + 12], S41, 0x655b59c3)\n d = II(d, a, b, c, x[k + 3], S42, 0x8f0ccc92)\n c = II(c, d, a, b, x[k + 10], S43, 0xffeff47d)\n b = II(b, c, d, a, x[k + 1], S44, 0x85845dd1)\n a = II(a, b, c, d, x[k + 8], S41, 0x6fa87e4f)\n d = II(d, a, b, c, x[k + 15], S42, 0xfe2ce6e0)\n c = II(c, d, a, b, x[k + 6], S43, 0xa3014314)\n b = II(b, c, d, a, x[k + 13], S44, 0x4e0811a1)\n a = II(a, b, c, d, x[k + 4], S41, 0xf7537e82)\n d = II(d, a, b, c, x[k + 11], S42, 0xbd3af235)\n c = II(c, d, a, b, x[k + 2], S43, 0x2ad7d2bb)\n b = II(b, c, d, a, x[k + 9], S44, 0xeb86d391)\n a = AddUnsigned(a, AA)\n b = AddUnsigned(b, BB)\n c = AddUnsigned(c, CC)\n d = AddUnsigned(d, DD)\n }\n\n const temp = WordToHex(a) + WordToHex(b) + WordToHex(c) + WordToHex(d)\n\n return temp.toLowerCase()\n}\n\nfunction Utf8Encode(str: string): string {\n str = str.replace(/\\r\\n/g, '\\n')\n let utftext = ''\n\n for (let n = 0; n < str.length; n++) {\n const c = str.charCodeAt(n)\n\n if (c < 128) {\n utftext += String.fromCharCode(c)\n } else if (c > 127 && c < 2048) {\n utftext += String.fromCharCode((c >> 6) | 192)\n utftext += String.fromCharCode((c & 63) | 128)\n } else {\n utftext += String.fromCharCode((c >> 12) | 224)\n utftext += String.fromCharCode(((c >> 6) & 63) | 128)\n utftext += String.fromCharCode((c & 63) | 128)\n }\n }\n\n return utftext\n}\n","import * as native from './native'\nimport * as node from './node'\n\nexport type HashFunc = (s: string) => string\n\nexport const sha256 = (\n process.env.NODEJS ? node.sha256 : native.sha256\n) as HashFunc\n\nexport const sha1 = (process.env.NODEJS ? node.sha1 : native.sha1) as HashFunc\n\nexport const md5 = (process.env.NODEJS ? node.md5 : native.md5) as HashFunc\n","import crypto from 'crypto'\n\nexport function sha256(msg: string): string {\n return crypto.createHash('sha256').update(msg, 'utf8').digest('hex')\n}\n\nexport function sha1(msg: string): string {\n return crypto.createHash('sha1').update(msg, 'utf8').digest('hex')\n}\n\nexport function md5(msg: string): string {\n return crypto.createHash('md5').update(msg, 'utf8').digest('hex')\n}\n","// Depends on jsbn.js and rng.js\n// Version 1.1: support utf-8 encoding in pkcs1pad2\n// convert a (hex) string to a bignum object\n\nimport { BigInteger } from './jsbn'\nimport { SecureRandom, SeededRandom } from './random'\nimport { sha1, sha256 } from './hash'\n\nexport function parseBigInt(str: string, r: number): BigInteger {\n return new BigInteger(str, r)\n}\n\nexport function linebrk(s: string, n: number): string {\n let ret = ''\n let i = 0\n while (i + n < s.length) {\n ret += s.substring(i, i + n) + '\\n'\n i += n\n }\n return ret + s.substring(i, s.length)\n}\n\nexport function byte2Hex(b: number): string {\n if (b < 0x10) return '0' + b.toString(16)\n else return b.toString(16)\n}\n\n// PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint\nexport function pkcs1pad2(s: string, n: number): BigInteger {\n if (n < s.length + 11) {\n // TODO: fix for utf-8\n //throw \"Message too long for RSA (n=\" + n + \", l=\" + s.length + \")\"\n //return null;\n throw 'Message too long for RSA (n=' + n + ', l=' + s.length + ')'\n }\n const ba = []\n let i = s.length - 1\n while (i >= 0 && n > 0) {\n const c = s.charCodeAt(i--)\n if (c < 128) {\n // encode using utf-8\n ba[--n] = c\n } else if (c > 127 && c < 2048) {\n ba[--n] = (c & 63) | 128\n ba[--n] = (c >> 6) | 192\n } else {\n ba[--n] = (c & 63) | 128\n ba[--n] = ((c >> 6) & 63) | 128\n ba[--n] = (c >> 12) | 224\n }\n }\n ba[--n] = 0\n const rng = new SecureRandom()\n const x = []\n while (n > 2) {\n // random non-zero pad\n x[0] = 0\n while (x[0] === 0) rng.nextBytes(x)\n ba[--n] = x[0]\n }\n ba[--n] = 2\n ba[--n] = 0\n return new BigInteger(ba)\n}\n\ntype RSAKeyKey = 'n' | 'e' | 'd' | 'p' | 'q' | 'dmp1' | 'dmq1' | 'coeff'\n\n// \"empty\" RSA key constructor\nexport class RSAKey {\n n = new BigInteger()\n e = 0\n private d = new BigInteger()\n private p = new BigInteger()\n private q = new BigInteger()\n private dmp1 = new BigInteger()\n private dmq1 = new BigInteger()\n private coeff = new BigInteger()\n\n // Return the PKCS#1 RSA encryption of \"text\" as a Base64-encoded string\n // encryptB64(text: string): string | null {\n // const h = this.encrypt(text)\n // if (h) return hex2b64(h)\n // else return null\n // }\n\n // Set the public key fields N and e from hex strings\n setPublic(N: string, E: string): void {\n if (N && E) {\n this.n = parseBigInt(N, 16)\n this.e = parseInt(E, 16)\n } else throw 'Invalid RSA public key'\n }\n\n // Perform raw public operation on \"x\": return x^e (mod n)\n doPublic(x: BigInteger): BigInteger {\n return x.modPowInt(this.e, this.n)\n }\n\n // Return the PKCS#1 RSA encryption of \"text\" as an even-length hex string\n encrypt(text: string): string {\n const m = pkcs1pad2(text, (this.n.bitLength() + 7) >> 3)\n // if (!m) return null\n const c = this.doPublic(m)\n // if (!c) return null\n const h = c.toString(16)\n if ((h.length & 1) === 0) return h\n else return '0' + h\n }\n\n // Set the private key fields N, e, and d from hex strings\n setPrivate(N: string, E: string, D: string): void {\n if (!N && !E && N.length > 0 && E.length > 0) {\n this.n = parseBigInt(N, 16)\n this.e = parseInt(E, 16)\n this.d = parseBigInt(D, 16)\n } else throw 'Invalid RSA private key'\n }\n\n // Set the private key fields N, e, d and CRT params from hex strings\n setPrivateEx(\n N: string,\n E: string,\n D: string,\n P: string,\n Q: string,\n DP: string,\n DQ: string,\n C: string,\n ): void {\n if (!N && !E && N.length > 0 && E.length > 0) {\n this.n = parseBigInt(N, 16)\n this.e = parseInt(E, 16)\n this.d = parseBigInt(D, 16)\n this.p = parseBigInt(P, 16)\n this.q = parseBigInt(Q, 16)\n this.dmp1 = parseBigInt(DP, 16)\n this.dmq1 = parseBigInt(DQ, 16)\n this.coeff = parseBigInt(C, 16)\n } else throw new Error('Invalid RSA private key')\n }\n\n // Generate a new random private key B bits long, using public expt E\n generate(B: number, E: string): void {\n const rng = new SeededRandom()\n const qs = B >> 1\n this.e = parseInt(E, 16)\n const ee = new BigInteger(E, 16)\n for (;;) {\n for (;;) {\n this.p = new BigInteger(B - qs, 1, rng)\n if (\n this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) ===\n 0 &&\n this.p.isProbablePrime(10)\n )\n break\n }\n for (;;) {\n this.q = new BigInteger(qs, 1, rng)\n if (\n this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) ===\n 0 &&\n this.q.isProbablePrime(10)\n )\n break\n }\n if (this.p.compareTo(this.q) <= 0) {\n const t = this.p\n this.p = this.q\n this.q = t\n }\n const p1 = this.p.subtract(BigInteger.ONE)\n const q1 = this.q.subtract(BigInteger.ONE)\n const phi = p1.multiply(q1)\n if (phi.gcd(ee).compareTo(BigInteger.ONE) === 0) {\n this.n = this.p.multiply(this.q)\n this.d = ee.modInverse(phi)\n this.dmp1 = this.d.mod(p1)\n this.dmq1 = this.d.mod(q1)\n this.coeff = this.q.modInverse(this.p)\n break\n }\n }\n }\n\n // Perform raw private operation on \"x\": return x^d (mod n)\n protected doPrivate(x: BigInteger): BigInteger {\n if (!this.p || !this.q) return x.modPow(this.d, this.n)\n // TODO: re-calculate any missing CRT params\n let xp = x.mod(this.p).modPow(this.dmp1, this.p)\n const xq = x.mod(this.q).modPow(this.dmq1, this.q)\n while (xp.compareTo(xq) < 0) xp = xp.add(this.p)\n return xp\n .subtract(xq)\n .multiply(this.coeff)\n .mod(this.p)\n .multiply(this.q)\n .add(xq)\n }\n\n // Return the PKCS#1 RSA decryption of \"ctext\".\n // \"ctext\" is an even-length hex string and the output is a plain string.\n decrypt(ctext: string): string | null {\n const c = parseBigInt(ctext, 16)\n const m = this.doPrivate(c)\n if (!(m instanceof BigInteger)) return null\n return pkcs1unpad2(m, (this.n.bitLength() + 7) >> 3)\n }\n\n signString = _rsasign_signString\n signStringWithSHA1 = _rsasign_signStringWithSHA1\n signStringWithSHA256 = _rsasign_signStringWithSHA256\n verifyHexSignatureForMessage = _rsasign_verifyHexSignatureForMessage\n verifyString = _rsasign_verifyString\n\n toJSON(): string {\n return JSON.stringify({\n coeff: this.coeff.toString(16),\n d: this.d.toString(16),\n dmp1: this.dmp1.toString(16),\n dmq1: this.dmq1.toString(16),\n e: this.e.toString(16),\n n: this.n.toString(16),\n p: this.p.toString(16),\n q: this.q.toString(16),\n })\n }\n\n static parse(key: string | Record<RSAKeyKey, string>): RSAKey | null {\n const json = (typeof key === 'string' ? JSON.parse(key) : key) as Record<\n RSAKeyKey,\n string\n >\n if (!json) {\n return null\n }\n\n const rsa = new RSAKey()\n rsa.setPrivateEx(\n json.n,\n json.e,\n json.d,\n json.p,\n json.q,\n json.dmp1,\n json.dmq1,\n json.coeff,\n )\n\n return rsa\n }\n}\n\n// Version 1.1: support utf-8 decoding in pkcs1unpad2\n// Undo PKCS#1 (type 2, random) padding and, if valid, return the plaintext\nexport function pkcs1unpad2(d: BigInteger, n: number): string | null {\n const b = d.toByteArray()\n let i = 0\n while (i < b.length && b[i] === 0) ++i\n if (b.length - i !== n - 1 || b[i] !== 2) return null\n ++i\n while (b[i] !== 0) if (++i >= b.length) return null\n let ret = ''\n while (++i < b.length) {\n const c = b[i] & 255\n if (c < 128) {\n // utf-8 decode\n ret += String.fromCharCode(c)\n } else if (c > 191 && c < 224) {\n ret += String.fromCharCode(((c & 31) << 6) | (b[i + 1] & 63))\n ++i\n } else {\n ret += String.fromCharCode(\n ((c & 15) << 12) | ((b[i + 1] & 63) << 6) | (b[i + 2] & 63),\n )\n i += 2\n }\n }\n return ret\n}\n\n//\n// rsa-sign.js - adding signing functions to RSAKey class.\n//\n//\n// version: 1.0 (2010-Jun-03)\n//\n// Copyright (c) 2010 Kenji Urushima (kenji.urushima@gmail.com)\n//\n// This software is licensed under the terms of the MIT License.\n// http://www.opensource.org/licenses/mit-license.php\n//\n// The above copyright and license notice shall be\n// included in all copies or substantial portions of the Software.\n//\n// Depends on:\n// function sha1(s) of sha1.js\n// jsbn.js\n// jsbn2.js\n// rsa.js\n// rsa2.js\n//\n// keysize / pmstrlen\n// 512 / 128\n// 1024 / 256\n// 2048 / 512\n// 4096 / 1024\n// As for _RSASGIN_DIHEAD values for each hash algorithm, see PKCS#1 v2.1 spec (p38).\nconst _RSASIGN_DIHEAD = <const>{\n sha1: '3021300906052b0e03021a05000414',\n sha256: '3031300d060960864801650304020105000420',\n // md2: '3020300c06082a864886f70d020205000410',\n // md5: '3020300c06082a864886f70d020505000410',\n // sha384: '3041300d060960864801650304020205000430',\n // sha512: '3051300d060960864801650304020305000440',\n}\nconst _RSASIGN_HASHHEXFUNC = <const>{\n sha1,\n sha256,\n}\ntype HashAlg = keyof typeof _RSASIGN_HASHHEXFUNC\n\n// ========================================================================\n// Signature Generation\n// ========================================================================\n\nfunction _rsasign_getHexPaddedDigestInfoForString(\n s: string,\n keySize: number,\n hashAlg: HashAlg,\n): string {\n const pmStrLen = keySize / 4\n const hashFunc = _RSASIGN_HASHHEXFUNC[hashAlg]\n const sHashHex = hashFunc(s)\n\n const sHead = '0001'\n const sTail = '00' + _RSASIGN_DIHEAD[hashAlg] + sHashHex\n let sMid = ''\n const fLen = pmStrLen - sHead.length - sTail.length\n for (let i = 0; i < fLen; i += 2) {\n sMid += 'ff'\n }\n const sPaddedMessageHex = sHead + sMid + sTail\n return sPaddedMessageHex\n}\n\nfunction _rsasign_signString(\n this: RSAKey,\n s: string,\n hashAlg: HashAlg,\n): string {\n const hPM = _rsasign_getHexPaddedDigestInfoForString(\n s,\n this.n.bitLength(),\n hashAlg,\n )\n const biPaddedMessage = parseBigInt(hPM, 16)\n const biSign = this.doPrivate(biPaddedMessage)\n const hexSign = biSign.toString(16)\n return hexSign\n}\n\nfunction _rsasign_signStringWithSHA1(this: RSAKey, s: string): string {\n const hPM = _rsasign_getHexPaddedDigestInfoForString(\n s,\n this.n.bitLength(),\n 'sha1',\n )\n const biPaddedMessage = parseBigInt(hPM, 16)\n const biSign = this.doPrivate(biPaddedMessage)\n const hexSign = biSign.toString(16)\n return hexSign\n}\n\nfunction _rsasign_signStringWithSHA256(this: RSAKey, s: string): string {\n const hPM = _rsasign_getHexPaddedDigestInfoForString(\n s,\n this.n.bitLength(),\n 'sha256',\n )\n const biPaddedMessage = parseBigInt(hPM, 16)\n const biSign = this.doPrivate(biPaddedMessage)\n const hexSign = biSign.toString(16)\n return hexSign\n}\n\n// ========================================================================\n// Signature Verification\n// ========================================================================\n\nfunction _rsasign_getDecryptSignatureBI(\n biSig: BigInteger,\n hN: string,\n hE: string,\n): BigInteger {\n const rsa = new RSAKey()\n rsa.setPublic(hN, hE)\n const biDecryptedSig = rsa.doPublic(biSig)\n return biDecryptedSig\n}\n\nfunction _rsasign_getHexDigestInfoFromSig(\n biSig: BigInteger,\n hN: string,\n hE: string,\n): string {\n const biDecryptedSig = _rsasign_getDecryptSignatureBI(biSig, hN, hE)\n const hDigestInfo = biDecryptedSig.toString(16).replace(/^1f+00/, '')\n return hDigestInfo\n}\n\nfunction _rsasign_getAlgNameAndHashFromHexDisgestInfo(\n hDigestInfo: string,\n): [HashAlg, string] | [] {\n for (const algName in _RSASIGN_DIHEAD) {\n const head = _RSASIGN_DIHEAD[algName as HashAlg]\n const len = head.length\n if (hDigestInfo.substring(0, len) === head) {\n return [algName as HashAlg, hDigestInfo.substring(len)]\n }\n }\n return []\n}\n\nfunction _rsasign_verifySignatureWithArgs(\n sMsg: string,\n biSig: BigInteger,\n hN: string,\n hE: string,\n): boolean {\n const hDigestInfo = _rsasign_getHexDigestInfoFromSig(biSig, hN, hE)\n const digestInfoAry =\n _rsasign_getAlgNameAndHashFromHexDisgestInfo(hDigestInfo)\n if (digestInfoAry.length === 0) return false\n const algName = digestInfoAry[0]\n const diHashValue = digestInfoAry[1]\n const ff = _RSASIGN_HASHHEXFUNC[algName]\n const msgHashValue = ff(sMsg)\n return diHashValue === msgHashValue\n}\n\nfunction _rsasign_verifyHexSignatureForMessage(\n this: RSAKey,\n sMsg: string,\n hSig: string,\n): boolean {\n const biSig = parseBigInt(hSig, 16)\n const result = _rsasign_verifySignatureWithArgs(\n sMsg,\n biSig,\n this.n.toString(16),\n this.e.toString(16),\n )\n return result\n}\n\nfunction _rsasign_verifyString(\n this: RSAKey,\n sMsg: string,\n hSig: string,\n): boolean {\n hSig = hSig.replace(/[ \\n]+/g, '')\n const biSig = parseBigInt(hSig, 16)\n const biDecryptedSig = this.doPublic(biSig)\n const hDigestInfo = biDecryptedSig.toString(16).replace(/^1f+00/, '')\n const digestInfoAry =\n _rsasign_getAlgNameAndHashFromHexDisgestInfo(hDigestInfo)\n\n if (digestInfoAry.length === 0) return false\n const algName = digestInfoAry[0]\n const diHashValue = digestInfoAry[1]\n const ff = _RSASIGN_HASHHEXFUNC[algName]\n const msgHashValue = ff(sMsg)\n return diHashValue === msgHashValue\n}\n","import { aes, AESKey } from './aes'\nimport { int2char } from './jsbn'\nimport { math, SecureRandom } from './random'\nimport { md5, sha256 } from './hash'\nimport { RSAKey } from './rsa'\nimport { ByteArray } from './type'\n\nconst base64Chars =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nconst magic = '::52cee64bb3a38f6403386519a39ac91c::'\n\naes.Init()\n\ntype DecryptStatusSuccessForSignature<Signature> = {\n status: 'success'\n plaintext: string\n signature: Signature\n publicKeyString: Signature extends 'unsigned' ? never : string\n}\ntype DecryptStatusSuccess =\n | DecryptStatusSuccessForSignature<'unsigned'>\n | DecryptStatusSuccessForSignature<'verified' | 'forged'>\ntype DecryptStatusFailure = { status: 'Invalid public key' | 'failure' }\n\nexport class cryptico {\n static b256to64(t: string): string {\n let a = 0, // Should be reassigned before read\n c,\n n\n let r = '',\n // l = 0,\n s = 0\n const tl = t.length\n for (n = 0; n < tl; n++) {\n c = t.charCodeAt(n)\n if (s === 0) {\n r += base64Chars.charAt((c >> 2) & 63)\n a = (c & 3) << 4\n } else if (s === 1) {\n r += base64Chars.charAt(a | ((c >> 4) & 15))\n a = (c & 15) << 2\n } else if (s === 2) {\n r += base64Chars.charAt(a | ((c >> 6) & 3))\n // l += 1\n r += base64Chars.charAt(c & 63)\n }\n // l += 1\n s += 1\n if (s === 3) s = 0\n }\n if (s > 0) {\n r += base64Chars.charAt(a)\n // l += 1\n r += '='\n // l += 1\n }\n if (s === 1) {\n r += '='\n }\n return r\n }\n\n static b64to256(t: string): string {\n let c, n\n let r = '',\n s = 0,\n a = 0\n const tl = t.length\n for (n = 0; n < tl; n++) {\n c = base64Chars.indexOf(t.charAt(n))\n if (c >= 0) {\n if (s) r += String.fromCharCode(a | ((c >> (6 - s)) & 255))\n s = (s + 2) & 7\n a = (c << s) & 255\n }\n }\n return r\n }\n\n static b16to64(h: string): string {\n let i\n let c\n let ret = ''\n if (h.length % 2 === 1) {\n h = '0' + h\n }\n for (i = 0; i + 3 <= h.length; i += 3) {\n c = parseInt(h.substring(i, i + 3), 16)\n ret += base64Chars.charAt(c >> 6) + base64Chars.charAt(c & 63)\n }\n if (i + 1 === h.length) {\n c = parseInt(h.substring(i, i + 1), 16)\n ret += base64Chars.charAt(c << 2)\n } else if (i + 2 === h.length) {\n c = parseInt(h.substring(i, i + 2), 16)\n ret += base64Chars.charAt(c >> 2) + base64Chars.charAt((c & 3) << 4)\n }\n while ((ret.length & 3) > 0) ret += '='\n return ret\n }\n\n static b64to16(s: string): string {\n let ret = ''\n let i\n let k = 0\n let slop = 0 // Should be reassigned before read\n for (i = 0; i < s.length; ++i) {\n if (s.charAt(i) === '=') break\n const v = base64Chars.indexOf(s.charAt(i))\n if (v < 0) continue\n if (k === 0) {\n ret += int2char(v >> 2)\n slop = v & 3\n k = 1\n } else if (k === 1) {\n ret += int2char((slop << 2) | (v >> 4))\n slop = v & 0xf\n k = 2\n } else if (k === 2) {\n ret += int2char(slop)\n ret += int2char(v >> 2)\n slop = v & 3\n k = 3\n } else {\n ret += int2char((slop << 2) | (v >> 4))\n ret += int2char(v & 0xf)\n k = 0\n }\n }\n if (k === 1) ret += int2char(slop << 2)\n return ret\n }\n\n // Converts a string to a byte array.\n static string2bytes(str: string): ByteArray {\n const bytes = []\n for (let i = 0; i < str.length; i++) {\n bytes.push(str.charCodeAt(i))\n }\n return bytes\n }\n\n // Converts a byte array to a string.\n static bytes2string(bytes: ByteArray): string {\n let str = ''\n for (let i = 0; i < bytes.length; i++) {\n str += String.fromCharCode(bytes[i])\n }\n return str\n }\n\n // Converts a UTF-8 string to ASCII string.\n static utf82string(str: string): string {\n return unescape(encodeURIComponent(str))\n }\n\n // Converts ascii string to a UTF-8 string.\n static string2utf8(uriencoded: string): string {\n return decodeURIComponent(escape(uriencoded))\n }\n\n // Converts a UTF-8 string to a byte array.\n static utf82bytes(str: string): ByteArray {\n const uriencoded = unescape(encodeURIComponent(str))\n return this.string2bytes(uriencoded)\n }\n\n // Converts a byte array to a UTF-8 string.\n static bytes2utf8(bytes: ByteArray): string {\n const uriencoded = this.bytes2string(bytes)\n return decodeURIComponent(escape(uriencoded))\n }\n\n // Returns a XOR b, where a and b are 16-byte byte arrays.\n static blockXOR(a: ByteArray, b: ByteArray): ByteArray {\n const xor = new Array(16) as ByteArray\n for (let i = 0; i < 16; i++) {\n xor[i] = a[i] ^ b[i]\n }\n return xor\n }\n\n // Returns a 16-byte initialization vector.\n static blockIV(): ByteArray {\n const r = new SecureRandom()\n const IV = new Array(16) as ByteArray\n r.nextBytes(IV)\n return IV\n }\n\n // Returns a copy of bytes with zeros appended to the end\n // so that the (length of bytes) % 16 === 0.\n static pad16(bytes: ByteArray): ByteArray {\n const newBytes = bytes.slice(0)\n const padding = (16 - (bytes.length % 16)) % 16\n for (let i = bytes.length; i < bytes.length + padding; i++) {\n newBytes.push(0)\n }\n return newBytes\n }\n\n // Removes trailing zeros from a byte array.\n static depad(bytes: ByteArray): ByteArray {\n let newBytes = bytes.slice(0)\n while (newBytes[newBytes.length - 1] === 0) {\n newBytes = newBytes.slice(0, newBytes.length - 1)\n }\n return newBytes\n }\n\n // AES CBC Encryption.\n static encryptAESCBC(plaintext: string, key: AESKey): string {\n const exkey = key.slice(0)\n aes.ExpandKey(exkey)\n let blocks = this.utf82bytes(plaintext)\n blocks = this.pad16(blocks)\n let encryptedBlocks = this.blockIV()\n for (let i = 0; i < blocks.length / 16; i++) {\n let tempBlock = blocks.slice(i * 16, i * 16 + 16)\n const prevBlock = encryptedBlocks.slice(i * 16, i * 16 + 16)\n tempBlock = this.blockXOR(prevBlock, tempBlock)\n aes.Encrypt(tempBlock, exkey)\n encryptedBlocks = encryptedBlocks.concat(tempBlock)\n }\n const ciphertext = this.bytes2string(encryptedBlocks)\n return this.b256to64(ciphertext)\n }\n\n // AES CBC Decryption.\n static decryptAESCBC(encryptedText: string, key: AESKey): string {\n const exkey = key.slice(0)\n aes.ExpandKey(exkey)\n const asciiText = this.b64to256(encryptedText)\n const encryptedBlocks = this.string2bytes(asciiText)\n let decryptedBlocks: ByteArray = []\n for (let i = 1; i < encryptedBlocks.length / 16; i++) {\n let tempBlock = encryptedBlocks.slice(i * 16, i * 16 + 16)\n const prevBlock = encryptedBlocks.slice((i - 1) * 16, (i - 1) * 16 + 16)\n aes.Decrypt(tempBlock, exkey)\n tempBlock = this.blockXOR(prevBlock, tempBlock)\n decryptedBlocks = decryptedBlocks.concat(tempBlock)\n }\n decryptedBlocks = this.depad(decryptedBlocks)\n return this.bytes2utf8(decryptedBlocks)\n }\n\n // Wraps a str to 60 characters.\n static wrap60(str: string): string {\n let outstr = ''\n for (let i = 0; i < str.length; i++) {\n if (i % 60 === 0 && i !== 0) outstr += '\\n'\n outstr += str[i]\n }\n return outstr\n }\n\n // Generate a random key for the AES-encrypted message. ciphertext.split\n static generateAESKey(): AESKey {\n const key = new Array(32) as ByteArray\n const r = new SecureRandom()\n r.nextBytes(key)\n return key\n }\n\n // Generates an RSA key from a passphrase.\n static generateRSAKey(passphrase: string, bitlength: number): RSAKey {\n math.seedrandom(sha256(passphrase))\n const rsa = new RSAKey()\n rsa.generate(bitlength, '03')\n return rsa\n }\n\n // Returns the ascii-armored version of the public key.\n static publicKeyString(rsakey: RSAKey): string {\n return this.b16to64(rsakey.n.toString(16))\n }\n\n // Returns an MD5 sum of a publicKeyString for easier identification.\n static publicKeyID(publicKeyString: string): string {\n return md5(publicKeyString)\n }\n\n static publicKeyFromString(str: string): RSAKey {\n const N = this.b64to16(str.split('|')[0])\n const E = '03'\n const rsa = new RSAKey()\n rsa.setPublic(N, E)\n return rsa\n }\n\n static encrypt(\n plaintext: string,\n publickeystring: string,\n signingkey: RSAKey,\n ): { status: string } | { status: 'success'; cipher: string } {\n {\n let cipherblock = ''\n const aeskey = this.generateAESKey()\n try {\n const publickey = this.publicKeyFromString(publickeystring)\n cipherblock +=\n this.b16to64(publickey.encrypt(this.bytes2string(aeskey))) + '?'\n } catch (err) {\n return { status: 'Invalid public key' }\n }\n if (signingkey) {\n const signString = this.sign(plaintext, signingkey)\n plaintext += magic\n plaintext += this.publicKeyString(signingkey)\n plaintext += magic\n plaintext += signString\n }\n cipherblock += this.encryptAESCBC(plaintext, aeskey)\n return { status: 'success', cipher: cipherblock }\n }\n }\n\n static decrypt(\n ciphertext: string,\n key: RSAKey,\n ): DecryptStatusSuccess | DecryptStatusFailure {\n const cipherblock = ciphertext.split('?')\n const aeskey = key.decrypt(this.b64to16(cipherblock[0]))\n if (aeskey == null) {\n return { status: 'failure' }\n }\n const aeskeyBytes = this.string2bytes(aeskey)\n const plaintext = this.decryptAESCBC(cipherblock[1], aeskeyBytes).split(\n magic,\n )\n if (plaintext.length > 1) {\n return this._confirm(plaintext)\n } else\n return {\n status: 'success',\n plaintext: plaintext[0],\n signature: 'unsigned',\n } as DecryptStatusSuccessForSignature<'unsigned'>\n }\n\n static sign(plaintext: string, signingkey: RSAKey): string {\n return this.b16to64(signingkey.signString(plaintext, 'sha256'))\n }\n\n static verify(plaintext: string[]): boolean {\n const result = this._confirm(plaintext)\n return result.status === 'success' && result.signature === 'verified'\n }\n\n private static _confirm(\n plaintext: string[],\n ): DecryptStatusSuccess | DecryptStatusFailure {\n if (plaintext.length === 3) {\n const publickey = this.publicKeyFromString(plaintext[1])\n const signature = this.b64to16(plaintext[2])\n if (publickey.verifyString(plaintext[0], signature)) {\n return {\n status: 'success',\n plaintext: plaintext[0],\n signature: 'verified',\n publicKeyString: this.publicKeyString(publickey),\n }\n } else {\n return {\n status: 'success',\n plaintext: plaintext[0],\n signature: 'forged',\n publicKeyString: this.publicKeyString(publickey),\n }\n }\n } else {\n return {\n status: 'failure',\n }\n }\n }\n}\n"],"names":["aes","Sbox","ShiftRowTab","Sbox_Inv","Array","ShiftRowTab_Inv","xtime","[object Object]","i","this","length","key","kl","ks","Rcon","temp","slice","j","block","l","AddRoundKey","SubBytes","ShiftRows","MixColumns","MixColumns_Inv","state","sbox","rkey","shifttab","h","concat","s0","s1","s2","s3","xh","h1","h2","pool","width","significance","Math","pow","overflow","startdenom","math","seed","use_entropy","mixkey","flatten","arguments","Date","getTime","arc4","ARC4","S","random","n","g","d","x","t","u","keylen","lowbits","count","s","r","obj","depth","result","typ","prop","indexOf","push","e","console","error","seedStr","smear","charCodeAt","mixed","forEach","v","String","fromCharCode","SeededRandom","ba","floor","Arcfour","rng_state","rng_pptr","rng_pool","rng_seed_time","rng_get_byte","init","next","SecureRandom","op_and","y","op_or","op_xor","op_andnot","BigInteger","BI_FP","a","b","c","fromNumber","fromInt","fromString","w","xl","m","DV","k","fromRadix","mi","sh","intAt","charAt","DB","clamp","ZERO","subTo","DM","negate","toString","toRadix","km","p","int2char","nbits","max","bs","cbs","bm","ds","min","abs","am","q","pm","pt","copyTo","ts","ms","nsh","lShiftTo","ys","y0","yt","F1","F2","d1","FV","d2","dlShiftTo","compareTo","ONE","qd","drShiftTo","rShiftTo","divRemTo","undefined","z","convert","r2","sqrTo","mulTo","revert","isEven","Classic","Montgomery","exp","LN2","log","signum","cs","chunkSize","intValue","substr","dMultiply","dAddOffset","testBit","bitwiseTo","shiftLeft","isProbablePrime","bitLength","nextBytes","op","f","lbit","cbit","changeBit","addTo","multiplyTo","squareTo","NullExp","Barrett","k1","g2","is1","clone","getLowestSetBit","ac","subtract","add","lowprimes","lplim","modInt","millerRabin","n1","shiftRight","modPow","modPowInt","BI_RC","rr","vv","mod","reduce","mp","invDigit","mpl","mph","um","mt2","u0","nNop","q3","mu","divide","multiplyUpperTo","multiplyLowerTo","Utf8Encode","str","replace","utftext","sha256","process","env","NODEJS","msg","crypto","createHash","update","digest","safe_add","lsw","X","R","Ch","Maj","Sigma0256","Sigma1256","Gamma0256","binarray","hex_tab","binb2hex","K","HASH","W","T1","T2","core_sha256","bin","str2binb","sha1","rotate_left","cvt_hex","val","blockstart","A","B","C","D","E","H0","H1","H2","H3","H4","msg_len","word_array","toLowerCase","md5","RotateLeft","lValue","iShiftBits","AddUnsigned","lX","lY","lX8","lY8","lX4","lY4","lResult","FF","F","GG","G","HH","H","II","I","WordToHex","lByte","lCount","WordToHexValue","WordToHexValue_temp","AA","BB","CC","DD","lWordCount","lMessageLength","lNumberOfWords_temp1","lNumberOfWords","lWordArray","lBytePosition","lByteCount","ConvertToWordArray","parseBigInt","pkcs1pad2","rng","RSAKey","N","parseInt","text","doPublic","P","Q","DP","DQ","Error","dmp1","dmq1","coeff","qs","ee","gcd","p1","q1","phi","multiply","modInverse","xp","xq","ctext","doPrivate","pkcs1unpad2","_rsasign_signString","_rsasign_signStringWithSHA1","_rsasign_signStringWithSHA256","_rsasign_verifyHexSignatureForMessage","_rsasign_verifyString","JSON","stringify","json","parse","rsa","setPrivateEx","toByteArray","ret","_RSASIGN_DIHEAD","_RSASIGN_HASHHEXFUNC","_rsasign_getHexPaddedDigestInfoForString","keySize","hashAlg","pmStrLen","sHashHex","hashFunc","sHead","sTail","sMid","fLen","biPaddedMessage","_rsasign_getHexDigestInfoFromSig","biSig","hN","hE","setPublic","_rsasign_getDecryptSignatureBI","_rsasign_getAlgNameAndHashFromHexDisgestInfo","hDigestInfo","algName","head","len","substring","sMsg","hSig","digestInfoAry","ff","_rsasign_verifySignatureWithArgs","base64Chars","magic","Init","tl","slop","bytes","unescape","encodeURIComponent","uriencoded","decodeURIComponent","escape","string2bytes","bytes2string","xor","IV","newBytes","padding","plaintext","exkey","ExpandKey","blocks","utf82bytes","pad16","encryptedBlocks","blockIV","tempBlock","prevBlock","blockXOR","Encrypt","ciphertext","b256to64","encryptedText","asciiText","b64to256","decryptedBlocks","Decrypt","depad","bytes2utf8","outstr","passphrase","bitlength","seedrandom","generate","rsakey","b16to64","publicKeyString","b64to16","split","publickeystring","signingkey","cipherblock","aeskey","generateAESKey","publickey","publicKeyFromString","encrypt","err","status","signString","sign","encryptAESCBC","cipher","decrypt","aeskeyBytes","decryptAESCBC","_confirm","signature","verifyString"],"mappings":"kSAyBaA,EAAa,CAExBC,KAAM,CACJ,GAAI,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,GAAI,EAAG,IAAK,GAAI,IAAK,IAAK,IAAK,IACtE,IAAK,IAAK,IAAK,IAAK,IAAK,GAAI,GAAI,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IACpE,IAAK,IAAK,IAAK,IAAK,GAAI,GAAI,GAAI,IAAK,IAAK,GAAI,IAAK,IAAK,IAAK,IAAK,IAAK,GACvE,GAAI,EAAG,IAAK,GAAI,IAAK,GAAI,IAAK,EAAG,IAAK,EAAG,GAAI,IAAK,IAAK,IAAK,GAAI,IAAK,IAAK,EAC1E,IAAK,GAAI,GAAI,GAAI,IAAK,GAAI,IAAK,GAAI,GAAI,IAAK,IAAK,GAAI,IAAK,GAAI,IAAK,GAAI,IACvE,EAAG,IAAK,GAAI,IAAK,IAAK,GAAI,IAAK,IAAK,IAAK,GAAI,GAAI,GAAI,GAAI,IAAK,IAAK,IAAK,IACxE,IAAK,GAAI,GAAI,GAAI,IAAK,GAAI,IAAK,EAAG,IAAK,GAAI,GAAI,IAAK,IAAK,GAAI,IAAK,GAAI,IACtE,IAAK,IAAK,GAAI,IAAK,IAAK,IAAK,IAAK,GAAI,GAAI,IAAK,IAAK,IAAK,IAAK,GAAI,GAAI,IACtE,GAAI,IAAK,GAAI,GAAI,IAAK,IAAK,IAAK,GAAI,IAAK,GAAI,GAAI,IAAK,GAAI,IAAK,GAAI,IAAK,GACxE,GA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