PHP WebShell

Текущая директория: /usr/lib/node_modules/bitgo/node_modules/openpgp/dist/lightweight

Просмотр файла: bn.interface.min.mjs.map

{"version":3,"file":"bn.interface.min.mjs","sources":["../../src/biginteger/bn.interface.js"],"sourcesContent":["import BN from 'bn.js';\n\n/**\n * @fileoverview\n * BigInteger implementation of basic operations\n * Wrapper of bn.js library (wwww.github.com/indutny/bn.js)\n * @module biginteger/bn\n * @private\n */\n\n/**\n * @private\n */\nexport default class BigInteger {\n  /**\n   * Get a BigInteger (input must be big endian for strings and arrays)\n   * @param {Number|String|Uint8Array} n - Value to convert\n   * @throws {Error} on undefined input\n   */\n  constructor(n) {\n    if (n === undefined) {\n      throw new Error('Invalid BigInteger input');\n    }\n\n    this.value = new BN(n);\n  }\n\n  clone() {\n    const clone = new BigInteger(null);\n    this.value.copy(clone.value);\n    return clone;\n  }\n\n  /**\n   * BigInteger increment in place\n   */\n  iinc() {\n    this.value.iadd(new BN(1));\n    return this;\n  }\n\n  /**\n   * BigInteger increment\n   * @returns {BigInteger} this + 1.\n   */\n  inc() {\n    return this.clone().iinc();\n  }\n\n  /**\n   * BigInteger decrement in place\n   */\n  idec() {\n    this.value.isub(new BN(1));\n    return this;\n  }\n\n  /**\n   * BigInteger decrement\n   * @returns {BigInteger} this - 1.\n   */\n  dec() {\n    return this.clone().idec();\n  }\n\n\n  /**\n   * BigInteger addition in place\n   * @param {BigInteger} x - Value to add\n   */\n  iadd(x) {\n    this.value.iadd(x.value);\n    return this;\n  }\n\n  /**\n   * BigInteger addition\n   * @param {BigInteger} x - Value to add\n   * @returns {BigInteger} this + x.\n   */\n  add(x) {\n    return this.clone().iadd(x);\n  }\n\n  /**\n   * BigInteger subtraction in place\n   * @param {BigInteger} x - Value to subtract\n   */\n  isub(x) {\n    this.value.isub(x.value);\n    return this;\n  }\n\n  /**\n   * BigInteger subtraction\n   * @param {BigInteger} x - Value to subtract\n   * @returns {BigInteger} this - x.\n   */\n  sub(x) {\n    return this.clone().isub(x);\n  }\n\n  /**\n   * BigInteger multiplication in place\n   * @param {BigInteger} x - Value to multiply\n   */\n  imul(x) {\n    this.value.imul(x.value);\n    return this;\n  }\n\n  /**\n   * BigInteger multiplication\n   * @param {BigInteger} x - Value to multiply\n   * @returns {BigInteger} this * x.\n   */\n  mul(x) {\n    return this.clone().imul(x);\n  }\n\n  /**\n   * Compute value modulo m, in place\n   * @param {BigInteger} m - Modulo\n   */\n  imod(m) {\n    this.value = this.value.umod(m.value);\n    return this;\n  }\n\n  /**\n   * Compute value modulo m\n   * @param {BigInteger} m - Modulo\n   * @returns {BigInteger} this mod m.\n   */\n  mod(m) {\n    return this.clone().imod(m);\n  }\n\n  /**\n   * Compute modular exponentiation\n   * Much faster than this.exp(e).mod(n)\n   * @param {BigInteger} e - Exponent\n   * @param {BigInteger} n - Modulo\n   * @returns {BigInteger} this ** e mod n.\n   */\n  modExp(e, n) {\n    // We use either Montgomery or normal reduction context\n    // Montgomery requires coprime n and R (montogmery multiplier)\n    //  bn.js picks R as power of 2, so n must be odd\n    const nred = n.isEven() ? BN.red(n.value) : BN.mont(n.value);\n    const x = this.clone();\n    x.value = x.value.toRed(nred).redPow(e.value).fromRed();\n    return x;\n  }\n\n  /**\n   * Compute the inverse of this value modulo n\n   * Note: this and and n must be relatively prime\n   * @param {BigInteger} n - Modulo\n   * @returns {BigInteger} x such that this*x = 1 mod n\n   * @throws {Error} if the inverse does not exist\n   */\n  modInv(n) {\n    // invm returns a wrong result if the inverse does not exist\n    if (!this.gcd(n).isOne()) {\n      throw new Error('Inverse does not exist');\n    }\n    return new BigInteger(this.value.invm(n.value));\n  }\n\n  /**\n   * Compute greatest common divisor between this and n\n   * @param {BigInteger} n - Operand\n   * @returns {BigInteger} gcd\n   */\n  gcd(n) {\n    return new BigInteger(this.value.gcd(n.value));\n  }\n\n  /**\n   * Shift this to the left by x, in place\n   * @param {BigInteger} x - Shift value\n   */\n  ileftShift(x) {\n    this.value.ishln(x.value.toNumber());\n    return this;\n  }\n\n  /**\n   * Shift this to the left by x\n   * @param {BigInteger} x - Shift value\n   * @returns {BigInteger} this << x.\n   */\n  leftShift(x) {\n    return this.clone().ileftShift(x);\n  }\n\n  /**\n   * Shift this to the right by x, in place\n   * @param {BigInteger} x - Shift value\n   */\n  irightShift(x) {\n    this.value.ishrn(x.value.toNumber());\n    return this;\n  }\n\n  /**\n   * Shift this to the right by x\n   * @param {BigInteger} x - Shift value\n   * @returns {BigInteger} this >> x.\n   */\n  rightShift(x) {\n    return this.clone().irightShift(x);\n  }\n\n  /**\n   * Whether this value is equal to x\n   * @param {BigInteger} x\n   * @returns {Boolean}\n   */\n  equal(x) {\n    return this.value.eq(x.value);\n  }\n\n  /**\n   * Whether this value is less than x\n   * @param {BigInteger} x\n   * @returns {Boolean}\n   */\n  lt(x) {\n    return this.value.lt(x.value);\n  }\n\n  /**\n   * Whether this value is less than or equal to x\n   * @param {BigInteger} x\n   * @returns {Boolean}\n   */\n  lte(x) {\n    return this.value.lte(x.value);\n  }\n\n  /**\n   * Whether this value is greater than x\n   * @param {BigInteger} x\n   * @returns {Boolean}\n   */\n  gt(x) {\n    return this.value.gt(x.value);\n  }\n\n  /**\n   * Whether this value is greater than or equal to x\n   * @param {BigInteger} x\n   * @returns {Boolean}\n   */\n  gte(x) {\n    return this.value.gte(x.value);\n  }\n\n  isZero() {\n    return this.value.isZero();\n  }\n\n  isOne() {\n    return this.value.eq(new BN(1));\n  }\n\n  isNegative() {\n    return this.value.isNeg();\n  }\n\n  isEven() {\n    return this.value.isEven();\n  }\n\n  abs() {\n    const res = this.clone();\n    res.value = res.value.abs();\n    return res;\n  }\n\n  /**\n   * Get this value as a string\n   * @returns {String} this value.\n   */\n  toString() {\n    return this.value.toString();\n  }\n\n  /**\n   * Get this value as an exact Number (max 53 bits)\n   * Fails if this value is too large\n   * @returns {Number}\n   */\n  toNumber() {\n    return this.value.toNumber();\n  }\n\n  /**\n   * Get value of i-th bit\n   * @param {Number} i - Bit index\n   * @returns {Number} Bit value.\n   */\n  getBit(i) {\n    return this.value.testn(i) ? 1 : 0;\n  }\n\n  /**\n   * Compute bit length\n   * @returns {Number} Bit length.\n   */\n  bitLength() {\n    return this.value.bitLength();\n  }\n\n  /**\n   * Compute byte length\n   * @returns {Number} Byte length.\n   */\n  byteLength() {\n    return this.value.byteLength();\n  }\n\n  /**\n   * Get Uint8Array representation of this number\n   * @param {String} endian - Endianess of output array (defaults to 'be')\n   * @param {Number} length - Of output array\n   * @returns {Uint8Array}\n   */\n  toUint8Array(endian = 'be', length) {\n    return this.value.toArrayLike(Uint8Array, endian, length);\n  }\n}\n"],"names":["BigInteger","constructor","n","undefined","Error","this","value","BN","clone","copy","iinc","iadd","inc","idec","isub","dec","x","add","sub","imul","mul","imod","m","umod","mod","modExp","e","nred","isEven","red","mont","toRed","redPow","fromRed","modInv","gcd","isOne","invm","ileftShift","ishln","toNumber","leftShift","irightShift","ishrn","rightShift","equal","eq","lt","lte","gt","gte","isZero","isNegative","isNeg","abs","res","toString","getBit","i","testn","bitLength","byteLength","toUint8Array","endian","length","toArrayLike","Uint8Array"],"mappings":";yJAae,MAAMA,EAMnBC,YAAYC,GACV,QAAUC,IAAND,EACF,MAAUE,MAAM,4BAGlBC,KAAKC,MAAQ,IAAIC,EAAGL,GAGtBM,QACE,MAAMA,EAAQ,IAAIR,EAAW,MAE7B,OADAK,KAAKC,MAAMG,KAAKD,EAAMF,OACfE,EAMTE,OAEE,OADAL,KAAKC,MAAMK,KAAK,IAAIJ,EAAG,IAChBF,KAOTO,MACE,OAAOP,KAAKG,QAAQE,OAMtBG,OAEE,OADAR,KAAKC,MAAMQ,KAAK,IAAIP,EAAG,IAChBF,KAOTU,MACE,OAAOV,KAAKG,QAAQK,OAQtBF,KAAKK,GAEH,OADAX,KAAKC,MAAMK,KAAKK,EAAEV,OACXD,KAQTY,IAAID,GACF,OAAOX,KAAKG,QAAQG,KAAKK,GAO3BF,KAAKE,GAEH,OADAX,KAAKC,MAAMQ,KAAKE,EAAEV,OACXD,KAQ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AEV,OAQzB4C,IAAIlC,GACF,OAAOX,KAAKC,MAAM4C,IAAIlC,EAAEV,OAG1B6C,SACE,OAAO9C,KAAKC,MAAM6C,SAGpBf,QACE,OAAO/B,KAAKC,MAAMwC,GAAG,IAAIvC,EAAG,IAG9B6C,aACE,OAAO/C,KAAKC,MAAM+C,QAGpBzB,SACE,OAAOvB,KAAKC,MAAMsB,SAGpB0B,MACE,MAAMC,EAAMlD,KAAKG,QAEjB,OADA+C,EAAIjD,MAAQiD,EAAIjD,MAAMgD,MACfC,EAOTC,WACE,OAAOnD,KAAKC,MAAMkD,WAQpBhB,WACE,OAAOnC,KAAKC,MAAMkC,WAQpBiB,OAAOC,GACL,OAAOrD,KAAKC,MAAMqD,MAAMD,GAAK,EAAI,EAOnCE,YACE,OAAOvD,KAAKC,MAAMsD,YAOpBC,aACE,OAAOxD,KAAKC,MAAMuD,aASpBC,aAAaC,EAAS,KAAMC,GAC1B,OAAO3D,KAAKC,MAAM2D,YAAYC,WAAYH,EAAQC"}

Выполнить команду


Для локальной разработки. Не используйте в интернете!