1 // [AIV_SHORT] Build version: 2.2.0 - Thursday, June 4th, 2020, 2:31:20 PM
2 /******/ (function(modules) { // webpackBootstrap
3 /******/ // The module cache
4 /******/ var installedModules = {};
6 /******/ // The require function
7 /******/ function __webpack_require__(moduleId) {
9 /******/ // Check if module is in cache
10 /******/ if(installedModules[moduleId]) {
11 /******/ return installedModules[moduleId].exports;
13 /******/ // Create a new module (and put it into the cache)
14 /******/ var module = installedModules[moduleId] = {
20 /******/ // Execute the module function
21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
23 /******/ // Flag the module as loaded
24 /******/ module.l = true;
26 /******/ // Return the exports of the module
27 /******/ return module.exports;
31 /******/ // expose the modules object (__webpack_modules__)
32 /******/ __webpack_require__.m = modules;
34 /******/ // expose the module cache
35 /******/ __webpack_require__.c = installedModules;
37 /******/ // define getter function for harmony exports
38 /******/ __webpack_require__.d = function(exports, name, getter) {
39 /******/ if(!__webpack_require__.o(exports, name)) {
40 /******/ Object.defineProperty(exports, name, {
41 /******/ configurable: false,
42 /******/ enumerable: true,
48 /******/ // getDefaultExport function for compatibility with non-harmony modules
49 /******/ __webpack_require__.n = function(module) {
50 /******/ var getter = module && module.__esModule ?
51 /******/ function getDefault() { return module['default']; } :
52 /******/ function getModuleExports() { return module; };
53 /******/ __webpack_require__.d(getter, 'a', getter);
54 /******/ return getter;
57 /******/ // Object.prototype.hasOwnProperty.call
58 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
60 /******/ // __webpack_public_path__
61 /******/ __webpack_require__.p = "/";
63 /******/ // Load entry module and return exports
64 /******/ return __webpack_require__(__webpack_require__.s = 569);
66 /************************************************************************/
70 /***/ (function(module, exports) {
72 if (typeof Object.create === 'function') {
73 // implementation from standard node.js 'util' module
74 module.exports = function inherits(ctor, superCtor) {
75 ctor.super_ = superCtor
76 ctor.prototype = Object.create(superCtor.prototype, {
86 // old school shim for old browsers
87 module.exports = function inherits(ctor, superCtor) {
88 ctor.super_ = superCtor
89 var TempCtor = function () {}
90 TempCtor.prototype = superCtor.prototype
91 ctor.prototype = new TempCtor()
92 ctor.prototype.constructor = ctor
99 /***/ (function(module, exports, __webpack_require__) {
101 /* eslint-disable node/no-deprecated-api */
102 var buffer = __webpack_require__(3)
103 var Buffer = buffer.Buffer
105 // alternative to using Object.keys for old browsers
106 function copyProps (src, dst) {
107 for (var key in src) {
111 if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
112 module.exports = buffer
114 // Copy properties from require('buffer')
115 copyProps(buffer, exports)
116 exports.Buffer = SafeBuffer
119 function SafeBuffer (arg, encodingOrOffset, length) {
120 return Buffer(arg, encodingOrOffset, length)
123 // Copy static methods from Buffer
124 copyProps(Buffer, SafeBuffer)
126 SafeBuffer.from = function (arg, encodingOrOffset, length) {
127 if (typeof arg === 'number') {
128 throw new TypeError('Argument must not be a number')
130 return Buffer(arg, encodingOrOffset, length)
133 SafeBuffer.alloc = function (size, fill, encoding) {
134 if (typeof size !== 'number') {
135 throw new TypeError('Argument must be a number')
137 var buf = Buffer(size)
138 if (fill !== undefined) {
139 if (typeof encoding === 'string') {
140 buf.fill(fill, encoding)
150 SafeBuffer.allocUnsafe = function (size) {
151 if (typeof size !== 'number') {
152 throw new TypeError('Argument must be a number')
157 SafeBuffer.allocUnsafeSlow = function (size) {
158 if (typeof size !== 'number') {
159 throw new TypeError('Argument must be a number')
161 return buffer.SlowBuffer(size)
167 /***/ (function(module, exports, __webpack_require__) {
170 /* WEBPACK VAR INJECTION */(function(global) {/*!
171 * The buffer module from node.js, for the browser.
173 * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
176 /* eslint-disable no-proto */
180 var base64 = __webpack_require__(175)
181 var ieee754 = __webpack_require__(176)
182 var isArray = __webpack_require__(92)
184 exports.Buffer = Buffer
185 exports.SlowBuffer = SlowBuffer
186 exports.INSPECT_MAX_BYTES = 50
189 * If `Buffer.TYPED_ARRAY_SUPPORT`:
190 * === true Use Uint8Array implementation (fastest)
191 * === false Use Object implementation (most compatible, even IE6)
193 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
194 * Opera 11.6+, iOS 4.2+.
196 * Due to various browser bugs, sometimes the Object implementation will be used even
197 * when the browser supports typed arrays.
201 * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
202 * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
204 * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
206 * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
207 * incorrect length in some situations.
209 * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
210 * get the Object implementation, which is slower but behaves correctly.
212 Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
213 ? global.TYPED_ARRAY_SUPPORT
214 : typedArraySupport()
217 * Export kMaxLength after typed array support is determined.
219 exports.kMaxLength = kMaxLength()
221 function typedArraySupport () {
223 var arr = new Uint8Array(1)
224 arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
225 return arr.foo() === 42 && // typed array instances can be augmented
226 typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
227 arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
233 function kMaxLength () {
234 return Buffer.TYPED_ARRAY_SUPPORT
239 function createBuffer (that, length) {
240 if (kMaxLength() < length) {
241 throw new RangeError('Invalid typed array length')
243 if (Buffer.TYPED_ARRAY_SUPPORT) {
244 // Return an augmented `Uint8Array` instance, for best performance
245 that = new Uint8Array(length)
246 that.__proto__ = Buffer.prototype
248 // Fallback: Return an object instance of the Buffer class
250 that = new Buffer(length)
259 * The Buffer constructor returns instances of `Uint8Array` that have their
260 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
261 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
262 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
263 * returns a single octet.
265 * The `Uint8Array` prototype remains unmodified.
268 function Buffer (arg, encodingOrOffset, length) {
269 if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
270 return new Buffer(arg, encodingOrOffset, length)
274 if (typeof arg === 'number') {
275 if (typeof encodingOrOffset === 'string') {
277 'If encoding is specified then the first argument must be a string'
280 return allocUnsafe(this, arg)
282 return from(this, arg, encodingOrOffset, length)
285 Buffer.poolSize = 8192 // not used by this implementation
287 // TODO: Legacy, not needed anymore. Remove in next major version.
288 Buffer._augment = function (arr) {
289 arr.__proto__ = Buffer.prototype
293 function from (that, value, encodingOrOffset, length) {
294 if (typeof value === 'number') {
295 throw new TypeError('"value" argument must not be a number')
298 if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
299 return fromArrayBuffer(that, value, encodingOrOffset, length)
302 if (typeof value === 'string') {
303 return fromString(that, value, encodingOrOffset)
306 return fromObject(that, value)
310 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
311 * if value is a number.
312 * Buffer.from(str[, encoding])
314 * Buffer.from(buffer)
315 * Buffer.from(arrayBuffer[, byteOffset[, length]])
317 Buffer.from = function (value, encodingOrOffset, length) {
318 return from(null, value, encodingOrOffset, length)
321 if (Buffer.TYPED_ARRAY_SUPPORT) {
322 Buffer.prototype.__proto__ = Uint8Array.prototype
323 Buffer.__proto__ = Uint8Array
324 if (typeof Symbol !== 'undefined' && Symbol.species &&
325 Buffer[Symbol.species] === Buffer) {
326 // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
327 Object.defineProperty(Buffer, Symbol.species, {
334 function assertSize (size) {
335 if (typeof size !== 'number') {
336 throw new TypeError('"size" argument must be a number')
337 } else if (size < 0) {
338 throw new RangeError('"size" argument must not be negative')
342 function alloc (that, size, fill, encoding) {
345 return createBuffer(that, size)
347 if (fill !== undefined) {
348 // Only pay attention to encoding if it's a string. This
349 // prevents accidentally sending in a number that would
350 // be interpretted as a start offset.
351 return typeof encoding === 'string'
352 ? createBuffer(that, size).fill(fill, encoding)
353 : createBuffer(that, size).fill(fill)
355 return createBuffer(that, size)
359 * Creates a new filled Buffer instance.
360 * alloc(size[, fill[, encoding]])
362 Buffer.alloc = function (size, fill, encoding) {
363 return alloc(null, size, fill, encoding)
366 function allocUnsafe (that, size) {
368 that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
369 if (!Buffer.TYPED_ARRAY_SUPPORT) {
370 for (var i = 0; i < size; ++i) {
378 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
380 Buffer.allocUnsafe = function (size) {
381 return allocUnsafe(null, size)
384 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
386 Buffer.allocUnsafeSlow = function (size) {
387 return allocUnsafe(null, size)
390 function fromString (that, string, encoding) {
391 if (typeof encoding !== 'string' || encoding === '') {
395 if (!Buffer.isEncoding(encoding)) {
396 throw new TypeError('"encoding" must be a valid string encoding')
399 var length = byteLength(string, encoding) | 0
400 that = createBuffer(that, length)
402 var actual = that.write(string, encoding)
404 if (actual !== length) {
405 // Writing a hex string, for example, that contains invalid characters will
406 // cause everything after the first invalid character to be ignored. (e.g.
407 // 'abxxcd' will be treated as 'ab')
408 that = that.slice(0, actual)
414 function fromArrayLike (that, array) {
415 var length = array.length < 0 ? 0 : checked(array.length) | 0
416 that = createBuffer(that, length)
417 for (var i = 0; i < length; i += 1) {
418 that[i] = array[i] & 255
423 function fromArrayBuffer (that, array, byteOffset, length) {
424 array.byteLength // this throws if `array` is not a valid ArrayBuffer
426 if (byteOffset < 0 || array.byteLength < byteOffset) {
427 throw new RangeError('\'offset\' is out of bounds')
430 if (array.byteLength < byteOffset + (length || 0)) {
431 throw new RangeError('\'length\' is out of bounds')
434 if (byteOffset === undefined && length === undefined) {
435 array = new Uint8Array(array)
436 } else if (length === undefined) {
437 array = new Uint8Array(array, byteOffset)
439 array = new Uint8Array(array, byteOffset, length)
442 if (Buffer.TYPED_ARRAY_SUPPORT) {
443 // Return an augmented `Uint8Array` instance, for best performance
445 that.__proto__ = Buffer.prototype
447 // Fallback: Return an object instance of the Buffer class
448 that = fromArrayLike(that, array)
453 function fromObject (that, obj) {
454 if (Buffer.isBuffer(obj)) {
455 var len = checked(obj.length) | 0
456 that = createBuffer(that, len)
458 if (that.length === 0) {
462 obj.copy(that, 0, 0, len)
467 if ((typeof ArrayBuffer !== 'undefined' &&
468 obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
469 if (typeof obj.length !== 'number' || isnan(obj.length)) {
470 return createBuffer(that, 0)
472 return fromArrayLike(that, obj)
475 if (obj.type === 'Buffer' && isArray(obj.data)) {
476 return fromArrayLike(that, obj.data)
480 throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
483 function checked (length) {
484 // Note: cannot use `length < kMaxLength()` here because that fails when
485 // length is NaN (which is otherwise coerced to zero.)
486 if (length >= kMaxLength()) {
487 throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
488 'size: 0x' + kMaxLength().toString(16) + ' bytes')
493 function SlowBuffer (length) {
494 if (+length != length) { // eslint-disable-line eqeqeq
497 return Buffer.alloc(+length)
500 Buffer.isBuffer = function isBuffer (b) {
501 return !!(b != null && b._isBuffer)
504 Buffer.compare = function compare (a, b) {
505 if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
506 throw new TypeError('Arguments must be Buffers')
509 if (a === b) return 0
514 for (var i = 0, len = Math.min(x, y); i < len; ++i) {
527 Buffer.isEncoding = function isEncoding (encoding) {
528 switch (String(encoding).toLowerCase()) {
546 Buffer.concat = function concat (list, length) {
547 if (!isArray(list)) {
548 throw new TypeError('"list" argument must be an Array of Buffers')
551 if (list.length === 0) {
552 return Buffer.alloc(0)
556 if (length === undefined) {
558 for (i = 0; i < list.length; ++i) {
559 length += list[i].length
563 var buffer = Buffer.allocUnsafe(length)
565 for (i = 0; i < list.length; ++i) {
567 if (!Buffer.isBuffer(buf)) {
568 throw new TypeError('"list" argument must be an Array of Buffers')
570 buf.copy(buffer, pos)
576 function byteLength (string, encoding) {
577 if (Buffer.isBuffer(string)) {
580 if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
581 (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
582 return string.byteLength
584 if (typeof string !== 'string') {
588 var len = string.length
589 if (len === 0) return 0
591 // Use a for loop to avoid recursion
592 var loweredCase = false
602 return utf8ToBytes(string).length
611 return base64ToBytes(string).length
613 if (loweredCase) return utf8ToBytes(string).length // assume utf8
614 encoding = ('' + encoding).toLowerCase()
619 Buffer.byteLength = byteLength
621 function slowToString (encoding, start, end) {
622 var loweredCase = false
624 // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
625 // property of a typed array.
627 // This behaves neither like String nor Uint8Array in that we set start/end
628 // to their upper/lower bounds if the value passed is out of range.
629 // undefined is handled specially as per ECMA-262 6th Edition,
630 // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
631 if (start === undefined || start < 0) {
634 // Return early if start > this.length. Done here to prevent potential uint32
635 // coercion fail below.
636 if (start > this.length) {
640 if (end === undefined || end > this.length) {
648 // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
656 if (!encoding) encoding = 'utf8'
661 return hexSlice(this, start, end)
665 return utf8Slice(this, start, end)
668 return asciiSlice(this, start, end)
672 return latin1Slice(this, start, end)
675 return base64Slice(this, start, end)
681 return utf16leSlice(this, start, end)
684 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
685 encoding = (encoding + '').toLowerCase()
691 // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
693 Buffer.prototype._isBuffer = true
695 function swap (b, n, m) {
701 Buffer.prototype.swap16 = function swap16 () {
702 var len = this.length
704 throw new RangeError('Buffer size must be a multiple of 16-bits')
706 for (var i = 0; i < len; i += 2) {
712 Buffer.prototype.swap32 = function swap32 () {
713 var len = this.length
715 throw new RangeError('Buffer size must be a multiple of 32-bits')
717 for (var i = 0; i < len; i += 4) {
719 swap(this, i + 1, i + 2)
724 Buffer.prototype.swap64 = function swap64 () {
725 var len = this.length
727 throw new RangeError('Buffer size must be a multiple of 64-bits')
729 for (var i = 0; i < len; i += 8) {
731 swap(this, i + 1, i + 6)
732 swap(this, i + 2, i + 5)
733 swap(this, i + 3, i + 4)
738 Buffer.prototype.toString = function toString () {
739 var length = this.length | 0
740 if (length === 0) return ''
741 if (arguments.length === 0) return utf8Slice(this, 0, length)
742 return slowToString.apply(this, arguments)
745 Buffer.prototype.equals = function equals (b) {
746 if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
747 if (this === b) return true
748 return Buffer.compare(this, b) === 0
751 Buffer.prototype.inspect = function inspect () {
753 var max = exports.INSPECT_MAX_BYTES
754 if (this.length > 0) {
755 str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
756 if (this.length > max) str += ' ... '
758 return '<Buffer ' + str + '>'
761 Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
762 if (!Buffer.isBuffer(target)) {
763 throw new TypeError('Argument must be a Buffer')
766 if (start === undefined) {
769 if (end === undefined) {
770 end = target ? target.length : 0
772 if (thisStart === undefined) {
775 if (thisEnd === undefined) {
776 thisEnd = this.length
779 if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
780 throw new RangeError('out of range index')
783 if (thisStart >= thisEnd && start >= end) {
786 if (thisStart >= thisEnd) {
798 if (this === target) return 0
800 var x = thisEnd - thisStart
802 var len = Math.min(x, y)
804 var thisCopy = this.slice(thisStart, thisEnd)
805 var targetCopy = target.slice(start, end)
807 for (var i = 0; i < len; ++i) {
808 if (thisCopy[i] !== targetCopy[i]) {
820 // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
821 // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
824 // - buffer - a Buffer to search
825 // - val - a string, Buffer, or number
826 // - byteOffset - an index into `buffer`; will be clamped to an int32
827 // - encoding - an optional encoding, relevant is val is a string
828 // - dir - true for indexOf, false for lastIndexOf
829 function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
830 // Empty buffer means no match
831 if (buffer.length === 0) return -1
833 // Normalize byteOffset
834 if (typeof byteOffset === 'string') {
835 encoding = byteOffset
837 } else if (byteOffset > 0x7fffffff) {
838 byteOffset = 0x7fffffff
839 } else if (byteOffset < -0x80000000) {
840 byteOffset = -0x80000000
842 byteOffset = +byteOffset // Coerce to Number.
843 if (isNaN(byteOffset)) {
844 // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
845 byteOffset = dir ? 0 : (buffer.length - 1)
848 // Normalize byteOffset: negative offsets start from the end of the buffer
849 if (byteOffset < 0) byteOffset = buffer.length + byteOffset
850 if (byteOffset >= buffer.length) {
852 else byteOffset = buffer.length - 1
853 } else if (byteOffset < 0) {
854 if (dir) byteOffset = 0
859 if (typeof val === 'string') {
860 val = Buffer.from(val, encoding)
863 // Finally, search either indexOf (if dir is true) or lastIndexOf
864 if (Buffer.isBuffer(val)) {
865 // Special case: looking for empty string/buffer always fails
866 if (val.length === 0) {
869 return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
870 } else if (typeof val === 'number') {
871 val = val & 0xFF // Search for a byte value [0-255]
872 if (Buffer.TYPED_ARRAY_SUPPORT &&
873 typeof Uint8Array.prototype.indexOf === 'function') {
875 return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
877 return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
880 return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
883 throw new TypeError('val must be string, number or Buffer')
886 function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
888 var arrLength = arr.length
889 var valLength = val.length
891 if (encoding !== undefined) {
892 encoding = String(encoding).toLowerCase()
893 if (encoding === 'ucs2' || encoding === 'ucs-2' ||
894 encoding === 'utf16le' || encoding === 'utf-16le') {
895 if (arr.length < 2 || val.length < 2) {
905 function read (buf, i) {
906 if (indexSize === 1) {
909 return buf.readUInt16BE(i * indexSize)
916 for (i = byteOffset; i < arrLength; i++) {
917 if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
918 if (foundIndex === -1) foundIndex = i
919 if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
921 if (foundIndex !== -1) i -= i - foundIndex
926 if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
927 for (i = byteOffset; i >= 0; i--) {
929 for (var j = 0; j < valLength; j++) {
930 if (read(arr, i + j) !== read(val, j)) {
942 Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
943 return this.indexOf(val, byteOffset, encoding) !== -1
946 Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
947 return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
950 Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
951 return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
954 function hexWrite (buf, string, offset, length) {
955 offset = Number(offset) || 0
956 var remaining = buf.length - offset
960 length = Number(length)
961 if (length > remaining) {
966 // must be an even number of digits
967 var strLen = string.length
968 if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
970 if (length > strLen / 2) {
973 for (var i = 0; i < length; ++i) {
974 var parsed = parseInt(string.substr(i * 2, 2), 16)
975 if (isNaN(parsed)) return i
976 buf[offset + i] = parsed
981 function utf8Write (buf, string, offset, length) {
982 return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
985 function asciiWrite (buf, string, offset, length) {
986 return blitBuffer(asciiToBytes(string), buf, offset, length)
989 function latin1Write (buf, string, offset, length) {
990 return asciiWrite(buf, string, offset, length)
993 function base64Write (buf, string, offset, length) {
994 return blitBuffer(base64ToBytes(string), buf, offset, length)
997 function ucs2Write (buf, string, offset, length) {
998 return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
1001 Buffer.prototype.write = function write (string, offset, length, encoding) {
1002 // Buffer#write(string)
1003 if (offset === undefined) {
1005 length = this.length
1007 // Buffer#write(string, encoding)
1008 } else if (length === undefined && typeof offset === 'string') {
1010 length = this.length
1012 // Buffer#write(string, offset[, length][, encoding])
1013 } else if (isFinite(offset)) {
1015 if (isFinite(length)) {
1017 if (encoding === undefined) encoding = 'utf8'
1022 // legacy write(string, encoding, offset, length) - remove in v0.13
1025 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
1029 var remaining = this.length - offset
1030 if (length === undefined || length > remaining) length = remaining
1032 if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
1033 throw new RangeError('Attempt to write outside buffer bounds')
1036 if (!encoding) encoding = 'utf8'
1038 var loweredCase = false
1042 return hexWrite(this, string, offset, length)
1046 return utf8Write(this, string, offset, length)
1049 return asciiWrite(this, string, offset, length)
1053 return latin1Write(this, string, offset, length)
1056 // Warning: maxLength not taken into account in base64Write
1057 return base64Write(this, string, offset, length)
1063 return ucs2Write(this, string, offset, length)
1066 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
1067 encoding = ('' + encoding).toLowerCase()
1073 Buffer.prototype.toJSON = function toJSON () {
1076 data: Array.prototype.slice.call(this._arr || this, 0)
1080 function base64Slice (buf, start, end) {
1081 if (start === 0 && end === buf.length) {
1082 return base64.fromByteArray(buf)
1084 return base64.fromByteArray(buf.slice(start, end))
1088 function utf8Slice (buf, start, end) {
1089 end = Math.min(buf.length, end)
1094 var firstByte = buf[i]
1095 var codePoint = null
1096 var bytesPerSequence = (firstByte > 0xEF) ? 4
1097 : (firstByte > 0xDF) ? 3
1098 : (firstByte > 0xBF) ? 2
1101 if (i + bytesPerSequence <= end) {
1102 var secondByte, thirdByte, fourthByte, tempCodePoint
1104 switch (bytesPerSequence) {
1106 if (firstByte < 0x80) {
1107 codePoint = firstByte
1111 secondByte = buf[i + 1]
1112 if ((secondByte & 0xC0) === 0x80) {
1113 tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
1114 if (tempCodePoint > 0x7F) {
1115 codePoint = tempCodePoint
1120 secondByte = buf[i + 1]
1121 thirdByte = buf[i + 2]
1122 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
1123 tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
1124 if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
1125 codePoint = tempCodePoint
1130 secondByte = buf[i + 1]
1131 thirdByte = buf[i + 2]
1132 fourthByte = buf[i + 3]
1133 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
1134 tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
1135 if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
1136 codePoint = tempCodePoint
1142 if (codePoint === null) {
1143 // we did not generate a valid codePoint so insert a
1144 // replacement char (U+FFFD) and advance only 1 byte
1146 bytesPerSequence = 1
1147 } else if (codePoint > 0xFFFF) {
1148 // encode to utf16 (surrogate pair dance)
1149 codePoint -= 0x10000
1150 res.push(codePoint >>> 10 & 0x3FF | 0xD800)
1151 codePoint = 0xDC00 | codePoint & 0x3FF
1155 i += bytesPerSequence
1158 return decodeCodePointsArray(res)
1161 // Based on http://stackoverflow.com/a/22747272/680742, the browser with
1162 // the lowest limit is Chrome, with 0x10000 args.
1163 // We go 1 magnitude less, for safety
1164 var MAX_ARGUMENTS_LENGTH = 0x1000
1166 function decodeCodePointsArray (codePoints) {
1167 var len = codePoints.length
1168 if (len <= MAX_ARGUMENTS_LENGTH) {
1169 return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
1172 // Decode in chunks to avoid "call stack size exceeded".
1176 res += String.fromCharCode.apply(
1178 codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
1184 function asciiSlice (buf, start, end) {
1186 end = Math.min(buf.length, end)
1188 for (var i = start; i < end; ++i) {
1189 ret += String.fromCharCode(buf[i] & 0x7F)
1194 function latin1Slice (buf, start, end) {
1196 end = Math.min(buf.length, end)
1198 for (var i = start; i < end; ++i) {
1199 ret += String.fromCharCode(buf[i])
1204 function hexSlice (buf, start, end) {
1205 var len = buf.length
1207 if (!start || start < 0) start = 0
1208 if (!end || end < 0 || end > len) end = len
1211 for (var i = start; i < end; ++i) {
1212 out += toHex(buf[i])
1217 function utf16leSlice (buf, start, end) {
1218 var bytes = buf.slice(start, end)
1220 for (var i = 0; i < bytes.length; i += 2) {
1221 res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
1226 Buffer.prototype.slice = function slice (start, end) {
1227 var len = this.length
1229 end = end === undefined ? len : ~~end
1233 if (start < 0) start = 0
1234 } else if (start > len) {
1240 if (end < 0) end = 0
1241 } else if (end > len) {
1245 if (end < start) end = start
1248 if (Buffer.TYPED_ARRAY_SUPPORT) {
1249 newBuf = this.subarray(start, end)
1250 newBuf.__proto__ = Buffer.prototype
1252 var sliceLen = end - start
1253 newBuf = new Buffer(sliceLen, undefined)
1254 for (var i = 0; i < sliceLen; ++i) {
1255 newBuf[i] = this[i + start]
1263 * Need to make sure that buffer isn't trying to write out of bounds.
1265 function checkOffset (offset, ext, length) {
1266 if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
1267 if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
1270 Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
1272 byteLength = byteLength | 0
1273 if (!noAssert) checkOffset(offset, byteLength, this.length)
1275 var val = this[offset]
1278 while (++i < byteLength && (mul *= 0x100)) {
1279 val += this[offset + i] * mul
1285 Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
1287 byteLength = byteLength | 0
1289 checkOffset(offset, byteLength, this.length)
1292 var val = this[offset + --byteLength]
1294 while (byteLength > 0 && (mul *= 0x100)) {
1295 val += this[offset + --byteLength] * mul
1301 Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
1302 if (!noAssert) checkOffset(offset, 1, this.length)
1306 Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
1307 if (!noAssert) checkOffset(offset, 2, this.length)
1308 return this[offset] | (this[offset + 1] << 8)
1311 Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
1312 if (!noAssert) checkOffset(offset, 2, this.length)
1313 return (this[offset] << 8) | this[offset + 1]
1316 Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
1317 if (!noAssert) checkOffset(offset, 4, this.length)
1319 return ((this[offset]) |
1320 (this[offset + 1] << 8) |
1321 (this[offset + 2] << 16)) +
1322 (this[offset + 3] * 0x1000000)
1325 Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
1326 if (!noAssert) checkOffset(offset, 4, this.length)
1328 return (this[offset] * 0x1000000) +
1329 ((this[offset + 1] << 16) |
1330 (this[offset + 2] << 8) |
1334 Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
1336 byteLength = byteLength | 0
1337 if (!noAssert) checkOffset(offset, byteLength, this.length)
1339 var val = this[offset]
1342 while (++i < byteLength && (mul *= 0x100)) {
1343 val += this[offset + i] * mul
1347 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
1352 Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
1354 byteLength = byteLength | 0
1355 if (!noAssert) checkOffset(offset, byteLength, this.length)
1359 var val = this[offset + --i]
1360 while (i > 0 && (mul *= 0x100)) {
1361 val += this[offset + --i] * mul
1365 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
1370 Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
1371 if (!noAssert) checkOffset(offset, 1, this.length)
1372 if (!(this[offset] & 0x80)) return (this[offset])
1373 return ((0xff - this[offset] + 1) * -1)
1376 Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
1377 if (!noAssert) checkOffset(offset, 2, this.length)
1378 var val = this[offset] | (this[offset + 1] << 8)
1379 return (val & 0x8000) ? val | 0xFFFF0000 : val
1382 Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
1383 if (!noAssert) checkOffset(offset, 2, this.length)
1384 var val = this[offset + 1] | (this[offset] << 8)
1385 return (val & 0x8000) ? val | 0xFFFF0000 : val
1388 Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
1389 if (!noAssert) checkOffset(offset, 4, this.length)
1391 return (this[offset]) |
1392 (this[offset + 1] << 8) |
1393 (this[offset + 2] << 16) |
1394 (this[offset + 3] << 24)
1397 Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
1398 if (!noAssert) checkOffset(offset, 4, this.length)
1400 return (this[offset] << 24) |
1401 (this[offset + 1] << 16) |
1402 (this[offset + 2] << 8) |
1406 Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
1407 if (!noAssert) checkOffset(offset, 4, this.length)
1408 return ieee754.read(this, offset, true, 23, 4)
1411 Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
1412 if (!noAssert) checkOffset(offset, 4, this.length)
1413 return ieee754.read(this, offset, false, 23, 4)
1416 Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
1417 if (!noAssert) checkOffset(offset, 8, this.length)
1418 return ieee754.read(this, offset, true, 52, 8)
1421 Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
1422 if (!noAssert) checkOffset(offset, 8, this.length)
1423 return ieee754.read(this, offset, false, 52, 8)
1426 function checkInt (buf, value, offset, ext, max, min) {
1427 if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
1428 if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
1429 if (offset + ext > buf.length) throw new RangeError('Index out of range')
1432 Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
1435 byteLength = byteLength | 0
1437 var maxBytes = Math.pow(2, 8 * byteLength) - 1
1438 checkInt(this, value, offset, byteLength, maxBytes, 0)
1443 this[offset] = value & 0xFF
1444 while (++i < byteLength && (mul *= 0x100)) {
1445 this[offset + i] = (value / mul) & 0xFF
1448 return offset + byteLength
1451 Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
1454 byteLength = byteLength | 0
1456 var maxBytes = Math.pow(2, 8 * byteLength) - 1
1457 checkInt(this, value, offset, byteLength, maxBytes, 0)
1460 var i = byteLength - 1
1462 this[offset + i] = value & 0xFF
1463 while (--i >= 0 && (mul *= 0x100)) {
1464 this[offset + i] = (value / mul) & 0xFF
1467 return offset + byteLength
1470 Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
1473 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
1474 if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
1475 this[offset] = (value & 0xff)
1479 function objectWriteUInt16 (buf, value, offset, littleEndian) {
1480 if (value < 0) value = 0xffff + value + 1
1481 for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
1482 buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
1483 (littleEndian ? i : 1 - i) * 8
1487 Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
1490 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
1491 if (Buffer.TYPED_ARRAY_SUPPORT) {
1492 this[offset] = (value & 0xff)
1493 this[offset + 1] = (value >>> 8)
1495 objectWriteUInt16(this, value, offset, true)
1500 Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
1503 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
1504 if (Buffer.TYPED_ARRAY_SUPPORT) {
1505 this[offset] = (value >>> 8)
1506 this[offset + 1] = (value & 0xff)
1508 objectWriteUInt16(this, value, offset, false)
1513 function objectWriteUInt32 (buf, value, offset, littleEndian) {
1514 if (value < 0) value = 0xffffffff + value + 1
1515 for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
1516 buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
1520 Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
1523 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
1524 if (Buffer.TYPED_ARRAY_SUPPORT) {
1525 this[offset + 3] = (value >>> 24)
1526 this[offset + 2] = (value >>> 16)
1527 this[offset + 1] = (value >>> 8)
1528 this[offset] = (value & 0xff)
1530 objectWriteUInt32(this, value, offset, true)
1535 Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
1538 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
1539 if (Buffer.TYPED_ARRAY_SUPPORT) {
1540 this[offset] = (value >>> 24)
1541 this[offset + 1] = (value >>> 16)
1542 this[offset + 2] = (value >>> 8)
1543 this[offset + 3] = (value & 0xff)
1545 objectWriteUInt32(this, value, offset, false)
1550 Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
1554 var limit = Math.pow(2, 8 * byteLength - 1)
1556 checkInt(this, value, offset, byteLength, limit - 1, -limit)
1562 this[offset] = value & 0xFF
1563 while (++i < byteLength && (mul *= 0x100)) {
1564 if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
1567 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
1570 return offset + byteLength
1573 Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
1577 var limit = Math.pow(2, 8 * byteLength - 1)
1579 checkInt(this, value, offset, byteLength, limit - 1, -limit)
1582 var i = byteLength - 1
1585 this[offset + i] = value & 0xFF
1586 while (--i >= 0 && (mul *= 0x100)) {
1587 if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
1590 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
1593 return offset + byteLength
1596 Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
1599 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
1600 if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
1601 if (value < 0) value = 0xff + value + 1
1602 this[offset] = (value & 0xff)
1606 Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
1609 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
1610 if (Buffer.TYPED_ARRAY_SUPPORT) {
1611 this[offset] = (value & 0xff)
1612 this[offset + 1] = (value >>> 8)
1614 objectWriteUInt16(this, value, offset, true)
1619 Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
1622 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
1623 if (Buffer.TYPED_ARRAY_SUPPORT) {
1624 this[offset] = (value >>> 8)
1625 this[offset + 1] = (value & 0xff)
1627 objectWriteUInt16(this, value, offset, false)
1632 Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
1635 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
1636 if (Buffer.TYPED_ARRAY_SUPPORT) {
1637 this[offset] = (value & 0xff)
1638 this[offset + 1] = (value >>> 8)
1639 this[offset + 2] = (value >>> 16)
1640 this[offset + 3] = (value >>> 24)
1642 objectWriteUInt32(this, value, offset, true)
1647 Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
1650 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
1651 if (value < 0) value = 0xffffffff + value + 1
1652 if (Buffer.TYPED_ARRAY_SUPPORT) {
1653 this[offset] = (value >>> 24)
1654 this[offset + 1] = (value >>> 16)
1655 this[offset + 2] = (value >>> 8)
1656 this[offset + 3] = (value & 0xff)
1658 objectWriteUInt32(this, value, offset, false)
1663 function checkIEEE754 (buf, value, offset, ext, max, min) {
1664 if (offset + ext > buf.length) throw new RangeError('Index out of range')
1665 if (offset < 0) throw new RangeError('Index out of range')
1668 function writeFloat (buf, value, offset, littleEndian, noAssert) {
1670 checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
1672 ieee754.write(buf, value, offset, littleEndian, 23, 4)
1676 Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
1677 return writeFloat(this, value, offset, true, noAssert)
1680 Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
1681 return writeFloat(this, value, offset, false, noAssert)
1684 function writeDouble (buf, value, offset, littleEndian, noAssert) {
1686 checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
1688 ieee754.write(buf, value, offset, littleEndian, 52, 8)
1692 Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
1693 return writeDouble(this, value, offset, true, noAssert)
1696 Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
1697 return writeDouble(this, value, offset, false, noAssert)
1700 // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
1701 Buffer.prototype.copy = function copy (target, targetStart, start, end) {
1702 if (!start) start = 0
1703 if (!end && end !== 0) end = this.length
1704 if (targetStart >= target.length) targetStart = target.length
1705 if (!targetStart) targetStart = 0
1706 if (end > 0 && end < start) end = start
1708 // Copy 0 bytes; we're done
1709 if (end === start) return 0
1710 if (target.length === 0 || this.length === 0) return 0
1712 // Fatal error conditions
1713 if (targetStart < 0) {
1714 throw new RangeError('targetStart out of bounds')
1716 if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
1717 if (end < 0) throw new RangeError('sourceEnd out of bounds')
1720 if (end > this.length) end = this.length
1721 if (target.length - targetStart < end - start) {
1722 end = target.length - targetStart + start
1725 var len = end - start
1728 if (this === target && start < targetStart && targetStart < end) {
1729 // descending copy from end
1730 for (i = len - 1; i >= 0; --i) {
1731 target[i + targetStart] = this[i + start]
1733 } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
1734 // ascending copy from start
1735 for (i = 0; i < len; ++i) {
1736 target[i + targetStart] = this[i + start]
1739 Uint8Array.prototype.set.call(
1741 this.subarray(start, start + len),
1750 // buffer.fill(number[, offset[, end]])
1751 // buffer.fill(buffer[, offset[, end]])
1752 // buffer.fill(string[, offset[, end]][, encoding])
1753 Buffer.prototype.fill = function fill (val, start, end, encoding) {
1754 // Handle string cases:
1755 if (typeof val === 'string') {
1756 if (typeof start === 'string') {
1760 } else if (typeof end === 'string') {
1764 if (val.length === 1) {
1765 var code = val.charCodeAt(0)
1770 if (encoding !== undefined && typeof encoding !== 'string') {
1771 throw new TypeError('encoding must be a string')
1773 if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
1774 throw new TypeError('Unknown encoding: ' + encoding)
1776 } else if (typeof val === 'number') {
1780 // Invalid ranges are not set to a default, so can range check early.
1781 if (start < 0 || this.length < start || this.length < end) {
1782 throw new RangeError('Out of range index')
1790 end = end === undefined ? this.length : end >>> 0
1795 if (typeof val === 'number') {
1796 for (i = start; i < end; ++i) {
1800 var bytes = Buffer.isBuffer(val)
1802 : utf8ToBytes(new Buffer(val, encoding).toString())
1803 var len = bytes.length
1804 for (i = 0; i < end - start; ++i) {
1805 this[i + start] = bytes[i % len]
1815 var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
1817 function base64clean (str) {
1818 // Node strips out invalid characters like \n and \t from the string, base64-js does not
1819 str = stringtrim(str).replace(INVALID_BASE64_RE, '')
1820 // Node converts strings with length < 2 to ''
1821 if (str.length < 2) return ''
1822 // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
1823 while (str.length % 4 !== 0) {
1829 function stringtrim (str) {
1830 if (str.trim) return str.trim()
1831 return str.replace(/^\s+|\s+$/g, '')
1834 function toHex (n) {
1835 if (n < 16) return '0' + n.toString(16)
1836 return n.toString(16)
1839 function utf8ToBytes (string, units) {
1840 units = units || Infinity
1842 var length = string.length
1843 var leadSurrogate = null
1846 for (var i = 0; i < length; ++i) {
1847 codePoint = string.charCodeAt(i)
1849 // is surrogate component
1850 if (codePoint > 0xD7FF && codePoint < 0xE000) {
1851 // last char was a lead
1852 if (!leadSurrogate) {
1854 if (codePoint > 0xDBFF) {
1856 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1858 } else if (i + 1 === length) {
1860 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1865 leadSurrogate = codePoint
1871 if (codePoint < 0xDC00) {
1872 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1873 leadSurrogate = codePoint
1877 // valid surrogate pair
1878 codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
1879 } else if (leadSurrogate) {
1880 // valid bmp char, but last char was a lead
1881 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1884 leadSurrogate = null
1887 if (codePoint < 0x80) {
1888 if ((units -= 1) < 0) break
1889 bytes.push(codePoint)
1890 } else if (codePoint < 0x800) {
1891 if ((units -= 2) < 0) break
1893 codePoint >> 0x6 | 0xC0,
1894 codePoint & 0x3F | 0x80
1896 } else if (codePoint < 0x10000) {
1897 if ((units -= 3) < 0) break
1899 codePoint >> 0xC | 0xE0,
1900 codePoint >> 0x6 & 0x3F | 0x80,
1901 codePoint & 0x3F | 0x80
1903 } else if (codePoint < 0x110000) {
1904 if ((units -= 4) < 0) break
1906 codePoint >> 0x12 | 0xF0,
1907 codePoint >> 0xC & 0x3F | 0x80,
1908 codePoint >> 0x6 & 0x3F | 0x80,
1909 codePoint & 0x3F | 0x80
1912 throw new Error('Invalid code point')
1919 function asciiToBytes (str) {
1921 for (var i = 0; i < str.length; ++i) {
1922 // Node's code seems to be doing this and not & 0x7F..
1923 byteArray.push(str.charCodeAt(i) & 0xFF)
1928 function utf16leToBytes (str, units) {
1931 for (var i = 0; i < str.length; ++i) {
1932 if ((units -= 2) < 0) break
1934 c = str.charCodeAt(i)
1944 function base64ToBytes (str) {
1945 return base64.toByteArray(base64clean(str))
1948 function blitBuffer (src, dst, offset, length) {
1949 for (var i = 0; i < length; ++i) {
1950 if ((i + offset >= dst.length) || (i >= src.length)) break
1951 dst[i + offset] = src[i]
1956 function isnan (val) {
1957 return val !== val // eslint-disable-line no-self-compare
1960 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
1964 /***/ (function(module, exports, __webpack_require__) {
1966 /* WEBPACK VAR INJECTION */(function(module) {(function (module, exports) {
1970 function assert (val, msg) {
1971 if (!val) throw new Error(msg || 'Assertion failed');
1974 // Could use `inherits` module, but don't want to move from single file
1975 // architecture yet.
1976 function inherits (ctor, superCtor) {
1977 ctor.super_ = superCtor;
1978 var TempCtor = function () {};
1979 TempCtor.prototype = superCtor.prototype;
1980 ctor.prototype = new TempCtor();
1981 ctor.prototype.constructor = ctor;
1986 function BN (number, base, endian) {
1987 if (BN.isBN(number)) {
1995 // Reduction context
1998 if (number !== null) {
1999 if (base === 'le' || base === 'be') {
2004 this._init(number || 0, base || 10, endian || 'be');
2007 if (typeof module === 'object') {
2008 module.exports = BN;
2018 Buffer = __webpack_require__(217).Buffer;
2022 BN.isBN = function isBN (num) {
2023 if (num instanceof BN) {
2027 return num !== null && typeof num === 'object' &&
2028 num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);
2031 BN.max = function max (left, right) {
2032 if (left.cmp(right) > 0) return left;
2036 BN.min = function min (left, right) {
2037 if (left.cmp(right) < 0) return left;
2041 BN.prototype._init = function init (number, base, endian) {
2042 if (typeof number === 'number') {
2043 return this._initNumber(number, base, endian);
2046 if (typeof number === 'object') {
2047 return this._initArray(number, base, endian);
2050 if (base === 'hex') {
2053 assert(base === (base | 0) && base >= 2 && base <= 36);
2055 number = number.toString().replace(/\s+/g, '');
2057 if (number[0] === '-') {
2062 this._parseHex(number, start);
2064 this._parseBase(number, base, start);
2067 if (number[0] === '-') {
2073 if (endian !== 'le') return;
2075 this._initArray(this.toArray(), base, endian);
2078 BN.prototype._initNumber = function _initNumber (number, base, endian) {
2083 if (number < 0x4000000) {
2084 this.words = [ number & 0x3ffffff ];
2086 } else if (number < 0x10000000000000) {
2089 (number / 0x4000000) & 0x3ffffff
2093 assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)
2096 (number / 0x4000000) & 0x3ffffff,
2102 if (endian !== 'le') return;
2104 // Reverse the bytes
2105 this._initArray(this.toArray(), base, endian);
2108 BN.prototype._initArray = function _initArray (number, base, endian) {
2109 // Perhaps a Uint8Array
2110 assert(typeof number.length === 'number');
2111 if (number.length <= 0) {
2117 this.length = Math.ceil(number.length / 3);
2118 this.words = new Array(this.length);
2119 for (var i = 0; i < this.length; i++) {
2125 if (endian === 'be') {
2126 for (i = number.length - 1, j = 0; i >= 0; i -= 3) {
2127 w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);
2128 this.words[j] |= (w << off) & 0x3ffffff;
2129 this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
2136 } else if (endian === 'le') {
2137 for (i = 0, j = 0; i < number.length; i += 3) {
2138 w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);
2139 this.words[j] |= (w << off) & 0x3ffffff;
2140 this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
2148 return this.strip();
2151 function parseHex (str, start, end) {
2153 var len = Math.min(str.length, end);
2154 for (var i = start; i < len; i++) {
2155 var c = str.charCodeAt(i) - 48;
2160 if (c >= 49 && c <= 54) {
2164 } else if (c >= 17 && c <= 22) {
2175 BN.prototype._parseHex = function _parseHex (number, start) {
2176 // Create possibly bigger array to ensure that it fits the number
2177 this.length = Math.ceil((number.length - start) / 6);
2178 this.words = new Array(this.length);
2179 for (var i = 0; i < this.length; i++) {
2184 // Scan 24-bit chunks and add them to the number
2186 for (i = number.length - 6, j = 0; i >= start; i -= 6) {
2187 w = parseHex(number, i, i + 6);
2188 this.words[j] |= (w << off) & 0x3ffffff;
2189 // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb
2190 this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;
2197 if (i + 6 !== start) {
2198 w = parseHex(number, start, i + 6);
2199 this.words[j] |= (w << off) & 0x3ffffff;
2200 this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;
2205 function parseBase (str, start, end, mul) {
2207 var len = Math.min(str.length, end);
2208 for (var i = start; i < len; i++) {
2209 var c = str.charCodeAt(i) - 48;
2218 } else if (c >= 17) {
2229 BN.prototype._parseBase = function _parseBase (number, base, start) {
2230 // Initialize as zero
2234 // Find length of limb in base
2235 for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {
2239 limbPow = (limbPow / base) | 0;
2241 var total = number.length - start;
2242 var mod = total % limbLen;
2243 var end = Math.min(total, total - mod) + start;
2246 for (var i = start; i < end; i += limbLen) {
2247 word = parseBase(number, i, i + limbLen, base);
2249 this.imuln(limbPow);
2250 if (this.words[0] + word < 0x4000000) {
2251 this.words[0] += word;
2259 word = parseBase(number, i, number.length, base);
2261 for (i = 0; i < mod; i++) {
2266 if (this.words[0] + word < 0x4000000) {
2267 this.words[0] += word;
2274 BN.prototype.copy = function copy (dest) {
2275 dest.words = new Array(this.length);
2276 for (var i = 0; i < this.length; i++) {
2277 dest.words[i] = this.words[i];
2279 dest.length = this.length;
2280 dest.negative = this.negative;
2281 dest.red = this.red;
2284 BN.prototype.clone = function clone () {
2285 var r = new BN(null);
2290 BN.prototype._expand = function _expand (size) {
2291 while (this.length < size) {
2292 this.words[this.length++] = 0;
2297 // Remove leading `0` from `this`
2298 BN.prototype.strip = function strip () {
2299 while (this.length > 1 && this.words[this.length - 1] === 0) {
2302 return this._normSign();
2305 BN.prototype._normSign = function _normSign () {
2307 if (this.length === 1 && this.words[0] === 0) {
2313 BN.prototype.inspect = function inspect () {
2314 return (this.red ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>';
2320 var groupSizes = [];
2321 var groupBases = [];
2325 while (++i < BN.wordSize) {
2334 while (++base < 36 + 1) {
2337 while (groupBase < (1 << BN.wordSize) / base) {
2341 groupSizes[base] = groupSize;
2342 groupBases[base] = groupBase;
2365 '00000000000000000',
2366 '000000000000000000',
2367 '0000000000000000000',
2368 '00000000000000000000',
2369 '000000000000000000000',
2370 '0000000000000000000000',
2371 '00000000000000000000000',
2372 '000000000000000000000000',
2373 '0000000000000000000000000'
2378 25, 16, 12, 11, 10, 9, 8,
2379 8, 7, 7, 7, 7, 6, 6,
2380 6, 6, 6, 6, 6, 5, 5,
2381 5, 5, 5, 5, 5, 5, 5,
2387 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,
2388 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,
2389 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,
2390 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,
2391 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176
2394 BN.prototype.toString = function toString (base, padding) {
2396 padding = padding | 0 || 1;
2399 if (base === 16 || base === 'hex') {
2403 for (var i = 0; i < this.length; i++) {
2404 var w = this.words[i];
2405 var word = (((w << off) | carry) & 0xffffff).toString(16);
2406 carry = (w >>> (24 - off)) & 0xffffff;
2407 if (carry !== 0 || i !== this.length - 1) {
2408 out = zeros[6 - word.length] + word + out;
2419 out = carry.toString(16) + out;
2421 while (out.length % padding !== 0) {
2424 if (this.negative !== 0) {
2430 if (base === (base | 0) && base >= 2 && base <= 36) {
2431 // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));
2432 var groupSize = groupSizes[base];
2433 // var groupBase = Math.pow(base, groupSize);
2434 var groupBase = groupBases[base];
2436 var c = this.clone();
2438 while (!c.isZero()) {
2439 var r = c.modn(groupBase).toString(base);
2440 c = c.idivn(groupBase);
2443 out = zeros[groupSize - r.length] + r + out;
2448 if (this.isZero()) {
2451 while (out.length % padding !== 0) {
2454 if (this.negative !== 0) {
2460 assert(false, 'Base should be between 2 and 36');
2463 BN.prototype.toNumber = function toNumber () {
2464 var ret = this.words[0];
2465 if (this.length === 2) {
2466 ret += this.words[1] * 0x4000000;
2467 } else if (this.length === 3 && this.words[2] === 0x01) {
2468 // NOTE: at this stage it is known that the top bit is set
2469 ret += 0x10000000000000 + (this.words[1] * 0x4000000);
2470 } else if (this.length > 2) {
2471 assert(false, 'Number can only safely store up to 53 bits');
2473 return (this.negative !== 0) ? -ret : ret;
2476 BN.prototype.toJSON = function toJSON () {
2477 return this.toString(16);
2480 BN.prototype.toBuffer = function toBuffer (endian, length) {
2481 assert(typeof Buffer !== 'undefined');
2482 return this.toArrayLike(Buffer, endian, length);
2485 BN.prototype.toArray = function toArray (endian, length) {
2486 return this.toArrayLike(Array, endian, length);
2489 BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {
2490 var byteLength = this.byteLength();
2491 var reqLength = length || Math.max(1, byteLength);
2492 assert(byteLength <= reqLength, 'byte array longer than desired length');
2493 assert(reqLength > 0, 'Requested array length <= 0');
2496 var littleEndian = endian === 'le';
2497 var res = new ArrayType(reqLength);
2500 var q = this.clone();
2501 if (!littleEndian) {
2502 // Assume big-endian
2503 for (i = 0; i < reqLength - byteLength; i++) {
2507 for (i = 0; !q.isZero(); i++) {
2511 res[reqLength - i - 1] = b;
2514 for (i = 0; !q.isZero(); i++) {
2521 for (; i < reqLength; i++) {
2530 BN.prototype._countBits = function _countBits (w) {
2531 return 32 - Math.clz32(w);
2534 BN.prototype._countBits = function _countBits (w) {
2557 BN.prototype._zeroBits = function _zeroBits (w) {
2559 if (w === 0) return 26;
2563 if ((t & 0x1fff) === 0) {
2567 if ((t & 0x7f) === 0) {
2571 if ((t & 0xf) === 0) {
2575 if ((t & 0x3) === 0) {
2579 if ((t & 0x1) === 0) {
2585 // Return number of used bits in a BN
2586 BN.prototype.bitLength = function bitLength () {
2587 var w = this.words[this.length - 1];
2588 var hi = this._countBits(w);
2589 return (this.length - 1) * 26 + hi;
2592 function toBitArray (num) {
2593 var w = new Array(num.bitLength());
2595 for (var bit = 0; bit < w.length; bit++) {
2596 var off = (bit / 26) | 0;
2597 var wbit = bit % 26;
2599 w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;
2605 // Number of trailing zero bits
2606 BN.prototype.zeroBits = function zeroBits () {
2607 if (this.isZero()) return 0;
2610 for (var i = 0; i < this.length; i++) {
2611 var b = this._zeroBits(this.words[i]);
2613 if (b !== 26) break;
2618 BN.prototype.byteLength = function byteLength () {
2619 return Math.ceil(this.bitLength() / 8);
2622 BN.prototype.toTwos = function toTwos (width) {
2623 if (this.negative !== 0) {
2624 return this.abs().inotn(width).iaddn(1);
2626 return this.clone();
2629 BN.prototype.fromTwos = function fromTwos (width) {
2630 if (this.testn(width - 1)) {
2631 return this.notn(width).iaddn(1).ineg();
2633 return this.clone();
2636 BN.prototype.isNeg = function isNeg () {
2637 return this.negative !== 0;
2640 // Return negative clone of `this`
2641 BN.prototype.neg = function neg () {
2642 return this.clone().ineg();
2645 BN.prototype.ineg = function ineg () {
2646 if (!this.isZero()) {
2653 // Or `num` with `this` in-place
2654 BN.prototype.iuor = function iuor (num) {
2655 while (this.length < num.length) {
2656 this.words[this.length++] = 0;
2659 for (var i = 0; i < num.length; i++) {
2660 this.words[i] = this.words[i] | num.words[i];
2663 return this.strip();
2666 BN.prototype.ior = function ior (num) {
2667 assert((this.negative | num.negative) === 0);
2668 return this.iuor(num);
2671 // Or `num` with `this`
2672 BN.prototype.or = function or (num) {
2673 if (this.length > num.length) return this.clone().ior(num);
2674 return num.clone().ior(this);
2677 BN.prototype.uor = function uor (num) {
2678 if (this.length > num.length) return this.clone().iuor(num);
2679 return num.clone().iuor(this);
2682 // And `num` with `this` in-place
2683 BN.prototype.iuand = function iuand (num) {
2684 // b = min-length(num, this)
2686 if (this.length > num.length) {
2692 for (var i = 0; i < b.length; i++) {
2693 this.words[i] = this.words[i] & num.words[i];
2696 this.length = b.length;
2698 return this.strip();
2701 BN.prototype.iand = function iand (num) {
2702 assert((this.negative | num.negative) === 0);
2703 return this.iuand(num);
2706 // And `num` with `this`
2707 BN.prototype.and = function and (num) {
2708 if (this.length > num.length) return this.clone().iand(num);
2709 return num.clone().iand(this);
2712 BN.prototype.uand = function uand (num) {
2713 if (this.length > num.length) return this.clone().iuand(num);
2714 return num.clone().iuand(this);
2717 // Xor `num` with `this` in-place
2718 BN.prototype.iuxor = function iuxor (num) {
2719 // a.length > b.length
2722 if (this.length > num.length) {
2730 for (var i = 0; i < b.length; i++) {
2731 this.words[i] = a.words[i] ^ b.words[i];
2735 for (; i < a.length; i++) {
2736 this.words[i] = a.words[i];
2740 this.length = a.length;
2742 return this.strip();
2745 BN.prototype.ixor = function ixor (num) {
2746 assert((this.negative | num.negative) === 0);
2747 return this.iuxor(num);
2750 // Xor `num` with `this`
2751 BN.prototype.xor = function xor (num) {
2752 if (this.length > num.length) return this.clone().ixor(num);
2753 return num.clone().ixor(this);
2756 BN.prototype.uxor = function uxor (num) {
2757 if (this.length > num.length) return this.clone().iuxor(num);
2758 return num.clone().iuxor(this);
2761 // Not ``this`` with ``width`` bitwidth
2762 BN.prototype.inotn = function inotn (width) {
2763 assert(typeof width === 'number' && width >= 0);
2765 var bytesNeeded = Math.ceil(width / 26) | 0;
2766 var bitsLeft = width % 26;
2768 // Extend the buffer with leading zeroes
2769 this._expand(bytesNeeded);
2775 // Handle complete words
2776 for (var i = 0; i < bytesNeeded; i++) {
2777 this.words[i] = ~this.words[i] & 0x3ffffff;
2780 // Handle the residue
2782 this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));
2785 // And remove leading zeroes
2786 return this.strip();
2789 BN.prototype.notn = function notn (width) {
2790 return this.clone().inotn(width);
2793 // Set `bit` of `this`
2794 BN.prototype.setn = function setn (bit, val) {
2795 assert(typeof bit === 'number' && bit >= 0);
2797 var off = (bit / 26) | 0;
2798 var wbit = bit % 26;
2800 this._expand(off + 1);
2803 this.words[off] = this.words[off] | (1 << wbit);
2805 this.words[off] = this.words[off] & ~(1 << wbit);
2808 return this.strip();
2811 // Add `num` to `this` in-place
2812 BN.prototype.iadd = function iadd (num) {
2815 // negative + positive
2816 if (this.negative !== 0 && num.negative === 0) {
2820 return this._normSign();
2822 // positive + negative
2823 } else if (this.negative === 0 && num.negative !== 0) {
2827 return r._normSign();
2830 // a.length > b.length
2832 if (this.length > num.length) {
2841 for (var i = 0; i < b.length; i++) {
2842 r = (a.words[i] | 0) + (b.words[i] | 0) + carry;
2843 this.words[i] = r & 0x3ffffff;
2846 for (; carry !== 0 && i < a.length; i++) {
2847 r = (a.words[i] | 0) + carry;
2848 this.words[i] = r & 0x3ffffff;
2852 this.length = a.length;
2854 this.words[this.length] = carry;
2856 // Copy the rest of the words
2857 } else if (a !== this) {
2858 for (; i < a.length; i++) {
2859 this.words[i] = a.words[i];
2866 // Add `num` to `this`
2867 BN.prototype.add = function add (num) {
2869 if (num.negative !== 0 && this.negative === 0) {
2871 res = this.sub(num);
2874 } else if (num.negative === 0 && this.negative !== 0) {
2876 res = num.sub(this);
2881 if (this.length > num.length) return this.clone().iadd(num);
2883 return num.clone().iadd(this);
2886 // Subtract `num` from `this` in-place
2887 BN.prototype.isub = function isub (num) {
2888 // this - (-num) = this + num
2889 if (num.negative !== 0) {
2891 var r = this.iadd(num);
2893 return r._normSign();
2895 // -this - num = -(this + num)
2896 } else if (this.negative !== 0) {
2900 return this._normSign();
2903 // At this point both numbers are positive
2904 var cmp = this.cmp(num);
2906 // Optimization - zeroify
2925 for (var i = 0; i < b.length; i++) {
2926 r = (a.words[i] | 0) - (b.words[i] | 0) + carry;
2928 this.words[i] = r & 0x3ffffff;
2930 for (; carry !== 0 && i < a.length; i++) {
2931 r = (a.words[i] | 0) + carry;
2933 this.words[i] = r & 0x3ffffff;
2936 // Copy rest of the words
2937 if (carry === 0 && i < a.length && a !== this) {
2938 for (; i < a.length; i++) {
2939 this.words[i] = a.words[i];
2943 this.length = Math.max(this.length, i);
2949 return this.strip();
2952 // Subtract `num` from `this`
2953 BN.prototype.sub = function sub (num) {
2954 return this.clone().isub(num);
2957 function smallMulTo (self, num, out) {
2958 out.negative = num.negative ^ self.negative;
2959 var len = (self.length + num.length) | 0;
2961 len = (len - 1) | 0;
2963 // Peel one iteration (compiler can't do it, because of code complexity)
2964 var a = self.words[0] | 0;
2965 var b = num.words[0] | 0;
2968 var lo = r & 0x3ffffff;
2969 var carry = (r / 0x4000000) | 0;
2972 for (var k = 1; k < len; k++) {
2973 // Sum all words with the same `i + j = k` and accumulate `ncarry`,
2974 // note that ncarry could be >= 0x3ffffff
2975 var ncarry = carry >>> 26;
2976 var rword = carry & 0x3ffffff;
2977 var maxJ = Math.min(k, num.length - 1);
2978 for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
2979 var i = (k - j) | 0;
2980 a = self.words[i] | 0;
2981 b = num.words[j] | 0;
2983 ncarry += (r / 0x4000000) | 0;
2984 rword = r & 0x3ffffff;
2986 out.words[k] = rword | 0;
2990 out.words[k] = carry | 0;
2998 // TODO(indutny): it may be reasonable to omit it for users who don't need
2999 // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit
3000 // multiplication (like elliptic secp256k1).
3001 var comb10MulTo = function comb10MulTo (self, num, out) {
3010 var al0 = a0 & 0x1fff;
3011 var ah0 = a0 >>> 13;
3013 var al1 = a1 & 0x1fff;
3014 var ah1 = a1 >>> 13;
3016 var al2 = a2 & 0x1fff;
3017 var ah2 = a2 >>> 13;
3019 var al3 = a3 & 0x1fff;
3020 var ah3 = a3 >>> 13;
3022 var al4 = a4 & 0x1fff;
3023 var ah4 = a4 >>> 13;
3025 var al5 = a5 & 0x1fff;
3026 var ah5 = a5 >>> 13;
3028 var al6 = a6 & 0x1fff;
3029 var ah6 = a6 >>> 13;
3031 var al7 = a7 & 0x1fff;
3032 var ah7 = a7 >>> 13;
3034 var al8 = a8 & 0x1fff;
3035 var ah8 = a8 >>> 13;
3037 var al9 = a9 & 0x1fff;
3038 var ah9 = a9 >>> 13;
3040 var bl0 = b0 & 0x1fff;
3041 var bh0 = b0 >>> 13;
3043 var bl1 = b1 & 0x1fff;
3044 var bh1 = b1 >>> 13;
3046 var bl2 = b2 & 0x1fff;
3047 var bh2 = b2 >>> 13;
3049 var bl3 = b3 & 0x1fff;
3050 var bh3 = b3 >>> 13;
3052 var bl4 = b4 & 0x1fff;
3053 var bh4 = b4 >>> 13;
3055 var bl5 = b5 & 0x1fff;
3056 var bh5 = b5 >>> 13;
3058 var bl6 = b6 & 0x1fff;
3059 var bh6 = b6 >>> 13;
3061 var bl7 = b7 & 0x1fff;
3062 var bh7 = b7 >>> 13;
3064 var bl8 = b8 & 0x1fff;
3065 var bh8 = b8 >>> 13;
3067 var bl9 = b9 & 0x1fff;
3068 var bh9 = b9 >>> 13;
3070 out.negative = self.negative ^ num.negative;
3073 lo = Math.imul(al0, bl0);
3074 mid = Math.imul(al0, bh0);
3075 mid = (mid + Math.imul(ah0, bl0)) | 0;
3076 hi = Math.imul(ah0, bh0);
3077 var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3078 c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;
3081 lo = Math.imul(al1, bl0);
3082 mid = Math.imul(al1, bh0);
3083 mid = (mid + Math.imul(ah1, bl0)) | 0;
3084 hi = Math.imul(ah1, bh0);
3085 lo = (lo + Math.imul(al0, bl1)) | 0;
3086 mid = (mid + Math.imul(al0, bh1)) | 0;
3087 mid = (mid + Math.imul(ah0, bl1)) | 0;
3088 hi = (hi + Math.imul(ah0, bh1)) | 0;
3089 var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3090 c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;
3093 lo = Math.imul(al2, bl0);
3094 mid = Math.imul(al2, bh0);
3095 mid = (mid + Math.imul(ah2, bl0)) | 0;
3096 hi = Math.imul(ah2, bh0);
3097 lo = (lo + Math.imul(al1, bl1)) | 0;
3098 mid = (mid + Math.imul(al1, bh1)) | 0;
3099 mid = (mid + Math.imul(ah1, bl1)) | 0;
3100 hi = (hi + Math.imul(ah1, bh1)) | 0;
3101 lo = (lo + Math.imul(al0, bl2)) | 0;
3102 mid = (mid + Math.imul(al0, bh2)) | 0;
3103 mid = (mid + Math.imul(ah0, bl2)) | 0;
3104 hi = (hi + Math.imul(ah0, bh2)) | 0;
3105 var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3106 c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;
3109 lo = Math.imul(al3, bl0);
3110 mid = Math.imul(al3, bh0);
3111 mid = (mid + Math.imul(ah3, bl0)) | 0;
3112 hi = Math.imul(ah3, bh0);
3113 lo = (lo + Math.imul(al2, bl1)) | 0;
3114 mid = (mid + Math.imul(al2, bh1)) | 0;
3115 mid = (mid + Math.imul(ah2, bl1)) | 0;
3116 hi = (hi + Math.imul(ah2, bh1)) | 0;
3117 lo = (lo + Math.imul(al1, bl2)) | 0;
3118 mid = (mid + Math.imul(al1, bh2)) | 0;
3119 mid = (mid + Math.imul(ah1, bl2)) | 0;
3120 hi = (hi + Math.imul(ah1, bh2)) | 0;
3121 lo = (lo + Math.imul(al0, bl3)) | 0;
3122 mid = (mid + Math.imul(al0, bh3)) | 0;
3123 mid = (mid + Math.imul(ah0, bl3)) | 0;
3124 hi = (hi + Math.imul(ah0, bh3)) | 0;
3125 var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3126 c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;
3129 lo = Math.imul(al4, bl0);
3130 mid = Math.imul(al4, bh0);
3131 mid = (mid + Math.imul(ah4, bl0)) | 0;
3132 hi = Math.imul(ah4, bh0);
3133 lo = (lo + Math.imul(al3, bl1)) | 0;
3134 mid = (mid + Math.imul(al3, bh1)) | 0;
3135 mid = (mid + Math.imul(ah3, bl1)) | 0;
3136 hi = (hi + Math.imul(ah3, bh1)) | 0;
3137 lo = (lo + Math.imul(al2, bl2)) | 0;
3138 mid = (mid + Math.imul(al2, bh2)) | 0;
3139 mid = (mid + Math.imul(ah2, bl2)) | 0;
3140 hi = (hi + Math.imul(ah2, bh2)) | 0;
3141 lo = (lo + Math.imul(al1, bl3)) | 0;
3142 mid = (mid + Math.imul(al1, bh3)) | 0;
3143 mid = (mid + Math.imul(ah1, bl3)) | 0;
3144 hi = (hi + Math.imul(ah1, bh3)) | 0;
3145 lo = (lo + Math.imul(al0, bl4)) | 0;
3146 mid = (mid + Math.imul(al0, bh4)) | 0;
3147 mid = (mid + Math.imul(ah0, bl4)) | 0;
3148 hi = (hi + Math.imul(ah0, bh4)) | 0;
3149 var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3150 c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;
3153 lo = Math.imul(al5, bl0);
3154 mid = Math.imul(al5, bh0);
3155 mid = (mid + Math.imul(ah5, bl0)) | 0;
3156 hi = Math.imul(ah5, bh0);
3157 lo = (lo + Math.imul(al4, bl1)) | 0;
3158 mid = (mid + Math.imul(al4, bh1)) | 0;
3159 mid = (mid + Math.imul(ah4, bl1)) | 0;
3160 hi = (hi + Math.imul(ah4, bh1)) | 0;
3161 lo = (lo + Math.imul(al3, bl2)) | 0;
3162 mid = (mid + Math.imul(al3, bh2)) | 0;
3163 mid = (mid + Math.imul(ah3, bl2)) | 0;
3164 hi = (hi + Math.imul(ah3, bh2)) | 0;
3165 lo = (lo + Math.imul(al2, bl3)) | 0;
3166 mid = (mid + Math.imul(al2, bh3)) | 0;
3167 mid = (mid + Math.imul(ah2, bl3)) | 0;
3168 hi = (hi + Math.imul(ah2, bh3)) | 0;
3169 lo = (lo + Math.imul(al1, bl4)) | 0;
3170 mid = (mid + Math.imul(al1, bh4)) | 0;
3171 mid = (mid + Math.imul(ah1, bl4)) | 0;
3172 hi = (hi + Math.imul(ah1, bh4)) | 0;
3173 lo = (lo + Math.imul(al0, bl5)) | 0;
3174 mid = (mid + Math.imul(al0, bh5)) | 0;
3175 mid = (mid + Math.imul(ah0, bl5)) | 0;
3176 hi = (hi + Math.imul(ah0, bh5)) | 0;
3177 var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3178 c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;
3181 lo = Math.imul(al6, bl0);
3182 mid = Math.imul(al6, bh0);
3183 mid = (mid + Math.imul(ah6, bl0)) | 0;
3184 hi = Math.imul(ah6, bh0);
3185 lo = (lo + Math.imul(al5, bl1)) | 0;
3186 mid = (mid + Math.imul(al5, bh1)) | 0;
3187 mid = (mid + Math.imul(ah5, bl1)) | 0;
3188 hi = (hi + Math.imul(ah5, bh1)) | 0;
3189 lo = (lo + Math.imul(al4, bl2)) | 0;
3190 mid = (mid + Math.imul(al4, bh2)) | 0;
3191 mid = (mid + Math.imul(ah4, bl2)) | 0;
3192 hi = (hi + Math.imul(ah4, bh2)) | 0;
3193 lo = (lo + Math.imul(al3, bl3)) | 0;
3194 mid = (mid + Math.imul(al3, bh3)) | 0;
3195 mid = (mid + Math.imul(ah3, bl3)) | 0;
3196 hi = (hi + Math.imul(ah3, bh3)) | 0;
3197 lo = (lo + Math.imul(al2, bl4)) | 0;
3198 mid = (mid + Math.imul(al2, bh4)) | 0;
3199 mid = (mid + Math.imul(ah2, bl4)) | 0;
3200 hi = (hi + Math.imul(ah2, bh4)) | 0;
3201 lo = (lo + Math.imul(al1, bl5)) | 0;
3202 mid = (mid + Math.imul(al1, bh5)) | 0;
3203 mid = (mid + Math.imul(ah1, bl5)) | 0;
3204 hi = (hi + Math.imul(ah1, bh5)) | 0;
3205 lo = (lo + Math.imul(al0, bl6)) | 0;
3206 mid = (mid + Math.imul(al0, bh6)) | 0;
3207 mid = (mid + Math.imul(ah0, bl6)) | 0;
3208 hi = (hi + Math.imul(ah0, bh6)) | 0;
3209 var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3210 c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;
3213 lo = Math.imul(al7, bl0);
3214 mid = Math.imul(al7, bh0);
3215 mid = (mid + Math.imul(ah7, bl0)) | 0;
3216 hi = Math.imul(ah7, bh0);
3217 lo = (lo + Math.imul(al6, bl1)) | 0;
3218 mid = (mid + Math.imul(al6, bh1)) | 0;
3219 mid = (mid + Math.imul(ah6, bl1)) | 0;
3220 hi = (hi + Math.imul(ah6, bh1)) | 0;
3221 lo = (lo + Math.imul(al5, bl2)) | 0;
3222 mid = (mid + Math.imul(al5, bh2)) | 0;
3223 mid = (mid + Math.imul(ah5, bl2)) | 0;
3224 hi = (hi + Math.imul(ah5, bh2)) | 0;
3225 lo = (lo + Math.imul(al4, bl3)) | 0;
3226 mid = (mid + Math.imul(al4, bh3)) | 0;
3227 mid = (mid + Math.imul(ah4, bl3)) | 0;
3228 hi = (hi + Math.imul(ah4, bh3)) | 0;
3229 lo = (lo + Math.imul(al3, bl4)) | 0;
3230 mid = (mid + Math.imul(al3, bh4)) | 0;
3231 mid = (mid + Math.imul(ah3, bl4)) | 0;
3232 hi = (hi + Math.imul(ah3, bh4)) | 0;
3233 lo = (lo + Math.imul(al2, bl5)) | 0;
3234 mid = (mid + Math.imul(al2, bh5)) | 0;
3235 mid = (mid + Math.imul(ah2, bl5)) | 0;
3236 hi = (hi + Math.imul(ah2, bh5)) | 0;
3237 lo = (lo + Math.imul(al1, bl6)) | 0;
3238 mid = (mid + Math.imul(al1, bh6)) | 0;
3239 mid = (mid + Math.imul(ah1, bl6)) | 0;
3240 hi = (hi + Math.imul(ah1, bh6)) | 0;
3241 lo = (lo + Math.imul(al0, bl7)) | 0;
3242 mid = (mid + Math.imul(al0, bh7)) | 0;
3243 mid = (mid + Math.imul(ah0, bl7)) | 0;
3244 hi = (hi + Math.imul(ah0, bh7)) | 0;
3245 var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3246 c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;
3249 lo = Math.imul(al8, bl0);
3250 mid = Math.imul(al8, bh0);
3251 mid = (mid + Math.imul(ah8, bl0)) | 0;
3252 hi = Math.imul(ah8, bh0);
3253 lo = (lo + Math.imul(al7, bl1)) | 0;
3254 mid = (mid + Math.imul(al7, bh1)) | 0;
3255 mid = (mid + Math.imul(ah7, bl1)) | 0;
3256 hi = (hi + Math.imul(ah7, bh1)) | 0;
3257 lo = (lo + Math.imul(al6, bl2)) | 0;
3258 mid = (mid + Math.imul(al6, bh2)) | 0;
3259 mid = (mid + Math.imul(ah6, bl2)) | 0;
3260 hi = (hi + Math.imul(ah6, bh2)) | 0;
3261 lo = (lo + Math.imul(al5, bl3)) | 0;
3262 mid = (mid + Math.imul(al5, bh3)) | 0;
3263 mid = (mid + Math.imul(ah5, bl3)) | 0;
3264 hi = (hi + Math.imul(ah5, bh3)) | 0;
3265 lo = (lo + Math.imul(al4, bl4)) | 0;
3266 mid = (mid + Math.imul(al4, bh4)) | 0;
3267 mid = (mid + Math.imul(ah4, bl4)) | 0;
3268 hi = (hi + Math.imul(ah4, bh4)) | 0;
3269 lo = (lo + Math.imul(al3, bl5)) | 0;
3270 mid = (mid + Math.imul(al3, bh5)) | 0;
3271 mid = (mid + Math.imul(ah3, bl5)) | 0;
3272 hi = (hi + Math.imul(ah3, bh5)) | 0;
3273 lo = (lo + Math.imul(al2, bl6)) | 0;
3274 mid = (mid + Math.imul(al2, bh6)) | 0;
3275 mid = (mid + Math.imul(ah2, bl6)) | 0;
3276 hi = (hi + Math.imul(ah2, bh6)) | 0;
3277 lo = (lo + Math.imul(al1, bl7)) | 0;
3278 mid = (mid + Math.imul(al1, bh7)) | 0;
3279 mid = (mid + Math.imul(ah1, bl7)) | 0;
3280 hi = (hi + Math.imul(ah1, bh7)) | 0;
3281 lo = (lo + Math.imul(al0, bl8)) | 0;
3282 mid = (mid + Math.imul(al0, bh8)) | 0;
3283 mid = (mid + Math.imul(ah0, bl8)) | 0;
3284 hi = (hi + Math.imul(ah0, bh8)) | 0;
3285 var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3286 c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;
3289 lo = Math.imul(al9, bl0);
3290 mid = Math.imul(al9, bh0);
3291 mid = (mid + Math.imul(ah9, bl0)) | 0;
3292 hi = Math.imul(ah9, bh0);
3293 lo = (lo + Math.imul(al8, bl1)) | 0;
3294 mid = (mid + Math.imul(al8, bh1)) | 0;
3295 mid = (mid + Math.imul(ah8, bl1)) | 0;
3296 hi = (hi + Math.imul(ah8, bh1)) | 0;
3297 lo = (lo + Math.imul(al7, bl2)) | 0;
3298 mid = (mid + Math.imul(al7, bh2)) | 0;
3299 mid = (mid + Math.imul(ah7, bl2)) | 0;
3300 hi = (hi + Math.imul(ah7, bh2)) | 0;
3301 lo = (lo + Math.imul(al6, bl3)) | 0;
3302 mid = (mid + Math.imul(al6, bh3)) | 0;
3303 mid = (mid + Math.imul(ah6, bl3)) | 0;
3304 hi = (hi + Math.imul(ah6, bh3)) | 0;
3305 lo = (lo + Math.imul(al5, bl4)) | 0;
3306 mid = (mid + Math.imul(al5, bh4)) | 0;
3307 mid = (mid + Math.imul(ah5, bl4)) | 0;
3308 hi = (hi + Math.imul(ah5, bh4)) | 0;
3309 lo = (lo + Math.imul(al4, bl5)) | 0;
3310 mid = (mid + Math.imul(al4, bh5)) | 0;
3311 mid = (mid + Math.imul(ah4, bl5)) | 0;
3312 hi = (hi + Math.imul(ah4, bh5)) | 0;
3313 lo = (lo + Math.imul(al3, bl6)) | 0;
3314 mid = (mid + Math.imul(al3, bh6)) | 0;
3315 mid = (mid + Math.imul(ah3, bl6)) | 0;
3316 hi = (hi + Math.imul(ah3, bh6)) | 0;
3317 lo = (lo + Math.imul(al2, bl7)) | 0;
3318 mid = (mid + Math.imul(al2, bh7)) | 0;
3319 mid = (mid + Math.imul(ah2, bl7)) | 0;
3320 hi = (hi + Math.imul(ah2, bh7)) | 0;
3321 lo = (lo + Math.imul(al1, bl8)) | 0;
3322 mid = (mid + Math.imul(al1, bh8)) | 0;
3323 mid = (mid + Math.imul(ah1, bl8)) | 0;
3324 hi = (hi + Math.imul(ah1, bh8)) | 0;
3325 lo = (lo + Math.imul(al0, bl9)) | 0;
3326 mid = (mid + Math.imul(al0, bh9)) | 0;
3327 mid = (mid + Math.imul(ah0, bl9)) | 0;
3328 hi = (hi + Math.imul(ah0, bh9)) | 0;
3329 var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3330 c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;
3333 lo = Math.imul(al9, bl1);
3334 mid = Math.imul(al9, bh1);
3335 mid = (mid + Math.imul(ah9, bl1)) | 0;
3336 hi = Math.imul(ah9, bh1);
3337 lo = (lo + Math.imul(al8, bl2)) | 0;
3338 mid = (mid + Math.imul(al8, bh2)) | 0;
3339 mid = (mid + Math.imul(ah8, bl2)) | 0;
3340 hi = (hi + Math.imul(ah8, bh2)) | 0;
3341 lo = (lo + Math.imul(al7, bl3)) | 0;
3342 mid = (mid + Math.imul(al7, bh3)) | 0;
3343 mid = (mid + Math.imul(ah7, bl3)) | 0;
3344 hi = (hi + Math.imul(ah7, bh3)) | 0;
3345 lo = (lo + Math.imul(al6, bl4)) | 0;
3346 mid = (mid + Math.imul(al6, bh4)) | 0;
3347 mid = (mid + Math.imul(ah6, bl4)) | 0;
3348 hi = (hi + Math.imul(ah6, bh4)) | 0;
3349 lo = (lo + Math.imul(al5, bl5)) | 0;
3350 mid = (mid + Math.imul(al5, bh5)) | 0;
3351 mid = (mid + Math.imul(ah5, bl5)) | 0;
3352 hi = (hi + Math.imul(ah5, bh5)) | 0;
3353 lo = (lo + Math.imul(al4, bl6)) | 0;
3354 mid = (mid + Math.imul(al4, bh6)) | 0;
3355 mid = (mid + Math.imul(ah4, bl6)) | 0;
3356 hi = (hi + Math.imul(ah4, bh6)) | 0;
3357 lo = (lo + Math.imul(al3, bl7)) | 0;
3358 mid = (mid + Math.imul(al3, bh7)) | 0;
3359 mid = (mid + Math.imul(ah3, bl7)) | 0;
3360 hi = (hi + Math.imul(ah3, bh7)) | 0;
3361 lo = (lo + Math.imul(al2, bl8)) | 0;
3362 mid = (mid + Math.imul(al2, bh8)) | 0;
3363 mid = (mid + Math.imul(ah2, bl8)) | 0;
3364 hi = (hi + Math.imul(ah2, bh8)) | 0;
3365 lo = (lo + Math.imul(al1, bl9)) | 0;
3366 mid = (mid + Math.imul(al1, bh9)) | 0;
3367 mid = (mid + Math.imul(ah1, bl9)) | 0;
3368 hi = (hi + Math.imul(ah1, bh9)) | 0;
3369 var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3370 c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;
3373 lo = Math.imul(al9, bl2);
3374 mid = Math.imul(al9, bh2);
3375 mid = (mid + Math.imul(ah9, bl2)) | 0;
3376 hi = Math.imul(ah9, bh2);
3377 lo = (lo + Math.imul(al8, bl3)) | 0;
3378 mid = (mid + Math.imul(al8, bh3)) | 0;
3379 mid = (mid + Math.imul(ah8, bl3)) | 0;
3380 hi = (hi + Math.imul(ah8, bh3)) | 0;
3381 lo = (lo + Math.imul(al7, bl4)) | 0;
3382 mid = (mid + Math.imul(al7, bh4)) | 0;
3383 mid = (mid + Math.imul(ah7, bl4)) | 0;
3384 hi = (hi + Math.imul(ah7, bh4)) | 0;
3385 lo = (lo + Math.imul(al6, bl5)) | 0;
3386 mid = (mid + Math.imul(al6, bh5)) | 0;
3387 mid = (mid + Math.imul(ah6, bl5)) | 0;
3388 hi = (hi + Math.imul(ah6, bh5)) | 0;
3389 lo = (lo + Math.imul(al5, bl6)) | 0;
3390 mid = (mid + Math.imul(al5, bh6)) | 0;
3391 mid = (mid + Math.imul(ah5, bl6)) | 0;
3392 hi = (hi + Math.imul(ah5, bh6)) | 0;
3393 lo = (lo + Math.imul(al4, bl7)) | 0;
3394 mid = (mid + Math.imul(al4, bh7)) | 0;
3395 mid = (mid + Math.imul(ah4, bl7)) | 0;
3396 hi = (hi + Math.imul(ah4, bh7)) | 0;
3397 lo = (lo + Math.imul(al3, bl8)) | 0;
3398 mid = (mid + Math.imul(al3, bh8)) | 0;
3399 mid = (mid + Math.imul(ah3, bl8)) | 0;
3400 hi = (hi + Math.imul(ah3, bh8)) | 0;
3401 lo = (lo + Math.imul(al2, bl9)) | 0;
3402 mid = (mid + Math.imul(al2, bh9)) | 0;
3403 mid = (mid + Math.imul(ah2, bl9)) | 0;
3404 hi = (hi + Math.imul(ah2, bh9)) | 0;
3405 var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3406 c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;
3409 lo = Math.imul(al9, bl3);
3410 mid = Math.imul(al9, bh3);
3411 mid = (mid + Math.imul(ah9, bl3)) | 0;
3412 hi = Math.imul(ah9, bh3);
3413 lo = (lo + Math.imul(al8, bl4)) | 0;
3414 mid = (mid + Math.imul(al8, bh4)) | 0;
3415 mid = (mid + Math.imul(ah8, bl4)) | 0;
3416 hi = (hi + Math.imul(ah8, bh4)) | 0;
3417 lo = (lo + Math.imul(al7, bl5)) | 0;
3418 mid = (mid + Math.imul(al7, bh5)) | 0;
3419 mid = (mid + Math.imul(ah7, bl5)) | 0;
3420 hi = (hi + Math.imul(ah7, bh5)) | 0;
3421 lo = (lo + Math.imul(al6, bl6)) | 0;
3422 mid = (mid + Math.imul(al6, bh6)) | 0;
3423 mid = (mid + Math.imul(ah6, bl6)) | 0;
3424 hi = (hi + Math.imul(ah6, bh6)) | 0;
3425 lo = (lo + Math.imul(al5, bl7)) | 0;
3426 mid = (mid + Math.imul(al5, bh7)) | 0;
3427 mid = (mid + Math.imul(ah5, bl7)) | 0;
3428 hi = (hi + Math.imul(ah5, bh7)) | 0;
3429 lo = (lo + Math.imul(al4, bl8)) | 0;
3430 mid = (mid + Math.imul(al4, bh8)) | 0;
3431 mid = (mid + Math.imul(ah4, bl8)) | 0;
3432 hi = (hi + Math.imul(ah4, bh8)) | 0;
3433 lo = (lo + Math.imul(al3, bl9)) | 0;
3434 mid = (mid + Math.imul(al3, bh9)) | 0;
3435 mid = (mid + Math.imul(ah3, bl9)) | 0;
3436 hi = (hi + Math.imul(ah3, bh9)) | 0;
3437 var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3438 c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;
3441 lo = Math.imul(al9, bl4);
3442 mid = Math.imul(al9, bh4);
3443 mid = (mid + Math.imul(ah9, bl4)) | 0;
3444 hi = Math.imul(ah9, bh4);
3445 lo = (lo + Math.imul(al8, bl5)) | 0;
3446 mid = (mid + Math.imul(al8, bh5)) | 0;
3447 mid = (mid + Math.imul(ah8, bl5)) | 0;
3448 hi = (hi + Math.imul(ah8, bh5)) | 0;
3449 lo = (lo + Math.imul(al7, bl6)) | 0;
3450 mid = (mid + Math.imul(al7, bh6)) | 0;
3451 mid = (mid + Math.imul(ah7, bl6)) | 0;
3452 hi = (hi + Math.imul(ah7, bh6)) | 0;
3453 lo = (lo + Math.imul(al6, bl7)) | 0;
3454 mid = (mid + Math.imul(al6, bh7)) | 0;
3455 mid = (mid + Math.imul(ah6, bl7)) | 0;
3456 hi = (hi + Math.imul(ah6, bh7)) | 0;
3457 lo = (lo + Math.imul(al5, bl8)) | 0;
3458 mid = (mid + Math.imul(al5, bh8)) | 0;
3459 mid = (mid + Math.imul(ah5, bl8)) | 0;
3460 hi = (hi + Math.imul(ah5, bh8)) | 0;
3461 lo = (lo + Math.imul(al4, bl9)) | 0;
3462 mid = (mid + Math.imul(al4, bh9)) | 0;
3463 mid = (mid + Math.imul(ah4, bl9)) | 0;
3464 hi = (hi + Math.imul(ah4, bh9)) | 0;
3465 var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3466 c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;
3469 lo = Math.imul(al9, bl5);
3470 mid = Math.imul(al9, bh5);
3471 mid = (mid + Math.imul(ah9, bl5)) | 0;
3472 hi = Math.imul(ah9, bh5);
3473 lo = (lo + Math.imul(al8, bl6)) | 0;
3474 mid = (mid + Math.imul(al8, bh6)) | 0;
3475 mid = (mid + Math.imul(ah8, bl6)) | 0;
3476 hi = (hi + Math.imul(ah8, bh6)) | 0;
3477 lo = (lo + Math.imul(al7, bl7)) | 0;
3478 mid = (mid + Math.imul(al7, bh7)) | 0;
3479 mid = (mid + Math.imul(ah7, bl7)) | 0;
3480 hi = (hi + Math.imul(ah7, bh7)) | 0;
3481 lo = (lo + Math.imul(al6, bl8)) | 0;
3482 mid = (mid + Math.imul(al6, bh8)) | 0;
3483 mid = (mid + Math.imul(ah6, bl8)) | 0;
3484 hi = (hi + Math.imul(ah6, bh8)) | 0;
3485 lo = (lo + Math.imul(al5, bl9)) | 0;
3486 mid = (mid + Math.imul(al5, bh9)) | 0;
3487 mid = (mid + Math.imul(ah5, bl9)) | 0;
3488 hi = (hi + Math.imul(ah5, bh9)) | 0;
3489 var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3490 c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;
3493 lo = Math.imul(al9, bl6);
3494 mid = Math.imul(al9, bh6);
3495 mid = (mid + Math.imul(ah9, bl6)) | 0;
3496 hi = Math.imul(ah9, bh6);
3497 lo = (lo + Math.imul(al8, bl7)) | 0;
3498 mid = (mid + Math.imul(al8, bh7)) | 0;
3499 mid = (mid + Math.imul(ah8, bl7)) | 0;
3500 hi = (hi + Math.imul(ah8, bh7)) | 0;
3501 lo = (lo + Math.imul(al7, bl8)) | 0;
3502 mid = (mid + Math.imul(al7, bh8)) | 0;
3503 mid = (mid + Math.imul(ah7, bl8)) | 0;
3504 hi = (hi + Math.imul(ah7, bh8)) | 0;
3505 lo = (lo + Math.imul(al6, bl9)) | 0;
3506 mid = (mid + Math.imul(al6, bh9)) | 0;
3507 mid = (mid + Math.imul(ah6, bl9)) | 0;
3508 hi = (hi + Math.imul(ah6, bh9)) | 0;
3509 var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3510 c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;
3513 lo = Math.imul(al9, bl7);
3514 mid = Math.imul(al9, bh7);
3515 mid = (mid + Math.imul(ah9, bl7)) | 0;
3516 hi = Math.imul(ah9, bh7);
3517 lo = (lo + Math.imul(al8, bl8)) | 0;
3518 mid = (mid + Math.imul(al8, bh8)) | 0;
3519 mid = (mid + Math.imul(ah8, bl8)) | 0;
3520 hi = (hi + Math.imul(ah8, bh8)) | 0;
3521 lo = (lo + Math.imul(al7, bl9)) | 0;
3522 mid = (mid + Math.imul(al7, bh9)) | 0;
3523 mid = (mid + Math.imul(ah7, bl9)) | 0;
3524 hi = (hi + Math.imul(ah7, bh9)) | 0;
3525 var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3526 c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;
3529 lo = Math.imul(al9, bl8);
3530 mid = Math.imul(al9, bh8);
3531 mid = (mid + Math.imul(ah9, bl8)) | 0;
3532 hi = Math.imul(ah9, bh8);
3533 lo = (lo + Math.imul(al8, bl9)) | 0;
3534 mid = (mid + Math.imul(al8, bh9)) | 0;
3535 mid = (mid + Math.imul(ah8, bl9)) | 0;
3536 hi = (hi + Math.imul(ah8, bh9)) | 0;
3537 var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3538 c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;
3541 lo = Math.imul(al9, bl9);
3542 mid = Math.imul(al9, bh9);
3543 mid = (mid + Math.imul(ah9, bl9)) | 0;
3544 hi = Math.imul(ah9, bh9);
3545 var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
3546 c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;
3576 comb10MulTo = smallMulTo;
3579 function bigMulTo (self, num, out) {
3580 out.negative = num.negative ^ self.negative;
3581 out.length = self.length + num.length;
3585 for (var k = 0; k < out.length - 1; k++) {
3586 // Sum all words with the same `i + j = k` and accumulate `ncarry`,
3587 // note that ncarry could be >= 0x3ffffff
3588 var ncarry = hncarry;
3590 var rword = carry & 0x3ffffff;
3591 var maxJ = Math.min(k, num.length - 1);
3592 for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
3594 var a = self.words[i] | 0;
3595 var b = num.words[j] | 0;
3598 var lo = r & 0x3ffffff;
3599 ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;
3600 lo = (lo + rword) | 0;
3601 rword = lo & 0x3ffffff;
3602 ncarry = (ncarry + (lo >>> 26)) | 0;
3604 hncarry += ncarry >>> 26;
3605 ncarry &= 0x3ffffff;
3607 out.words[k] = rword;
3612 out.words[k] = carry;
3620 function jumboMulTo (self, num, out) {
3621 var fftm = new FFTM();
3622 return fftm.mulp(self, num, out);
3625 BN.prototype.mulTo = function mulTo (num, out) {
3627 var len = this.length + num.length;
3628 if (this.length === 10 && num.length === 10) {
3629 res = comb10MulTo(this, num, out);
3630 } else if (len < 63) {
3631 res = smallMulTo(this, num, out);
3632 } else if (len < 1024) {
3633 res = bigMulTo(this, num, out);
3635 res = jumboMulTo(this, num, out);
3641 // Cooley-Tukey algorithm for FFT
3642 // slightly revisited to rely on looping instead of recursion
3644 function FFTM (x, y) {
3649 FFTM.prototype.makeRBT = function makeRBT (N) {
3650 var t = new Array(N);
3651 var l = BN.prototype._countBits(N) - 1;
3652 for (var i = 0; i < N; i++) {
3653 t[i] = this.revBin(i, l, N);
3659 // Returns binary-reversed representation of `x`
3660 FFTM.prototype.revBin = function revBin (x, l, N) {
3661 if (x === 0 || x === N - 1) return x;
3664 for (var i = 0; i < l; i++) {
3665 rb |= (x & 1) << (l - i - 1);
3672 // Performs "tweedling" phase, therefore 'emulating'
3673 // behaviour of the recursive algorithm
3674 FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {
3675 for (var i = 0; i < N; i++) {
3676 rtws[i] = rws[rbt[i]];
3677 itws[i] = iws[rbt[i]];
3681 FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {
3682 this.permute(rbt, rws, iws, rtws, itws, N);
3684 for (var s = 1; s < N; s <<= 1) {
3687 var rtwdf = Math.cos(2 * Math.PI / l);
3688 var itwdf = Math.sin(2 * Math.PI / l);
3690 for (var p = 0; p < N; p += l) {
3694 for (var j = 0; j < s; j++) {
3695 var re = rtws[p + j];
3696 var ie = itws[p + j];
3698 var ro = rtws[p + j + s];
3699 var io = itws[p + j + s];
3701 var rx = rtwdf_ * ro - itwdf_ * io;
3703 io = rtwdf_ * io + itwdf_ * ro;
3706 rtws[p + j] = re + ro;
3707 itws[p + j] = ie + io;
3709 rtws[p + j + s] = re - ro;
3710 itws[p + j + s] = ie - io;
3712 /* jshint maxdepth : false */
3714 rx = rtwdf * rtwdf_ - itwdf * itwdf_;
3716 itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;
3724 FFTM.prototype.guessLen13b = function guessLen13b (n, m) {
3725 var N = Math.max(m, n) | 1;
3728 for (N = N / 2 | 0; N; N = N >>> 1) {
3732 return 1 << i + 1 + odd;
3735 FFTM.prototype.conjugate = function conjugate (rws, iws, N) {
3738 for (var i = 0; i < N / 2; i++) {
3741 rws[i] = rws[N - i - 1];
3746 iws[i] = -iws[N - i - 1];
3747 iws[N - i - 1] = -t;
3751 FFTM.prototype.normalize13b = function normalize13b (ws, N) {
3753 for (var i = 0; i < N / 2; i++) {
3754 var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +
3755 Math.round(ws[2 * i] / N) +
3758 ws[i] = w & 0x3ffffff;
3760 if (w < 0x4000000) {
3763 carry = w / 0x4000000 | 0;
3770 FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {
3772 for (var i = 0; i < len; i++) {
3773 carry = carry + (ws[i] | 0);
3775 rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;
3776 rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;
3780 for (i = 2 * len; i < N; ++i) {
3784 assert(carry === 0);
3785 assert((carry & ~0x1fff) === 0);
3788 FFTM.prototype.stub = function stub (N) {
3789 var ph = new Array(N);
3790 for (var i = 0; i < N; i++) {
3797 FFTM.prototype.mulp = function mulp (x, y, out) {
3798 var N = 2 * this.guessLen13b(x.length, y.length);
3800 var rbt = this.makeRBT(N);
3802 var _ = this.stub(N);
3804 var rws = new Array(N);
3805 var rwst = new Array(N);
3806 var iwst = new Array(N);
3808 var nrws = new Array(N);
3809 var nrwst = new Array(N);
3810 var niwst = new Array(N);
3812 var rmws = out.words;
3815 this.convert13b(x.words, x.length, rws, N);
3816 this.convert13b(y.words, y.length, nrws, N);
3818 this.transform(rws, _, rwst, iwst, N, rbt);
3819 this.transform(nrws, _, nrwst, niwst, N, rbt);
3821 for (var i = 0; i < N; i++) {
3822 var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];
3823 iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];
3827 this.conjugate(rwst, iwst, N);
3828 this.transform(rwst, iwst, rmws, _, N, rbt);
3829 this.conjugate(rmws, _, N);
3830 this.normalize13b(rmws, N);
3832 out.negative = x.negative ^ y.negative;
3833 out.length = x.length + y.length;
3837 // Multiply `this` by `num`
3838 BN.prototype.mul = function mul (num) {
3839 var out = new BN(null);
3840 out.words = new Array(this.length + num.length);
3841 return this.mulTo(num, out);
3844 // Multiply employing FFT
3845 BN.prototype.mulf = function mulf (num) {
3846 var out = new BN(null);
3847 out.words = new Array(this.length + num.length);
3848 return jumboMulTo(this, num, out);
3851 // In-place Multiplication
3852 BN.prototype.imul = function imul (num) {
3853 return this.clone().mulTo(num, this);
3856 BN.prototype.imuln = function imuln (num) {
3857 assert(typeof num === 'number');
3858 assert(num < 0x4000000);
3862 for (var i = 0; i < this.length; i++) {
3863 var w = (this.words[i] | 0) * num;
3864 var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);
3866 carry += (w / 0x4000000) | 0;
3867 // NOTE: lo is 27bit maximum
3869 this.words[i] = lo & 0x3ffffff;
3873 this.words[i] = carry;
3880 BN.prototype.muln = function muln (num) {
3881 return this.clone().imuln(num);
3885 BN.prototype.sqr = function sqr () {
3886 return this.mul(this);
3889 // `this` * `this` in-place
3890 BN.prototype.isqr = function isqr () {
3891 return this.imul(this.clone());
3894 // Math.pow(`this`, `num`)
3895 BN.prototype.pow = function pow (num) {
3896 var w = toBitArray(num);
3897 if (w.length === 0) return new BN(1);
3899 // Skip leading zeroes
3901 for (var i = 0; i < w.length; i++, res = res.sqr()) {
3902 if (w[i] !== 0) break;
3905 if (++i < w.length) {
3906 for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {
3907 if (w[i] === 0) continue;
3916 // Shift-left in-place
3917 BN.prototype.iushln = function iushln (bits) {
3918 assert(typeof bits === 'number' && bits >= 0);
3920 var s = (bits - r) / 26;
3921 var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);
3927 for (i = 0; i < this.length; i++) {
3928 var newCarry = this.words[i] & carryMask;
3929 var c = ((this.words[i] | 0) - newCarry) << r;
3930 this.words[i] = c | carry;
3931 carry = newCarry >>> (26 - r);
3935 this.words[i] = carry;
3941 for (i = this.length - 1; i >= 0; i--) {
3942 this.words[i + s] = this.words[i];
3945 for (i = 0; i < s; i++) {
3952 return this.strip();
3955 BN.prototype.ishln = function ishln (bits) {
3956 // TODO(indutny): implement me
3957 assert(this.negative === 0);
3958 return this.iushln(bits);
3961 // Shift-right in-place
3962 // NOTE: `hint` is a lowest bit before trailing zeroes
3963 // NOTE: if `extended` is present - it will be filled with destroyed bits
3964 BN.prototype.iushrn = function iushrn (bits, hint, extended) {
3965 assert(typeof bits === 'number' && bits >= 0);
3968 h = (hint - (hint % 26)) / 26;
3974 var s = Math.min((bits - r) / 26, this.length);
3975 var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
3976 var maskedWords = extended;
3981 // Extended mode, copy masked part
3983 for (var i = 0; i < s; i++) {
3984 maskedWords.words[i] = this.words[i];
3986 maskedWords.length = s;
3990 // No-op, we should not move anything at all
3991 } else if (this.length > s) {
3993 for (i = 0; i < this.length; i++) {
3994 this.words[i] = this.words[i + s];
4002 for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
4003 var word = this.words[i] | 0;
4004 this.words[i] = (carry << (26 - r)) | (word >>> r);
4005 carry = word & mask;
4008 // Push carried bits as a mask
4009 if (maskedWords && carry !== 0) {
4010 maskedWords.words[maskedWords.length++] = carry;
4013 if (this.length === 0) {
4018 return this.strip();
4021 BN.prototype.ishrn = function ishrn (bits, hint, extended) {
4022 // TODO(indutny): implement me
4023 assert(this.negative === 0);
4024 return this.iushrn(bits, hint, extended);
4028 BN.prototype.shln = function shln (bits) {
4029 return this.clone().ishln(bits);
4032 BN.prototype.ushln = function ushln (bits) {
4033 return this.clone().iushln(bits);
4037 BN.prototype.shrn = function shrn (bits) {
4038 return this.clone().ishrn(bits);
4041 BN.prototype.ushrn = function ushrn (bits) {
4042 return this.clone().iushrn(bits);
4045 // Test if n bit is set
4046 BN.prototype.testn = function testn (bit) {
4047 assert(typeof bit === 'number' && bit >= 0);
4049 var s = (bit - r) / 26;
4052 // Fast case: bit is much higher than all existing words
4053 if (this.length <= s) return false;
4055 // Check bit and return
4056 var w = this.words[s];
4061 // Return only lowers bits of number (in-place)
4062 BN.prototype.imaskn = function imaskn (bits) {
4063 assert(typeof bits === 'number' && bits >= 0);
4065 var s = (bits - r) / 26;
4067 assert(this.negative === 0, 'imaskn works only with positive numbers');
4069 if (this.length <= s) {
4076 this.length = Math.min(s, this.length);
4079 var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
4080 this.words[this.length - 1] &= mask;
4083 return this.strip();
4086 // Return only lowers bits of number
4087 BN.prototype.maskn = function maskn (bits) {
4088 return this.clone().imaskn(bits);
4091 // Add plain number `num` to `this`
4092 BN.prototype.iaddn = function iaddn (num) {
4093 assert(typeof num === 'number');
4094 assert(num < 0x4000000);
4095 if (num < 0) return this.isubn(-num);
4097 // Possible sign change
4098 if (this.negative !== 0) {
4099 if (this.length === 1 && (this.words[0] | 0) < num) {
4100 this.words[0] = num - (this.words[0] | 0);
4111 // Add without checks
4112 return this._iaddn(num);
4115 BN.prototype._iaddn = function _iaddn (num) {
4116 this.words[0] += num;
4119 for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {
4120 this.words[i] -= 0x4000000;
4121 if (i === this.length - 1) {
4122 this.words[i + 1] = 1;
4124 this.words[i + 1]++;
4127 this.length = Math.max(this.length, i + 1);
4132 // Subtract plain number `num` from `this`
4133 BN.prototype.isubn = function isubn (num) {
4134 assert(typeof num === 'number');
4135 assert(num < 0x4000000);
4136 if (num < 0) return this.iaddn(-num);
4138 if (this.negative !== 0) {
4145 this.words[0] -= num;
4147 if (this.length === 1 && this.words[0] < 0) {
4148 this.words[0] = -this.words[0];
4152 for (var i = 0; i < this.length && this.words[i] < 0; i++) {
4153 this.words[i] += 0x4000000;
4154 this.words[i + 1] -= 1;
4158 return this.strip();
4161 BN.prototype.addn = function addn (num) {
4162 return this.clone().iaddn(num);
4165 BN.prototype.subn = function subn (num) {
4166 return this.clone().isubn(num);
4169 BN.prototype.iabs = function iabs () {
4175 BN.prototype.abs = function abs () {
4176 return this.clone().iabs();
4179 BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {
4180 var len = num.length + shift;
4187 for (i = 0; i < num.length; i++) {
4188 w = (this.words[i + shift] | 0) + carry;
4189 var right = (num.words[i] | 0) * mul;
4190 w -= right & 0x3ffffff;
4191 carry = (w >> 26) - ((right / 0x4000000) | 0);
4192 this.words[i + shift] = w & 0x3ffffff;
4194 for (; i < this.length - shift; i++) {
4195 w = (this.words[i + shift] | 0) + carry;
4197 this.words[i + shift] = w & 0x3ffffff;
4200 if (carry === 0) return this.strip();
4202 // Subtraction overflow
4203 assert(carry === -1);
4205 for (i = 0; i < this.length; i++) {
4206 w = -(this.words[i] | 0) + carry;
4208 this.words[i] = w & 0x3ffffff;
4212 return this.strip();
4215 BN.prototype._wordDiv = function _wordDiv (num, mode) {
4216 var shift = this.length - num.length;
4218 var a = this.clone();
4222 var bhi = b.words[b.length - 1] | 0;
4223 var bhiBits = this._countBits(bhi);
4224 shift = 26 - bhiBits;
4228 bhi = b.words[b.length - 1] | 0;
4231 // Initialize quotient
4232 var m = a.length - b.length;
4235 if (mode !== 'mod') {
4238 q.words = new Array(q.length);
4239 for (var i = 0; i < q.length; i++) {
4244 var diff = a.clone()._ishlnsubmul(b, 1, m);
4245 if (diff.negative === 0) {
4252 for (var j = m - 1; j >= 0; j--) {
4253 var qj = (a.words[b.length + j] | 0) * 0x4000000 +
4254 (a.words[b.length + j - 1] | 0);
4256 // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max
4258 qj = Math.min((qj / bhi) | 0, 0x3ffffff);
4260 a._ishlnsubmul(b, qj, j);
4261 while (a.negative !== 0) {
4264 a._ishlnsubmul(b, 1, j);
4279 if (mode !== 'div' && shift !== 0) {
4289 // NOTE: 1) `mode` can be set to `mod` to request mod only,
4290 // to `div` to request div only, or be absent to
4291 // request both div & mod
4292 // 2) `positive` is true if unsigned mod is requested
4293 BN.prototype.divmod = function divmod (num, mode, positive) {
4294 assert(!num.isZero());
4296 if (this.isZero()) {
4304 if (this.negative !== 0 && num.negative === 0) {
4305 res = this.neg().divmod(num, mode);
4307 if (mode !== 'mod') {
4308 div = res.div.neg();
4311 if (mode !== 'div') {
4312 mod = res.mod.neg();
4313 if (positive && mod.negative !== 0) {
4324 if (this.negative === 0 && num.negative !== 0) {
4325 res = this.divmod(num.neg(), mode);
4327 if (mode !== 'mod') {
4328 div = res.div.neg();
4337 if ((this.negative & num.negative) !== 0) {
4338 res = this.neg().divmod(num.neg(), mode);
4340 if (mode !== 'div') {
4341 mod = res.mod.neg();
4342 if (positive && mod.negative !== 0) {
4353 // Both numbers are positive at this point
4355 // Strip both numbers to approximate shift value
4356 if (num.length > this.length || this.cmp(num) < 0) {
4363 // Very short reduction
4364 if (num.length === 1) {
4365 if (mode === 'div') {
4367 div: this.divn(num.words[0]),
4372 if (mode === 'mod') {
4375 mod: new BN(this.modn(num.words[0]))
4380 div: this.divn(num.words[0]),
4381 mod: new BN(this.modn(num.words[0]))
4385 return this._wordDiv(num, mode);
4388 // Find `this` / `num`
4389 BN.prototype.div = function div (num) {
4390 return this.divmod(num, 'div', false).div;
4393 // Find `this` % `num`
4394 BN.prototype.mod = function mod (num) {
4395 return this.divmod(num, 'mod', false).mod;
4398 BN.prototype.umod = function umod (num) {
4399 return this.divmod(num, 'mod', true).mod;
4402 // Find Round(`this` / `num`)
4403 BN.prototype.divRound = function divRound (num) {
4404 var dm = this.divmod(num);
4406 // Fast case - exact division
4407 if (dm.mod.isZero()) return dm.div;
4409 var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;
4411 var half = num.ushrn(1);
4412 var r2 = num.andln(1);
4413 var cmp = mod.cmp(half);
4416 if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div;
4419 return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
4422 BN.prototype.modn = function modn (num) {
4423 assert(num <= 0x3ffffff);
4424 var p = (1 << 26) % num;
4427 for (var i = this.length - 1; i >= 0; i--) {
4428 acc = (p * acc + (this.words[i] | 0)) % num;
4434 // In-place division by number
4435 BN.prototype.idivn = function idivn (num) {
4436 assert(num <= 0x3ffffff);
4439 for (var i = this.length - 1; i >= 0; i--) {
4440 var w = (this.words[i] | 0) + carry * 0x4000000;
4441 this.words[i] = (w / num) | 0;
4445 return this.strip();
4448 BN.prototype.divn = function divn (num) {
4449 return this.clone().idivn(num);
4452 BN.prototype.egcd = function egcd (p) {
4453 assert(p.negative === 0);
4454 assert(!p.isZero());
4459 if (x.negative !== 0) {
4465 // A * x + B * y = x
4469 // C * x + D * y = y
4475 while (x.isEven() && y.isEven()) {
4484 while (!x.isZero()) {
4485 for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
4489 if (A.isOdd() || B.isOdd()) {
4499 for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
4503 if (C.isOdd() || D.isOdd()) {
4513 if (x.cmp(y) >= 0) {
4531 // This is reduced incarnation of the binary EEA
4532 // above, designated to invert members of the
4533 // _prime_ fields F(p) at a maximal speed
4534 BN.prototype._invmp = function _invmp (p) {
4535 assert(p.negative === 0);
4536 assert(!p.isZero());
4541 if (a.negative !== 0) {
4550 var delta = b.clone();
4552 while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {
4553 for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
4565 for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
4577 if (a.cmp(b) >= 0) {
4587 if (a.cmpn(1) === 0) {
4593 if (res.cmpn(0) < 0) {
4600 BN.prototype.gcd = function gcd (num) {
4601 if (this.isZero()) return num.abs();
4602 if (num.isZero()) return this.abs();
4604 var a = this.clone();
4605 var b = num.clone();
4609 // Remove common factor of two
4610 for (var shift = 0; a.isEven() && b.isEven(); shift++) {
4616 while (a.isEven()) {
4619 while (b.isEven()) {
4625 // Swap `a` and `b` to make `a` always bigger than `b`
4629 } else if (r === 0 || b.cmpn(1) === 0) {
4636 return b.iushln(shift);
4639 // Invert number in the field F(num)
4640 BN.prototype.invm = function invm (num) {
4641 return this.egcd(num).a.umod(num);
4644 BN.prototype.isEven = function isEven () {
4645 return (this.words[0] & 1) === 0;
4648 BN.prototype.isOdd = function isOdd () {
4649 return (this.words[0] & 1) === 1;
4652 // And first word and num
4653 BN.prototype.andln = function andln (num) {
4654 return this.words[0] & num;
4657 // Increment at the bit position in-line
4658 BN.prototype.bincn = function bincn (bit) {
4659 assert(typeof bit === 'number');
4661 var s = (bit - r) / 26;
4664 // Fast case: bit is much higher than all existing words
4665 if (this.length <= s) {
4666 this._expand(s + 1);
4671 // Add bit and propagate, if needed
4673 for (var i = s; carry !== 0 && i < this.length; i++) {
4674 var w = this.words[i] | 0;
4681 this.words[i] = carry;
4687 BN.prototype.isZero = function isZero () {
4688 return this.length === 1 && this.words[0] === 0;
4691 BN.prototype.cmpn = function cmpn (num) {
4692 var negative = num < 0;
4694 if (this.negative !== 0 && !negative) return -1;
4695 if (this.negative === 0 && negative) return 1;
4700 if (this.length > 1) {
4707 assert(num <= 0x3ffffff, 'Number is too big');
4709 var w = this.words[0] | 0;
4710 res = w === num ? 0 : w < num ? -1 : 1;
4712 if (this.negative !== 0) return -res | 0;
4716 // Compare two numbers and return:
4717 // 1 - if `this` > `num`
4718 // 0 - if `this` == `num`
4719 // -1 - if `this` < `num`
4720 BN.prototype.cmp = function cmp (num) {
4721 if (this.negative !== 0 && num.negative === 0) return -1;
4722 if (this.negative === 0 && num.negative !== 0) return 1;
4724 var res = this.ucmp(num);
4725 if (this.negative !== 0) return -res | 0;
4729 // Unsigned comparison
4730 BN.prototype.ucmp = function ucmp (num) {
4731 // At this point both numbers have the same sign
4732 if (this.length > num.length) return 1;
4733 if (this.length < num.length) return -1;
4736 for (var i = this.length - 1; i >= 0; i--) {
4737 var a = this.words[i] | 0;
4738 var b = num.words[i] | 0;
4740 if (a === b) continue;
4751 BN.prototype.gtn = function gtn (num) {
4752 return this.cmpn(num) === 1;
4755 BN.prototype.gt = function gt (num) {
4756 return this.cmp(num) === 1;
4759 BN.prototype.gten = function gten (num) {
4760 return this.cmpn(num) >= 0;
4763 BN.prototype.gte = function gte (num) {
4764 return this.cmp(num) >= 0;
4767 BN.prototype.ltn = function ltn (num) {
4768 return this.cmpn(num) === -1;
4771 BN.prototype.lt = function lt (num) {
4772 return this.cmp(num) === -1;
4775 BN.prototype.lten = function lten (num) {
4776 return this.cmpn(num) <= 0;
4779 BN.prototype.lte = function lte (num) {
4780 return this.cmp(num) <= 0;
4783 BN.prototype.eqn = function eqn (num) {
4784 return this.cmpn(num) === 0;
4787 BN.prototype.eq = function eq (num) {
4788 return this.cmp(num) === 0;
4792 // A reduce context, could be using montgomery or something better, depending
4793 // on the `m` itself.
4795 BN.red = function red (num) {
4796 return new Red(num);
4799 BN.prototype.toRed = function toRed (ctx) {
4800 assert(!this.red, 'Already a number in reduction context');
4801 assert(this.negative === 0, 'red works only with positives');
4802 return ctx.convertTo(this)._forceRed(ctx);
4805 BN.prototype.fromRed = function fromRed () {
4806 assert(this.red, 'fromRed works only with numbers in reduction context');
4807 return this.red.convertFrom(this);
4810 BN.prototype._forceRed = function _forceRed (ctx) {
4815 BN.prototype.forceRed = function forceRed (ctx) {
4816 assert(!this.red, 'Already a number in reduction context');
4817 return this._forceRed(ctx);
4820 BN.prototype.redAdd = function redAdd (num) {
4821 assert(this.red, 'redAdd works only with red numbers');
4822 return this.red.add(this, num);
4825 BN.prototype.redIAdd = function redIAdd (num) {
4826 assert(this.red, 'redIAdd works only with red numbers');
4827 return this.red.iadd(this, num);
4830 BN.prototype.redSub = function redSub (num) {
4831 assert(this.red, 'redSub works only with red numbers');
4832 return this.red.sub(this, num);
4835 BN.prototype.redISub = function redISub (num) {
4836 assert(this.red, 'redISub works only with red numbers');
4837 return this.red.isub(this, num);
4840 BN.prototype.redShl = function redShl (num) {
4841 assert(this.red, 'redShl works only with red numbers');
4842 return this.red.shl(this, num);
4845 BN.prototype.redMul = function redMul (num) {
4846 assert(this.red, 'redMul works only with red numbers');
4847 this.red._verify2(this, num);
4848 return this.red.mul(this, num);
4851 BN.prototype.redIMul = function redIMul (num) {
4852 assert(this.red, 'redMul works only with red numbers');
4853 this.red._verify2(this, num);
4854 return this.red.imul(this, num);
4857 BN.prototype.redSqr = function redSqr () {
4858 assert(this.red, 'redSqr works only with red numbers');
4859 this.red._verify1(this);
4860 return this.red.sqr(this);
4863 BN.prototype.redISqr = function redISqr () {
4864 assert(this.red, 'redISqr works only with red numbers');
4865 this.red._verify1(this);
4866 return this.red.isqr(this);
4869 // Square root over p
4870 BN.prototype.redSqrt = function redSqrt () {
4871 assert(this.red, 'redSqrt works only with red numbers');
4872 this.red._verify1(this);
4873 return this.red.sqrt(this);
4876 BN.prototype.redInvm = function redInvm () {
4877 assert(this.red, 'redInvm works only with red numbers');
4878 this.red._verify1(this);
4879 return this.red.invm(this);
4882 // Return negative clone of `this` % `red modulo`
4883 BN.prototype.redNeg = function redNeg () {
4884 assert(this.red, 'redNeg works only with red numbers');
4885 this.red._verify1(this);
4886 return this.red.neg(this);
4889 BN.prototype.redPow = function redPow (num) {
4890 assert(this.red && !num.red, 'redPow(normalNum)');
4891 this.red._verify1(this);
4892 return this.red.pow(this, num);
4895 // Prime numbers with efficient reduction
4903 // Pseudo-Mersenne prime
4904 function MPrime (name, p) {
4907 this.p = new BN(p, 16);
4908 this.n = this.p.bitLength();
4909 this.k = new BN(1).iushln(this.n).isub(this.p);
4911 this.tmp = this._tmp();
4914 MPrime.prototype._tmp = function _tmp () {
4915 var tmp = new BN(null);
4916 tmp.words = new Array(Math.ceil(this.n / 13));
4920 MPrime.prototype.ireduce = function ireduce (num) {
4921 // Assumes that `num` is less than `P^2`
4922 // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)
4927 this.split(r, this.tmp);
4929 r = r.iadd(this.tmp);
4930 rlen = r.bitLength();
4931 } while (rlen > this.n);
4933 var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
4937 } else if (cmp > 0) {
4946 MPrime.prototype.split = function split (input, out) {
4947 input.iushrn(this.n, 0, out);
4950 MPrime.prototype.imulK = function imulK (num) {
4951 return num.imul(this.k);
4958 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');
4960 inherits(K256, MPrime);
4962 K256.prototype.split = function split (input, output) {
4963 // 256 = 9 * 26 + 22
4964 var mask = 0x3fffff;
4966 var outLen = Math.min(input.length, 9);
4967 for (var i = 0; i < outLen; i++) {
4968 output.words[i] = input.words[i];
4970 output.length = outLen;
4972 if (input.length <= 9) {
4979 var prev = input.words[9];
4980 output.words[output.length++] = prev & mask;
4982 for (i = 10; i < input.length; i++) {
4983 var next = input.words[i] | 0;
4984 input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);
4988 input.words[i - 10] = prev;
4989 if (prev === 0 && input.length > 10) {
4996 K256.prototype.imulK = function imulK (num) {
4997 // K = 0x1000003d1 = [ 0x40, 0x3d1 ]
4998 num.words[num.length] = 0;
4999 num.words[num.length + 1] = 0;
5002 // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390
5004 for (var i = 0; i < num.length; i++) {
5005 var w = num.words[i] | 0;
5007 num.words[i] = lo & 0x3ffffff;
5008 lo = w * 0x40 + ((lo / 0x4000000) | 0);
5011 // Fast length reduction
5012 if (num.words[num.length - 1] === 0) {
5014 if (num.words[num.length - 1] === 0) {
5025 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');
5027 inherits(P224, MPrime);
5033 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');
5035 inherits(P192, MPrime);
5037 function P25519 () {
5042 '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');
5044 inherits(P25519, MPrime);
5046 P25519.prototype.imulK = function imulK (num) {
5049 for (var i = 0; i < num.length; i++) {
5050 var hi = (num.words[i] | 0) * 0x13 + carry;
5051 var lo = hi & 0x3ffffff;
5058 num.words[num.length++] = carry;
5063 // Exported mostly for testing purposes, use plain name instead
5064 BN._prime = function prime (name) {
5065 // Cached version of prime
5066 if (primes[name]) return primes[name];
5069 if (name === 'k256') {
5071 } else if (name === 'p224') {
5073 } else if (name === 'p192') {
5075 } else if (name === 'p25519') {
5076 prime = new P25519();
5078 throw new Error('Unknown prime ' + name);
5080 primes[name] = prime;
5086 // Base reduction engine
5089 if (typeof m === 'string') {
5090 var prime = BN._prime(m);
5094 assert(m.gtn(1), 'modulus must be greater than 1');
5100 Red.prototype._verify1 = function _verify1 (a) {
5101 assert(a.negative === 0, 'red works only with positives');
5102 assert(a.red, 'red works only with red numbers');
5105 Red.prototype._verify2 = function _verify2 (a, b) {
5106 assert((a.negative | b.negative) === 0, 'red works only with positives');
5107 assert(a.red && a.red === b.red,
5108 'red works only with red numbers');
5111 Red.prototype.imod = function imod (a) {
5112 if (this.prime) return this.prime.ireduce(a)._forceRed(this);
5113 return a.umod(this.m)._forceRed(this);
5116 Red.prototype.neg = function neg (a) {
5121 return this.m.sub(a)._forceRed(this);
5124 Red.prototype.add = function add (a, b) {
5125 this._verify2(a, b);
5128 if (res.cmp(this.m) >= 0) {
5131 return res._forceRed(this);
5134 Red.prototype.iadd = function iadd (a, b) {
5135 this._verify2(a, b);
5137 var res = a.iadd(b);
5138 if (res.cmp(this.m) >= 0) {
5144 Red.prototype.sub = function sub (a, b) {
5145 this._verify2(a, b);
5148 if (res.cmpn(0) < 0) {
5151 return res._forceRed(this);
5154 Red.prototype.isub = function isub (a, b) {
5155 this._verify2(a, b);
5157 var res = a.isub(b);
5158 if (res.cmpn(0) < 0) {
5164 Red.prototype.shl = function shl (a, num) {
5166 return this.imod(a.ushln(num));
5169 Red.prototype.imul = function imul (a, b) {
5170 this._verify2(a, b);
5171 return this.imod(a.imul(b));
5174 Red.prototype.mul = function mul (a, b) {
5175 this._verify2(a, b);
5176 return this.imod(a.mul(b));
5179 Red.prototype.isqr = function isqr (a) {
5180 return this.imul(a, a.clone());
5183 Red.prototype.sqr = function sqr (a) {
5184 return this.mul(a, a);
5187 Red.prototype.sqrt = function sqrt (a) {
5188 if (a.isZero()) return a.clone();
5190 var mod3 = this.m.andln(3);
5191 assert(mod3 % 2 === 1);
5195 var pow = this.m.add(new BN(1)).iushrn(2);
5196 return this.pow(a, pow);
5199 // Tonelli-Shanks algorithm (Totally unoptimized and slow)
5201 // Find Q and S, that Q * 2 ^ S = (P - 1)
5202 var q = this.m.subn(1);
5204 while (!q.isZero() && q.andln(1) === 0) {
5208 assert(!q.isZero());
5210 var one = new BN(1).toRed(this);
5211 var nOne = one.redNeg();
5213 // Find quadratic non-residue
5214 // NOTE: Max is such because of generalized Riemann hypothesis.
5215 var lpow = this.m.subn(1).iushrn(1);
5216 var z = this.m.bitLength();
5217 z = new BN(2 * z * z).toRed(this);
5219 while (this.pow(z, lpow).cmp(nOne) !== 0) {
5223 var c = this.pow(z, q);
5224 var r = this.pow(a, q.addn(1).iushrn(1));
5225 var t = this.pow(a, q);
5227 while (t.cmp(one) !== 0) {
5229 for (var i = 0; tmp.cmp(one) !== 0; i++) {
5233 var b = this.pow(c, new BN(1).iushln(m - i - 1));
5244 Red.prototype.invm = function invm (a) {
5245 var inv = a._invmp(this.m);
5246 if (inv.negative !== 0) {
5248 return this.imod(inv).redNeg();
5250 return this.imod(inv);
5254 Red.prototype.pow = function pow (a, num) {
5255 if (num.isZero()) return new BN(1).toRed(this);
5256 if (num.cmpn(1) === 0) return a.clone();
5259 var wnd = new Array(1 << windowSize);
5260 wnd[0] = new BN(1).toRed(this);
5262 for (var i = 2; i < wnd.length; i++) {
5263 wnd[i] = this.mul(wnd[i - 1], a);
5269 var start = num.bitLength() % 26;
5274 for (i = num.length - 1; i >= 0; i--) {
5275 var word = num.words[i];
5276 for (var j = start - 1; j >= 0; j--) {
5277 var bit = (word >> j) & 1;
5278 if (res !== wnd[0]) {
5279 res = this.sqr(res);
5282 if (bit === 0 && current === 0) {
5290 if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;
5292 res = this.mul(res, wnd[current]);
5302 Red.prototype.convertTo = function convertTo (num) {
5303 var r = num.umod(this.m);
5305 return r === num ? r.clone() : r;
5308 Red.prototype.convertFrom = function convertFrom (num) {
5309 var res = num.clone();
5315 // Montgomery method engine
5318 BN.mont = function mont (num) {
5319 return new Mont(num);
5325 this.shift = this.m.bitLength();
5326 if (this.shift % 26 !== 0) {
5327 this.shift += 26 - (this.shift % 26);
5330 this.r = new BN(1).iushln(this.shift);
5331 this.r2 = this.imod(this.r.sqr());
5332 this.rinv = this.r._invmp(this.m);
5334 this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);
5335 this.minv = this.minv.umod(this.r);
5336 this.minv = this.r.sub(this.minv);
5338 inherits(Mont, Red);
5340 Mont.prototype.convertTo = function convertTo (num) {
5341 return this.imod(num.ushln(this.shift));
5344 Mont.prototype.convertFrom = function convertFrom (num) {
5345 var r = this.imod(num.mul(this.rinv));
5350 Mont.prototype.imul = function imul (a, b) {
5351 if (a.isZero() || b.isZero()) {
5358 var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
5359 var u = t.isub(c).iushrn(this.shift);
5362 if (u.cmp(this.m) >= 0) {
5363 res = u.isub(this.m);
5364 } else if (u.cmpn(0) < 0) {
5365 res = u.iadd(this.m);
5368 return res._forceRed(this);
5371 Mont.prototype.mul = function mul (a, b) {
5372 if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
5375 var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
5376 var u = t.isub(c).iushrn(this.shift);
5378 if (u.cmp(this.m) >= 0) {
5379 res = u.isub(this.m);
5380 } else if (u.cmpn(0) < 0) {
5381 res = u.iadd(this.m);
5384 return res._forceRed(this);
5387 Mont.prototype.invm = function invm (a) {
5388 // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R
5389 var res = this.imod(a._invmp(this.m).mul(this.r2));
5390 return res._forceRed(this);
5392 })(typeof module === 'undefined' || module, this);
5394 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(128)(module)))
5398 /***/ (function(module, exports) {
5400 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
5401 var global = module.exports = typeof window != 'undefined' && window.Math == Math
5402 ? window : typeof self != 'undefined' && self.Math == Math ? self
5403 // eslint-disable-next-line no-new-func
5404 : Function('return this')();
5405 if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
5410 /***/ (function(module, exports, __webpack_require__) {
5415 var elliptic = exports;
5417 elliptic.version = __webpack_require__(223).version;
5418 elliptic.utils = __webpack_require__(224);
5419 elliptic.rand = __webpack_require__(115);
5420 elliptic.curve = __webpack_require__(45);
5421 elliptic.curves = __webpack_require__(229);
5424 elliptic.ec = __webpack_require__(237);
5425 elliptic.eddsa = __webpack_require__(241);
5430 /***/ (function(module, exports, __webpack_require__) {
5432 var store = __webpack_require__(70)('wks');
5433 var uid = __webpack_require__(47);
5434 var Symbol = __webpack_require__(5).Symbol;
5435 var USE_SYMBOL = typeof Symbol == 'function';
5437 var $exports = module.exports = function (name) {
5438 return store[name] || (store[name] =
5439 USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
5442 $exports.store = store;
5447 /***/ (function(module, exports) {
5449 var core = module.exports = { version: '2.5.7' };
5450 if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
5455 /***/ (function(module, exports) {
5457 module.exports = assert;
5459 function assert(val, msg) {
5461 throw new Error(msg || 'Assertion failed');
5464 assert.equal = function assertEqual(l, r, msg) {
5466 throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));
5472 /***/ (function(module, exports) {
5476 // This works in non-strict mode
\r
5482 // This works if eval is allowed (see CSP)
\r
5483 g = g || Function("return this")() || (1,eval)("this");
\r
5485 // This works if the window reference is available
\r
5486 if(typeof window === "object")
\r
5490 // g can still be undefined, but nothing to do about it...
\r
5491 // We return undefined, instead of nothing here, so it's
\r
5492 // easier to handle this case. if(!global) { ...}
\r
5494 module.exports = g;
\r
5499 /***/ (function(module, exports, __webpack_require__) {
5504 var assert = __webpack_require__(9);
5505 var inherits = __webpack_require__(1);
5507 exports.inherits = inherits;
5509 function toArray(msg, enc) {
5510 if (Array.isArray(msg))
5515 if (typeof msg === 'string') {
5517 for (var i = 0; i < msg.length; i++) {
5518 var c = msg.charCodeAt(i);
5526 } else if (enc === 'hex') {
5527 msg = msg.replace(/[^a-z0-9]+/ig, '');
5528 if (msg.length % 2 !== 0)
5530 for (i = 0; i < msg.length; i += 2)
5531 res.push(parseInt(msg[i] + msg[i + 1], 16));
5534 for (i = 0; i < msg.length; i++)
5535 res[i] = msg[i] | 0;
5539 exports.toArray = toArray;
5541 function toHex(msg) {
5543 for (var i = 0; i < msg.length; i++)
5544 res += zero2(msg[i].toString(16));
5547 exports.toHex = toHex;
5550 var res = (w >>> 24) |
5551 ((w >>> 8) & 0xff00) |
5552 ((w << 8) & 0xff0000) |
5556 exports.htonl = htonl;
5558 function toHex32(msg, endian) {
5560 for (var i = 0; i < msg.length; i++) {
5562 if (endian === 'little')
5564 res += zero8(w.toString(16));
5568 exports.toHex32 = toHex32;
5570 function zero2(word) {
5571 if (word.length === 1)
5576 exports.zero2 = zero2;
5578 function zero8(word) {
5579 if (word.length === 7)
5581 else if (word.length === 6)
5583 else if (word.length === 5)
5584 return '000' + word;
5585 else if (word.length === 4)
5586 return '0000' + word;
5587 else if (word.length === 3)
5588 return '00000' + word;
5589 else if (word.length === 2)
5590 return '000000' + word;
5591 else if (word.length === 1)
5592 return '0000000' + word;
5596 exports.zero8 = zero8;
5598 function join32(msg, start, end, endian) {
5599 var len = end - start;
5600 assert(len % 4 === 0);
5601 var res = new Array(len / 4);
5602 for (var i = 0, k = start; i < res.length; i++, k += 4) {
5604 if (endian === 'big')
5605 w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];
5607 w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];
5612 exports.join32 = join32;
5614 function split32(msg, endian) {
5615 var res = new Array(msg.length * 4);
5616 for (var i = 0, k = 0; i < msg.length; i++, k += 4) {
5618 if (endian === 'big') {
5620 res[k + 1] = (m >>> 16) & 0xff;
5621 res[k + 2] = (m >>> 8) & 0xff;
5622 res[k + 3] = m & 0xff;
5624 res[k + 3] = m >>> 24;
5625 res[k + 2] = (m >>> 16) & 0xff;
5626 res[k + 1] = (m >>> 8) & 0xff;
5632 exports.split32 = split32;
5634 function rotr32(w, b) {
5635 return (w >>> b) | (w << (32 - b));
5637 exports.rotr32 = rotr32;
5639 function rotl32(w, b) {
5640 return (w << b) | (w >>> (32 - b));
5642 exports.rotl32 = rotl32;
5644 function sum32(a, b) {
5645 return (a + b) >>> 0;
5647 exports.sum32 = sum32;
5649 function sum32_3(a, b, c) {
5650 return (a + b + c) >>> 0;
5652 exports.sum32_3 = sum32_3;
5654 function sum32_4(a, b, c, d) {
5655 return (a + b + c + d) >>> 0;
5657 exports.sum32_4 = sum32_4;
5659 function sum32_5(a, b, c, d, e) {
5660 return (a + b + c + d + e) >>> 0;
5662 exports.sum32_5 = sum32_5;
5664 function sum64(buf, pos, ah, al) {
5666 var bl = buf[pos + 1];
5668 var lo = (al + bl) >>> 0;
5669 var hi = (lo < al ? 1 : 0) + ah + bh;
5670 buf[pos] = hi >>> 0;
5673 exports.sum64 = sum64;
5675 function sum64_hi(ah, al, bh, bl) {
5676 var lo = (al + bl) >>> 0;
5677 var hi = (lo < al ? 1 : 0) + ah + bh;
5680 exports.sum64_hi = sum64_hi;
5682 function sum64_lo(ah, al, bh, bl) {
5686 exports.sum64_lo = sum64_lo;
5688 function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {
5691 lo = (lo + bl) >>> 0;
5692 carry += lo < al ? 1 : 0;
5693 lo = (lo + cl) >>> 0;
5694 carry += lo < cl ? 1 : 0;
5695 lo = (lo + dl) >>> 0;
5696 carry += lo < dl ? 1 : 0;
5698 var hi = ah + bh + ch + dh + carry;
5701 exports.sum64_4_hi = sum64_4_hi;
5703 function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {
5704 var lo = al + bl + cl + dl;
5707 exports.sum64_4_lo = sum64_4_lo;
5709 function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
5712 lo = (lo + bl) >>> 0;
5713 carry += lo < al ? 1 : 0;
5714 lo = (lo + cl) >>> 0;
5715 carry += lo < cl ? 1 : 0;
5716 lo = (lo + dl) >>> 0;
5717 carry += lo < dl ? 1 : 0;
5718 lo = (lo + el) >>> 0;
5719 carry += lo < el ? 1 : 0;
5721 var hi = ah + bh + ch + dh + eh + carry;
5724 exports.sum64_5_hi = sum64_5_hi;
5726 function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
5727 var lo = al + bl + cl + dl + el;
5731 exports.sum64_5_lo = sum64_5_lo;
5733 function rotr64_hi(ah, al, num) {
5734 var r = (al << (32 - num)) | (ah >>> num);
5737 exports.rotr64_hi = rotr64_hi;
5739 function rotr64_lo(ah, al, num) {
5740 var r = (ah << (32 - num)) | (al >>> num);
5743 exports.rotr64_lo = rotr64_lo;
5745 function shr64_hi(ah, al, num) {
5748 exports.shr64_hi = shr64_hi;
5750 function shr64_lo(ah, al, num) {
5751 var r = (ah << (32 - num)) | (al >>> num);
5754 exports.shr64_lo = shr64_lo;
5759 /***/ (function(module, exports) {
5761 module.exports = function (it) {
5762 return typeof it === 'object' ? it !== null : typeof it === 'function';
5768 /***/ (function(module, exports, __webpack_require__) {
5770 var global = __webpack_require__(5);
5771 var core = __webpack_require__(8);
5772 var ctx = __webpack_require__(35);
5773 var hide = __webpack_require__(19);
5774 var has = __webpack_require__(20);
5775 var PROTOTYPE = 'prototype';
5777 var $export = function (type, name, source) {
5778 var IS_FORCED = type & $export.F;
5779 var IS_GLOBAL = type & $export.G;
5780 var IS_STATIC = type & $export.S;
5781 var IS_PROTO = type & $export.P;
5782 var IS_BIND = type & $export.B;
5783 var IS_WRAP = type & $export.W;
5784 var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
5785 var expProto = exports[PROTOTYPE];
5786 var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
5788 if (IS_GLOBAL) source = name;
5789 for (key in source) {
5790 // contains in native
5791 own = !IS_FORCED && target && target[key] !== undefined;
5792 if (own && has(exports, key)) continue;
5793 // export native or passed
5794 out = own ? target[key] : source[key];
5795 // prevent global pollution for namespaces
5796 exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
5797 // bind timers to global for call from export context
5798 : IS_BIND && own ? ctx(out, global)
5799 // wrap global constructors for prevent change them in library
5800 : IS_WRAP && target[key] == out ? (function (C) {
5801 var F = function (a, b, c) {
5802 if (this instanceof C) {
5803 switch (arguments.length) {
5804 case 0: return new C();
5805 case 1: return new C(a);
5806 case 2: return new C(a, b);
5807 } return new C(a, b, c);
5808 } return C.apply(this, arguments);
5810 F[PROTOTYPE] = C[PROTOTYPE];
5812 // make static versions for prototype methods
5813 })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
5814 // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
5816 (exports.virtual || (exports.virtual = {}))[key] = out;
5817 // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
5818 if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
5823 $export.F = 1; // forced
5824 $export.G = 2; // global
5825 $export.S = 4; // static
5826 $export.P = 8; // proto
5827 $export.B = 16; // bind
5828 $export.W = 32; // wrap
5829 $export.U = 64; // safe
5830 $export.R = 128; // real proto method for `library`
5831 module.exports = $export;
5836 /***/ (function(module, exports) {
5838 // shim for using process in browser
5839 var process = module.exports = {};
5841 // cached from whatever global is present so that test runners that stub it
5842 // don't break things. But we need to wrap it in a try catch in case it is
5843 // wrapped in strict mode code which doesn't define any globals. It's inside a
5844 // function because try/catches deoptimize in certain engines.
5846 var cachedSetTimeout;
5847 var cachedClearTimeout;
5849 function defaultSetTimout() {
5850 throw new Error('setTimeout has not been defined');
5852 function defaultClearTimeout () {
5853 throw new Error('clearTimeout has not been defined');
5857 if (typeof setTimeout === 'function') {
5858 cachedSetTimeout = setTimeout;
5860 cachedSetTimeout = defaultSetTimout;
5863 cachedSetTimeout = defaultSetTimout;
5866 if (typeof clearTimeout === 'function') {
5867 cachedClearTimeout = clearTimeout;
5869 cachedClearTimeout = defaultClearTimeout;
5872 cachedClearTimeout = defaultClearTimeout;
5875 function runTimeout(fun) {
5876 if (cachedSetTimeout === setTimeout) {
5877 //normal enviroments in sane situations
5878 return setTimeout(fun, 0);
5880 // if setTimeout wasn't available but was latter defined
5881 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
5882 cachedSetTimeout = setTimeout;
5883 return setTimeout(fun, 0);
5886 // when when somebody has screwed with setTimeout but no I.E. maddness
5887 return cachedSetTimeout(fun, 0);
5890 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
5891 return cachedSetTimeout.call(null, fun, 0);
5893 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
5894 return cachedSetTimeout.call(this, fun, 0);
5900 function runClearTimeout(marker) {
5901 if (cachedClearTimeout === clearTimeout) {
5902 //normal enviroments in sane situations
5903 return clearTimeout(marker);
5905 // if clearTimeout wasn't available but was latter defined
5906 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
5907 cachedClearTimeout = clearTimeout;
5908 return clearTimeout(marker);
5911 // when when somebody has screwed with setTimeout but no I.E. maddness
5912 return cachedClearTimeout(marker);
5915 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
5916 return cachedClearTimeout.call(null, marker);
5918 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
5919 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
5920 return cachedClearTimeout.call(this, marker);
5928 var draining = false;
5930 var queueIndex = -1;
5932 function cleanUpNextTick() {
5933 if (!draining || !currentQueue) {
5937 if (currentQueue.length) {
5938 queue = currentQueue.concat(queue);
5947 function drainQueue() {
5951 var timeout = runTimeout(cleanUpNextTick);
5954 var len = queue.length;
5956 currentQueue = queue;
5958 while (++queueIndex < len) {
5960 currentQueue[queueIndex].run();
5966 currentQueue = null;
5968 runClearTimeout(timeout);
5971 process.nextTick = function (fun) {
5972 var args = new Array(arguments.length - 1);
5973 if (arguments.length > 1) {
5974 for (var i = 1; i < arguments.length; i++) {
5975 args[i - 1] = arguments[i];
5978 queue.push(new Item(fun, args));
5979 if (queue.length === 1 && !draining) {
5980 runTimeout(drainQueue);
5984 // v8 likes predictible objects
5985 function Item(fun, array) {
5989 Item.prototype.run = function () {
5990 this.fun.apply(null, this.array);
5992 process.title = 'browser';
5993 process.browser = true;
5996 process.version = ''; // empty string to avoid regexp issues
5997 process.versions = {};
6002 process.addListener = noop;
6003 process.once = noop;
6005 process.removeListener = noop;
6006 process.removeAllListeners = noop;
6007 process.emit = noop;
6008 process.prependListener = noop;
6009 process.prependOnceListener = noop;
6011 process.listeners = function (name) { return [] }
6013 process.binding = function (name) {
6014 throw new Error('process.binding is not supported');
6017 process.cwd = function () { return '/' };
6018 process.chdir = function (dir) {
6019 throw new Error('process.chdir is not supported');
6021 process.umask = function() { return 0; };
6026 /***/ (function(module, exports, __webpack_require__) {
6028 var isObject = __webpack_require__(12);
6029 module.exports = function (it) {
6030 if (!isObject(it)) throw TypeError(it + ' is not an object!');
6037 /***/ (function(module, exports, __webpack_require__) {
6039 var anObject = __webpack_require__(15);
6040 var IE8_DOM_DEFINE = __webpack_require__(130);
6041 var toPrimitive = __webpack_require__(72);
6042 var dP = Object.defineProperty;
6044 exports.f = __webpack_require__(17) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
6046 P = toPrimitive(P, true);
6047 anObject(Attributes);
6048 if (IE8_DOM_DEFINE) try {
6049 return dP(O, P, Attributes);
6050 } catch (e) { /* empty */ }
6051 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
6052 if ('value' in Attributes) O[P] = Attributes.value;
6059 /***/ (function(module, exports, __webpack_require__) {
6061 // Thank's IE8 for his funny defineProperty
6062 module.exports = !__webpack_require__(22)(function () {
6063 return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
6069 /***/ (function(module, exports, __webpack_require__) {
6071 var Buffer = __webpack_require__(2).Buffer
6072 var Transform = __webpack_require__(57).Transform
6073 var StringDecoder = __webpack_require__(61).StringDecoder
6074 var inherits = __webpack_require__(1)
6076 function CipherBase (hashMode) {
6077 Transform.call(this)
6078 this.hashMode = typeof hashMode === 'string'
6079 if (this.hashMode) {
6080 this[hashMode] = this._finalOrDigest
6082 this.final = this._finalOrDigest
6085 this.__final = this._final
6088 this._decoder = null
6089 this._encoding = null
6091 inherits(CipherBase, Transform)
6093 CipherBase.prototype.update = function (data, inputEnc, outputEnc) {
6094 if (typeof data === 'string') {
6095 data = Buffer.from(data, inputEnc)
6098 var outData = this._update(data)
6099 if (this.hashMode) return this
6102 outData = this._toString(outData, outputEnc)
6108 CipherBase.prototype.setAutoPadding = function () {}
6109 CipherBase.prototype.getAuthTag = function () {
6110 throw new Error('trying to get auth tag in unsupported state')
6113 CipherBase.prototype.setAuthTag = function () {
6114 throw new Error('trying to set auth tag in unsupported state')
6117 CipherBase.prototype.setAAD = function () {
6118 throw new Error('trying to set aad in unsupported state')
6121 CipherBase.prototype._transform = function (data, _, next) {
6124 if (this.hashMode) {
6127 this.push(this._update(data))
6135 CipherBase.prototype._flush = function (done) {
6138 this.push(this.__final())
6145 CipherBase.prototype._finalOrDigest = function (outputEnc) {
6146 var outData = this.__final() || Buffer.alloc(0)
6148 outData = this._toString(outData, outputEnc, true)
6153 CipherBase.prototype._toString = function (value, enc, fin) {
6154 if (!this._decoder) {
6155 this._decoder = new StringDecoder(enc)
6156 this._encoding = enc
6159 if (this._encoding !== enc) throw new Error('can\'t switch encodings')
6161 var out = this._decoder.write(value)
6163 out += this._decoder.end()
6169 module.exports = CipherBase
6174 /***/ (function(module, exports, __webpack_require__) {
6176 var dP = __webpack_require__(16);
6177 var createDesc = __webpack_require__(48);
6178 module.exports = __webpack_require__(17) ? function (object, key, value) {
6179 return dP.f(object, key, createDesc(1, value));
6180 } : function (object, key, value) {
6181 object[key] = value;
6188 /***/ (function(module, exports) {
6190 var hasOwnProperty = {}.hasOwnProperty;
6191 module.exports = function (it, key) {
6192 return hasOwnProperty.call(it, key);
6198 /***/ (function(module, exports, __webpack_require__) {
6201 // Copyright Joyent, Inc. and other Node contributors.
6203 // Permission is hereby granted, free of charge, to any person obtaining a
6204 // copy of this software and associated documentation files (the
6205 // "Software"), to deal in the Software without restriction, including
6206 // without limitation the rights to use, copy, modify, merge, publish,
6207 // distribute, sublicense, and/or sell copies of the Software, and to permit
6208 // persons to whom the Software is furnished to do so, subject to the
6209 // following conditions:
6211 // The above copyright notice and this permission notice shall be included
6212 // in all copies or substantial portions of the Software.
6214 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
6215 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6216 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
6217 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
6218 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
6219 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
6220 // USE OR OTHER DEALINGS IN THE SOFTWARE.
6222 // a duplex stream is just a stream that is both readable and writable.
6223 // Since JS doesn't have multiple prototypal inheritance, this class
6224 // prototypally inherits from Readable, and then parasitically from
6231 var pna = __webpack_require__(42);
6235 var objectKeys = Object.keys || function (obj) {
6237 for (var key in obj) {
6243 module.exports = Duplex;
6246 var util = __webpack_require__(30);
6247 util.inherits = __webpack_require__(1);
6250 var Readable = __webpack_require__(95);
6251 var Writable = __webpack_require__(60);
6253 util.inherits(Duplex, Readable);
6256 // avoid scope creep, the keys array can then be collected
6257 var keys = objectKeys(Writable.prototype);
6258 for (var v = 0; v < keys.length; v++) {
6259 var method = keys[v];
6260 if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
6264 function Duplex(options) {
6265 if (!(this instanceof Duplex)) return new Duplex(options);
6267 Readable.call(this, options);
6268 Writable.call(this, options);
6270 if (options && options.readable === false) this.readable = false;
6272 if (options && options.writable === false) this.writable = false;
6274 this.allowHalfOpen = true;
6275 if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
6277 this.once('end', onend);
6280 Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
6281 // making it explicit this property is not enumerable
6282 // because otherwise some prototype manipulation in
6283 // userland will fail
6286 return this._writableState.highWaterMark;
6290 // the no-half-open enforcer
6292 // if we allow half-open state, or if the writable side ended,
6294 if (this.allowHalfOpen || this._writableState.ended) return;
6296 // no more data can be written.
6297 // But allow more writes to happen in this tick.
6298 pna.nextTick(onEndNT, this);
6301 function onEndNT(self) {
6305 Object.defineProperty(Duplex.prototype, 'destroyed', {
6307 if (this._readableState === undefined || this._writableState === undefined) {
6310 return this._readableState.destroyed && this._writableState.destroyed;
6312 set: function (value) {
6313 // we ignore the value if the stream
6314 // has not been initialized yet
6315 if (this._readableState === undefined || this._writableState === undefined) {
6319 // backward compatibility, the user is explicitly
6320 // managing destroyed
6321 this._readableState.destroyed = value;
6322 this._writableState.destroyed = value;
6326 Duplex.prototype._destroy = function (err, cb) {
6330 pna.nextTick(cb, err);
6335 /***/ (function(module, exports) {
6337 module.exports = function (exec) {
6348 /***/ (function(module, exports, __webpack_require__) {
6351 /* WEBPACK VAR INJECTION */(function(global, process) {
6353 function oldBrowser () {
6354 throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11')
6357 var Buffer = __webpack_require__(2).Buffer
6358 var crypto = global.crypto || global.msCrypto
6360 if (crypto && crypto.getRandomValues) {
6361 module.exports = randomBytes
6363 module.exports = oldBrowser
6366 function randomBytes (size, cb) {
6367 // phantomjs needs to throw
6368 if (size > 65536) throw new Error('requested too many random bytes')
6369 // in case browserify isn't using the Uint8Array version
6370 var rawBytes = new global.Uint8Array(size)
6372 // This will not work in older browsers.
6373 // See https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
6374 if (size > 0) { // getRandomValues fails on IE if size == 0
6375 crypto.getRandomValues(rawBytes)
6378 // XXX: phantomjs doesn't like a buffer being passed here
6379 var bytes = Buffer.from(rawBytes.buffer)
6381 if (typeof cb === 'function') {
6382 return process.nextTick(function () {
6390 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10), __webpack_require__(14)))
6394 /***/ (function(module, exports, __webpack_require__) {
6396 var Buffer = __webpack_require__(2).Buffer
6398 // prototype class for hash functions
6399 function Hash (blockSize, finalSize) {
6400 this._block = Buffer.alloc(blockSize)
6401 this._finalSize = finalSize
6402 this._blockSize = blockSize
6406 Hash.prototype.update = function (data, enc) {
6407 if (typeof data === 'string') {
6409 data = Buffer.from(data, enc)
6412 var block = this._block
6413 var blockSize = this._blockSize
6414 var length = data.length
6415 var accum = this._len
6417 for (var offset = 0; offset < length;) {
6418 var assigned = accum % blockSize
6419 var remainder = Math.min(length - offset, blockSize - assigned)
6421 for (var i = 0; i < remainder; i++) {
6422 block[assigned + i] = data[offset + i]
6428 if ((accum % blockSize) === 0) {
6437 Hash.prototype.digest = function (enc) {
6438 var rem = this._len % this._blockSize
6440 this._block[rem] = 0x80
6442 // zero (rem + 1) trailing bits, where (rem + 1) is the smallest
6443 // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize
6444 this._block.fill(0, rem + 1)
6446 if (rem >= this._finalSize) {
6447 this._update(this._block)
6451 var bits = this._len * 8
6454 if (bits <= 0xffffffff) {
6455 this._block.writeUInt32BE(bits, this._blockSize - 4)
6459 var lowBits = (bits & 0xffffffff) >>> 0
6460 var highBits = (bits - lowBits) / 0x100000000
6462 this._block.writeUInt32BE(highBits, this._blockSize - 8)
6463 this._block.writeUInt32BE(lowBits, this._blockSize - 4)
6466 this._update(this._block)
6467 var hash = this._hash()
6469 return enc ? hash.toString(enc) : hash
6472 Hash.prototype._update = function () {
6473 throw new Error('_update must be implemented by subclass')
6476 module.exports = Hash
6481 /***/ (function(module, exports, __webpack_require__) {
6483 // to indexed object, toObject with fallback for non-array-like ES3 strings
6484 var IObject = __webpack_require__(74);
6485 var defined = __webpack_require__(51);
6486 module.exports = function (it) {
6487 return IObject(defined(it));
6493 /***/ (function(module, exports, __webpack_require__) {
6498 exports.__esModule = true;
6500 exports.default = function (instance, Constructor) {
6501 if (!(instance instanceof Constructor)) {
6502 throw new TypeError("Cannot call a class as a function");
6508 /***/ (function(module, exports) {
6510 var toString = {}.toString;
6512 module.exports = function (it) {
6513 return toString.call(it).slice(8, -1);
6519 /***/ (function(module, exports) {
6521 module.exports = {};
6526 /***/ (function(module, exports, __webpack_require__) {
6530 var inherits = __webpack_require__(1)
6531 var MD5 = __webpack_require__(56)
6532 var RIPEMD160 = __webpack_require__(62)
6533 var sha = __webpack_require__(63)
6534 var Base = __webpack_require__(18)
6536 function Hash (hash) {
6537 Base.call(this, 'digest')
6542 inherits(Hash, Base)
6544 Hash.prototype._update = function (data) {
6545 this._hash.update(data)
6548 Hash.prototype._final = function () {
6549 return this._hash.digest()
6552 module.exports = function createHash (alg) {
6553 alg = alg.toLowerCase()
6554 if (alg === 'md5') return new MD5()
6555 if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160()
6557 return new Hash(sha(alg))
6563 /***/ (function(module, exports, __webpack_require__) {
6565 /* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors.
6567 // Permission is hereby granted, free of charge, to any person obtaining a
6568 // copy of this software and associated documentation files (the
6569 // "Software"), to deal in the Software without restriction, including
6570 // without limitation the rights to use, copy, modify, merge, publish,
6571 // distribute, sublicense, and/or sell copies of the Software, and to permit
6572 // persons to whom the Software is furnished to do so, subject to the
6573 // following conditions:
6575 // The above copyright notice and this permission notice shall be included
6576 // in all copies or substantial portions of the Software.
6578 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
6579 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6580 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
6581 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
6582 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
6583 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
6584 // USE OR OTHER DEALINGS IN THE SOFTWARE.
6586 // NOTE: These type checking functions intentionally don't use `instanceof`
6587 // because it is fragile and can be easily faked with `Object.create()`.
6589 function isArray(arg) {
6590 if (Array.isArray) {
6591 return Array.isArray(arg);
6593 return objectToString(arg) === '[object Array]';
6595 exports.isArray = isArray;
6597 function isBoolean(arg) {
6598 return typeof arg === 'boolean';
6600 exports.isBoolean = isBoolean;
6602 function isNull(arg) {
6603 return arg === null;
6605 exports.isNull = isNull;
6607 function isNullOrUndefined(arg) {
6610 exports.isNullOrUndefined = isNullOrUndefined;
6612 function isNumber(arg) {
6613 return typeof arg === 'number';
6615 exports.isNumber = isNumber;
6617 function isString(arg) {
6618 return typeof arg === 'string';
6620 exports.isString = isString;
6622 function isSymbol(arg) {
6623 return typeof arg === 'symbol';
6625 exports.isSymbol = isSymbol;
6627 function isUndefined(arg) {
6628 return arg === void 0;
6630 exports.isUndefined = isUndefined;
6632 function isRegExp(re) {
6633 return objectToString(re) === '[object RegExp]';
6635 exports.isRegExp = isRegExp;
6637 function isObject(arg) {
6638 return typeof arg === 'object' && arg !== null;
6640 exports.isObject = isObject;
6642 function isDate(d) {
6643 return objectToString(d) === '[object Date]';
6645 exports.isDate = isDate;
6647 function isError(e) {
6648 return (objectToString(e) === '[object Error]' || e instanceof Error);
6650 exports.isError = isError;
6652 function isFunction(arg) {
6653 return typeof arg === 'function';
6655 exports.isFunction = isFunction;
6657 function isPrimitive(arg) {
6658 return arg === null ||
6659 typeof arg === 'boolean' ||
6660 typeof arg === 'number' ||
6661 typeof arg === 'string' ||
6662 typeof arg === 'symbol' || // ES6 symbol
6663 typeof arg === 'undefined';
6665 exports.isPrimitive = isPrimitive;
6667 exports.isBuffer = Buffer.isBuffer;
6669 function objectToString(o) {
6670 return Object.prototype.toString.call(o);
6673 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
6677 /***/ (function(module, exports, __webpack_require__) {
6679 /* WEBPACK VAR INJECTION */(function(Buffer) {module.exports = function xor (a, b) {
6680 var length = Math.min(a.length, b.length)
6681 var buffer = new Buffer(length)
6683 for (var i = 0; i < length; ++i) {
6684 buffer[i] = a[i] ^ b[i]
6690 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
6694 /***/ (function(module, exports, __webpack_require__) {
6699 var utils = __webpack_require__(11);
6700 var assert = __webpack_require__(9);
6702 function BlockHash() {
6703 this.pending = null;
6704 this.pendingTotal = 0;
6705 this.blockSize = this.constructor.blockSize;
6706 this.outSize = this.constructor.outSize;
6707 this.hmacStrength = this.constructor.hmacStrength;
6708 this.padLength = this.constructor.padLength / 8;
6709 this.endian = 'big';
6711 this._delta8 = this.blockSize / 8;
6712 this._delta32 = this.blockSize / 32;
6714 exports.BlockHash = BlockHash;
6716 BlockHash.prototype.update = function update(msg, enc) {
6717 // Convert message to array, pad it, and join into 32bit blocks
6718 msg = utils.toArray(msg, enc);
6722 this.pending = this.pending.concat(msg);
6723 this.pendingTotal += msg.length;
6725 // Enough data, try updating
6726 if (this.pending.length >= this._delta8) {
6729 // Process pending data in blocks
6730 var r = msg.length % this._delta8;
6731 this.pending = msg.slice(msg.length - r, msg.length);
6732 if (this.pending.length === 0)
6733 this.pending = null;
6735 msg = utils.join32(msg, 0, msg.length - r, this.endian);
6736 for (var i = 0; i < msg.length; i += this._delta32)
6737 this._update(msg, i, i + this._delta32);
6743 BlockHash.prototype.digest = function digest(enc) {
6744 this.update(this._pad());
6745 assert(this.pending === null);
6747 return this._digest(enc);
6750 BlockHash.prototype._pad = function pad() {
6751 var len = this.pendingTotal;
6752 var bytes = this._delta8;
6753 var k = bytes - ((len + this.padLength) % bytes);
6754 var res = new Array(k + this.padLength);
6756 for (var i = 1; i < k; i++)
6761 if (this.endian === 'big') {
6762 for (var t = 8; t < this.padLength; t++)
6769 res[i++] = (len >>> 24) & 0xff;
6770 res[i++] = (len >>> 16) & 0xff;
6771 res[i++] = (len >>> 8) & 0xff;
6772 res[i++] = len & 0xff;
6774 res[i++] = len & 0xff;
6775 res[i++] = (len >>> 8) & 0xff;
6776 res[i++] = (len >>> 16) & 0xff;
6777 res[i++] = (len >>> 24) & 0xff;
6783 for (t = 8; t < this.padLength; t++)
6793 /***/ (function(module, exports, __webpack_require__) {
6797 asn1.bignum = __webpack_require__(4);
6799 asn1.define = __webpack_require__(245).define;
6800 asn1.base = __webpack_require__(34);
6801 asn1.constants = __webpack_require__(121);
6802 asn1.decoders = __webpack_require__(251);
6803 asn1.encoders = __webpack_require__(253);
6808 /***/ (function(module, exports, __webpack_require__) {
6812 base.Reporter = __webpack_require__(248).Reporter;
6813 base.DecoderBuffer = __webpack_require__(120).DecoderBuffer;
6814 base.EncoderBuffer = __webpack_require__(120).EncoderBuffer;
6815 base.Node = __webpack_require__(249);
6820 /***/ (function(module, exports, __webpack_require__) {
6822 // optional / simple context binding
6823 var aFunction = __webpack_require__(38);
6824 module.exports = function (fn, that, length) {
6826 if (that === undefined) return fn;
6828 case 1: return function (a) {
6829 return fn.call(that, a);
6831 case 2: return function (a, b) {
6832 return fn.call(that, a, b);
6834 case 3: return function (a, b, c) {
6835 return fn.call(that, a, b, c);
6838 return function (/* ...args */) {
6839 return fn.apply(that, arguments);
6846 /***/ (function(module, exports, __webpack_require__) {
6851 exports.__esModule = true;
6853 var _defineProperty = __webpack_require__(136);
6855 var _defineProperty2 = _interopRequireDefault(_defineProperty);
6857 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6859 exports.default = function () {
6860 function defineProperties(target, props) {
6861 for (var i = 0; i < props.length; i++) {
6862 var descriptor = props[i];
6863 descriptor.enumerable = descriptor.enumerable || false;
6864 descriptor.configurable = true;
6865 if ("value" in descriptor) descriptor.writable = true;
6866 (0, _defineProperty2.default)(target, descriptor.key, descriptor);
6870 return function (Constructor, protoProps, staticProps) {
6871 if (protoProps) defineProperties(Constructor.prototype, protoProps);
6872 if (staticProps) defineProperties(Constructor, staticProps);
6879 /***/ (function(module, exports) {
6881 module.exports = true;
6886 /***/ (function(module, exports) {
6888 module.exports = function (it) {
6889 if (typeof it != 'function') throw TypeError(it + ' is not a function!');
6896 /***/ (function(module, exports, __webpack_require__) {
6898 // 19.1.2.14 / 15.2.3.14 Object.keys(O)
6899 var $keys = __webpack_require__(131);
6900 var enumBugKeys = __webpack_require__(71);
6902 module.exports = Object.keys || function keys(O) {
6903 return $keys(O, enumBugKeys);
6909 /***/ (function(module, exports, __webpack_require__) {
6911 var def = __webpack_require__(16).f;
6912 var has = __webpack_require__(20);
6913 var TAG = __webpack_require__(7)('toStringTag');
6915 module.exports = function (it, tag, stat) {
6916 if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
6923 /***/ (function(module, exports, __webpack_require__) {
6926 /* WEBPACK VAR INJECTION */(function(process) {
6928 if (!process.version ||
6929 process.version.indexOf('v0.') === 0 ||
6930 process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
6931 module.exports = { nextTick: nextTick };
6933 module.exports = process
6936 function nextTick(fn, arg1, arg2, arg3) {
6937 if (typeof fn !== 'function') {
6938 throw new TypeError('"callback" argument must be a function');
6940 var len = arguments.length;
6945 return process.nextTick(fn);
6947 return process.nextTick(function afterTickOne() {
6948 fn.call(null, arg1);
6951 return process.nextTick(function afterTickTwo() {
6952 fn.call(null, arg1, arg2);
6955 return process.nextTick(function afterTickThree() {
6956 fn.call(null, arg1, arg2, arg3);
6959 args = new Array(len - 1);
6961 while (i < args.length) {
6962 args[i++] = arguments[i];
6964 return process.nextTick(function afterTick() {
6965 fn.apply(null, args);
6971 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(14)))
6975 /***/ (function(module, exports, __webpack_require__) {
6977 // based on the aes implimentation in triple sec
6978 // https://github.com/keybase/triplesec
6979 // which is in turn based on the one from crypto-js
6980 // https://code.google.com/p/crypto-js/
6982 var Buffer = __webpack_require__(2).Buffer
6984 function asUInt32Array (buf) {
6985 if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)
6987 var len = (buf.length / 4) | 0
6988 var out = new Array(len)
6990 for (var i = 0; i < len; i++) {
6991 out[i] = buf.readUInt32BE(i * 4)
6997 function scrubVec (v) {
6998 for (var i = 0; i < v.length; v++) {
7003 function cryptBlock (M, keySchedule, SUB_MIX, SBOX, nRounds) {
7004 var SUB_MIX0 = SUB_MIX[0]
7005 var SUB_MIX1 = SUB_MIX[1]
7006 var SUB_MIX2 = SUB_MIX[2]
7007 var SUB_MIX3 = SUB_MIX[3]
7009 var s0 = M[0] ^ keySchedule[0]
7010 var s1 = M[1] ^ keySchedule[1]
7011 var s2 = M[2] ^ keySchedule[2]
7012 var s3 = M[3] ^ keySchedule[3]
7016 for (var round = 1; round < nRounds; round++) {
7017 t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[(s1 >>> 16) & 0xff] ^ SUB_MIX2[(s2 >>> 8) & 0xff] ^ SUB_MIX3[s3 & 0xff] ^ keySchedule[ksRow++]
7018 t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[(s2 >>> 16) & 0xff] ^ SUB_MIX2[(s3 >>> 8) & 0xff] ^ SUB_MIX3[s0 & 0xff] ^ keySchedule[ksRow++]
7019 t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[(s3 >>> 16) & 0xff] ^ SUB_MIX2[(s0 >>> 8) & 0xff] ^ SUB_MIX3[s1 & 0xff] ^ keySchedule[ksRow++]
7020 t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[(s0 >>> 16) & 0xff] ^ SUB_MIX2[(s1 >>> 8) & 0xff] ^ SUB_MIX3[s2 & 0xff] ^ keySchedule[ksRow++]
7027 t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]
7028 t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]
7029 t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]
7030 t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]
7036 return [t0, t1, t2, t3]
7040 var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]
7041 var G = (function () {
7042 // Compute double table
7043 var d = new Array(256)
7044 for (var j = 0; j < 256; j++) {
7048 d[j] = (j << 1) ^ 0x11b
7054 var SUB_MIX = [[], [], [], []]
7055 var INV_SUB_MIX = [[], [], [], []]
7060 for (var i = 0; i < 256; ++i) {
7062 var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4)
7063 sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63
7067 // Compute multiplication
7072 // Compute sub bytes, mix columns tables
7073 var t = (d[sx] * 0x101) ^ (sx * 0x1010100)
7074 SUB_MIX[0][x] = (t << 24) | (t >>> 8)
7075 SUB_MIX[1][x] = (t << 16) | (t >>> 16)
7076 SUB_MIX[2][x] = (t << 8) | (t >>> 24)
7079 // Compute inv sub bytes, inv mix columns tables
7080 t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100)
7081 INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8)
7082 INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16)
7083 INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24)
7084 INV_SUB_MIX[3][sx] = t
7089 x = x2 ^ d[d[d[x8 ^ x2]]]
7098 INV_SUB_MIX: INV_SUB_MIX
7102 function AES (key) {
7103 this._key = asUInt32Array(key)
7107 AES.blockSize = 4 * 4
7108 AES.keySize = 256 / 8
7109 AES.prototype.blockSize = AES.blockSize
7110 AES.prototype.keySize = AES.keySize
7111 AES.prototype._reset = function () {
7112 var keyWords = this._key
7113 var keySize = keyWords.length
7114 var nRounds = keySize + 6
7115 var ksRows = (nRounds + 1) * 4
7117 var keySchedule = []
7118 for (var k = 0; k < keySize; k++) {
7119 keySchedule[k] = keyWords[k]
7122 for (k = keySize; k < ksRows; k++) {
7123 var t = keySchedule[k - 1]
7125 if (k % keySize === 0) {
7126 t = (t << 8) | (t >>> 24)
7128 (G.SBOX[t >>> 24] << 24) |
7129 (G.SBOX[(t >>> 16) & 0xff] << 16) |
7130 (G.SBOX[(t >>> 8) & 0xff] << 8) |
7133 t ^= RCON[(k / keySize) | 0] << 24
7134 } else if (keySize > 6 && k % keySize === 4) {
7136 (G.SBOX[t >>> 24] << 24) |
7137 (G.SBOX[(t >>> 16) & 0xff] << 16) |
7138 (G.SBOX[(t >>> 8) & 0xff] << 8) |
7142 keySchedule[k] = keySchedule[k - keySize] ^ t
7145 var invKeySchedule = []
7146 for (var ik = 0; ik < ksRows; ik++) {
7147 var ksR = ksRows - ik
7148 var tt = keySchedule[ksR - (ik % 4 ? 0 : 4)]
7150 if (ik < 4 || ksR <= 4) {
7151 invKeySchedule[ik] = tt
7153 invKeySchedule[ik] =
7154 G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^
7155 G.INV_SUB_MIX[1][G.SBOX[(tt >>> 16) & 0xff]] ^
7156 G.INV_SUB_MIX[2][G.SBOX[(tt >>> 8) & 0xff]] ^
7157 G.INV_SUB_MIX[3][G.SBOX[tt & 0xff]]
7161 this._nRounds = nRounds
7162 this._keySchedule = keySchedule
7163 this._invKeySchedule = invKeySchedule
7166 AES.prototype.encryptBlockRaw = function (M) {
7167 M = asUInt32Array(M)
7168 return cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds)
7171 AES.prototype.encryptBlock = function (M) {
7172 var out = this.encryptBlockRaw(M)
7173 var buf = Buffer.allocUnsafe(16)
7174 buf.writeUInt32BE(out[0], 0)
7175 buf.writeUInt32BE(out[1], 4)
7176 buf.writeUInt32BE(out[2], 8)
7177 buf.writeUInt32BE(out[3], 12)
7181 AES.prototype.decryptBlock = function (M) {
7182 M = asUInt32Array(M)
7189 var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds)
7190 var buf = Buffer.allocUnsafe(16)
7191 buf.writeUInt32BE(out[0], 0)
7192 buf.writeUInt32BE(out[3], 4)
7193 buf.writeUInt32BE(out[2], 8)
7194 buf.writeUInt32BE(out[1], 12)
7198 AES.prototype.scrub = function () {
7199 scrubVec(this._keySchedule)
7200 scrubVec(this._invKeySchedule)
7204 module.exports.AES = AES
7209 /***/ (function(module, exports, __webpack_require__) {
7211 var Buffer = __webpack_require__(2).Buffer
7212 var MD5 = __webpack_require__(56)
7214 /* eslint-disable camelcase */
7215 function EVP_BytesToKey (password, salt, keyBits, ivLen) {
7216 if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary')
7218 if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary')
7219 if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length')
7222 var keyLen = keyBits / 8
7223 var key = Buffer.alloc(keyLen)
7224 var iv = Buffer.alloc(ivLen || 0)
7225 var tmp = Buffer.alloc(0)
7227 while (keyLen > 0 || ivLen > 0) {
7228 var hash = new MD5()
7230 hash.update(password)
7231 if (salt) hash.update(salt)
7237 var keyStart = key.length - keyLen
7238 used = Math.min(keyLen, tmp.length)
7239 tmp.copy(key, keyStart, 0, used)
7243 if (used < tmp.length && ivLen > 0) {
7244 var ivStart = iv.length - ivLen
7245 var length = Math.min(ivLen, tmp.length - used)
7246 tmp.copy(iv, ivStart, used, used + length)
7252 return { key: key, iv: iv }
7255 module.exports = EVP_BytesToKey
7260 /***/ (function(module, exports, __webpack_require__) {
7265 var curve = exports;
7267 curve.base = __webpack_require__(225);
7268 curve.short = __webpack_require__(226);
7269 curve.mont = __webpack_require__(227);
7270 curve.edwards = __webpack_require__(228);
7275 /***/ (function(module, exports, __webpack_require__) {
7277 /* WEBPACK VAR INJECTION */(function(Buffer) {var asn1 = __webpack_require__(244)
7278 var aesid = __webpack_require__(256)
7279 var fixProc = __webpack_require__(257)
7280 var ciphers = __webpack_require__(65)
7281 var compat = __webpack_require__(104)
7282 module.exports = parseKeys
7284 function parseKeys (buffer) {
7286 if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) {
7287 password = buffer.passphrase
7290 if (typeof buffer === 'string') {
7291 buffer = new Buffer(buffer)
7294 var stripped = fixProc(buffer, password)
7296 var type = stripped.tag
7297 var data = stripped.data
7301 ndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo
7305 ndata = asn1.PublicKey.decode(data, 'der')
7307 subtype = ndata.algorithm.algorithm.join('.')
7309 case '1.2.840.113549.1.1.1':
7310 return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der')
7311 case '1.2.840.10045.2.1':
7312 ndata.subjectPrivateKey = ndata.subjectPublicKey
7317 case '1.2.840.10040.4.1':
7318 ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der')
7321 data: ndata.algorithm.params
7323 default: throw new Error('unknown key id ' + subtype)
7325 throw new Error('unknown key type ' + type)
7326 case 'ENCRYPTED PRIVATE KEY':
7327 data = asn1.EncryptedPrivateKey.decode(data, 'der')
7328 data = decrypt(data, password)
7331 ndata = asn1.PrivateKey.decode(data, 'der')
7332 subtype = ndata.algorithm.algorithm.join('.')
7334 case '1.2.840.113549.1.1.1':
7335 return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der')
7336 case '1.2.840.10045.2.1':
7338 curve: ndata.algorithm.curve,
7339 privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey
7341 case '1.2.840.10040.4.1':
7342 ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der')
7345 params: ndata.algorithm.params
7347 default: throw new Error('unknown key id ' + subtype)
7349 throw new Error('unknown key type ' + type)
7350 case 'RSA PUBLIC KEY':
7351 return asn1.RSAPublicKey.decode(data, 'der')
7352 case 'RSA PRIVATE KEY':
7353 return asn1.RSAPrivateKey.decode(data, 'der')
7354 case 'DSA PRIVATE KEY':
7357 params: asn1.DSAPrivateKey.decode(data, 'der')
7359 case 'EC PRIVATE KEY':
7360 data = asn1.ECPrivateKey.decode(data, 'der')
7362 curve: data.parameters.value,
7363 privateKey: data.privateKey
7365 default: throw new Error('unknown key type ' + type)
7368 parseKeys.signature = asn1.signature
7369 function decrypt (data, password) {
7370 var salt = data.algorithm.decrypt.kde.kdeparams.salt
7371 var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10)
7372 var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')]
7373 var iv = data.algorithm.decrypt.cipher.iv
7374 var cipherText = data.subjectPrivateKey
7375 var keylen = parseInt(algo.split('-')[1], 10) / 8
7376 var key = compat.pbkdf2Sync(password, salt, iters, keylen)
7377 var cipher = ciphers.createDecipheriv(algo, key, iv)
7379 out.push(cipher.update(cipherText))
7380 out.push(cipher.final())
7381 return Buffer.concat(out)
7384 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
7388 /***/ (function(module, exports) {
7391 var px = Math.random();
7392 module.exports = function (key) {
7393 return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
7399 /***/ (function(module, exports) {
7401 module.exports = function (bitmap, value) {
7403 enumerable: !(bitmap & 1),
7404 configurable: !(bitmap & 2),
7405 writable: !(bitmap & 4),
7413 /***/ (function(module, exports) {
7415 exports.f = {}.propertyIsEnumerable;
7420 /***/ (function(module, exports, __webpack_require__) {
7422 var isObject = __webpack_require__(12);
7423 var document = __webpack_require__(5).document;
7424 // typeof document.createElement is 'object' in old IE
7425 var is = isObject(document) && isObject(document.createElement);
7426 module.exports = function (it) {
7427 return is ? document.createElement(it) : {};
7433 /***/ (function(module, exports) {
7435 // 7.2.1 RequireObjectCoercible(argument)
7436 module.exports = function (it) {
7437 if (it == undefined) throw TypeError("Can't call method on " + it);
7444 /***/ (function(module, exports) {
7447 var ceil = Math.ceil;
7448 var floor = Math.floor;
7449 module.exports = function (it) {
7450 return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
7456 /***/ (function(module, exports, __webpack_require__) {
7458 var shared = __webpack_require__(70)('keys');
7459 var uid = __webpack_require__(47);
7460 module.exports = function (key) {
7461 return shared[key] || (shared[key] = uid(key));
7467 /***/ (function(module, exports, __webpack_require__) {
7469 // 7.1.13 ToObject(argument)
7470 var defined = __webpack_require__(51);
7471 module.exports = function (it) {
7472 return Object(defined(it));
7478 /***/ (function(module, exports, __webpack_require__) {
7482 // 25.4.1.5 NewPromiseCapability(C)
7483 var aFunction = __webpack_require__(38);
7485 function PromiseCapability(C) {
7486 var resolve, reject;
7487 this.promise = new C(function ($$resolve, $$reject) {
7488 if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
7489 resolve = $$resolve;
7492 this.resolve = aFunction(resolve);
7493 this.reject = aFunction(reject);
7496 module.exports.f = function (C) {
7497 return new PromiseCapability(C);
7503 /***/ (function(module, exports, __webpack_require__) {
7506 /* WEBPACK VAR INJECTION */(function(Buffer) {
7507 var inherits = __webpack_require__(1)
7508 var HashBase = __webpack_require__(94)
7510 var ARRAY16 = new Array(16)
7513 HashBase.call(this, 64)
7516 this._a = 0x67452301
7517 this._b = 0xefcdab89
7518 this._c = 0x98badcfe
7519 this._d = 0x10325476
7522 inherits(MD5, HashBase)
7524 MD5.prototype._update = function () {
7526 for (var i = 0; i < 16; ++i) M[i] = this._block.readInt32LE(i * 4)
7533 a = fnF(a, b, c, d, M[0], 0xd76aa478, 7)
7534 d = fnF(d, a, b, c, M[1], 0xe8c7b756, 12)
7535 c = fnF(c, d, a, b, M[2], 0x242070db, 17)
7536 b = fnF(b, c, d, a, M[3], 0xc1bdceee, 22)
7537 a = fnF(a, b, c, d, M[4], 0xf57c0faf, 7)
7538 d = fnF(d, a, b, c, M[5], 0x4787c62a, 12)
7539 c = fnF(c, d, a, b, M[6], 0xa8304613, 17)
7540 b = fnF(b, c, d, a, M[7], 0xfd469501, 22)
7541 a = fnF(a, b, c, d, M[8], 0x698098d8, 7)
7542 d = fnF(d, a, b, c, M[9], 0x8b44f7af, 12)
7543 c = fnF(c, d, a, b, M[10], 0xffff5bb1, 17)
7544 b = fnF(b, c, d, a, M[11], 0x895cd7be, 22)
7545 a = fnF(a, b, c, d, M[12], 0x6b901122, 7)
7546 d = fnF(d, a, b, c, M[13], 0xfd987193, 12)
7547 c = fnF(c, d, a, b, M[14], 0xa679438e, 17)
7548 b = fnF(b, c, d, a, M[15], 0x49b40821, 22)
7550 a = fnG(a, b, c, d, M[1], 0xf61e2562, 5)
7551 d = fnG(d, a, b, c, M[6], 0xc040b340, 9)
7552 c = fnG(c, d, a, b, M[11], 0x265e5a51, 14)
7553 b = fnG(b, c, d, a, M[0], 0xe9b6c7aa, 20)
7554 a = fnG(a, b, c, d, M[5], 0xd62f105d, 5)
7555 d = fnG(d, a, b, c, M[10], 0x02441453, 9)
7556 c = fnG(c, d, a, b, M[15], 0xd8a1e681, 14)
7557 b = fnG(b, c, d, a, M[4], 0xe7d3fbc8, 20)
7558 a = fnG(a, b, c, d, M[9], 0x21e1cde6, 5)
7559 d = fnG(d, a, b, c, M[14], 0xc33707d6, 9)
7560 c = fnG(c, d, a, b, M[3], 0xf4d50d87, 14)
7561 b = fnG(b, c, d, a, M[8], 0x455a14ed, 20)
7562 a = fnG(a, b, c, d, M[13], 0xa9e3e905, 5)
7563 d = fnG(d, a, b, c, M[2], 0xfcefa3f8, 9)
7564 c = fnG(c, d, a, b, M[7], 0x676f02d9, 14)
7565 b = fnG(b, c, d, a, M[12], 0x8d2a4c8a, 20)
7567 a = fnH(a, b, c, d, M[5], 0xfffa3942, 4)
7568 d = fnH(d, a, b, c, M[8], 0x8771f681, 11)
7569 c = fnH(c, d, a, b, M[11], 0x6d9d6122, 16)
7570 b = fnH(b, c, d, a, M[14], 0xfde5380c, 23)
7571 a = fnH(a, b, c, d, M[1], 0xa4beea44, 4)
7572 d = fnH(d, a, b, c, M[4], 0x4bdecfa9, 11)
7573 c = fnH(c, d, a, b, M[7], 0xf6bb4b60, 16)
7574 b = fnH(b, c, d, a, M[10], 0xbebfbc70, 23)
7575 a = fnH(a, b, c, d, M[13], 0x289b7ec6, 4)
7576 d = fnH(d, a, b, c, M[0], 0xeaa127fa, 11)
7577 c = fnH(c, d, a, b, M[3], 0xd4ef3085, 16)
7578 b = fnH(b, c, d, a, M[6], 0x04881d05, 23)
7579 a = fnH(a, b, c, d, M[9], 0xd9d4d039, 4)
7580 d = fnH(d, a, b, c, M[12], 0xe6db99e5, 11)
7581 c = fnH(c, d, a, b, M[15], 0x1fa27cf8, 16)
7582 b = fnH(b, c, d, a, M[2], 0xc4ac5665, 23)
7584 a = fnI(a, b, c, d, M[0], 0xf4292244, 6)
7585 d = fnI(d, a, b, c, M[7], 0x432aff97, 10)
7586 c = fnI(c, d, a, b, M[14], 0xab9423a7, 15)
7587 b = fnI(b, c, d, a, M[5], 0xfc93a039, 21)
7588 a = fnI(a, b, c, d, M[12], 0x655b59c3, 6)
7589 d = fnI(d, a, b, c, M[3], 0x8f0ccc92, 10)
7590 c = fnI(c, d, a, b, M[10], 0xffeff47d, 15)
7591 b = fnI(b, c, d, a, M[1], 0x85845dd1, 21)
7592 a = fnI(a, b, c, d, M[8], 0x6fa87e4f, 6)
7593 d = fnI(d, a, b, c, M[15], 0xfe2ce6e0, 10)
7594 c = fnI(c, d, a, b, M[6], 0xa3014314, 15)
7595 b = fnI(b, c, d, a, M[13], 0x4e0811a1, 21)
7596 a = fnI(a, b, c, d, M[4], 0xf7537e82, 6)
7597 d = fnI(d, a, b, c, M[11], 0xbd3af235, 10)
7598 c = fnI(c, d, a, b, M[2], 0x2ad7d2bb, 15)
7599 b = fnI(b, c, d, a, M[9], 0xeb86d391, 21)
7601 this._a = (this._a + a) | 0
7602 this._b = (this._b + b) | 0
7603 this._c = (this._c + c) | 0
7604 this._d = (this._d + d) | 0
7607 MD5.prototype._digest = function () {
7608 // create padding and handle blocks
7609 this._block[this._blockOffset++] = 0x80
7610 if (this._blockOffset > 56) {
7611 this._block.fill(0, this._blockOffset, 64)
7613 this._blockOffset = 0
7616 this._block.fill(0, this._blockOffset, 56)
7617 this._block.writeUInt32LE(this._length[0], 56)
7618 this._block.writeUInt32LE(this._length[1], 60)
7622 var buffer = new Buffer(16)
7623 buffer.writeInt32LE(this._a, 0)
7624 buffer.writeInt32LE(this._b, 4)
7625 buffer.writeInt32LE(this._c, 8)
7626 buffer.writeInt32LE(this._d, 12)
7630 function rotl (x, n) {
7631 return (x << n) | (x >>> (32 - n))
7634 function fnF (a, b, c, d, m, k, s) {
7635 return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + b) | 0
7638 function fnG (a, b, c, d, m, k, s) {
7639 return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + b) | 0
7642 function fnH (a, b, c, d, m, k, s) {
7643 return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + b) | 0
7646 function fnI (a, b, c, d, m, k, s) {
7647 return (rotl((a + ((c ^ (b | (~d)))) + m + k) | 0, s) + b) | 0
7650 module.exports = MD5
7652 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
7656 /***/ (function(module, exports, __webpack_require__) {
7658 // Copyright Joyent, Inc. and other Node contributors.
7660 // Permission is hereby granted, free of charge, to any person obtaining a
7661 // copy of this software and associated documentation files (the
7662 // "Software"), to deal in the Software without restriction, including
7663 // without limitation the rights to use, copy, modify, merge, publish,
7664 // distribute, sublicense, and/or sell copies of the Software, and to permit
7665 // persons to whom the Software is furnished to do so, subject to the
7666 // following conditions:
7668 // The above copyright notice and this permission notice shall be included
7669 // in all copies or substantial portions of the Software.
7671 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
7672 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
7673 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
7674 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
7675 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
7676 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
7677 // USE OR OTHER DEALINGS IN THE SOFTWARE.
7679 module.exports = Stream;
7681 var EE = __webpack_require__(58).EventEmitter;
7682 var inherits = __webpack_require__(1);
7684 inherits(Stream, EE);
7685 Stream.Readable = __webpack_require__(59);
7686 Stream.Writable = __webpack_require__(188);
7687 Stream.Duplex = __webpack_require__(189);
7688 Stream.Transform = __webpack_require__(190);
7689 Stream.PassThrough = __webpack_require__(191);
7691 // Backwards-compat with node 0.4.x
7692 Stream.Stream = Stream;
7696 // old-style streams. Note that the pipe method (the only relevant
7697 // part of this class) is overridden in the Readable class.
7703 Stream.prototype.pipe = function(dest, options) {
7706 function ondata(chunk) {
7707 if (dest.writable) {
7708 if (false === dest.write(chunk) && source.pause) {
7714 source.on('data', ondata);
7716 function ondrain() {
7717 if (source.readable && source.resume) {
7722 dest.on('drain', ondrain);
7724 // If the 'end' option is not supplied, dest.end() will be called when
7725 // source gets the 'end' or 'close' events. Only dest.end() once.
7726 if (!dest._isStdio && (!options || options.end !== false)) {
7727 source.on('end', onend);
7728 source.on('close', onclose);
7731 var didOnEnd = false;
7733 if (didOnEnd) return;
7740 function onclose() {
7741 if (didOnEnd) return;
7744 if (typeof dest.destroy === 'function') dest.destroy();
7747 // don't leave dangling pipes when there are errors.
7748 function onerror(er) {
7750 if (EE.listenerCount(this, 'error') === 0) {
7751 throw er; // Unhandled stream error in pipe.
7755 source.on('error', onerror);
7756 dest.on('error', onerror);
7758 // remove all the event listeners that were added.
7759 function cleanup() {
7760 source.removeListener('data', ondata);
7761 dest.removeListener('drain', ondrain);
7763 source.removeListener('end', onend);
7764 source.removeListener('close', onclose);
7766 source.removeListener('error', onerror);
7767 dest.removeListener('error', onerror);
7769 source.removeListener('end', cleanup);
7770 source.removeListener('close', cleanup);
7772 dest.removeListener('close', cleanup);
7775 source.on('end', cleanup);
7776 source.on('close', cleanup);
7778 dest.on('close', cleanup);
7780 dest.emit('pipe', source);
7782 // Allow for unix-like usage: A.pipe(B).pipe(C)
7789 /***/ (function(module, exports) {
7791 // Copyright Joyent, Inc. and other Node contributors.
7793 // Permission is hereby granted, free of charge, to any person obtaining a
7794 // copy of this software and associated documentation files (the
7795 // "Software"), to deal in the Software without restriction, including
7796 // without limitation the rights to use, copy, modify, merge, publish,
7797 // distribute, sublicense, and/or sell copies of the Software, and to permit
7798 // persons to whom the Software is furnished to do so, subject to the
7799 // following conditions:
7801 // The above copyright notice and this permission notice shall be included
7802 // in all copies or substantial portions of the Software.
7804 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
7805 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
7806 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
7807 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
7808 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
7809 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
7810 // USE OR OTHER DEALINGS IN THE SOFTWARE.
7812 function EventEmitter() {
7813 this._events = this._events || {};
7814 this._maxListeners = this._maxListeners || undefined;
7816 module.exports = EventEmitter;
7818 // Backwards-compat with node 0.10.x
7819 EventEmitter.EventEmitter = EventEmitter;
7821 EventEmitter.prototype._events = undefined;
7822 EventEmitter.prototype._maxListeners = undefined;
7824 // By default EventEmitters will print a warning if more than 10 listeners are
7825 // added to it. This is a useful default which helps finding memory leaks.
7826 EventEmitter.defaultMaxListeners = 10;
7828 // Obviously not all Emitters should be limited to 10. This function allows
7829 // that to be increased. Set to zero for unlimited.
7830 EventEmitter.prototype.setMaxListeners = function(n) {
7831 if (!isNumber(n) || n < 0 || isNaN(n))
7832 throw TypeError('n must be a positive number');
7833 this._maxListeners = n;
7837 EventEmitter.prototype.emit = function(type) {
7838 var er, handler, len, args, i, listeners;
7843 // If there is no 'error' event listener then throw.
7844 if (type === 'error') {
7845 if (!this._events.error ||
7846 (isObject(this._events.error) && !this._events.error.length)) {
7848 if (er instanceof Error) {
7849 throw er; // Unhandled 'error' event
7851 // At least give some kind of context to the user
7852 var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
7859 handler = this._events[type];
7861 if (isUndefined(handler))
7864 if (isFunction(handler)) {
7865 switch (arguments.length) {
7871 handler.call(this, arguments[1]);
7874 handler.call(this, arguments[1], arguments[2]);
7878 args = Array.prototype.slice.call(arguments, 1);
7879 handler.apply(this, args);
7881 } else if (isObject(handler)) {
7882 args = Array.prototype.slice.call(arguments, 1);
7883 listeners = handler.slice();
7884 len = listeners.length;
7885 for (i = 0; i < len; i++)
7886 listeners[i].apply(this, args);
7892 EventEmitter.prototype.addListener = function(type, listener) {
7895 if (!isFunction(listener))
7896 throw TypeError('listener must be a function');
7901 // To avoid recursion in the case that type === "newListener"! Before
7902 // adding it to the listeners, first emit "newListener".
7903 if (this._events.newListener)
7904 this.emit('newListener', type,
7905 isFunction(listener.listener) ?
7906 listener.listener : listener);
7908 if (!this._events[type])
7909 // Optimize the case of one listener. Don't need the extra array object.
7910 this._events[type] = listener;
7911 else if (isObject(this._events[type]))
7912 // If we've already got an array, just append.
7913 this._events[type].push(listener);
7915 // Adding the second element, need to change to array.
7916 this._events[type] = [this._events[type], listener];
7918 // Check for listener leak
7919 if (isObject(this._events[type]) && !this._events[type].warned) {
7920 if (!isUndefined(this._maxListeners)) {
7921 m = this._maxListeners;
7923 m = EventEmitter.defaultMaxListeners;
7926 if (m && m > 0 && this._events[type].length > m) {
7927 this._events[type].warned = true;
7928 console.error('(node) warning: possible EventEmitter memory ' +
7929 'leak detected. %d listeners added. ' +
7930 'Use emitter.setMaxListeners() to increase limit.',
7931 this._events[type].length);
7932 if (typeof console.trace === 'function') {
7933 // not supported in IE 10
7942 EventEmitter.prototype.on = EventEmitter.prototype.addListener;
7944 EventEmitter.prototype.once = function(type, listener) {
7945 if (!isFunction(listener))
7946 throw TypeError('listener must be a function');
7951 this.removeListener(type, g);
7955 listener.apply(this, arguments);
7959 g.listener = listener;
7965 // emits a 'removeListener' event iff the listener was removed
7966 EventEmitter.prototype.removeListener = function(type, listener) {
7967 var list, position, length, i;
7969 if (!isFunction(listener))
7970 throw TypeError('listener must be a function');
7972 if (!this._events || !this._events[type])
7975 list = this._events[type];
7976 length = list.length;
7979 if (list === listener ||
7980 (isFunction(list.listener) && list.listener === listener)) {
7981 delete this._events[type];
7982 if (this._events.removeListener)
7983 this.emit('removeListener', type, listener);
7985 } else if (isObject(list)) {
7986 for (i = length; i-- > 0;) {
7987 if (list[i] === listener ||
7988 (list[i].listener && list[i].listener === listener)) {
7997 if (list.length === 1) {
7999 delete this._events[type];
8001 list.splice(position, 1);
8004 if (this._events.removeListener)
8005 this.emit('removeListener', type, listener);
8011 EventEmitter.prototype.removeAllListeners = function(type) {
8017 // not listening for removeListener, no need to emit
8018 if (!this._events.removeListener) {
8019 if (arguments.length === 0)
8021 else if (this._events[type])
8022 delete this._events[type];
8026 // emit removeListener for all listeners on all events
8027 if (arguments.length === 0) {
8028 for (key in this._events) {
8029 if (key === 'removeListener') continue;
8030 this.removeAllListeners(key);
8032 this.removeAllListeners('removeListener');
8037 listeners = this._events[type];
8039 if (isFunction(listeners)) {
8040 this.removeListener(type, listeners);
8041 } else if (listeners) {
8043 while (listeners.length)
8044 this.removeListener(type, listeners[listeners.length - 1]);
8046 delete this._events[type];
8051 EventEmitter.prototype.listeners = function(type) {
8053 if (!this._events || !this._events[type])
8055 else if (isFunction(this._events[type]))
8056 ret = [this._events[type]];
8058 ret = this._events[type].slice();
8062 EventEmitter.prototype.listenerCount = function(type) {
8064 var evlistener = this._events[type];
8066 if (isFunction(evlistener))
8068 else if (evlistener)
8069 return evlistener.length;
8074 EventEmitter.listenerCount = function(emitter, type) {
8075 return emitter.listenerCount(type);
8078 function isFunction(arg) {
8079 return typeof arg === 'function';
8082 function isNumber(arg) {
8083 return typeof arg === 'number';
8086 function isObject(arg) {
8087 return typeof arg === 'object' && arg !== null;
8090 function isUndefined(arg) {
8091 return arg === void 0;
8097 /***/ (function(module, exports, __webpack_require__) {
8099 exports = module.exports = __webpack_require__(95);
8100 exports.Stream = exports;
8101 exports.Readable = exports;
8102 exports.Writable = __webpack_require__(60);
8103 exports.Duplex = __webpack_require__(21);
8104 exports.Transform = __webpack_require__(98);
8105 exports.PassThrough = __webpack_require__(187);
8110 /***/ (function(module, exports, __webpack_require__) {
8113 /* WEBPACK VAR INJECTION */(function(process, setImmediate, global) {// Copyright Joyent, Inc. and other Node contributors.
8115 // Permission is hereby granted, free of charge, to any person obtaining a
8116 // copy of this software and associated documentation files (the
8117 // "Software"), to deal in the Software without restriction, including
8118 // without limitation the rights to use, copy, modify, merge, publish,
8119 // distribute, sublicense, and/or sell copies of the Software, and to permit
8120 // persons to whom the Software is furnished to do so, subject to the
8121 // following conditions:
8123 // The above copyright notice and this permission notice shall be included
8124 // in all copies or substantial portions of the Software.
8126 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8127 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
8128 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
8129 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
8130 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
8131 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8132 // USE OR OTHER DEALINGS IN THE SOFTWARE.
8134 // A bit simpler than readable streams.
8135 // Implement an async ._write(chunk, encoding, cb), and it'll handle all
8136 // the drain event emission and buffering.
8142 var pna = __webpack_require__(42);
8145 module.exports = Writable;
8148 function WriteReq(chunk, encoding, cb) {
8150 this.encoding = encoding;
8155 // It seems a linked list but it is not
8156 // there will be only 2 of these for each stream
8157 function CorkedRequest(state) {
8162 this.finish = function () {
8163 onCorkedFinish(_this, state);
8166 /* </replacement> */
8169 var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
8176 Writable.WritableState = WritableState;
8179 var util = __webpack_require__(30);
8180 util.inherits = __webpack_require__(1);
8184 var internalUtil = {
8185 deprecate: __webpack_require__(186)
8190 var Stream = __webpack_require__(96);
8195 var Buffer = __webpack_require__(2).Buffer;
8196 var OurUint8Array = global.Uint8Array || function () {};
8197 function _uint8ArrayToBuffer(chunk) {
8198 return Buffer.from(chunk);
8200 function _isUint8Array(obj) {
8201 return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
8206 var destroyImpl = __webpack_require__(97);
8208 util.inherits(Writable, Stream);
8212 function WritableState(options, stream) {
8213 Duplex = Duplex || __webpack_require__(21);
8215 options = options || {};
8217 // Duplex streams are both readable and writable, but share
8218 // the same options object.
8219 // However, some cases require setting options to different
8220 // values for the readable and the writable sides of the duplex stream.
8221 // These options can be provided separately as readableXXX and writableXXX.
8222 var isDuplex = stream instanceof Duplex;
8224 // object stream flag to indicate whether or not this stream
8225 // contains buffers or objects.
8226 this.objectMode = !!options.objectMode;
8228 if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
8230 // the point at which write() starts returning false
8231 // Note: 0 is a valid value, means that we always return false if
8232 // the entire buffer is not flushed immediately on write()
8233 var hwm = options.highWaterMark;
8234 var writableHwm = options.writableHighWaterMark;
8235 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
8237 if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
8240 this.highWaterMark = Math.floor(this.highWaterMark);
8242 // if _final has been called
8243 this.finalCalled = false;
8245 // drain event flag.
8246 this.needDrain = false;
8247 // at the start of calling end()
8248 this.ending = false;
8249 // when end() has been called, and returned
8251 // when 'finish' is emitted
8252 this.finished = false;
8254 // has it been destroyed
8255 this.destroyed = false;
8257 // should we decode strings into buffers before passing to _write?
8258 // this is here so that some node-core streams can optimize string
8259 // handling at a lower level.
8260 var noDecode = options.decodeStrings === false;
8261 this.decodeStrings = !noDecode;
8263 // Crypto is kind of old and crusty. Historically, its default string
8264 // encoding is 'binary' so we have to make this configurable.
8265 // Everything else in the universe uses 'utf8', though.
8266 this.defaultEncoding = options.defaultEncoding || 'utf8';
8268 // not an actual buffer we keep track of, but a measurement
8269 // of how much we're waiting to get pushed to some underlying
8273 // a flag to see when we're in the middle of a write.
8274 this.writing = false;
8276 // when true all writes will be buffered until .uncork() call
8279 // a flag to be able to tell if the onwrite cb is called immediately,
8280 // or on a later tick. We set this to true at first, because any
8281 // actions that shouldn't happen until "later" should generally also
8282 // not happen before the first write call.
8285 // a flag to know if we're processing previously buffered items, which
8286 // may call the _write() callback in the same tick, so that we don't
8287 // end up in an overlapped onwrite situation.
8288 this.bufferProcessing = false;
8290 // the callback that's passed to _write(chunk,cb)
8291 this.onwrite = function (er) {
8292 onwrite(stream, er);
8295 // the callback that the user supplies to write(chunk,encoding,cb)
8296 this.writecb = null;
8298 // the amount that is being written when _write is called.
8301 this.bufferedRequest = null;
8302 this.lastBufferedRequest = null;
8304 // number of pending user-supplied write callbacks
8305 // this must be 0 before 'finish' can be emitted
8308 // emit prefinish if the only thing we're waiting for is _write cbs
8309 // This is relevant for synchronous Transform streams
8310 this.prefinished = false;
8312 // True if the error was already emitted and should not be thrown again
8313 this.errorEmitted = false;
8315 // count buffered requests
8316 this.bufferedRequestCount = 0;
8318 // allocate the first CorkedRequest, there is always
8319 // one allocated and free to use, and we maintain at most two
8320 this.corkedRequestsFree = new CorkedRequest(this);
8323 WritableState.prototype.getBuffer = function getBuffer() {
8324 var current = this.bufferedRequest;
8328 current = current.next;
8335 Object.defineProperty(WritableState.prototype, 'buffer', {
8336 get: internalUtil.deprecate(function () {
8337 return this.getBuffer();
8338 }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
8343 // Test _writableState for inheritance to account for Duplex streams,
8344 // whose prototype chain only points to Readable.
8345 var realHasInstance;
8346 if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
8347 realHasInstance = Function.prototype[Symbol.hasInstance];
8348 Object.defineProperty(Writable, Symbol.hasInstance, {
8349 value: function (object) {
8350 if (realHasInstance.call(this, object)) return true;
8351 if (this !== Writable) return false;
8353 return object && object._writableState instanceof WritableState;
8357 realHasInstance = function (object) {
8358 return object instanceof this;
8362 function Writable(options) {
8363 Duplex = Duplex || __webpack_require__(21);
8365 // Writable ctor is applied to Duplexes, too.
8366 // `realHasInstance` is necessary because using plain `instanceof`
8367 // would return false, as no `_writableState` property is attached.
8369 // Trying to use the custom `instanceof` for Writable here will also break the
8370 // Node.js LazyTransform implementation, which has a non-trivial getter for
8371 // `_writableState` that would lead to infinite recursion.
8372 if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
8373 return new Writable(options);
8376 this._writableState = new WritableState(options, this);
8379 this.writable = true;
8382 if (typeof options.write === 'function') this._write = options.write;
8384 if (typeof options.writev === 'function') this._writev = options.writev;
8386 if (typeof options.destroy === 'function') this._destroy = options.destroy;
8388 if (typeof options.final === 'function') this._final = options.final;
8394 // Otherwise people can pipe Writable streams, which is just wrong.
8395 Writable.prototype.pipe = function () {
8396 this.emit('error', new Error('Cannot pipe, not readable'));
8399 function writeAfterEnd(stream, cb) {
8400 var er = new Error('write after end');
8401 // TODO: defer error events consistently everywhere, not just the cb
8402 stream.emit('error', er);
8403 pna.nextTick(cb, er);
8406 // Checks that a user-supplied chunk is valid, especially for the particular
8407 // mode the stream is in. Currently this means that `null` is never accepted
8408 // and undefined/non-string values are only allowed in object mode.
8409 function validChunk(stream, state, chunk, cb) {
8413 if (chunk === null) {
8414 er = new TypeError('May not write null values to stream');
8415 } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
8416 er = new TypeError('Invalid non-string/buffer chunk');
8419 stream.emit('error', er);
8420 pna.nextTick(cb, er);
8426 Writable.prototype.write = function (chunk, encoding, cb) {
8427 var state = this._writableState;
8429 var isBuf = !state.objectMode && _isUint8Array(chunk);
8431 if (isBuf && !Buffer.isBuffer(chunk)) {
8432 chunk = _uint8ArrayToBuffer(chunk);
8435 if (typeof encoding === 'function') {
8440 if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
8442 if (typeof cb !== 'function') cb = nop;
8444 if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
8446 ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
8452 Writable.prototype.cork = function () {
8453 var state = this._writableState;
8458 Writable.prototype.uncork = function () {
8459 var state = this._writableState;
8464 if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
8468 Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
8469 // node::ParseEncoding() requires lower case.
8470 if (typeof encoding === 'string') encoding = encoding.toLowerCase();
8471 if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
8472 this._writableState.defaultEncoding = encoding;
8476 function decodeChunk(state, chunk, encoding) {
8477 if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
8478 chunk = Buffer.from(chunk, encoding);
8483 Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
8484 // making it explicit this property is not enumerable
8485 // because otherwise some prototype manipulation in
8486 // userland will fail
8489 return this._writableState.highWaterMark;
8493 // if we're already writing something, then just put this
8494 // in the queue, and wait our turn. Otherwise, call _write
8495 // If we return false, then we need a drain event, so set that flag.
8496 function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
8498 var newChunk = decodeChunk(state, chunk, encoding);
8499 if (chunk !== newChunk) {
8501 encoding = 'buffer';
8505 var len = state.objectMode ? 1 : chunk.length;
8507 state.length += len;
8509 var ret = state.length < state.highWaterMark;
8510 // we must ensure that previous needDrain will not be reset to false.
8511 if (!ret) state.needDrain = true;
8513 if (state.writing || state.corked) {
8514 var last = state.lastBufferedRequest;
8515 state.lastBufferedRequest = {
8523 last.next = state.lastBufferedRequest;
8525 state.bufferedRequest = state.lastBufferedRequest;
8527 state.bufferedRequestCount += 1;
8529 doWrite(stream, state, false, len, chunk, encoding, cb);
8535 function doWrite(stream, state, writev, len, chunk, encoding, cb) {
8536 state.writelen = len;
8538 state.writing = true;
8540 if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
8544 function onwriteError(stream, state, sync, er, cb) {
8548 // defer the callback if we are being called synchronously
8549 // to avoid piling up things on the stack
8550 pna.nextTick(cb, er);
8551 // this can emit finish, and it will always happen
8553 pna.nextTick(finishMaybe, stream, state);
8554 stream._writableState.errorEmitted = true;
8555 stream.emit('error', er);
8557 // the caller expect this to happen before if
8560 stream._writableState.errorEmitted = true;
8561 stream.emit('error', er);
8562 // this can emit finish, but finish must
8563 // always follow error
8564 finishMaybe(stream, state);
8568 function onwriteStateUpdate(state) {
8569 state.writing = false;
8570 state.writecb = null;
8571 state.length -= state.writelen;
8575 function onwrite(stream, er) {
8576 var state = stream._writableState;
8577 var sync = state.sync;
8578 var cb = state.writecb;
8580 onwriteStateUpdate(state);
8582 if (er) onwriteError(stream, state, sync, er, cb);else {
8583 // Check if we're actually ready to finish, but don't emit yet
8584 var finished = needFinish(state);
8586 if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
8587 clearBuffer(stream, state);
8592 asyncWrite(afterWrite, stream, state, finished, cb);
8595 afterWrite(stream, state, finished, cb);
8600 function afterWrite(stream, state, finished, cb) {
8601 if (!finished) onwriteDrain(stream, state);
8604 finishMaybe(stream, state);
8607 // Must force callback to be called on nextTick, so that we don't
8608 // emit 'drain' before the write() consumer gets the 'false' return
8609 // value, and has a chance to attach a 'drain' listener.
8610 function onwriteDrain(stream, state) {
8611 if (state.length === 0 && state.needDrain) {
8612 state.needDrain = false;
8613 stream.emit('drain');
8617 // if there's something in the buffer waiting, then process it
8618 function clearBuffer(stream, state) {
8619 state.bufferProcessing = true;
8620 var entry = state.bufferedRequest;
8622 if (stream._writev && entry && entry.next) {
8623 // Fast case, write everything using _writev()
8624 var l = state.bufferedRequestCount;
8625 var buffer = new Array(l);
8626 var holder = state.corkedRequestsFree;
8627 holder.entry = entry;
8630 var allBuffers = true;
8632 buffer[count] = entry;
8633 if (!entry.isBuf) allBuffers = false;
8637 buffer.allBuffers = allBuffers;
8639 doWrite(stream, state, true, state.length, buffer, '', holder.finish);
8641 // doWrite is almost always async, defer these to save a bit of time
8642 // as the hot path ends with doWrite
8644 state.lastBufferedRequest = null;
8646 state.corkedRequestsFree = holder.next;
8649 state.corkedRequestsFree = new CorkedRequest(state);
8651 state.bufferedRequestCount = 0;
8653 // Slow case, write chunks one-by-one
8655 var chunk = entry.chunk;
8656 var encoding = entry.encoding;
8657 var cb = entry.callback;
8658 var len = state.objectMode ? 1 : chunk.length;
8660 doWrite(stream, state, false, len, chunk, encoding, cb);
8662 state.bufferedRequestCount--;
8663 // if we didn't call the onwrite immediately, then
8664 // it means that we need to wait until it does.
8665 // also, that means that the chunk and cb are currently
8666 // being processed, so move the buffer counter past them.
8667 if (state.writing) {
8672 if (entry === null) state.lastBufferedRequest = null;
8675 state.bufferedRequest = entry;
8676 state.bufferProcessing = false;
8679 Writable.prototype._write = function (chunk, encoding, cb) {
8680 cb(new Error('_write() is not implemented'));
8683 Writable.prototype._writev = null;
8685 Writable.prototype.end = function (chunk, encoding, cb) {
8686 var state = this._writableState;
8688 if (typeof chunk === 'function') {
8692 } else if (typeof encoding === 'function') {
8697 if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
8699 // .end() fully uncorks
8705 // ignore unnecessary end() calls.
8706 if (!state.ending && !state.finished) endWritable(this, state, cb);
8709 function needFinish(state) {
8710 return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
8712 function callFinal(stream, state) {
8713 stream._final(function (err) {
8716 stream.emit('error', err);
8718 state.prefinished = true;
8719 stream.emit('prefinish');
8720 finishMaybe(stream, state);
8723 function prefinish(stream, state) {
8724 if (!state.prefinished && !state.finalCalled) {
8725 if (typeof stream._final === 'function') {
8727 state.finalCalled = true;
8728 pna.nextTick(callFinal, stream, state);
8730 state.prefinished = true;
8731 stream.emit('prefinish');
8736 function finishMaybe(stream, state) {
8737 var need = needFinish(state);
8739 prefinish(stream, state);
8740 if (state.pendingcb === 0) {
8741 state.finished = true;
8742 stream.emit('finish');
8748 function endWritable(stream, state, cb) {
8749 state.ending = true;
8750 finishMaybe(stream, state);
8752 if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
8755 stream.writable = false;
8758 function onCorkedFinish(corkReq, state, err) {
8759 var entry = corkReq.entry;
8760 corkReq.entry = null;
8762 var cb = entry.callback;
8767 if (state.corkedRequestsFree) {
8768 state.corkedRequestsFree.next = corkReq;
8770 state.corkedRequestsFree = corkReq;
8774 Object.defineProperty(Writable.prototype, 'destroyed', {
8776 if (this._writableState === undefined) {
8779 return this._writableState.destroyed;
8781 set: function (value) {
8782 // we ignore the value if the stream
8783 // has not been initialized yet
8784 if (!this._writableState) {
8788 // backward compatibility, the user is explicitly
8789 // managing destroyed
8790 this._writableState.destroyed = value;
8794 Writable.prototype.destroy = destroyImpl.destroy;
8795 Writable.prototype._undestroy = destroyImpl.undestroy;
8796 Writable.prototype._destroy = function (err, cb) {
8800 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(14), __webpack_require__(140).setImmediate, __webpack_require__(10)))
8804 /***/ (function(module, exports, __webpack_require__) {
8807 // Copyright Joyent, Inc. and other Node contributors.
8809 // Permission is hereby granted, free of charge, to any person obtaining a
8810 // copy of this software and associated documentation files (the
8811 // "Software"), to deal in the Software without restriction, including
8812 // without limitation the rights to use, copy, modify, merge, publish,
8813 // distribute, sublicense, and/or sell copies of the Software, and to permit
8814 // persons to whom the Software is furnished to do so, subject to the
8815 // following conditions:
8817 // The above copyright notice and this permission notice shall be included
8818 // in all copies or substantial portions of the Software.
8820 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8821 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
8822 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
8823 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
8824 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
8825 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8826 // USE OR OTHER DEALINGS IN THE SOFTWARE.
8832 var Buffer = __webpack_require__(2).Buffer;
8835 var isEncoding = Buffer.isEncoding || function (encoding) {
8836 encoding = '' + encoding;
8837 switch (encoding && encoding.toLowerCase()) {
8838 case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
8845 function _normalizeEncoding(enc) {
8846 if (!enc) return 'utf8';
8866 if (retried) return; // undefined
8867 enc = ('' + enc).toLowerCase();
8873 // Do not cache `Buffer.isEncoding` when checking encoding names as some
8874 // modules monkey-patch it to support additional encodings
8875 function normalizeEncoding(enc) {
8876 var nenc = _normalizeEncoding(enc);
8877 if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
8881 // StringDecoder provides an interface for efficiently splitting a series of
8882 // buffers into a series of JS strings without breaking apart multi-byte
8884 exports.StringDecoder = StringDecoder;
8885 function StringDecoder(encoding) {
8886 this.encoding = normalizeEncoding(encoding);
8888 switch (this.encoding) {
8890 this.text = utf16Text;
8891 this.end = utf16End;
8895 this.fillLast = utf8FillLast;
8899 this.text = base64Text;
8900 this.end = base64End;
8904 this.write = simpleWrite;
8905 this.end = simpleEnd;
8910 this.lastChar = Buffer.allocUnsafe(nb);
8913 StringDecoder.prototype.write = function (buf) {
8914 if (buf.length === 0) return '';
8917 if (this.lastNeed) {
8918 r = this.fillLast(buf);
8919 if (r === undefined) return '';
8925 if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
8929 StringDecoder.prototype.end = utf8End;
8931 // Returns only complete characters in a Buffer
8932 StringDecoder.prototype.text = utf8Text;
8934 // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
8935 StringDecoder.prototype.fillLast = function (buf) {
8936 if (this.lastNeed <= buf.length) {
8937 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
8938 return this.lastChar.toString(this.encoding, 0, this.lastTotal);
8940 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
8941 this.lastNeed -= buf.length;
8944 // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
8945 // continuation byte. If an invalid byte is detected, -2 is returned.
8946 function utf8CheckByte(byte) {
8947 if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
8948 return byte >> 6 === 0x02 ? -1 : -2;
8951 // Checks at most 3 bytes at the end of a Buffer in order to detect an
8952 // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
8953 // needed to complete the UTF-8 character (if applicable) are returned.
8954 function utf8CheckIncomplete(self, buf, i) {
8955 var j = buf.length - 1;
8956 if (j < i) return 0;
8957 var nb = utf8CheckByte(buf[j]);
8959 if (nb > 0) self.lastNeed = nb - 1;
8962 if (--j < i || nb === -2) return 0;
8963 nb = utf8CheckByte(buf[j]);
8965 if (nb > 0) self.lastNeed = nb - 2;
8968 if (--j < i || nb === -2) return 0;
8969 nb = utf8CheckByte(buf[j]);
8972 if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
8979 // Validates as many continuation bytes for a multi-byte UTF-8 character as
8980 // needed or are available. If we see a non-continuation byte where we expect
8981 // one, we "replace" the validated continuation bytes we've seen so far with
8982 // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
8983 // behavior. The continuation byte check is included three times in the case
8984 // where all of the continuation bytes for a character exist in the same buffer.
8985 // It is also done this way as a slight performance increase instead of using a
8987 function utf8CheckExtraBytes(self, buf, p) {
8988 if ((buf[0] & 0xC0) !== 0x80) {
8992 if (self.lastNeed > 1 && buf.length > 1) {
8993 if ((buf[1] & 0xC0) !== 0x80) {
8997 if (self.lastNeed > 2 && buf.length > 2) {
8998 if ((buf[2] & 0xC0) !== 0x80) {
9006 // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
9007 function utf8FillLast(buf) {
9008 var p = this.lastTotal - this.lastNeed;
9009 var r = utf8CheckExtraBytes(this, buf, p);
9010 if (r !== undefined) return r;
9011 if (this.lastNeed <= buf.length) {
9012 buf.copy(this.lastChar, p, 0, this.lastNeed);
9013 return this.lastChar.toString(this.encoding, 0, this.lastTotal);
9015 buf.copy(this.lastChar, p, 0, buf.length);
9016 this.lastNeed -= buf.length;
9019 // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
9020 // partial character, the character's bytes are buffered until the required
9021 // number of bytes are available.
9022 function utf8Text(buf, i) {
9023 var total = utf8CheckIncomplete(this, buf, i);
9024 if (!this.lastNeed) return buf.toString('utf8', i);
9025 this.lastTotal = total;
9026 var end = buf.length - (total - this.lastNeed);
9027 buf.copy(this.lastChar, 0, end);
9028 return buf.toString('utf8', i, end);
9031 // For UTF-8, a replacement character is added when ending on a partial
9033 function utf8End(buf) {
9034 var r = buf && buf.length ? this.write(buf) : '';
9035 if (this.lastNeed) return r + '\ufffd';
9039 // UTF-16LE typically needs two bytes per character, but even if we have an even
9040 // number of bytes available, we need to check if we end on a leading/high
9041 // surrogate. In that case, we need to wait for the next two bytes in order to
9042 // decode the last character properly.
9043 function utf16Text(buf, i) {
9044 if ((buf.length - i) % 2 === 0) {
9045 var r = buf.toString('utf16le', i);
9047 var c = r.charCodeAt(r.length - 1);
9048 if (c >= 0xD800 && c <= 0xDBFF) {
9051 this.lastChar[0] = buf[buf.length - 2];
9052 this.lastChar[1] = buf[buf.length - 1];
9053 return r.slice(0, -1);
9060 this.lastChar[0] = buf[buf.length - 1];
9061 return buf.toString('utf16le', i, buf.length - 1);
9064 // For UTF-16LE we do not explicitly append special replacement characters if we
9065 // end on a partial character, we simply let v8 handle that.
9066 function utf16End(buf) {
9067 var r = buf && buf.length ? this.write(buf) : '';
9068 if (this.lastNeed) {
9069 var end = this.lastTotal - this.lastNeed;
9070 return r + this.lastChar.toString('utf16le', 0, end);
9075 function base64Text(buf, i) {
9076 var n = (buf.length - i) % 3;
9077 if (n === 0) return buf.toString('base64', i);
9078 this.lastNeed = 3 - n;
9081 this.lastChar[0] = buf[buf.length - 1];
9083 this.lastChar[0] = buf[buf.length - 2];
9084 this.lastChar[1] = buf[buf.length - 1];
9086 return buf.toString('base64', i, buf.length - n);
9089 function base64End(buf) {
9090 var r = buf && buf.length ? this.write(buf) : '';
9091 if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
9095 // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
9096 function simpleWrite(buf) {
9097 return buf.toString(this.encoding);
9100 function simpleEnd(buf) {
9101 return buf && buf.length ? this.write(buf) : '';
9106 /***/ (function(module, exports, __webpack_require__) {
9110 var Buffer = __webpack_require__(3).Buffer
9111 var inherits = __webpack_require__(1)
9112 var HashBase = __webpack_require__(94)
9114 var ARRAY16 = new Array(16)
9117 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
9118 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
9119 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
9120 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
9121 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
9125 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
9126 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
9127 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
9128 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
9129 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
9133 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
9134 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
9135 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
9136 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
9137 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
9141 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
9142 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
9143 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
9144 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
9145 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
9148 var hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]
9149 var hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]
9151 function RIPEMD160 () {
9152 HashBase.call(this, 64)
9155 this._a = 0x67452301
9156 this._b = 0xefcdab89
9157 this._c = 0x98badcfe
9158 this._d = 0x10325476
9159 this._e = 0xc3d2e1f0
9162 inherits(RIPEMD160, HashBase)
9164 RIPEMD160.prototype._update = function () {
9166 for (var j = 0; j < 16; ++j) words[j] = this._block.readInt32LE(j * 4)
9168 var al = this._a | 0
9169 var bl = this._b | 0
9170 var cl = this._c | 0
9171 var dl = this._d | 0
9172 var el = this._e | 0
9174 var ar = this._a | 0
9175 var br = this._b | 0
9176 var cr = this._c | 0
9177 var dr = this._d | 0
9178 var er = this._e | 0
9181 for (var i = 0; i < 80; i += 1) {
9185 tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i])
9186 tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i])
9187 } else if (i < 32) {
9188 tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i])
9189 tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i])
9190 } else if (i < 48) {
9191 tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i])
9192 tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i])
9193 } else if (i < 64) {
9194 tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i])
9195 tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i])
9196 } else { // if (i<80) {
9197 tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i])
9198 tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i])
9215 var t = (this._b + cl + dr) | 0
9216 this._b = (this._c + dl + er) | 0
9217 this._c = (this._d + el + ar) | 0
9218 this._d = (this._e + al + br) | 0
9219 this._e = (this._a + bl + cr) | 0
9223 RIPEMD160.prototype._digest = function () {
9224 // create padding and handle blocks
9225 this._block[this._blockOffset++] = 0x80
9226 if (this._blockOffset > 56) {
9227 this._block.fill(0, this._blockOffset, 64)
9229 this._blockOffset = 0
9232 this._block.fill(0, this._blockOffset, 56)
9233 this._block.writeUInt32LE(this._length[0], 56)
9234 this._block.writeUInt32LE(this._length[1], 60)
9238 var buffer = Buffer.alloc ? Buffer.alloc(20) : new Buffer(20)
9239 buffer.writeInt32LE(this._a, 0)
9240 buffer.writeInt32LE(this._b, 4)
9241 buffer.writeInt32LE(this._c, 8)
9242 buffer.writeInt32LE(this._d, 12)
9243 buffer.writeInt32LE(this._e, 16)
9247 function rotl (x, n) {
9248 return (x << n) | (x >>> (32 - n))
9251 function fn1 (a, b, c, d, e, m, k, s) {
9252 return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + e) | 0
9255 function fn2 (a, b, c, d, e, m, k, s) {
9256 return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + e) | 0
9259 function fn3 (a, b, c, d, e, m, k, s) {
9260 return (rotl((a + ((b | (~c)) ^ d) + m + k) | 0, s) + e) | 0
9263 function fn4 (a, b, c, d, e, m, k, s) {
9264 return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + e) | 0
9267 function fn5 (a, b, c, d, e, m, k, s) {
9268 return (rotl((a + (b ^ (c | (~d))) + m + k) | 0, s) + e) | 0
9271 module.exports = RIPEMD160
9276 /***/ (function(module, exports, __webpack_require__) {
9278 var exports = module.exports = function SHA (algorithm) {
9279 algorithm = algorithm.toLowerCase()
9281 var Algorithm = exports[algorithm]
9282 if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)')
9284 return new Algorithm()
9287 exports.sha = __webpack_require__(192)
9288 exports.sha1 = __webpack_require__(193)
9289 exports.sha224 = __webpack_require__(194)
9290 exports.sha256 = __webpack_require__(99)
9291 exports.sha384 = __webpack_require__(195)
9292 exports.sha512 = __webpack_require__(100)
9297 /***/ (function(module, exports, __webpack_require__) {
9302 exports.utils = __webpack_require__(201);
9303 exports.Cipher = __webpack_require__(202);
9304 exports.DES = __webpack_require__(203);
9305 exports.CBC = __webpack_require__(204);
9306 exports.EDE = __webpack_require__(205);
9311 /***/ (function(module, exports, __webpack_require__) {
9313 var ciphers = __webpack_require__(206)
9314 var deciphers = __webpack_require__(214)
9315 var modes = __webpack_require__(110)
9317 function getCiphers () {
9318 return Object.keys(modes)
9321 exports.createCipher = exports.Cipher = ciphers.createCipher
9322 exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv
9323 exports.createDecipher = exports.Decipher = deciphers.createDecipher
9324 exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv
9325 exports.listCiphers = exports.getCiphers = getCiphers
9330 /***/ (function(module, exports, __webpack_require__) {
9333 ECB: __webpack_require__(207),
9334 CBC: __webpack_require__(208),
9335 CFB: __webpack_require__(209),
9336 CFB8: __webpack_require__(210),
9337 CFB1: __webpack_require__(211),
9338 OFB: __webpack_require__(212),
9339 CTR: __webpack_require__(108),
9340 GCM: __webpack_require__(108)
9343 var modes = __webpack_require__(110)
9345 for (var key in modes) {
9346 modes[key].module = modeModules[modes[key].mode]
9349 module.exports = modes
9354 /***/ (function(module, exports, __webpack_require__) {
9356 /* WEBPACK VAR INJECTION */(function(Buffer) {var bn = __webpack_require__(4);
9357 var randomBytes = __webpack_require__(23);
9358 module.exports = crt;
9359 function blind(priv) {
9361 var blinder = r.toRed(bn.mont(priv.modulus))
9362 .redPow(new bn(priv.publicExponent)).fromRed();
9365 unblinder:r.invm(priv.modulus)
9368 function crt(msg, priv) {
9369 var blinds = blind(priv);
9370 var len = priv.modulus.byteLength();
9371 var mod = bn.mont(priv.modulus);
9372 var blinded = new bn(msg).mul(blinds.blinder).umod(priv.modulus);
9373 var c1 = blinded.toRed(bn.mont(priv.prime1));
9374 var c2 = blinded.toRed(bn.mont(priv.prime2));
9375 var qinv = priv.coefficient;
9376 var p = priv.prime1;
9377 var q = priv.prime2;
9378 var m1 = c1.redPow(priv.exponent1);
9379 var m2 = c2.redPow(priv.exponent2);
9382 var h = m1.isub(m2).imul(qinv).umod(p);
9385 return new Buffer(m2.imul(blinds.unblinder).umod(priv.modulus).toArray(false, len));
9388 function getr(priv) {
9389 var len = priv.modulus.byteLength();
9390 var r = new bn(randomBytes(len));
9391 while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2)) {
9392 r = new bn(randomBytes(len));
9397 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
9401 /***/ (function(module, exports, __webpack_require__) {
9405 hash.utils = __webpack_require__(11);
9406 hash.common = __webpack_require__(32);
9407 hash.sha = __webpack_require__(230);
9408 hash.ripemd = __webpack_require__(234);
9409 hash.hmac = __webpack_require__(235);
9411 // Proxy hash functions to the main object
9412 hash.sha1 = hash.sha.sha1;
9413 hash.sha256 = hash.sha.sha256;
9414 hash.sha224 = hash.sha.sha224;
9415 hash.sha384 = hash.sha.sha384;
9416 hash.sha512 = hash.sha.sha512;
9417 hash.ripemd160 = hash.ripemd.ripemd160;
9422 /***/ (function(module, exports, __webpack_require__) {
9424 module.exports = { "default": __webpack_require__(148), __esModule: true };
9428 /***/ (function(module, exports, __webpack_require__) {
9430 var core = __webpack_require__(8);
9431 var global = __webpack_require__(5);
9432 var SHARED = '__core-js_shared__';
9433 var store = global[SHARED] || (global[SHARED] = {});
9435 (module.exports = function (key, value) {
9436 return store[key] || (store[key] = value !== undefined ? value : {});
9437 })('versions', []).push({
9438 version: core.version,
9439 mode: __webpack_require__(37) ? 'pure' : 'global',
9440 copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
9446 /***/ (function(module, exports) {
9448 // IE 8- don't enum bug keys
9450 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
9456 /***/ (function(module, exports, __webpack_require__) {
9458 // 7.1.1 ToPrimitive(input [, PreferredType])
9459 var isObject = __webpack_require__(12);
9460 // instead of the ES6 spec version, we didn't implement @@toPrimitive case
9461 // and the second argument - flag - preferred type is a string
9462 module.exports = function (it, S) {
9463 if (!isObject(it)) return it;
9465 if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
9466 if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
9467 if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
9468 throw TypeError("Can't convert object to primitive value");
9474 /***/ (function(module, exports) {
9476 exports.f = Object.getOwnPropertySymbols;
9481 /***/ (function(module, exports, __webpack_require__) {
9483 // fallback for non-array-like ES3 and non-enumerable old V8 strings
9484 var cof = __webpack_require__(27);
9485 // eslint-disable-next-line no-prototype-builtins
9486 module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
9487 return cof(it) == 'String' ? it.split('') : Object(it);
9493 /***/ (function(module, exports, __webpack_require__) {
9496 var toInteger = __webpack_require__(52);
9498 module.exports = function (it) {
9499 return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
9505 /***/ (function(module, exports, __webpack_require__) {
9507 module.exports = { "default": __webpack_require__(156), __esModule: true };
9511 /***/ (function(module, exports) {
9517 /***/ (function(module, exports, __webpack_require__) {
9519 module.exports = __webpack_require__(19);
9524 /***/ (function(module, exports, __webpack_require__) {
9526 __webpack_require__(161);
9527 var global = __webpack_require__(5);
9528 var hide = __webpack_require__(19);
9529 var Iterators = __webpack_require__(28);
9530 var TO_STRING_TAG = __webpack_require__(7)('toStringTag');
9532 var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
9533 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
9534 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
9535 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
9536 'TextTrackList,TouchList').split(',');
9538 for (var i = 0; i < DOMIterables.length; i++) {
9539 var NAME = DOMIterables[i];
9540 var Collection = global[NAME];
9541 var proto = Collection && Collection.prototype;
9542 if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
9543 Iterators[NAME] = Iterators.Array;
9549 /***/ (function(module, exports, __webpack_require__) {
9551 var ctx = __webpack_require__(35);
9552 var call = __webpack_require__(165);
9553 var isArrayIter = __webpack_require__(166);
9554 var anObject = __webpack_require__(15);
9555 var toLength = __webpack_require__(75);
9556 var getIterFn = __webpack_require__(167);
9559 var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
9560 var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);
9561 var f = ctx(fn, that, entries ? 2 : 1);
9563 var length, step, iterator, result;
9564 if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
9565 // fast case for arrays with default iterator
9566 if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
9567 result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
9568 if (result === BREAK || result === RETURN) return result;
9569 } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
9570 result = call(iterator, f, step.value, entries);
9571 if (result === BREAK || result === RETURN) return result;
9574 exports.BREAK = BREAK;
9575 exports.RETURN = RETURN;
9580 /***/ (function(module, exports, __webpack_require__) {
9582 exports.f = __webpack_require__(7);
9587 /***/ (function(module, exports, __webpack_require__) {
9589 var global = __webpack_require__(5);
9590 var core = __webpack_require__(8);
9591 var LIBRARY = __webpack_require__(37);
9592 var wksExt = __webpack_require__(81);
9593 var defineProperty = __webpack_require__(16).f;
9594 module.exports = function (name) {
9595 var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
9596 if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });
9604 /***/ (function(module, exports, __webpack_require__) {
9608 var LIBRARY = __webpack_require__(37);
9609 var $export = __webpack_require__(13);
9610 var redefine = __webpack_require__(78);
9611 var hide = __webpack_require__(19);
9612 var Iterators = __webpack_require__(28);
9613 var $iterCreate = __webpack_require__(158);
9614 var setToStringTag = __webpack_require__(40);
9615 var getPrototypeOf = __webpack_require__(160);
9616 var ITERATOR = __webpack_require__(7)('iterator');
9617 var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
9618 var FF_ITERATOR = '@@iterator';
9620 var VALUES = 'values';
9622 var returnThis = function () { return this; };
9624 module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
9625 $iterCreate(Constructor, NAME, next);
9626 var getMethod = function (kind) {
9627 if (!BUGGY && kind in proto) return proto[kind];
9629 case KEYS: return function keys() { return new Constructor(this, kind); };
9630 case VALUES: return function values() { return new Constructor(this, kind); };
9631 } return function entries() { return new Constructor(this, kind); };
9633 var TAG = NAME + ' Iterator';
9634 var DEF_VALUES = DEFAULT == VALUES;
9635 var VALUES_BUG = false;
9636 var proto = Base.prototype;
9637 var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
9638 var $default = $native || getMethod(DEFAULT);
9639 var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
9640 var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
9641 var methods, key, IteratorPrototype;
9644 IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
9645 if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
9646 // Set @@toStringTag to native iterators
9647 setToStringTag(IteratorPrototype, TAG, true);
9648 // fix for some old engines
9649 if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
9652 // fix Array#{values, @@iterator}.name in V8 / FF
9653 if (DEF_VALUES && $native && $native.name !== VALUES) {
9655 $default = function values() { return $native.call(this); };
9658 if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
9659 hide(proto, ITERATOR, $default);
9662 Iterators[NAME] = $default;
9663 Iterators[TAG] = returnThis;
9666 values: DEF_VALUES ? $default : getMethod(VALUES),
9667 keys: IS_SET ? $default : getMethod(KEYS),
9670 if (FORCED) for (key in methods) {
9671 if (!(key in proto)) redefine(proto, key, methods[key]);
9672 } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
9680 /***/ (function(module, exports, __webpack_require__) {
9682 var document = __webpack_require__(5).document;
9683 module.exports = document && document.documentElement;
9688 /***/ (function(module, exports, __webpack_require__) {
9690 // getting tag from 19.1.3.6 Object.prototype.toString()
9691 var cof = __webpack_require__(27);
9692 var TAG = __webpack_require__(7)('toStringTag');
9694 var ARG = cof(function () { return arguments; }()) == 'Arguments';
9696 // fallback for IE11 Script Access Denied error
9697 var tryGet = function (it, key) {
9700 } catch (e) { /* empty */ }
9703 module.exports = function (it) {
9705 return it === undefined ? 'Undefined' : it === null ? 'Null'
9706 // @@toStringTag case
9707 : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
9710 // ES3 arguments fallback
9711 : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
9717 /***/ (function(module, exports, __webpack_require__) {
9719 // 7.3.20 SpeciesConstructor(O, defaultConstructor)
9720 var anObject = __webpack_require__(15);
9721 var aFunction = __webpack_require__(38);
9722 var SPECIES = __webpack_require__(7)('species');
9723 module.exports = function (O, D) {
9724 var C = anObject(O).constructor;
9726 return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
9732 /***/ (function(module, exports, __webpack_require__) {
9734 var ctx = __webpack_require__(35);
9735 var invoke = __webpack_require__(168);
9736 var html = __webpack_require__(86);
9737 var cel = __webpack_require__(50);
9738 var global = __webpack_require__(5);
9739 var process = global.process;
9740 var setTask = global.setImmediate;
9741 var clearTask = global.clearImmediate;
9742 var MessageChannel = global.MessageChannel;
9743 var Dispatch = global.Dispatch;
9746 var ONREADYSTATECHANGE = 'onreadystatechange';
9747 var defer, channel, port;
9748 var run = function () {
9750 // eslint-disable-next-line no-prototype-builtins
9751 if (queue.hasOwnProperty(id)) {
9757 var listener = function (event) {
9758 run.call(event.data);
9760 // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
9761 if (!setTask || !clearTask) {
9762 setTask = function setImmediate(fn) {
9765 while (arguments.length > i) args.push(arguments[i++]);
9766 queue[++counter] = function () {
9767 // eslint-disable-next-line no-new-func
9768 invoke(typeof fn == 'function' ? fn : Function(fn), args);
9773 clearTask = function clearImmediate(id) {
9777 if (__webpack_require__(27)(process) == 'process') {
9778 defer = function (id) {
9779 process.nextTick(ctx(run, id, 1));
9781 // Sphere (JS game engine) Dispatch API
9782 } else if (Dispatch && Dispatch.now) {
9783 defer = function (id) {
9784 Dispatch.now(ctx(run, id, 1));
9786 // Browsers with MessageChannel, includes WebWorkers
9787 } else if (MessageChannel) {
9788 channel = new MessageChannel();
9789 port = channel.port2;
9790 channel.port1.onmessage = listener;
9791 defer = ctx(port.postMessage, port, 1);
9792 // Browsers with postMessage, skip WebWorkers
9793 // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
9794 } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
9795 defer = function (id) {
9796 global.postMessage(id + '', '*');
9798 global.addEventListener('message', listener, false);
9800 } else if (ONREADYSTATECHANGE in cel('script')) {
9801 defer = function (id) {
9802 html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {
9803 html.removeChild(this);
9807 // Rest old browsers
9809 defer = function (id) {
9810 setTimeout(ctx(run, id, 1), 0);
9822 /***/ (function(module, exports) {
9824 module.exports = function (exec) {
9826 return { e: false, v: exec() };
9828 return { e: true, v: e };
9835 /***/ (function(module, exports, __webpack_require__) {
9837 var anObject = __webpack_require__(15);
9838 var isObject = __webpack_require__(12);
9839 var newPromiseCapability = __webpack_require__(55);
9841 module.exports = function (C, x) {
9843 if (isObject(x) && x.constructor === C) return x;
9844 var promiseCapability = newPromiseCapability.f(C);
9845 var resolve = promiseCapability.resolve;
9847 return promiseCapability.promise;
9853 /***/ (function(module, exports) {
9855 var toString = {}.toString;
9857 module.exports = Array.isArray || function (arr) {
9858 return toString.call(arr) == '[object Array]';
9864 /***/ (function(module, exports, __webpack_require__) {
9866 var META = __webpack_require__(47)('meta');
9867 var isObject = __webpack_require__(12);
9868 var has = __webpack_require__(20);
9869 var setDesc = __webpack_require__(16).f;
9871 var isExtensible = Object.isExtensible || function () {
9874 var FREEZE = !__webpack_require__(22)(function () {
9875 return isExtensible(Object.preventExtensions({}));
9877 var setMeta = function (it) {
9878 setDesc(it, META, { value: {
9879 i: 'O' + ++id, // object ID
9880 w: {} // weak collections IDs
9883 var fastKey = function (it, create) {
9884 // return primitive with prefix
9885 if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
9886 if (!has(it, META)) {
9887 // can't set metadata to uncaught frozen object
9888 if (!isExtensible(it)) return 'F';
9889 // not necessary to add metadata
9890 if (!create) return 'E';
9891 // add missing metadata
9894 } return it[META].i;
9896 var getWeak = function (it, create) {
9897 if (!has(it, META)) {
9898 // can't set metadata to uncaught frozen object
9899 if (!isExtensible(it)) return true;
9900 // not necessary to add metadata
9901 if (!create) return false;
9902 // add missing metadata
9904 // return hash weak collections IDs
9905 } return it[META].w;
9907 // add metadata on freeze-family methods calling
9908 var onFreeze = function (it) {
9909 if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
9912 var meta = module.exports = {
9923 /***/ (function(module, exports, __webpack_require__) {
9927 var Buffer = __webpack_require__(2).Buffer
9928 var Transform = __webpack_require__(57).Transform
9929 var inherits = __webpack_require__(1)
9931 function throwIfNotStringOrBuffer (val, prefix) {
9932 if (!Buffer.isBuffer(val) && typeof val !== 'string') {
9933 throw new TypeError(prefix + ' must be a string or a buffer')
9937 function HashBase (blockSize) {
9938 Transform.call(this)
9940 this._block = Buffer.allocUnsafe(blockSize)
9941 this._blockSize = blockSize
9942 this._blockOffset = 0
9943 this._length = [0, 0, 0, 0]
9945 this._finalized = false
9948 inherits(HashBase, Transform)
9950 HashBase.prototype._transform = function (chunk, encoding, callback) {
9953 this.update(chunk, encoding)
9961 HashBase.prototype._flush = function (callback) {
9964 this.push(this.digest())
9972 HashBase.prototype.update = function (data, encoding) {
9973 throwIfNotStringOrBuffer(data, 'Data')
9974 if (this._finalized) throw new Error('Digest already called')
9975 if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding)
9978 var block = this._block
9980 while (this._blockOffset + data.length - offset >= this._blockSize) {
9981 for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++]
9983 this._blockOffset = 0
9985 while (offset < data.length) block[this._blockOffset++] = data[offset++]
9988 for (var j = 0, carry = data.length * 8; carry > 0; ++j) {
9989 this._length[j] += carry
9990 carry = (this._length[j] / 0x0100000000) | 0
9991 if (carry > 0) this._length[j] -= 0x0100000000 * carry
9997 HashBase.prototype._update = function () {
9998 throw new Error('_update is not implemented')
10001 HashBase.prototype.digest = function (encoding) {
10002 if (this._finalized) throw new Error('Digest already called')
10003 this._finalized = true
10005 var digest = this._digest()
10006 if (encoding !== undefined) digest = digest.toString(encoding)
10009 this._block.fill(0)
10010 this._blockOffset = 0
10011 for (var i = 0; i < 4; ++i) this._length[i] = 0
10016 HashBase.prototype._digest = function () {
10017 throw new Error('_digest is not implemented')
10020 module.exports = HashBase
10025 /***/ (function(module, exports, __webpack_require__) {
10028 /* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.
10030 // Permission is hereby granted, free of charge, to any person obtaining a
10031 // copy of this software and associated documentation files (the
10032 // "Software"), to deal in the Software without restriction, including
10033 // without limitation the rights to use, copy, modify, merge, publish,
10034 // distribute, sublicense, and/or sell copies of the Software, and to permit
10035 // persons to whom the Software is furnished to do so, subject to the
10036 // following conditions:
10038 // The above copyright notice and this permission notice shall be included
10039 // in all copies or substantial portions of the Software.
10041 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10042 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10043 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
10044 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
10045 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
10046 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
10047 // USE OR OTHER DEALINGS IN THE SOFTWARE.
10053 var pna = __webpack_require__(42);
10056 module.exports = Readable;
10059 var isArray = __webpack_require__(92);
10066 Readable.ReadableState = ReadableState;
10069 var EE = __webpack_require__(58).EventEmitter;
10071 var EElistenerCount = function (emitter, type) {
10072 return emitter.listeners(type).length;
10077 var Stream = __webpack_require__(96);
10082 var Buffer = __webpack_require__(2).Buffer;
10083 var OurUint8Array = global.Uint8Array || function () {};
10084 function _uint8ArrayToBuffer(chunk) {
10085 return Buffer.from(chunk);
10087 function _isUint8Array(obj) {
10088 return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
10094 var util = __webpack_require__(30);
10095 util.inherits = __webpack_require__(1);
10099 var debugUtil = __webpack_require__(183);
10100 var debug = void 0;
10101 if (debugUtil && debugUtil.debuglog) {
10102 debug = debugUtil.debuglog('stream');
10104 debug = function () {};
10108 var BufferList = __webpack_require__(184);
10109 var destroyImpl = __webpack_require__(97);
10112 util.inherits(Readable, Stream);
10114 var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
10116 function prependListener(emitter, event, fn) {
10117 // Sadly this is not cacheable as some libraries bundle their own
10118 // event emitter implementation with them.
10119 if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
10121 // This is a hack to make sure that our error handler is attached before any
10122 // userland ones. NEVER DO THIS. This is here only because this code needs
10123 // to continue to work with older versions of Node.js that do not include
10124 // the prependListener() method. The goal is to eventually remove this hack.
10125 if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
10128 function ReadableState(options, stream) {
10129 Duplex = Duplex || __webpack_require__(21);
10131 options = options || {};
10133 // Duplex streams are both readable and writable, but share
10134 // the same options object.
10135 // However, some cases require setting options to different
10136 // values for the readable and the writable sides of the duplex stream.
10137 // These options can be provided separately as readableXXX and writableXXX.
10138 var isDuplex = stream instanceof Duplex;
10140 // object stream flag. Used to make read(n) ignore n and to
10141 // make all the buffer merging and length checks go away
10142 this.objectMode = !!options.objectMode;
10144 if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
10146 // the point at which it stops calling _read() to fill the buffer
10147 // Note: 0 is a valid value, means "don't call _read preemptively ever"
10148 var hwm = options.highWaterMark;
10149 var readableHwm = options.readableHighWaterMark;
10150 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
10152 if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
10155 this.highWaterMark = Math.floor(this.highWaterMark);
10157 // A linked list is used to store data chunks instead of an array because the
10158 // linked list can remove elements from the beginning faster than
10160 this.buffer = new BufferList();
10163 this.pipesCount = 0;
10164 this.flowing = null;
10165 this.ended = false;
10166 this.endEmitted = false;
10167 this.reading = false;
10169 // a flag to be able to tell if the event 'readable'/'data' is emitted
10170 // immediately, or on a later tick. We set this to true at first, because
10171 // any actions that shouldn't happen until "later" should generally also
10172 // not happen before the first read call.
10175 // whenever we return null, then we set a flag to say
10176 // that we're awaiting a 'readable' event emission.
10177 this.needReadable = false;
10178 this.emittedReadable = false;
10179 this.readableListening = false;
10180 this.resumeScheduled = false;
10182 // has it been destroyed
10183 this.destroyed = false;
10185 // Crypto is kind of old and crusty. Historically, its default string
10186 // encoding is 'binary' so we have to make this configurable.
10187 // Everything else in the universe uses 'utf8', though.
10188 this.defaultEncoding = options.defaultEncoding || 'utf8';
10190 // the number of writers that are awaiting a drain event in .pipe()s
10191 this.awaitDrain = 0;
10193 // if true, a maybeReadMore has been scheduled
10194 this.readingMore = false;
10196 this.decoder = null;
10197 this.encoding = null;
10198 if (options.encoding) {
10199 if (!StringDecoder) StringDecoder = __webpack_require__(61).StringDecoder;
10200 this.decoder = new StringDecoder(options.encoding);
10201 this.encoding = options.encoding;
10205 function Readable(options) {
10206 Duplex = Duplex || __webpack_require__(21);
10208 if (!(this instanceof Readable)) return new Readable(options);
10210 this._readableState = new ReadableState(options, this);
10213 this.readable = true;
10216 if (typeof options.read === 'function') this._read = options.read;
10218 if (typeof options.destroy === 'function') this._destroy = options.destroy;
10224 Object.defineProperty(Readable.prototype, 'destroyed', {
10226 if (this._readableState === undefined) {
10229 return this._readableState.destroyed;
10231 set: function (value) {
10232 // we ignore the value if the stream
10233 // has not been initialized yet
10234 if (!this._readableState) {
10238 // backward compatibility, the user is explicitly
10239 // managing destroyed
10240 this._readableState.destroyed = value;
10244 Readable.prototype.destroy = destroyImpl.destroy;
10245 Readable.prototype._undestroy = destroyImpl.undestroy;
10246 Readable.prototype._destroy = function (err, cb) {
10251 // Manually shove something into the read() buffer.
10252 // This returns true if the highWaterMark has not been hit yet,
10253 // similar to how Writable.write() returns true if you should
10254 // write() some more.
10255 Readable.prototype.push = function (chunk, encoding) {
10256 var state = this._readableState;
10257 var skipChunkCheck;
10259 if (!state.objectMode) {
10260 if (typeof chunk === 'string') {
10261 encoding = encoding || state.defaultEncoding;
10262 if (encoding !== state.encoding) {
10263 chunk = Buffer.from(chunk, encoding);
10266 skipChunkCheck = true;
10269 skipChunkCheck = true;
10272 return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
10275 // Unshift should *always* be something directly out of read()
10276 Readable.prototype.unshift = function (chunk) {
10277 return readableAddChunk(this, chunk, null, true, false);
10280 function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
10281 var state = stream._readableState;
10282 if (chunk === null) {
10283 state.reading = false;
10284 onEofChunk(stream, state);
10287 if (!skipChunkCheck) er = chunkInvalid(state, chunk);
10289 stream.emit('error', er);
10290 } else if (state.objectMode || chunk && chunk.length > 0) {
10291 if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
10292 chunk = _uint8ArrayToBuffer(chunk);
10296 if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
10297 } else if (state.ended) {
10298 stream.emit('error', new Error('stream.push() after EOF'));
10300 state.reading = false;
10301 if (state.decoder && !encoding) {
10302 chunk = state.decoder.write(chunk);
10303 if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
10305 addChunk(stream, state, chunk, false);
10308 } else if (!addToFront) {
10309 state.reading = false;
10313 return needMoreData(state);
10316 function addChunk(stream, state, chunk, addToFront) {
10317 if (state.flowing && state.length === 0 && !state.sync) {
10318 stream.emit('data', chunk);
10321 // update the buffer info.
10322 state.length += state.objectMode ? 1 : chunk.length;
10323 if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
10325 if (state.needReadable) emitReadable(stream);
10327 maybeReadMore(stream, state);
10330 function chunkInvalid(state, chunk) {
10332 if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
10333 er = new TypeError('Invalid non-string/buffer chunk');
10338 // if it's past the high water mark, we can push in some more.
10339 // Also, if we have no data yet, we can stand some
10340 // more bytes. This is to work around cases where hwm=0,
10341 // such as the repl. Also, if the push() triggered a
10342 // readable event, and the user called read(largeNumber) such that
10343 // needReadable was set, then we ought to push more, so that another
10344 // 'readable' event will be triggered.
10345 function needMoreData(state) {
10346 return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
10349 Readable.prototype.isPaused = function () {
10350 return this._readableState.flowing === false;
10353 // backwards compatibility.
10354 Readable.prototype.setEncoding = function (enc) {
10355 if (!StringDecoder) StringDecoder = __webpack_require__(61).StringDecoder;
10356 this._readableState.decoder = new StringDecoder(enc);
10357 this._readableState.encoding = enc;
10361 // Don't raise the hwm > 8MB
10362 var MAX_HWM = 0x800000;
10363 function computeNewHighWaterMark(n) {
10364 if (n >= MAX_HWM) {
10367 // Get the next highest power of 2 to prevent increasing hwm excessively in
10380 // This function is designed to be inlinable, so please take care when making
10381 // changes to the function body.
10382 function howMuchToRead(n, state) {
10383 if (n <= 0 || state.length === 0 && state.ended) return 0;
10384 if (state.objectMode) return 1;
10386 // Only flow one buffer at a time
10387 if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
10389 // If we're asking for more than the current hwm, then raise the hwm.
10390 if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
10391 if (n <= state.length) return n;
10392 // Don't have enough
10393 if (!state.ended) {
10394 state.needReadable = true;
10397 return state.length;
10400 // you can override either this method, or the async _read(n) below.
10401 Readable.prototype.read = function (n) {
10403 n = parseInt(n, 10);
10404 var state = this._readableState;
10407 if (n !== 0) state.emittedReadable = false;
10409 // if we're doing read(0) to trigger a readable event, but we
10410 // already have a bunch of data in the buffer, then just trigger
10411 // the 'readable' event and move on.
10412 if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
10413 debug('read: emitReadable', state.length, state.ended);
10414 if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
10418 n = howMuchToRead(n, state);
10420 // if we've ended, and we're now clear, then finish it up.
10421 if (n === 0 && state.ended) {
10422 if (state.length === 0) endReadable(this);
10426 // All the actual chunk generation logic needs to be
10427 // *below* the call to _read. The reason is that in certain
10428 // synthetic stream cases, such as passthrough streams, _read
10429 // may be a completely synchronous operation which may change
10430 // the state of the read buffer, providing enough data when
10431 // before there was *not* enough.
10433 // So, the steps are:
10434 // 1. Figure out what the state of things will be after we do
10435 // a read from the buffer.
10437 // 2. If that resulting state will trigger a _read, then call _read.
10438 // Note that this may be asynchronous, or synchronous. Yes, it is
10439 // deeply ugly to write APIs this way, but that still doesn't mean
10440 // that the Readable class should behave improperly, as streams are
10441 // designed to be sync/async agnostic.
10442 // Take note if the _read call is sync or async (ie, if the read call
10443 // has returned yet), so that we know whether or not it's safe to emit
10446 // 3. Actually pull the requested chunks out of the buffer and return.
10448 // if we need a readable event, then we need to do some reading.
10449 var doRead = state.needReadable;
10450 debug('need readable', doRead);
10452 // if we currently have less than the highWaterMark, then also read some
10453 if (state.length === 0 || state.length - n < state.highWaterMark) {
10455 debug('length less than watermark', doRead);
10458 // however, if we've ended, then there's no point, and if we're already
10459 // reading, then it's unnecessary.
10460 if (state.ended || state.reading) {
10462 debug('reading or ended', doRead);
10463 } else if (doRead) {
10465 state.reading = true;
10467 // if the length is currently zero, then we *need* a readable event.
10468 if (state.length === 0) state.needReadable = true;
10469 // call internal read method
10470 this._read(state.highWaterMark);
10471 state.sync = false;
10472 // If _read pushed data synchronously, then `reading` will be false,
10473 // and we need to re-evaluate how much data we can return to the user.
10474 if (!state.reading) n = howMuchToRead(nOrig, state);
10478 if (n > 0) ret = fromList(n, state);else ret = null;
10480 if (ret === null) {
10481 state.needReadable = true;
10487 if (state.length === 0) {
10488 // If we have nothing in the buffer, then we want to know
10489 // as soon as we *do* get something into the buffer.
10490 if (!state.ended) state.needReadable = true;
10492 // If we tried to read() past the EOF, then emit end on the next tick.
10493 if (nOrig !== n && state.ended) endReadable(this);
10496 if (ret !== null) this.emit('data', ret);
10501 function onEofChunk(stream, state) {
10502 if (state.ended) return;
10503 if (state.decoder) {
10504 var chunk = state.decoder.end();
10505 if (chunk && chunk.length) {
10506 state.buffer.push(chunk);
10507 state.length += state.objectMode ? 1 : chunk.length;
10510 state.ended = true;
10512 // emit 'readable' now to make sure it gets picked up.
10513 emitReadable(stream);
10516 // Don't emit readable right away in sync mode, because this can trigger
10517 // another read() call => stack overflow. This way, it might trigger
10518 // a nextTick recursion warning, but that's not so bad.
10519 function emitReadable(stream) {
10520 var state = stream._readableState;
10521 state.needReadable = false;
10522 if (!state.emittedReadable) {
10523 debug('emitReadable', state.flowing);
10524 state.emittedReadable = true;
10525 if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
10529 function emitReadable_(stream) {
10530 debug('emit readable');
10531 stream.emit('readable');
10535 // at this point, the user has presumably seen the 'readable' event,
10536 // and called read() to consume some data. that may have triggered
10537 // in turn another _read(n) call, in which case reading = true if
10538 // it's in progress.
10539 // However, if we're not ended, or reading, and the length < hwm,
10540 // then go ahead and try to read some more preemptively.
10541 function maybeReadMore(stream, state) {
10542 if (!state.readingMore) {
10543 state.readingMore = true;
10544 pna.nextTick(maybeReadMore_, stream, state);
10548 function maybeReadMore_(stream, state) {
10549 var len = state.length;
10550 while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
10551 debug('maybeReadMore read 0');
10553 if (len === state.length)
10554 // didn't get any data, stop spinning.
10555 break;else len = state.length;
10557 state.readingMore = false;
10560 // abstract method. to be overridden in specific implementation classes.
10561 // call cb(er, data) where data is <= n in length.
10562 // for virtual (non-string, non-buffer) streams, "length" is somewhat
10563 // arbitrary, and perhaps not very meaningful.
10564 Readable.prototype._read = function (n) {
10565 this.emit('error', new Error('_read() is not implemented'));
10568 Readable.prototype.pipe = function (dest, pipeOpts) {
10570 var state = this._readableState;
10572 switch (state.pipesCount) {
10574 state.pipes = dest;
10577 state.pipes = [state.pipes, dest];
10580 state.pipes.push(dest);
10583 state.pipesCount += 1;
10584 debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
10586 var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
10588 var endFn = doEnd ? onend : unpipe;
10589 if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
10591 dest.on('unpipe', onunpipe);
10592 function onunpipe(readable, unpipeInfo) {
10594 if (readable === src) {
10595 if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
10596 unpipeInfo.hasUnpiped = true;
10607 // when the dest drains, it reduces the awaitDrain counter
10608 // on the source. This would be more elegant with a .once()
10609 // handler in flow(), but adding and removing repeatedly is
10611 var ondrain = pipeOnDrain(src);
10612 dest.on('drain', ondrain);
10614 var cleanedUp = false;
10615 function cleanup() {
10617 // cleanup event handlers once the pipe is broken
10618 dest.removeListener('close', onclose);
10619 dest.removeListener('finish', onfinish);
10620 dest.removeListener('drain', ondrain);
10621 dest.removeListener('error', onerror);
10622 dest.removeListener('unpipe', onunpipe);
10623 src.removeListener('end', onend);
10624 src.removeListener('end', unpipe);
10625 src.removeListener('data', ondata);
10629 // if the reader is waiting for a drain event from this
10630 // specific writer, then it would cause it to never start
10632 // So, if this is awaiting a drain, then we just call it now.
10633 // If we don't know, then assume that we are waiting for one.
10634 if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
10637 // If the user pushes more data while we're writing to dest then we'll end up
10638 // in ondata again. However, we only want to increase awaitDrain once because
10639 // dest will only emit one 'drain' event for the multiple writes.
10640 // => Introduce a guard on increasing awaitDrain.
10641 var increasedAwaitDrain = false;
10642 src.on('data', ondata);
10643 function ondata(chunk) {
10645 increasedAwaitDrain = false;
10646 var ret = dest.write(chunk);
10647 if (false === ret && !increasedAwaitDrain) {
10648 // If the user unpiped during `dest.write()`, it is possible
10649 // to get stuck in a permanently paused state if that write
10650 // also returned false.
10651 // => Check whether `dest` is still a piping destination.
10652 if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
10653 debug('false write response, pause', src._readableState.awaitDrain);
10654 src._readableState.awaitDrain++;
10655 increasedAwaitDrain = true;
10661 // if the dest has an error, then stop piping into it.
10662 // however, don't suppress the throwing behavior for this.
10663 function onerror(er) {
10664 debug('onerror', er);
10666 dest.removeListener('error', onerror);
10667 if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
10670 // Make sure our error handler is attached before userland ones.
10671 prependListener(dest, 'error', onerror);
10673 // Both close and finish should trigger unpipe, but only once.
10674 function onclose() {
10675 dest.removeListener('finish', onfinish);
10678 dest.once('close', onclose);
10679 function onfinish() {
10681 dest.removeListener('close', onclose);
10684 dest.once('finish', onfinish);
10686 function unpipe() {
10691 // tell the dest that it's being piped to
10692 dest.emit('pipe', src);
10694 // start the flow if it hasn't been started already.
10695 if (!state.flowing) {
10696 debug('pipe resume');
10703 function pipeOnDrain(src) {
10704 return function () {
10705 var state = src._readableState;
10706 debug('pipeOnDrain', state.awaitDrain);
10707 if (state.awaitDrain) state.awaitDrain--;
10708 if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
10709 state.flowing = true;
10715 Readable.prototype.unpipe = function (dest) {
10716 var state = this._readableState;
10717 var unpipeInfo = { hasUnpiped: false };
10719 // if we're not piping anywhere, then do nothing.
10720 if (state.pipesCount === 0) return this;
10722 // just one destination. most common case.
10723 if (state.pipesCount === 1) {
10724 // passed in one, but it's not the right one.
10725 if (dest && dest !== state.pipes) return this;
10727 if (!dest) dest = state.pipes;
10730 state.pipes = null;
10731 state.pipesCount = 0;
10732 state.flowing = false;
10733 if (dest) dest.emit('unpipe', this, unpipeInfo);
10737 // slow case. multiple pipe destinations.
10741 var dests = state.pipes;
10742 var len = state.pipesCount;
10743 state.pipes = null;
10744 state.pipesCount = 0;
10745 state.flowing = false;
10747 for (var i = 0; i < len; i++) {
10748 dests[i].emit('unpipe', this, unpipeInfo);
10752 // try to find the right one.
10753 var index = indexOf(state.pipes, dest);
10754 if (index === -1) return this;
10756 state.pipes.splice(index, 1);
10757 state.pipesCount -= 1;
10758 if (state.pipesCount === 1) state.pipes = state.pipes[0];
10760 dest.emit('unpipe', this, unpipeInfo);
10765 // set up data events if they are asked for
10766 // Ensure readable listeners eventually get something
10767 Readable.prototype.on = function (ev, fn) {
10768 var res = Stream.prototype.on.call(this, ev, fn);
10770 if (ev === 'data') {
10771 // Start flowing on next tick if stream isn't explicitly paused
10772 if (this._readableState.flowing !== false) this.resume();
10773 } else if (ev === 'readable') {
10774 var state = this._readableState;
10775 if (!state.endEmitted && !state.readableListening) {
10776 state.readableListening = state.needReadable = true;
10777 state.emittedReadable = false;
10778 if (!state.reading) {
10779 pna.nextTick(nReadingNextTick, this);
10780 } else if (state.length) {
10781 emitReadable(this);
10788 Readable.prototype.addListener = Readable.prototype.on;
10790 function nReadingNextTick(self) {
10791 debug('readable nexttick read 0');
10795 // pause() and resume() are remnants of the legacy readable stream API
10796 // If the user uses them, then switch into old mode.
10797 Readable.prototype.resume = function () {
10798 var state = this._readableState;
10799 if (!state.flowing) {
10801 state.flowing = true;
10802 resume(this, state);
10807 function resume(stream, state) {
10808 if (!state.resumeScheduled) {
10809 state.resumeScheduled = true;
10810 pna.nextTick(resume_, stream, state);
10814 function resume_(stream, state) {
10815 if (!state.reading) {
10816 debug('resume read 0');
10820 state.resumeScheduled = false;
10821 state.awaitDrain = 0;
10822 stream.emit('resume');
10824 if (state.flowing && !state.reading) stream.read(0);
10827 Readable.prototype.pause = function () {
10828 debug('call pause flowing=%j', this._readableState.flowing);
10829 if (false !== this._readableState.flowing) {
10831 this._readableState.flowing = false;
10832 this.emit('pause');
10837 function flow(stream) {
10838 var state = stream._readableState;
10839 debug('flow', state.flowing);
10840 while (state.flowing && stream.read() !== null) {}
10843 // wrap an old-style stream as the async data source.
10844 // This is *not* part of the readable stream interface.
10845 // It is an ugly unfortunate mess of history.
10846 Readable.prototype.wrap = function (stream) {
10849 var state = this._readableState;
10850 var paused = false;
10852 stream.on('end', function () {
10853 debug('wrapped end');
10854 if (state.decoder && !state.ended) {
10855 var chunk = state.decoder.end();
10856 if (chunk && chunk.length) _this.push(chunk);
10862 stream.on('data', function (chunk) {
10863 debug('wrapped data');
10864 if (state.decoder) chunk = state.decoder.write(chunk);
10866 // don't skip over falsy values in objectMode
10867 if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
10869 var ret = _this.push(chunk);
10876 // proxy all the other methods.
10877 // important when wrapping filters and duplexes.
10878 for (var i in stream) {
10879 if (this[i] === undefined && typeof stream[i] === 'function') {
10880 this[i] = function (method) {
10881 return function () {
10882 return stream[method].apply(stream, arguments);
10888 // proxy certain important events.
10889 for (var n = 0; n < kProxyEvents.length; n++) {
10890 stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
10893 // when we try to consume some more bytes, simply unpause the
10894 // underlying stream.
10895 this._read = function (n) {
10896 debug('wrapped _read', n);
10906 Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
10907 // making it explicit this property is not enumerable
10908 // because otherwise some prototype manipulation in
10909 // userland will fail
10912 return this._readableState.highWaterMark;
10916 // exposed for testing purposes only.
10917 Readable._fromList = fromList;
10919 // Pluck off n bytes from an array of buffers.
10920 // Length is the combined lengths of all the buffers in the list.
10921 // This function is designed to be inlinable, so please take care when making
10922 // changes to the function body.
10923 function fromList(n, state) {
10924 // nothing buffered
10925 if (state.length === 0) return null;
10928 if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
10929 // read it all, truncate the list
10930 if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
10931 state.buffer.clear();
10933 // read part of list
10934 ret = fromListPartial(n, state.buffer, state.decoder);
10940 // Extracts only enough buffered data to satisfy the amount requested.
10941 // This function is designed to be inlinable, so please take care when making
10942 // changes to the function body.
10943 function fromListPartial(n, list, hasStrings) {
10945 if (n < list.head.data.length) {
10946 // slice is the same for buffers and strings
10947 ret = list.head.data.slice(0, n);
10948 list.head.data = list.head.data.slice(n);
10949 } else if (n === list.head.data.length) {
10950 // first chunk is a perfect match
10951 ret = list.shift();
10953 // result spans more than one buffer
10954 ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
10959 // Copies a specified amount of characters from the list of buffered data
10961 // This function is designed to be inlinable, so please take care when making
10962 // changes to the function body.
10963 function copyFromBufferString(n, list) {
10968 while (p = p.next) {
10970 var nb = n > str.length ? str.length : n;
10971 if (nb === str.length) ret += str;else ret += str.slice(0, n);
10974 if (nb === str.length) {
10976 if (p.next) list.head = p.next;else list.head = list.tail = null;
10979 p.data = str.slice(nb);
10989 // Copies a specified amount of bytes from the list of buffered data chunks.
10990 // This function is designed to be inlinable, so please take care when making
10991 // changes to the function body.
10992 function copyFromBuffer(n, list) {
10993 var ret = Buffer.allocUnsafe(n);
10997 n -= p.data.length;
10998 while (p = p.next) {
11000 var nb = n > buf.length ? buf.length : n;
11001 buf.copy(ret, ret.length - n, 0, nb);
11004 if (nb === buf.length) {
11006 if (p.next) list.head = p.next;else list.head = list.tail = null;
11009 p.data = buf.slice(nb);
11019 function endReadable(stream) {
11020 var state = stream._readableState;
11022 // If we get here before consuming all the bytes, then that is a
11023 // bug in node. Should never happen.
11024 if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
11026 if (!state.endEmitted) {
11027 state.ended = true;
11028 pna.nextTick(endReadableNT, state, stream);
11032 function endReadableNT(state, stream) {
11033 // Check that we didn't get one last unshift.
11034 if (!state.endEmitted && state.length === 0) {
11035 state.endEmitted = true;
11036 stream.readable = false;
11037 stream.emit('end');
11041 function indexOf(xs, x) {
11042 for (var i = 0, l = xs.length; i < l; i++) {
11043 if (xs[i] === x) return i;
11047 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10), __webpack_require__(14)))
11051 /***/ (function(module, exports, __webpack_require__) {
11053 module.exports = __webpack_require__(58).EventEmitter;
11058 /***/ (function(module, exports, __webpack_require__) {
11065 var pna = __webpack_require__(42);
11068 // undocumented cb() API, needed for core, not for public API
11069 function destroy(err, cb) {
11072 var readableDestroyed = this._readableState && this._readableState.destroyed;
11073 var writableDestroyed = this._writableState && this._writableState.destroyed;
11075 if (readableDestroyed || writableDestroyed) {
11078 } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
11079 pna.nextTick(emitErrorNT, this, err);
11084 // we set destroyed to true before firing error callbacks in order
11085 // to make it re-entrance safe in case destroy() is called within callbacks
11087 if (this._readableState) {
11088 this._readableState.destroyed = true;
11091 // if this is a duplex stream mark the writable part as destroyed as well
11092 if (this._writableState) {
11093 this._writableState.destroyed = true;
11096 this._destroy(err || null, function (err) {
11098 pna.nextTick(emitErrorNT, _this, err);
11099 if (_this._writableState) {
11100 _this._writableState.errorEmitted = true;
11110 function undestroy() {
11111 if (this._readableState) {
11112 this._readableState.destroyed = false;
11113 this._readableState.reading = false;
11114 this._readableState.ended = false;
11115 this._readableState.endEmitted = false;
11118 if (this._writableState) {
11119 this._writableState.destroyed = false;
11120 this._writableState.ended = false;
11121 this._writableState.ending = false;
11122 this._writableState.finished = false;
11123 this._writableState.errorEmitted = false;
11127 function emitErrorNT(self, err) {
11128 self.emit('error', err);
11133 undestroy: undestroy
11138 /***/ (function(module, exports, __webpack_require__) {
11141 // Copyright Joyent, Inc. and other Node contributors.
11143 // Permission is hereby granted, free of charge, to any person obtaining a
11144 // copy of this software and associated documentation files (the
11145 // "Software"), to deal in the Software without restriction, including
11146 // without limitation the rights to use, copy, modify, merge, publish,
11147 // distribute, sublicense, and/or sell copies of the Software, and to permit
11148 // persons to whom the Software is furnished to do so, subject to the
11149 // following conditions:
11151 // The above copyright notice and this permission notice shall be included
11152 // in all copies or substantial portions of the Software.
11154 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
11155 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11156 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
11157 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
11158 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
11159 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
11160 // USE OR OTHER DEALINGS IN THE SOFTWARE.
11162 // a transform stream is a readable/writable stream where you do
11163 // something with the data. Sometimes it's called a "filter",
11164 // but that's not a great name for it, since that implies a thing where
11165 // some bits pass through, and others are simply ignored. (That would
11166 // be a valid example of a transform, of course.)
11168 // While the output is causally related to the input, it's not a
11169 // necessarily symmetric or synchronous transformation. For example,
11170 // a zlib stream might take multiple plain-text writes(), and then
11171 // emit a single compressed chunk some time in the future.
11173 // Here's how this works:
11175 // The Transform stream has all the aspects of the readable and writable
11176 // stream classes. When you write(chunk), that calls _write(chunk,cb)
11177 // internally, and returns false if there's a lot of pending writes
11178 // buffered up. When you call read(), that calls _read(n) until
11179 // there's enough pending readable data buffered up.
11181 // In a transform stream, the written data is placed in a buffer. When
11182 // _read(n) is called, it transforms the queued up data, calling the
11183 // buffered _write cb's as it consumes chunks. If consuming a single
11184 // written chunk would result in multiple output chunks, then the first
11185 // outputted bit calls the readcb, and subsequent chunks just go into
11186 // the read buffer, and will cause it to emit 'readable' if necessary.
11188 // This way, back-pressure is actually determined by the reading side,
11189 // since _read has to be called to start processing a new chunk. However,
11190 // a pathological inflate type of transform can cause excessive buffering
11191 // here. For example, imagine a stream where every byte of input is
11192 // interpreted as an integer from 0-255, and then results in that many
11193 // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
11194 // 1kb of data being output. In this case, you could write a very small
11195 // amount of input, and end up with a very large amount of output. In
11196 // such a pathological inflating mechanism, there'd be no way to tell
11197 // the system to stop doing the transform. A single 4MB write could
11198 // cause the system to run out of memory.
11200 // However, even in such a pathological case, only a single written chunk
11201 // would be consumed, and then the rest would wait (un-transformed) until
11202 // the results of the previous transformed chunk were consumed.
11206 module.exports = Transform;
11208 var Duplex = __webpack_require__(21);
11211 var util = __webpack_require__(30);
11212 util.inherits = __webpack_require__(1);
11215 util.inherits(Transform, Duplex);
11217 function afterTransform(er, data) {
11218 var ts = this._transformState;
11219 ts.transforming = false;
11221 var cb = ts.writecb;
11224 return this.emit('error', new Error('write callback called multiple times'));
11227 ts.writechunk = null;
11230 if (data != null) // single equals check for both `null` and `undefined`
11235 var rs = this._readableState;
11236 rs.reading = false;
11237 if (rs.needReadable || rs.length < rs.highWaterMark) {
11238 this._read(rs.highWaterMark);
11242 function Transform(options) {
11243 if (!(this instanceof Transform)) return new Transform(options);
11245 Duplex.call(this, options);
11247 this._transformState = {
11248 afterTransform: afterTransform.bind(this),
11249 needTransform: false,
11250 transforming: false,
11253 writeencoding: null
11256 // start out asking for a readable event once data is transformed.
11257 this._readableState.needReadable = true;
11259 // we have implemented the _read method, and done the other things
11260 // that Readable wants before the first _read call, so unset the
11261 // sync guard flag.
11262 this._readableState.sync = false;
11265 if (typeof options.transform === 'function') this._transform = options.transform;
11267 if (typeof options.flush === 'function') this._flush = options.flush;
11270 // When the writable side finishes, then flush out anything remaining.
11271 this.on('prefinish', prefinish);
11274 function prefinish() {
11277 if (typeof this._flush === 'function') {
11278 this._flush(function (er, data) {
11279 done(_this, er, data);
11282 done(this, null, null);
11286 Transform.prototype.push = function (chunk, encoding) {
11287 this._transformState.needTransform = false;
11288 return Duplex.prototype.push.call(this, chunk, encoding);
11291 // This is the part where you do stuff!
11292 // override this function in implementation classes.
11293 // 'chunk' is an input chunk.
11295 // Call `push(newChunk)` to pass along transformed output
11296 // to the readable side. You may call 'push' zero or more times.
11298 // Call `cb(err)` when you are done with this chunk. If you pass
11299 // an error, then that'll put the hurt on the whole operation. If you
11300 // never call cb(), then you'll never get another chunk.
11301 Transform.prototype._transform = function (chunk, encoding, cb) {
11302 throw new Error('_transform() is not implemented');
11305 Transform.prototype._write = function (chunk, encoding, cb) {
11306 var ts = this._transformState;
11308 ts.writechunk = chunk;
11309 ts.writeencoding = encoding;
11310 if (!ts.transforming) {
11311 var rs = this._readableState;
11312 if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
11316 // Doesn't matter what the args are here.
11317 // _transform does all the work.
11318 // That we got here means that the readable side wants more data.
11319 Transform.prototype._read = function (n) {
11320 var ts = this._transformState;
11322 if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
11323 ts.transforming = true;
11324 this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
11326 // mark that we need a transform, so that any data that comes in
11327 // will get processed, now that we've asked for it.
11328 ts.needTransform = true;
11332 Transform.prototype._destroy = function (err, cb) {
11335 Duplex.prototype._destroy.call(this, err, function (err2) {
11337 _this2.emit('close');
11341 function done(stream, er, data) {
11342 if (er) return stream.emit('error', er);
11344 if (data != null) // single equals check for both `null` and `undefined`
11347 // if there's nothing in the write buffer, then that means
11348 // that nothing more will ever be provided
11349 if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
11351 if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
11353 return stream.push(null);
11358 /***/ (function(module, exports, __webpack_require__) {
11361 * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
11363 * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
11364 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
11368 var inherits = __webpack_require__(1)
11369 var Hash = __webpack_require__(24)
11370 var Buffer = __webpack_require__(2).Buffer
11373 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
11374 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
11375 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
11376 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
11377 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
11378 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
11379 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
11380 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
11381 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
11382 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
11383 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
11384 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
11385 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
11386 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
11387 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
11388 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
11391 var W = new Array(64)
11393 function Sha256 () {
11396 this._w = W // new Array(64)
11398 Hash.call(this, 64, 56)
11401 inherits(Sha256, Hash)
11403 Sha256.prototype.init = function () {
11404 this._a = 0x6a09e667
11405 this._b = 0xbb67ae85
11406 this._c = 0x3c6ef372
11407 this._d = 0xa54ff53a
11408 this._e = 0x510e527f
11409 this._f = 0x9b05688c
11410 this._g = 0x1f83d9ab
11411 this._h = 0x5be0cd19
11416 function ch (x, y, z) {
11417 return z ^ (x & (y ^ z))
11420 function maj (x, y, z) {
11421 return (x & y) | (z & (x | y))
11424 function sigma0 (x) {
11425 return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10)
11428 function sigma1 (x) {
11429 return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7)
11432 function gamma0 (x) {
11433 return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3)
11436 function gamma1 (x) {
11437 return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10)
11440 Sha256.prototype._update = function (M) {
11443 var a = this._a | 0
11444 var b = this._b | 0
11445 var c = this._c | 0
11446 var d = this._d | 0
11447 var e = this._e | 0
11448 var f = this._f | 0
11449 var g = this._g | 0
11450 var h = this._h | 0
11452 for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
11453 for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0
11455 for (var j = 0; j < 64; ++j) {
11456 var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0
11457 var T2 = (sigma0(a) + maj(a, b, c)) | 0
11469 this._a = (a + this._a) | 0
11470 this._b = (b + this._b) | 0
11471 this._c = (c + this._c) | 0
11472 this._d = (d + this._d) | 0
11473 this._e = (e + this._e) | 0
11474 this._f = (f + this._f) | 0
11475 this._g = (g + this._g) | 0
11476 this._h = (h + this._h) | 0
11479 Sha256.prototype._hash = function () {
11480 var H = Buffer.allocUnsafe(32)
11482 H.writeInt32BE(this._a, 0)
11483 H.writeInt32BE(this._b, 4)
11484 H.writeInt32BE(this._c, 8)
11485 H.writeInt32BE(this._d, 12)
11486 H.writeInt32BE(this._e, 16)
11487 H.writeInt32BE(this._f, 20)
11488 H.writeInt32BE(this._g, 24)
11489 H.writeInt32BE(this._h, 28)
11494 module.exports = Sha256
11499 /***/ (function(module, exports, __webpack_require__) {
11501 var inherits = __webpack_require__(1)
11502 var Hash = __webpack_require__(24)
11503 var Buffer = __webpack_require__(2).Buffer
11506 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
11507 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
11508 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
11509 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
11510 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
11511 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
11512 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
11513 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
11514 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
11515 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
11516 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
11517 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
11518 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
11519 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
11520 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
11521 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
11522 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
11523 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
11524 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
11525 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
11526 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
11527 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
11528 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
11529 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
11530 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
11531 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
11532 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
11533 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
11534 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
11535 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
11536 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
11537 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
11538 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
11539 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
11540 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
11541 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
11542 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
11543 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
11544 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
11545 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
11548 var W = new Array(160)
11550 function Sha512 () {
11554 Hash.call(this, 128, 112)
11557 inherits(Sha512, Hash)
11559 Sha512.prototype.init = function () {
11560 this._ah = 0x6a09e667
11561 this._bh = 0xbb67ae85
11562 this._ch = 0x3c6ef372
11563 this._dh = 0xa54ff53a
11564 this._eh = 0x510e527f
11565 this._fh = 0x9b05688c
11566 this._gh = 0x1f83d9ab
11567 this._hh = 0x5be0cd19
11569 this._al = 0xf3bcc908
11570 this._bl = 0x84caa73b
11571 this._cl = 0xfe94f82b
11572 this._dl = 0x5f1d36f1
11573 this._el = 0xade682d1
11574 this._fl = 0x2b3e6c1f
11575 this._gl = 0xfb41bd6b
11576 this._hl = 0x137e2179
11581 function Ch (x, y, z) {
11582 return z ^ (x & (y ^ z))
11585 function maj (x, y, z) {
11586 return (x & y) | (z & (x | y))
11589 function sigma0 (x, xl) {
11590 return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25)
11593 function sigma1 (x, xl) {
11594 return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23)
11597 function Gamma0 (x, xl) {
11598 return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7)
11601 function Gamma0l (x, xl) {
11602 return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25)
11605 function Gamma1 (x, xl) {
11606 return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6)
11609 function Gamma1l (x, xl) {
11610 return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26)
11613 function getCarry (a, b) {
11614 return (a >>> 0) < (b >>> 0) ? 1 : 0
11617 Sha512.prototype._update = function (M) {
11620 var ah = this._ah | 0
11621 var bh = this._bh | 0
11622 var ch = this._ch | 0
11623 var dh = this._dh | 0
11624 var eh = this._eh | 0
11625 var fh = this._fh | 0
11626 var gh = this._gh | 0
11627 var hh = this._hh | 0
11629 var al = this._al | 0
11630 var bl = this._bl | 0
11631 var cl = this._cl | 0
11632 var dl = this._dl | 0
11633 var el = this._el | 0
11634 var fl = this._fl | 0
11635 var gl = this._gl | 0
11636 var hl = this._hl | 0
11638 for (var i = 0; i < 32; i += 2) {
11639 W[i] = M.readInt32BE(i * 4)
11640 W[i + 1] = M.readInt32BE(i * 4 + 4)
11642 for (; i < 160; i += 2) {
11643 var xh = W[i - 15 * 2]
11644 var xl = W[i - 15 * 2 + 1]
11645 var gamma0 = Gamma0(xh, xl)
11646 var gamma0l = Gamma0l(xl, xh)
11649 xl = W[i - 2 * 2 + 1]
11650 var gamma1 = Gamma1(xh, xl)
11651 var gamma1l = Gamma1l(xl, xh)
11653 // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
11654 var Wi7h = W[i - 7 * 2]
11655 var Wi7l = W[i - 7 * 2 + 1]
11657 var Wi16h = W[i - 16 * 2]
11658 var Wi16l = W[i - 16 * 2 + 1]
11660 var Wil = (gamma0l + Wi7l) | 0
11661 var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0
11662 Wil = (Wil + gamma1l) | 0
11663 Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0
11664 Wil = (Wil + Wi16l) | 0
11665 Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0
11671 for (var j = 0; j < 160; j += 2) {
11675 var majh = maj(ah, bh, ch)
11676 var majl = maj(al, bl, cl)
11678 var sigma0h = sigma0(ah, al)
11679 var sigma0l = sigma0(al, ah)
11680 var sigma1h = sigma1(eh, el)
11681 var sigma1l = sigma1(el, eh)
11683 // t1 = h + sigma1 + ch + K[j] + W[j]
11687 var chh = Ch(eh, fh, gh)
11688 var chl = Ch(el, fl, gl)
11690 var t1l = (hl + sigma1l) | 0
11691 var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0
11692 t1l = (t1l + chl) | 0
11693 t1h = (t1h + chh + getCarry(t1l, chl)) | 0
11694 t1l = (t1l + Kil) | 0
11695 t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0
11696 t1l = (t1l + Wil) | 0
11697 t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0
11699 // t2 = sigma0 + maj
11700 var t2l = (sigma0l + majl) | 0
11701 var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0
11709 el = (dl + t1l) | 0
11710 eh = (dh + t1h + getCarry(el, dl)) | 0
11717 al = (t1l + t2l) | 0
11718 ah = (t1h + t2h + getCarry(al, t1l)) | 0
11721 this._al = (this._al + al) | 0
11722 this._bl = (this._bl + bl) | 0
11723 this._cl = (this._cl + cl) | 0
11724 this._dl = (this._dl + dl) | 0
11725 this._el = (this._el + el) | 0
11726 this._fl = (this._fl + fl) | 0
11727 this._gl = (this._gl + gl) | 0
11728 this._hl = (this._hl + hl) | 0
11730 this._ah = (this._ah + ah + getCarry(this._al, al)) | 0
11731 this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0
11732 this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0
11733 this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0
11734 this._eh = (this._eh + eh + getCarry(this._el, el)) | 0
11735 this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0
11736 this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0
11737 this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0
11740 Sha512.prototype._hash = function () {
11741 var H = Buffer.allocUnsafe(64)
11743 function writeInt64BE (h, l, offset) {
11744 H.writeInt32BE(h, offset)
11745 H.writeInt32BE(l, offset + 4)
11748 writeInt64BE(this._ah, this._al, 0)
11749 writeInt64BE(this._bh, this._bl, 8)
11750 writeInt64BE(this._ch, this._cl, 16)
11751 writeInt64BE(this._dh, this._dl, 24)
11752 writeInt64BE(this._eh, this._el, 32)
11753 writeInt64BE(this._fh, this._fl, 40)
11754 writeInt64BE(this._gh, this._gl, 48)
11755 writeInt64BE(this._hh, this._hl, 56)
11760 module.exports = Sha512
11765 /***/ (function(module, exports, __webpack_require__) {
11769 var inherits = __webpack_require__(1)
11770 var Legacy = __webpack_require__(196)
11771 var Base = __webpack_require__(18)
11772 var Buffer = __webpack_require__(2).Buffer
11773 var md5 = __webpack_require__(102)
11774 var RIPEMD160 = __webpack_require__(62)
11776 var sha = __webpack_require__(63)
11778 var ZEROS = Buffer.alloc(128)
11780 function Hmac (alg, key) {
11781 Base.call(this, 'digest')
11782 if (typeof key === 'string') {
11783 key = Buffer.from(key)
11786 var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
11790 if (key.length > blocksize) {
11791 var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)
11792 key = hash.update(key).digest()
11793 } else if (key.length < blocksize) {
11794 key = Buffer.concat([key, ZEROS], blocksize)
11797 var ipad = this._ipad = Buffer.allocUnsafe(blocksize)
11798 var opad = this._opad = Buffer.allocUnsafe(blocksize)
11800 for (var i = 0; i < blocksize; i++) {
11801 ipad[i] = key[i] ^ 0x36
11802 opad[i] = key[i] ^ 0x5C
11804 this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)
11805 this._hash.update(ipad)
11808 inherits(Hmac, Base)
11810 Hmac.prototype._update = function (data) {
11811 this._hash.update(data)
11814 Hmac.prototype._final = function () {
11815 var h = this._hash.digest()
11816 var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg)
11817 return hash.update(this._opad).update(h).digest()
11820 module.exports = function createHmac (alg, key) {
11821 alg = alg.toLowerCase()
11822 if (alg === 'rmd160' || alg === 'ripemd160') {
11823 return new Hmac('rmd160', key)
11825 if (alg === 'md5') {
11826 return new Legacy(md5, key)
11828 return new Hmac(alg, key)
11834 /***/ (function(module, exports, __webpack_require__) {
11836 var MD5 = __webpack_require__(56)
11838 module.exports = function (buffer) {
11839 return new MD5().update(buffer).digest()
11845 /***/ (function(module, exports) {
11847 module.exports = {"sha224WithRSAEncryption":{"sign":"rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"RSA-SHA224":{"sign":"ecdsa/rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"sha256WithRSAEncryption":{"sign":"rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"RSA-SHA256":{"sign":"ecdsa/rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"sha384WithRSAEncryption":{"sign":"rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"RSA-SHA384":{"sign":"ecdsa/rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"sha512WithRSAEncryption":{"sign":"rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA512":{"sign":"ecdsa/rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA1":{"sign":"rsa","hash":"sha1","id":"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{"sign":"ecdsa","hash":"sha1","id":""},"sha256":{"sign":"ecdsa","hash":"sha256","id":""},"sha224":{"sign":"ecdsa","hash":"sha224","id":""},"sha384":{"sign":"ecdsa","hash":"sha384","id":""},"sha512":{"sign":"ecdsa","hash":"sha512","id":""},"DSA-SHA":{"sign":"dsa","hash":"sha1","id":""},"DSA-SHA1":{"sign":"dsa","hash":"sha1","id":""},"DSA":{"sign":"dsa","hash":"sha1","id":""},"DSA-WITH-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-WITH-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-WITH-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-WITH-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-RIPEMD160":{"sign":"dsa","hash":"rmd160","id":""},"ripemd160WithRSA":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"RSA-RIPEMD160":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"md5WithRSAEncryption":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"},"RSA-MD5":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"}}
11851 /***/ (function(module, exports, __webpack_require__) {
11853 exports.pbkdf2 = __webpack_require__(198)
11854 exports.pbkdf2Sync = __webpack_require__(107)
11859 /***/ (function(module, exports, __webpack_require__) {
11861 /* WEBPACK VAR INJECTION */(function(Buffer) {var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs
11863 function checkBuffer (buf, name) {
11864 if (typeof buf !== 'string' && !Buffer.isBuffer(buf)) {
11865 throw new TypeError(name + ' must be a buffer or string')
11869 module.exports = function (password, salt, iterations, keylen) {
11870 checkBuffer(password, 'Password')
11871 checkBuffer(salt, 'Salt')
11873 if (typeof iterations !== 'number') {
11874 throw new TypeError('Iterations not a number')
11877 if (iterations < 0) {
11878 throw new TypeError('Bad iterations')
11881 if (typeof keylen !== 'number') {
11882 throw new TypeError('Key length not a number')
11885 if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */
11886 throw new TypeError('Bad key length')
11890 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
11894 /***/ (function(module, exports, __webpack_require__) {
11896 /* WEBPACK VAR INJECTION */(function(process) {var defaultEncoding
11897 /* istanbul ignore next */
11898 if (process.browser) {
11899 defaultEncoding = 'utf-8'
11901 var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10)
11903 defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary'
11905 module.exports = defaultEncoding
11907 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(14)))
11911 /***/ (function(module, exports, __webpack_require__) {
11913 var md5 = __webpack_require__(102)
11914 var rmd160 = __webpack_require__(62)
11915 var sha = __webpack_require__(63)
11917 var checkParameters = __webpack_require__(105)
11918 var defaultEncoding = __webpack_require__(106)
11919 var Buffer = __webpack_require__(2).Buffer
11920 var ZEROS = Buffer.alloc(128)
11932 function Hmac (alg, key, saltLen) {
11933 var hash = getDigest(alg)
11934 var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
11936 if (key.length > blocksize) {
11938 } else if (key.length < blocksize) {
11939 key = Buffer.concat([key, ZEROS], blocksize)
11942 var ipad = Buffer.allocUnsafe(blocksize + sizes[alg])
11943 var opad = Buffer.allocUnsafe(blocksize + sizes[alg])
11944 for (var i = 0; i < blocksize; i++) {
11945 ipad[i] = key[i] ^ 0x36
11946 opad[i] = key[i] ^ 0x5C
11949 var ipad1 = Buffer.allocUnsafe(blocksize + saltLen + 4)
11950 ipad.copy(ipad1, 0, 0, blocksize)
11955 this.blocksize = blocksize
11957 this.size = sizes[alg]
11960 Hmac.prototype.run = function (data, ipad) {
11961 data.copy(ipad, this.blocksize)
11962 var h = this.hash(ipad)
11963 h.copy(this.opad, this.blocksize)
11964 return this.hash(this.opad)
11967 function getDigest (alg) {
11968 function shaFunc (data) {
11969 return sha(alg).update(data).digest()
11972 if (alg === 'rmd160' || alg === 'ripemd160') return rmd160
11973 if (alg === 'md5') return md5
11977 function pbkdf2 (password, salt, iterations, keylen, digest) {
11978 checkParameters(password, salt, iterations, keylen)
11980 if (!Buffer.isBuffer(password)) password = Buffer.from(password, defaultEncoding)
11981 if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, defaultEncoding)
11983 digest = digest || 'sha1'
11985 var hmac = new Hmac(digest, password, salt.length)
11987 var DK = Buffer.allocUnsafe(keylen)
11988 var block1 = Buffer.allocUnsafe(salt.length + 4)
11989 salt.copy(block1, 0, 0, salt.length)
11992 var hLen = sizes[digest]
11993 var l = Math.ceil(keylen / hLen)
11995 for (var i = 1; i <= l; i++) {
11996 block1.writeUInt32BE(i, salt.length)
11998 var T = hmac.run(block1, hmac.ipad1)
12001 for (var j = 1; j < iterations; j++) {
12002 U = hmac.run(U, hmac.ipad2)
12003 for (var k = 0; k < hLen; k++) T[k] ^= U[k]
12006 T.copy(DK, destPos)
12013 module.exports = pbkdf2
12018 /***/ (function(module, exports, __webpack_require__) {
12020 var xor = __webpack_require__(31)
12021 var Buffer = __webpack_require__(2).Buffer
12022 var incr32 = __webpack_require__(109)
12024 function getBlock (self) {
12025 var out = self._cipher.encryptBlockRaw(self._prev)
12031 exports.encrypt = function (self, chunk) {
12032 var chunkNum = Math.ceil(chunk.length / blockSize)
12033 var start = self._cache.length
12034 self._cache = Buffer.concat([
12036 Buffer.allocUnsafe(chunkNum * blockSize)
12038 for (var i = 0; i < chunkNum; i++) {
12039 var out = getBlock(self)
12040 var offset = start + i * blockSize
12041 self._cache.writeUInt32BE(out[0], offset + 0)
12042 self._cache.writeUInt32BE(out[1], offset + 4)
12043 self._cache.writeUInt32BE(out[2], offset + 8)
12044 self._cache.writeUInt32BE(out[3], offset + 12)
12046 var pad = self._cache.slice(0, chunk.length)
12047 self._cache = self._cache.slice(chunk.length)
12048 return xor(chunk, pad)
12054 /***/ (function(module, exports) {
12056 function incr32 (iv) {
12057 var len = iv.length
12060 item = iv.readUInt8(len)
12061 if (item === 255) {
12062 iv.writeUInt8(0, len)
12065 iv.writeUInt8(item, len)
12070 module.exports = incr32
12075 /***/ (function(module, exports) {
12077 module.exports = {"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}
12081 /***/ (function(module, exports, __webpack_require__) {
12083 var aes = __webpack_require__(43)
12084 var Buffer = __webpack_require__(2).Buffer
12085 var Transform = __webpack_require__(18)
12086 var inherits = __webpack_require__(1)
12087 var GHASH = __webpack_require__(213)
12088 var xor = __webpack_require__(31)
12089 var incr32 = __webpack_require__(109)
12091 function xorTest (a, b) {
12093 if (a.length !== b.length) out++
12095 var len = Math.min(a.length, b.length)
12096 for (var i = 0; i < len; ++i) {
12097 out += (a[i] ^ b[i])
12103 function calcIv (self, iv, ck) {
12104 if (iv.length === 12) {
12105 self._finID = Buffer.concat([iv, Buffer.from([0, 0, 0, 1])])
12106 return Buffer.concat([iv, Buffer.from([0, 0, 0, 2])])
12108 var ghash = new GHASH(ck)
12109 var len = iv.length
12110 var toPad = len % 16
12114 ghash.update(Buffer.alloc(toPad, 0))
12116 ghash.update(Buffer.alloc(8, 0))
12117 var ivBits = len * 8
12118 var tail = Buffer.alloc(8)
12119 tail.writeUIntBE(ivBits, 0, 8)
12121 self._finID = ghash.state
12122 var out = Buffer.from(self._finID)
12126 function StreamCipher (mode, key, iv, decrypt) {
12127 Transform.call(this)
12129 var h = Buffer.alloc(4, 0)
12131 this._cipher = new aes.AES(key)
12132 var ck = this._cipher.encryptBlock(h)
12133 this._ghash = new GHASH(ck)
12134 iv = calcIv(this, iv, ck)
12136 this._prev = Buffer.from(iv)
12137 this._cache = Buffer.allocUnsafe(0)
12138 this._secCache = Buffer.allocUnsafe(0)
12139 this._decrypt = decrypt
12144 this._authTag = null
12145 this._called = false
12148 inherits(StreamCipher, Transform)
12150 StreamCipher.prototype._update = function (chunk) {
12151 if (!this._called && this._alen) {
12152 var rump = 16 - (this._alen % 16)
12154 rump = Buffer.alloc(rump, 0)
12155 this._ghash.update(rump)
12159 this._called = true
12160 var out = this._mode.encrypt(this, chunk)
12161 if (this._decrypt) {
12162 this._ghash.update(chunk)
12164 this._ghash.update(out)
12166 this._len += chunk.length
12170 StreamCipher.prototype._final = function () {
12171 if (this._decrypt && !this._authTag) throw new Error('Unsupported state or unable to authenticate data')
12173 var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID))
12174 if (this._decrypt && xorTest(tag, this._authTag)) throw new Error('Unsupported state or unable to authenticate data')
12176 this._authTag = tag
12177 this._cipher.scrub()
12180 StreamCipher.prototype.getAuthTag = function getAuthTag () {
12181 if (this._decrypt || !Buffer.isBuffer(this._authTag)) throw new Error('Attempting to get auth tag in unsupported state')
12183 return this._authTag
12186 StreamCipher.prototype.setAuthTag = function setAuthTag (tag) {
12187 if (!this._decrypt) throw new Error('Attempting to set auth tag in unsupported state')
12189 this._authTag = tag
12192 StreamCipher.prototype.setAAD = function setAAD (buf) {
12193 if (this._called) throw new Error('Attempting to set AAD in unsupported state')
12195 this._ghash.update(buf)
12196 this._alen += buf.length
12199 module.exports = StreamCipher
12204 /***/ (function(module, exports, __webpack_require__) {
12206 var aes = __webpack_require__(43)
12207 var Buffer = __webpack_require__(2).Buffer
12208 var Transform = __webpack_require__(18)
12209 var inherits = __webpack_require__(1)
12211 function StreamCipher (mode, key, iv, decrypt) {
12212 Transform.call(this)
12214 this._cipher = new aes.AES(key)
12215 this._prev = Buffer.from(iv)
12216 this._cache = Buffer.allocUnsafe(0)
12217 this._secCache = Buffer.allocUnsafe(0)
12218 this._decrypt = decrypt
12222 inherits(StreamCipher, Transform)
12224 StreamCipher.prototype._update = function (chunk) {
12225 return this._mode.encrypt(this, chunk, this._decrypt)
12228 StreamCipher.prototype._final = function () {
12229 this._cipher.scrub()
12232 module.exports = StreamCipher
12237 /***/ (function(module, exports, __webpack_require__) {
12239 var randomBytes = __webpack_require__(23);
12240 module.exports = findPrime;
12241 findPrime.simpleSieve = simpleSieve;
12242 findPrime.fermatTest = fermatTest;
12243 var BN = __webpack_require__(4);
12244 var TWENTYFOUR = new BN(24);
12245 var MillerRabin = __webpack_require__(114);
12246 var millerRabin = new MillerRabin();
12247 var ONE = new BN(1);
12248 var TWO = new BN(2);
12249 var FIVE = new BN(5);
12250 var SIXTEEN = new BN(16);
12251 var EIGHT = new BN(8);
12252 var TEN = new BN(10);
12253 var THREE = new BN(3);
12254 var SEVEN = new BN(7);
12255 var ELEVEN = new BN(11);
12256 var FOUR = new BN(4);
12257 var TWELVE = new BN(12);
12260 function _getPrimes() {
12261 if (primes !== null)
12264 var limit = 0x100000;
12267 for (var i = 1, k = 3; k < limit; k += 2) {
12268 var sqrt = Math.ceil(Math.sqrt(k));
12269 for (var j = 0; j < i && res[j] <= sqrt; j++)
12270 if (k % res[j] === 0)
12273 if (i !== j && res[j] <= sqrt)
12282 function simpleSieve(p) {
12283 var primes = _getPrimes();
12285 for (var i = 0; i < primes.length; i++)
12286 if (p.modn(primes[i]) === 0) {
12287 if (p.cmpn(primes[i]) === 0) {
12297 function fermatTest(p) {
12298 var red = BN.mont(p);
12299 return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;
12302 function findPrime(bits, gen) {
12304 // this is what openssl does
12305 if (gen === 2 || gen === 5) {
12306 return new BN([0x8c, 0x7b]);
12308 return new BN([0x8c, 0x27]);
12316 num = new BN(randomBytes(Math.ceil(bits / 8)));
12317 while (num.bitLength() > bits) {
12320 if (num.isEven()) {
12323 if (!num.testn(1)) {
12326 if (!gen.cmp(TWO)) {
12327 while (num.mod(TWENTYFOUR).cmp(ELEVEN)) {
12330 } else if (!gen.cmp(FIVE)) {
12331 while (num.mod(TEN).cmp(THREE)) {
12336 if (simpleSieve(n2) && simpleSieve(num) &&
12337 fermatTest(n2) && fermatTest(num) &&
12338 millerRabin.test(n2) && millerRabin.test(num)) {
12348 /***/ (function(module, exports, __webpack_require__) {
12350 var bn = __webpack_require__(4);
12351 var brorand = __webpack_require__(115);
12353 function MillerRabin(rand) {
12354 this.rand = rand || new brorand.Rand();
12356 module.exports = MillerRabin;
12358 MillerRabin.create = function create(rand) {
12359 return new MillerRabin(rand);
12362 MillerRabin.prototype._randbelow = function _randbelow(n) {
12363 var len = n.bitLength();
12364 var min_bytes = Math.ceil(len / 8);
12366 // Generage random bytes until a number less than n is found.
12367 // This ensures that 0..n-1 have an equal probability of being selected.
12369 var a = new bn(this.rand.generate(min_bytes));
12370 while (a.cmp(n) >= 0);
12375 MillerRabin.prototype._randrange = function _randrange(start, stop) {
12376 // Generate a random number greater than or equal to start and less than stop.
12377 var size = stop.sub(start);
12378 return start.add(this._randbelow(size));
12381 MillerRabin.prototype.test = function test(n, k, cb) {
12382 var len = n.bitLength();
12383 var red = bn.mont(n);
12384 var rone = new bn(1).toRed(red);
12387 k = Math.max(1, (len / 48) | 0);
12389 // Find d and s, (n - 1) = (2 ^ s) * d;
12390 var n1 = n.subn(1);
12391 for (var s = 0; !n1.testn(s); s++) {}
12394 var rn1 = n1.toRed(red);
12397 for (; k > 0; k--) {
12398 var a = this._randrange(new bn(2), n1);
12402 var x = a.toRed(red).redPow(d);
12403 if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)
12406 for (var i = 1; i < s; i++) {
12409 if (x.cmp(rone) === 0)
12411 if (x.cmp(rn1) === 0)
12422 MillerRabin.prototype.getDivisor = function getDivisor(n, k) {
12423 var len = n.bitLength();
12424 var red = bn.mont(n);
12425 var rone = new bn(1).toRed(red);
12428 k = Math.max(1, (len / 48) | 0);
12430 // Find d and s, (n - 1) = (2 ^ s) * d;
12431 var n1 = n.subn(1);
12432 for (var s = 0; !n1.testn(s); s++) {}
12435 var rn1 = n1.toRed(red);
12437 for (; k > 0; k--) {
12438 var a = this._randrange(new bn(2), n1);
12441 if (g.cmpn(1) !== 0)
12444 var x = a.toRed(red).redPow(d);
12445 if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)
12448 for (var i = 1; i < s; i++) {
12451 if (x.cmp(rone) === 0)
12452 return x.fromRed().subn(1).gcd(n);
12453 if (x.cmp(rn1) === 0)
12459 return x.fromRed().subn(1).gcd(n);
12469 /***/ (function(module, exports, __webpack_require__) {
12473 module.exports = function rand(len) {
12475 r = new Rand(null);
12477 return r.generate(len);
12480 function Rand(rand) {
12483 module.exports.Rand = Rand;
12485 Rand.prototype.generate = function generate(len) {
12486 return this._rand(len);
12489 // Emulate crypto API using randy
12490 Rand.prototype._rand = function _rand(n) {
12491 if (this.rand.getBytes)
12492 return this.rand.getBytes(n);
12494 var res = new Uint8Array(n);
12495 for (var i = 0; i < res.length; i++)
12496 res[i] = this.rand.getByte();
12500 if (typeof self === 'object') {
12501 if (self.crypto && self.crypto.getRandomValues) {
12503 Rand.prototype._rand = function _rand(n) {
12504 var arr = new Uint8Array(n);
12505 self.crypto.getRandomValues(arr);
12508 } else if (self.msCrypto && self.msCrypto.getRandomValues) {
12510 Rand.prototype._rand = function _rand(n) {
12511 var arr = new Uint8Array(n);
12512 self.msCrypto.getRandomValues(arr);
12516 // Safari's WebWorkers do not have `crypto`
12517 } else if (typeof window === 'object') {
12519 Rand.prototype._rand = function() {
12520 throw new Error('Not implemented yet');
12524 // Node.js or Web worker with no crypto support
12526 var crypto = __webpack_require__(218);
12527 if (typeof crypto.randomBytes !== 'function')
12528 throw new Error('Not supported');
12530 Rand.prototype._rand = function _rand(n) {
12531 return crypto.randomBytes(n);
12540 /***/ (function(module, exports, __webpack_require__) {
12545 var utils = exports;
12547 function toArray(msg, enc) {
12548 if (Array.isArray(msg))
12549 return msg.slice();
12553 if (typeof msg !== 'string') {
12554 for (var i = 0; i < msg.length; i++)
12555 res[i] = msg[i] | 0;
12558 if (enc === 'hex') {
12559 msg = msg.replace(/[^a-z0-9]+/ig, '');
12560 if (msg.length % 2 !== 0)
12562 for (var i = 0; i < msg.length; i += 2)
12563 res.push(parseInt(msg[i] + msg[i + 1], 16));
12565 for (var i = 0; i < msg.length; i++) {
12566 var c = msg.charCodeAt(i);
12577 utils.toArray = toArray;
12579 function zero2(word) {
12580 if (word.length === 1)
12585 utils.zero2 = zero2;
12587 function toHex(msg) {
12589 for (var i = 0; i < msg.length; i++)
12590 res += zero2(msg[i].toString(16));
12593 utils.toHex = toHex;
12595 utils.encode = function encode(arr, enc) {
12605 /***/ (function(module, exports, __webpack_require__) {
12610 var utils = __webpack_require__(11);
12611 var rotr32 = utils.rotr32;
12613 function ft_1(s, x, y, z) {
12615 return ch32(x, y, z);
12616 if (s === 1 || s === 3)
12617 return p32(x, y, z);
12619 return maj32(x, y, z);
12621 exports.ft_1 = ft_1;
12623 function ch32(x, y, z) {
12624 return (x & y) ^ ((~x) & z);
12626 exports.ch32 = ch32;
12628 function maj32(x, y, z) {
12629 return (x & y) ^ (x & z) ^ (y & z);
12631 exports.maj32 = maj32;
12633 function p32(x, y, z) {
12638 function s0_256(x) {
12639 return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);
12641 exports.s0_256 = s0_256;
12643 function s1_256(x) {
12644 return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);
12646 exports.s1_256 = s1_256;
12648 function g0_256(x) {
12649 return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);
12651 exports.g0_256 = g0_256;
12653 function g1_256(x) {
12654 return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);
12656 exports.g1_256 = g1_256;
12661 /***/ (function(module, exports, __webpack_require__) {
12666 var utils = __webpack_require__(11);
12667 var common = __webpack_require__(32);
12668 var shaCommon = __webpack_require__(117);
12669 var assert = __webpack_require__(9);
12671 var sum32 = utils.sum32;
12672 var sum32_4 = utils.sum32_4;
12673 var sum32_5 = utils.sum32_5;
12674 var ch32 = shaCommon.ch32;
12675 var maj32 = shaCommon.maj32;
12676 var s0_256 = shaCommon.s0_256;
12677 var s1_256 = shaCommon.s1_256;
12678 var g0_256 = shaCommon.g0_256;
12679 var g1_256 = shaCommon.g1_256;
12681 var BlockHash = common.BlockHash;
12684 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
12685 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
12686 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
12687 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
12688 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
12689 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
12690 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
12691 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
12692 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
12693 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
12694 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
12695 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
12696 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
12697 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
12698 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
12699 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
12702 function SHA256() {
12703 if (!(this instanceof SHA256))
12704 return new SHA256();
12706 BlockHash.call(this);
12708 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
12709 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
12712 this.W = new Array(64);
12714 utils.inherits(SHA256, BlockHash);
12715 module.exports = SHA256;
12717 SHA256.blockSize = 512;
12718 SHA256.outSize = 256;
12719 SHA256.hmacStrength = 192;
12720 SHA256.padLength = 64;
12722 SHA256.prototype._update = function _update(msg, start) {
12725 for (var i = 0; i < 16; i++)
12726 W[i] = msg[start + i];
12727 for (; i < W.length; i++)
12728 W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);
12739 assert(this.k.length === W.length);
12740 for (i = 0; i < W.length; i++) {
12741 var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);
12742 var T2 = sum32(s0_256(a), maj32(a, b, c));
12753 this.h[0] = sum32(this.h[0], a);
12754 this.h[1] = sum32(this.h[1], b);
12755 this.h[2] = sum32(this.h[2], c);
12756 this.h[3] = sum32(this.h[3], d);
12757 this.h[4] = sum32(this.h[4], e);
12758 this.h[5] = sum32(this.h[5], f);
12759 this.h[6] = sum32(this.h[6], g);
12760 this.h[7] = sum32(this.h[7], h);
12763 SHA256.prototype._digest = function digest(enc) {
12765 return utils.toHex32(this.h, 'big');
12767 return utils.split32(this.h, 'big');
12773 /***/ (function(module, exports, __webpack_require__) {
12778 var utils = __webpack_require__(11);
12779 var common = __webpack_require__(32);
12780 var assert = __webpack_require__(9);
12782 var rotr64_hi = utils.rotr64_hi;
12783 var rotr64_lo = utils.rotr64_lo;
12784 var shr64_hi = utils.shr64_hi;
12785 var shr64_lo = utils.shr64_lo;
12786 var sum64 = utils.sum64;
12787 var sum64_hi = utils.sum64_hi;
12788 var sum64_lo = utils.sum64_lo;
12789 var sum64_4_hi = utils.sum64_4_hi;
12790 var sum64_4_lo = utils.sum64_4_lo;
12791 var sum64_5_hi = utils.sum64_5_hi;
12792 var sum64_5_lo = utils.sum64_5_lo;
12794 var BlockHash = common.BlockHash;
12797 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
12798 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
12799 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
12800 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
12801 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
12802 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
12803 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
12804 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
12805 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
12806 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
12807 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
12808 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
12809 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
12810 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
12811 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
12812 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
12813 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
12814 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
12815 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
12816 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
12817 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
12818 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
12819 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
12820 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
12821 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
12822 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
12823 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
12824 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
12825 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
12826 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
12827 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
12828 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
12829 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
12830 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
12831 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
12832 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
12833 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
12834 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
12835 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
12836 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
12839 function SHA512() {
12840 if (!(this instanceof SHA512))
12841 return new SHA512();
12843 BlockHash.call(this);
12845 0x6a09e667, 0xf3bcc908,
12846 0xbb67ae85, 0x84caa73b,
12847 0x3c6ef372, 0xfe94f82b,
12848 0xa54ff53a, 0x5f1d36f1,
12849 0x510e527f, 0xade682d1,
12850 0x9b05688c, 0x2b3e6c1f,
12851 0x1f83d9ab, 0xfb41bd6b,
12852 0x5be0cd19, 0x137e2179 ];
12854 this.W = new Array(160);
12856 utils.inherits(SHA512, BlockHash);
12857 module.exports = SHA512;
12859 SHA512.blockSize = 1024;
12860 SHA512.outSize = 512;
12861 SHA512.hmacStrength = 192;
12862 SHA512.padLength = 128;
12864 SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {
12867 // 32 x 32bit words
12868 for (var i = 0; i < 32; i++)
12869 W[i] = msg[start + i];
12870 for (; i < W.length; i += 2) {
12871 var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2
12872 var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);
12873 var c1_hi = W[i - 14]; // i - 7
12874 var c1_lo = W[i - 13];
12875 var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15
12876 var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);
12877 var c3_hi = W[i - 32]; // i - 16
12878 var c3_lo = W[i - 31];
12885 W[i + 1] = sum64_4_lo(
12893 SHA512.prototype._update = function _update(msg, start) {
12894 this._prepareBlock(msg, start);
12898 var ah = this.h[0];
12899 var al = this.h[1];
12900 var bh = this.h[2];
12901 var bl = this.h[3];
12902 var ch = this.h[4];
12903 var cl = this.h[5];
12904 var dh = this.h[6];
12905 var dl = this.h[7];
12906 var eh = this.h[8];
12907 var el = this.h[9];
12908 var fh = this.h[10];
12909 var fl = this.h[11];
12910 var gh = this.h[12];
12911 var gl = this.h[13];
12912 var hh = this.h[14];
12913 var hl = this.h[15];
12915 assert(this.k.length === W.length);
12916 for (var i = 0; i < W.length; i += 2) {
12919 var c1_hi = s1_512_hi(eh, el);
12920 var c1_lo = s1_512_lo(eh, el);
12921 var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);
12922 var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);
12923 var c3_hi = this.k[i];
12924 var c3_lo = this.k[i + 1];
12926 var c4_lo = W[i + 1];
12928 var T1_hi = sum64_5_hi(
12934 var T1_lo = sum64_5_lo(
12941 c0_hi = s0_512_hi(ah, al);
12942 c0_lo = s0_512_lo(ah, al);
12943 c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);
12944 c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);
12946 var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);
12947 var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);
12958 eh = sum64_hi(dh, dl, T1_hi, T1_lo);
12959 el = sum64_lo(dl, dl, T1_hi, T1_lo);
12970 ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);
12971 al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);
12974 sum64(this.h, 0, ah, al);
12975 sum64(this.h, 2, bh, bl);
12976 sum64(this.h, 4, ch, cl);
12977 sum64(this.h, 6, dh, dl);
12978 sum64(this.h, 8, eh, el);
12979 sum64(this.h, 10, fh, fl);
12980 sum64(this.h, 12, gh, gl);
12981 sum64(this.h, 14, hh, hl);
12984 SHA512.prototype._digest = function digest(enc) {
12986 return utils.toHex32(this.h, 'big');
12988 return utils.split32(this.h, 'big');
12991 function ch64_hi(xh, xl, yh, yl, zh) {
12992 var r = (xh & yh) ^ ((~xh) & zh);
12998 function ch64_lo(xh, xl, yh, yl, zh, zl) {
12999 var r = (xl & yl) ^ ((~xl) & zl);
13005 function maj64_hi(xh, xl, yh, yl, zh) {
13006 var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);
13012 function maj64_lo(xh, xl, yh, yl, zh, zl) {
13013 var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);
13019 function s0_512_hi(xh, xl) {
13020 var c0_hi = rotr64_hi(xh, xl, 28);
13021 var c1_hi = rotr64_hi(xl, xh, 2); // 34
13022 var c2_hi = rotr64_hi(xl, xh, 7); // 39
13024 var r = c0_hi ^ c1_hi ^ c2_hi;
13030 function s0_512_lo(xh, xl) {
13031 var c0_lo = rotr64_lo(xh, xl, 28);
13032 var c1_lo = rotr64_lo(xl, xh, 2); // 34
13033 var c2_lo = rotr64_lo(xl, xh, 7); // 39
13035 var r = c0_lo ^ c1_lo ^ c2_lo;
13041 function s1_512_hi(xh, xl) {
13042 var c0_hi = rotr64_hi(xh, xl, 14);
13043 var c1_hi = rotr64_hi(xh, xl, 18);
13044 var c2_hi = rotr64_hi(xl, xh, 9); // 41
13046 var r = c0_hi ^ c1_hi ^ c2_hi;
13052 function s1_512_lo(xh, xl) {
13053 var c0_lo = rotr64_lo(xh, xl, 14);
13054 var c1_lo = rotr64_lo(xh, xl, 18);
13055 var c2_lo = rotr64_lo(xl, xh, 9); // 41
13057 var r = c0_lo ^ c1_lo ^ c2_lo;
13063 function g0_512_hi(xh, xl) {
13064 var c0_hi = rotr64_hi(xh, xl, 1);
13065 var c1_hi = rotr64_hi(xh, xl, 8);
13066 var c2_hi = shr64_hi(xh, xl, 7);
13068 var r = c0_hi ^ c1_hi ^ c2_hi;
13074 function g0_512_lo(xh, xl) {
13075 var c0_lo = rotr64_lo(xh, xl, 1);
13076 var c1_lo = rotr64_lo(xh, xl, 8);
13077 var c2_lo = shr64_lo(xh, xl, 7);
13079 var r = c0_lo ^ c1_lo ^ c2_lo;
13085 function g1_512_hi(xh, xl) {
13086 var c0_hi = rotr64_hi(xh, xl, 19);
13087 var c1_hi = rotr64_hi(xl, xh, 29); // 61
13088 var c2_hi = shr64_hi(xh, xl, 6);
13090 var r = c0_hi ^ c1_hi ^ c2_hi;
13096 function g1_512_lo(xh, xl) {
13097 var c0_lo = rotr64_lo(xh, xl, 19);
13098 var c1_lo = rotr64_lo(xl, xh, 29); // 61
13099 var c2_lo = shr64_lo(xh, xl, 6);
13101 var r = c0_lo ^ c1_lo ^ c2_lo;
13110 /***/ (function(module, exports, __webpack_require__) {
13112 var inherits = __webpack_require__(1);
13113 var Reporter = __webpack_require__(34).Reporter;
13114 var Buffer = __webpack_require__(3).Buffer;
13116 function DecoderBuffer(base, options) {
13117 Reporter.call(this, options);
13118 if (!Buffer.isBuffer(base)) {
13119 this.error('Input not Buffer');
13125 this.length = base.length;
13127 inherits(DecoderBuffer, Reporter);
13128 exports.DecoderBuffer = DecoderBuffer;
13130 DecoderBuffer.prototype.save = function save() {
13131 return { offset: this.offset, reporter: Reporter.prototype.save.call(this) };
13134 DecoderBuffer.prototype.restore = function restore(save) {
13135 // Return skipped data
13136 var res = new DecoderBuffer(this.base);
13137 res.offset = save.offset;
13138 res.length = this.offset;
13140 this.offset = save.offset;
13141 Reporter.prototype.restore.call(this, save.reporter);
13146 DecoderBuffer.prototype.isEmpty = function isEmpty() {
13147 return this.offset === this.length;
13150 DecoderBuffer.prototype.readUInt8 = function readUInt8(fail) {
13151 if (this.offset + 1 <= this.length)
13152 return this.base.readUInt8(this.offset++, true);
13154 return this.error(fail || 'DecoderBuffer overrun');
13157 DecoderBuffer.prototype.skip = function skip(bytes, fail) {
13158 if (!(this.offset + bytes <= this.length))
13159 return this.error(fail || 'DecoderBuffer overrun');
13161 var res = new DecoderBuffer(this.base);
13163 // Share reporter state
13164 res._reporterState = this._reporterState;
13166 res.offset = this.offset;
13167 res.length = this.offset + bytes;
13168 this.offset += bytes;
13172 DecoderBuffer.prototype.raw = function raw(save) {
13173 return this.base.slice(save ? save.offset : this.offset, this.length);
13176 function EncoderBuffer(value, reporter) {
13177 if (Array.isArray(value)) {
13179 this.value = value.map(function(item) {
13180 if (!(item instanceof EncoderBuffer))
13181 item = new EncoderBuffer(item, reporter);
13182 this.length += item.length;
13185 } else if (typeof value === 'number') {
13186 if (!(0 <= value && value <= 0xff))
13187 return reporter.error('non-byte EncoderBuffer value');
13188 this.value = value;
13190 } else if (typeof value === 'string') {
13191 this.value = value;
13192 this.length = Buffer.byteLength(value);
13193 } else if (Buffer.isBuffer(value)) {
13194 this.value = value;
13195 this.length = value.length;
13197 return reporter.error('Unsupported type: ' + typeof value);
13200 exports.EncoderBuffer = EncoderBuffer;
13202 EncoderBuffer.prototype.join = function join(out, offset) {
13204 out = new Buffer(this.length);
13208 if (this.length === 0)
13211 if (Array.isArray(this.value)) {
13212 this.value.forEach(function(item) {
13213 item.join(out, offset);
13214 offset += item.length;
13217 if (typeof this.value === 'number')
13218 out[offset] = this.value;
13219 else if (typeof this.value === 'string')
13220 out.write(this.value, offset);
13221 else if (Buffer.isBuffer(this.value))
13222 this.value.copy(out, offset);
13223 offset += this.length;
13232 /***/ (function(module, exports, __webpack_require__) {
13234 var constants = exports;
13237 constants._reverse = function reverse(map) {
13240 Object.keys(map).forEach(function(key) {
13241 // Convert key to integer if it is stringified
13242 if ((key | 0) == key)
13245 var value = map[key];
13252 constants.der = __webpack_require__(250);
13257 /***/ (function(module, exports, __webpack_require__) {
13259 var inherits = __webpack_require__(1);
13261 var asn1 = __webpack_require__(33);
13262 var base = asn1.base;
13263 var bignum = asn1.bignum;
13265 // Import DER constants
13266 var der = asn1.constants.der;
13268 function DERDecoder(entity) {
13270 this.name = entity.name;
13271 this.entity = entity;
13273 // Construct base tree
13274 this.tree = new DERNode();
13275 this.tree._init(entity.body);
13277 module.exports = DERDecoder;
13279 DERDecoder.prototype.decode = function decode(data, options) {
13280 if (!(data instanceof base.DecoderBuffer))
13281 data = new base.DecoderBuffer(data, options);
13283 return this.tree._decode(data, options);
13288 function DERNode(parent) {
13289 base.Node.call(this, 'der', parent);
13291 inherits(DERNode, base.Node);
13293 DERNode.prototype._peekTag = function peekTag(buffer, tag, any) {
13294 if (buffer.isEmpty())
13297 var state = buffer.save();
13298 var decodedTag = derDecodeTag(buffer, 'Failed to peek tag: "' + tag + '"');
13299 if (buffer.isError(decodedTag))
13302 buffer.restore(state);
13304 return decodedTag.tag === tag || decodedTag.tagStr === tag ||
13305 (decodedTag.tagStr + 'of') === tag || any;
13308 DERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) {
13309 var decodedTag = derDecodeTag(buffer,
13310 'Failed to decode tag of "' + tag + '"');
13311 if (buffer.isError(decodedTag))
13314 var len = derDecodeLen(buffer,
13315 decodedTag.primitive,
13316 'Failed to get length of "' + tag + '"');
13319 if (buffer.isError(len))
13323 decodedTag.tag !== tag &&
13324 decodedTag.tagStr !== tag &&
13325 decodedTag.tagStr + 'of' !== tag) {
13326 return buffer.error('Failed to match tag: "' + tag + '"');
13329 if (decodedTag.primitive || len !== null)
13330 return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
13332 // Indefinite length... find END tag
13333 var state = buffer.save();
13334 var res = this._skipUntilEnd(
13336 'Failed to skip indefinite length body: "' + this.tag + '"');
13337 if (buffer.isError(res))
13340 len = buffer.offset - state.offset;
13341 buffer.restore(state);
13342 return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
13345 DERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) {
13347 var tag = derDecodeTag(buffer, fail);
13348 if (buffer.isError(tag))
13350 var len = derDecodeLen(buffer, tag.primitive, fail);
13351 if (buffer.isError(len))
13355 if (tag.primitive || len !== null)
13356 res = buffer.skip(len)
13358 res = this._skipUntilEnd(buffer, fail);
13361 if (buffer.isError(res))
13364 if (tag.tagStr === 'end')
13369 DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder,
13372 while (!buffer.isEmpty()) {
13373 var possibleEnd = this._peekTag(buffer, 'end');
13374 if (buffer.isError(possibleEnd))
13375 return possibleEnd;
13377 var res = decoder.decode(buffer, 'der', options);
13378 if (buffer.isError(res) && possibleEnd)
13385 DERNode.prototype._decodeStr = function decodeStr(buffer, tag) {
13386 if (tag === 'bitstr') {
13387 var unused = buffer.readUInt8();
13388 if (buffer.isError(unused))
13390 return { unused: unused, data: buffer.raw() };
13391 } else if (tag === 'bmpstr') {
13392 var raw = buffer.raw();
13393 if (raw.length % 2 === 1)
13394 return buffer.error('Decoding of string type: bmpstr length mismatch');
13397 for (var i = 0; i < raw.length / 2; i++) {
13398 str += String.fromCharCode(raw.readUInt16BE(i * 2));
13401 } else if (tag === 'numstr') {
13402 var numstr = buffer.raw().toString('ascii');
13403 if (!this._isNumstr(numstr)) {
13404 return buffer.error('Decoding of string type: ' +
13405 'numstr unsupported characters');
13408 } else if (tag === 'octstr') {
13409 return buffer.raw();
13410 } else if (tag === 'objDesc') {
13411 return buffer.raw();
13412 } else if (tag === 'printstr') {
13413 var printstr = buffer.raw().toString('ascii');
13414 if (!this._isPrintstr(printstr)) {
13415 return buffer.error('Decoding of string type: ' +
13416 'printstr unsupported characters');
13419 } else if (/str$/.test(tag)) {
13420 return buffer.raw().toString();
13422 return buffer.error('Decoding of string type: ' + tag + ' unsupported');
13426 DERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) {
13428 var identifiers = [];
13430 while (!buffer.isEmpty()) {
13431 var subident = buffer.readUInt8();
13433 ident |= subident & 0x7f;
13434 if ((subident & 0x80) === 0) {
13435 identifiers.push(ident);
13439 if (subident & 0x80)
13440 identifiers.push(ident);
13442 var first = (identifiers[0] / 40) | 0;
13443 var second = identifiers[0] % 40;
13446 result = identifiers;
13448 result = [first, second].concat(identifiers.slice(1));
13451 var tmp = values[result.join(' ')];
13452 if (tmp === undefined)
13453 tmp = values[result.join('.')];
13454 if (tmp !== undefined)
13461 DERNode.prototype._decodeTime = function decodeTime(buffer, tag) {
13462 var str = buffer.raw().toString();
13463 if (tag === 'gentime') {
13464 var year = str.slice(0, 4) | 0;
13465 var mon = str.slice(4, 6) | 0;
13466 var day = str.slice(6, 8) | 0;
13467 var hour = str.slice(8, 10) | 0;
13468 var min = str.slice(10, 12) | 0;
13469 var sec = str.slice(12, 14) | 0;
13470 } else if (tag === 'utctime') {
13471 var year = str.slice(0, 2) | 0;
13472 var mon = str.slice(2, 4) | 0;
13473 var day = str.slice(4, 6) | 0;
13474 var hour = str.slice(6, 8) | 0;
13475 var min = str.slice(8, 10) | 0;
13476 var sec = str.slice(10, 12) | 0;
13478 year = 2000 + year;
13480 year = 1900 + year;
13482 return buffer.error('Decoding ' + tag + ' time is not supported yet');
13485 return Date.UTC(year, mon - 1, day, hour, min, sec, 0);
13488 DERNode.prototype._decodeNull = function decodeNull(buffer) {
13492 DERNode.prototype._decodeBool = function decodeBool(buffer) {
13493 var res = buffer.readUInt8();
13494 if (buffer.isError(res))
13500 DERNode.prototype._decodeInt = function decodeInt(buffer, values) {
13501 // Bigint, return as it is (assume big endian)
13502 var raw = buffer.raw();
13503 var res = new bignum(raw);
13506 res = values[res.toString(10)] || res;
13511 DERNode.prototype._use = function use(entity, obj) {
13512 if (typeof entity === 'function')
13513 entity = entity(obj);
13514 return entity._getDecoder('der').tree;
13519 function derDecodeTag(buf, fail) {
13520 var tag = buf.readUInt8(fail);
13521 if (buf.isError(tag))
13524 var cls = der.tagClass[tag >> 6];
13525 var primitive = (tag & 0x20) === 0;
13527 // Multi-octet tag - load
13528 if ((tag & 0x1f) === 0x1f) {
13531 while ((oct & 0x80) === 0x80) {
13532 oct = buf.readUInt8(fail);
13533 if (buf.isError(oct))
13542 var tagStr = der.tag[tag];
13546 primitive: primitive,
13552 function derDecodeLen(buf, primitive, fail) {
13553 var len = buf.readUInt8(fail);
13554 if (buf.isError(len))
13558 if (!primitive && len === 0x80)
13562 if ((len & 0x80) === 0) {
13568 var num = len & 0x7f;
13570 return buf.error('length octect is too long');
13573 for (var i = 0; i < num; i++) {
13575 var j = buf.readUInt8(fail);
13576 if (buf.isError(j))
13587 /***/ (function(module, exports, __webpack_require__) {
13589 var inherits = __webpack_require__(1);
13590 var Buffer = __webpack_require__(3).Buffer;
13592 var asn1 = __webpack_require__(33);
13593 var base = asn1.base;
13595 // Import DER constants
13596 var der = asn1.constants.der;
13598 function DEREncoder(entity) {
13600 this.name = entity.name;
13601 this.entity = entity;
13603 // Construct base tree
13604 this.tree = new DERNode();
13605 this.tree._init(entity.body);
13607 module.exports = DEREncoder;
13609 DEREncoder.prototype.encode = function encode(data, reporter) {
13610 return this.tree._encode(data, reporter).join();
13615 function DERNode(parent) {
13616 base.Node.call(this, 'der', parent);
13618 inherits(DERNode, base.Node);
13620 DERNode.prototype._encodeComposite = function encodeComposite(tag,
13624 var encodedTag = encodeTag(tag, primitive, cls, this.reporter);
13627 if (content.length < 0x80) {
13628 var header = new Buffer(2);
13629 header[0] = encodedTag;
13630 header[1] = content.length;
13631 return this._createEncoderBuffer([ header, content ]);
13635 // Count octets required to store length
13637 for (var i = content.length; i >= 0x100; i >>= 8)
13640 var header = new Buffer(1 + 1 + lenOctets);
13641 header[0] = encodedTag;
13642 header[1] = 0x80 | lenOctets;
13644 for (var i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8)
13645 header[i] = j & 0xff;
13647 return this._createEncoderBuffer([ header, content ]);
13650 DERNode.prototype._encodeStr = function encodeStr(str, tag) {
13651 if (tag === 'bitstr') {
13652 return this._createEncoderBuffer([ str.unused | 0, str.data ]);
13653 } else if (tag === 'bmpstr') {
13654 var buf = new Buffer(str.length * 2);
13655 for (var i = 0; i < str.length; i++) {
13656 buf.writeUInt16BE(str.charCodeAt(i), i * 2);
13658 return this._createEncoderBuffer(buf);
13659 } else if (tag === 'numstr') {
13660 if (!this._isNumstr(str)) {
13661 return this.reporter.error('Encoding of string type: numstr supports ' +
13662 'only digits and space');
13664 return this._createEncoderBuffer(str);
13665 } else if (tag === 'printstr') {
13666 if (!this._isPrintstr(str)) {
13667 return this.reporter.error('Encoding of string type: printstr supports ' +
13668 'only latin upper and lower case letters, ' +
13669 'digits, space, apostrophe, left and rigth ' +
13670 'parenthesis, plus sign, comma, hyphen, ' +
13671 'dot, slash, colon, equal sign, ' +
13674 return this._createEncoderBuffer(str);
13675 } else if (/str$/.test(tag)) {
13676 return this._createEncoderBuffer(str);
13677 } else if (tag === 'objDesc') {
13678 return this._createEncoderBuffer(str);
13680 return this.reporter.error('Encoding of string type: ' + tag +
13685 DERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {
13686 if (typeof id === 'string') {
13688 return this.reporter.error('string objid given, but no values map found');
13689 if (!values.hasOwnProperty(id))
13690 return this.reporter.error('objid not found in values map');
13691 id = values[id].split(/[\s\.]+/g);
13692 for (var i = 0; i < id.length; i++)
13694 } else if (Array.isArray(id)) {
13696 for (var i = 0; i < id.length; i++)
13700 if (!Array.isArray(id)) {
13701 return this.reporter.error('objid() should be either array or string, ' +
13702 'got: ' + JSON.stringify(id));
13707 return this.reporter.error('Second objid identifier OOB');
13708 id.splice(0, 2, id[0] * 40 + id[1]);
13711 // Count number of octets
13713 for (var i = 0; i < id.length; i++) {
13715 for (size++; ident >= 0x80; ident >>= 7)
13719 var objid = new Buffer(size);
13720 var offset = objid.length - 1;
13721 for (var i = id.length - 1; i >= 0; i--) {
13723 objid[offset--] = ident & 0x7f;
13724 while ((ident >>= 7) > 0)
13725 objid[offset--] = 0x80 | (ident & 0x7f);
13728 return this._createEncoderBuffer(objid);
13731 function two(num) {
13738 DERNode.prototype._encodeTime = function encodeTime(time, tag) {
13740 var date = new Date(time);
13742 if (tag === 'gentime') {
13744 two(date.getFullYear()),
13745 two(date.getUTCMonth() + 1),
13746 two(date.getUTCDate()),
13747 two(date.getUTCHours()),
13748 two(date.getUTCMinutes()),
13749 two(date.getUTCSeconds()),
13752 } else if (tag === 'utctime') {
13754 two(date.getFullYear() % 100),
13755 two(date.getUTCMonth() + 1),
13756 two(date.getUTCDate()),
13757 two(date.getUTCHours()),
13758 two(date.getUTCMinutes()),
13759 two(date.getUTCSeconds()),
13763 this.reporter.error('Encoding ' + tag + ' time is not supported yet');
13766 return this._encodeStr(str, 'octstr');
13769 DERNode.prototype._encodeNull = function encodeNull() {
13770 return this._createEncoderBuffer('');
13773 DERNode.prototype._encodeInt = function encodeInt(num, values) {
13774 if (typeof num === 'string') {
13776 return this.reporter.error('String int or enum given, but no values map');
13777 if (!values.hasOwnProperty(num)) {
13778 return this.reporter.error('Values map doesn\'t contain: ' +
13779 JSON.stringify(num));
13784 // Bignum, assume big endian
13785 if (typeof num !== 'number' && !Buffer.isBuffer(num)) {
13786 var numArray = num.toArray();
13787 if (!num.sign && numArray[0] & 0x80) {
13788 numArray.unshift(0);
13790 num = new Buffer(numArray);
13793 if (Buffer.isBuffer(num)) {
13794 var size = num.length;
13795 if (num.length === 0)
13798 var out = new Buffer(size);
13800 if (num.length === 0)
13802 return this._createEncoderBuffer(out);
13806 return this._createEncoderBuffer(num);
13809 return this._createEncoderBuffer([0, num]);
13812 for (var i = num; i >= 0x100; i >>= 8)
13815 var out = new Array(size);
13816 for (var i = out.length - 1; i >= 0; i--) {
13817 out[i] = num & 0xff;
13820 if(out[0] & 0x80) {
13824 return this._createEncoderBuffer(new Buffer(out));
13827 DERNode.prototype._encodeBool = function encodeBool(value) {
13828 return this._createEncoderBuffer(value ? 0xff : 0);
13831 DERNode.prototype._use = function use(entity, obj) {
13832 if (typeof entity === 'function')
13833 entity = entity(obj);
13834 return entity._getEncoder('der').tree;
13837 DERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {
13838 var state = this._baseState;
13840 if (state['default'] === null)
13843 var data = dataBuffer.join();
13844 if (state.defaultBuffer === undefined)
13845 state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();
13847 if (data.length !== state.defaultBuffer.length)
13850 for (i=0; i < data.length; i++)
13851 if (data[i] !== state.defaultBuffer[i])
13859 function encodeTag(tag, primitive, cls, reporter) {
13862 if (tag === 'seqof')
13864 else if (tag === 'setof')
13867 if (der.tagByName.hasOwnProperty(tag))
13868 res = der.tagByName[tag];
13869 else if (typeof tag === 'number' && (tag | 0) === tag)
13872 return reporter.error('Unknown tag: ' + tag);
13875 return reporter.error('Multi-octet tag encoding unsupported');
13880 res |= (der.tagClassByName[cls || 'universal'] << 6);
13888 /***/ (function(module, exports) {
13890 module.exports = {"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}
13894 /***/ (function(module, exports, __webpack_require__) {
13896 /* WEBPACK VAR INJECTION */(function(Buffer) {var createHash = __webpack_require__(29);
13897 module.exports = function (seed, len) {
13898 var t = new Buffer('');
13900 while (t.length < len) {
13902 t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()]);
13904 return t.slice(0, len);
13907 function i2ops(c) {
13908 var out = new Buffer(4);
13909 out.writeUInt32BE(c,0);
13912 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
13916 /***/ (function(module, exports) {
13918 module.exports = function xor(a, b) {
13919 var len = a.length;
13921 while (++i < len) {
13929 /***/ (function(module, exports, __webpack_require__) {
13931 /* WEBPACK VAR INJECTION */(function(Buffer) {var bn = __webpack_require__(4);
13932 function withPublic(paddedMsg, key) {
13933 return new Buffer(paddedMsg
13934 .toRed(bn.mont(key.modulus))
13935 .redPow(new bn(key.publicExponent))
13940 module.exports = withPublic;
13941 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
13945 /***/ (function(module, exports) {
13947 module.exports = function(module) {
\r
13948 if(!module.webpackPolyfill) {
\r
13949 module.deprecate = function() {};
\r
13950 module.paths = [];
\r
13951 // module.parent = undefined by default
\r
13952 if(!module.children) module.children = [];
\r
13953 Object.defineProperty(module, "loaded", {
\r
13954 enumerable: true,
\r
13955 get: function() {
\r
13959 Object.defineProperty(module, "id", {
\r
13960 enumerable: true,
\r
13961 get: function() {
\r
13965 module.webpackPolyfill = 1;
\r
13973 /***/ (function(module, __webpack_exports__, __webpack_require__) {
13976 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ERROR; });
13977 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return PUSH_BYTOM; });
13978 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return UPDATE_BYTOM; });
13979 /* unused harmony export AUTHENTICATE */
13980 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return TRANSFER; });
13981 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ENABLE; });
13982 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ADVTRANSFER; });
13983 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return SIGNTRANSACTION; });
13984 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return SIGNMESSAGE; });
13985 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return SETCHAIN; });
13986 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return SEND; });
13987 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return LOAD; });
13988 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return UPDATE; });
13989 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return REQUEST_CURRENT_ACCOUNT; });
13990 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return REQUEST_CURRENT_NETWORK; });
13991 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return REQUEST_CURRENT_CHAIN_TYPE; });
13992 /* unused harmony export REQUEST_ACCOUNT_LIST */
13993 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return SET_PROMPT; });
13994 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return GET_PROMPT; });
13995 var ERROR = 'error';
13997 var PUSH_BYTOM = 'pushBytom';
13998 var UPDATE_BYTOM = 'updateBytom';
13999 var AUTHENTICATE = 'authenticate';
14000 var TRANSFER = 'transfer';
14001 var ENABLE = 'enable';
14002 var ADVTRANSFER = 'advTransfer';
14003 var SIGNTRANSACTION = 'signTransaction';
14004 var SIGNMESSAGE = 'signMessage';
14005 var SETCHAIN = 'setChain';
14008 var UPDATE = 'update';
14010 var REQUEST_CURRENT_ACCOUNT = 'defaultAccount';
14011 var REQUEST_CURRENT_NETWORK = 'currentNetwork';
14012 var REQUEST_CURRENT_CHAIN_TYPE = 'currentChain';
14013 var REQUEST_ACCOUNT_LIST = 'accountList';
14016 var SET_PROMPT = 'setPrompt';
14017 var GET_PROMPT = 'getPrompt';
14021 /***/ (function(module, exports, __webpack_require__) {
14023 module.exports = !__webpack_require__(17) && !__webpack_require__(22)(function () {
14024 return Object.defineProperty(__webpack_require__(50)('div'), 'a', { get: function () { return 7; } }).a != 7;
14030 /***/ (function(module, exports, __webpack_require__) {
14032 var has = __webpack_require__(20);
14033 var toIObject = __webpack_require__(25);
14034 var arrayIndexOf = __webpack_require__(150)(false);
14035 var IE_PROTO = __webpack_require__(53)('IE_PROTO');
14037 module.exports = function (object, names) {
14038 var O = toIObject(object);
14042 for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
14043 // Don't enum bug & hidden keys
14044 while (names.length > i) if (has(O, key = names[i++])) {
14045 ~arrayIndexOf(result, key) || result.push(key);
14053 /***/ (function(module, exports, __webpack_require__) {
14057 var $at = __webpack_require__(157)(true);
14059 // 21.1.3.27 String.prototype[@@iterator]()
14060 __webpack_require__(85)(String, 'String', function (iterated) {
14061 this._t = String(iterated); // target
14062 this._i = 0; // next index
14063 // 21.1.5.2.1 %StringIteratorPrototype%.next()
14066 var index = this._i;
14068 if (index >= O.length) return { value: undefined, done: true };
14069 point = $at(O, index);
14070 this._i += point.length;
14071 return { value: point, done: false };
14077 /***/ (function(module, exports, __webpack_require__) {
14079 // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
14080 var anObject = __webpack_require__(15);
14081 var dPs = __webpack_require__(159);
14082 var enumBugKeys = __webpack_require__(71);
14083 var IE_PROTO = __webpack_require__(53)('IE_PROTO');
14084 var Empty = function () { /* empty */ };
14085 var PROTOTYPE = 'prototype';
14087 // Create object with fake `null` prototype: use iframe Object with cleared prototype
14088 var createDict = function () {
14089 // Thrash, waste and sodomy: IE GC bug
14090 var iframe = __webpack_require__(50)('iframe');
14091 var i = enumBugKeys.length;
14094 var iframeDocument;
14095 iframe.style.display = 'none';
14096 __webpack_require__(86).appendChild(iframe);
14097 iframe.src = 'javascript:'; // eslint-disable-line no-script-url
14098 // createDict = iframe.contentWindow.Object;
14099 // html.removeChild(iframe);
14100 iframeDocument = iframe.contentWindow.document;
14101 iframeDocument.open();
14102 iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
14103 iframeDocument.close();
14104 createDict = iframeDocument.F;
14105 while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
14106 return createDict();
14109 module.exports = Object.create || function create(O, Properties) {
14112 Empty[PROTOTYPE] = anObject(O);
14113 result = new Empty();
14114 Empty[PROTOTYPE] = null;
14115 // add "__proto__" for Object.getPrototypeOf polyfill
14116 result[IE_PROTO] = O;
14117 } else result = createDict();
14118 return Properties === undefined ? result : dPs(result, Properties);
14124 /***/ (function(module, exports) {
14126 module.exports = function (it, Constructor, name, forbiddenField) {
14127 if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
14128 throw TypeError(name + ': incorrect invocation!');
14135 /***/ (function(module, exports, __webpack_require__) {
14137 var hide = __webpack_require__(19);
14138 module.exports = function (target, src, safe) {
14139 for (var key in src) {
14140 if (safe && target[key]) target[key] = src[key];
14141 else hide(target, key, src[key]);
14148 /***/ (function(module, exports, __webpack_require__) {
14150 module.exports = { "default": __webpack_require__(152), __esModule: true };
14154 /***/ (function(module, exports, __webpack_require__) {
14158 Object.defineProperty(exports, "__esModule", { value: true });
\r
14159 var EncryptedStream_1 = __webpack_require__(179);
\r
14160 exports.EncryptedStream = EncryptedStream_1.EncryptedStream;
\r
14161 var LocalStream_1 = __webpack_require__(264);
\r
14162 exports.LocalStream = LocalStream_1.LocalStream;
\r
14163 //# sourceMappingURL=index.js.map
14167 /***/ (function(module, exports, __webpack_require__) {
14169 module.exports = __webpack_require__(154);
14174 /***/ (function(module, exports, __webpack_require__) {
14179 exports.__esModule = true;
14181 var _promise = __webpack_require__(76);
14183 var _promise2 = _interopRequireDefault(_promise);
14185 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14187 exports.default = function (fn) {
14188 return function () {
14189 var gen = fn.apply(this, arguments);
14190 return new _promise2.default(function (resolve, reject) {
14191 function step(key, arg) {
14193 var info = gen[key](arg);
14194 var value = info.value;
14203 return _promise2.default.resolve(value).then(function (value) {
14204 step("next", value);
14205 }, function (err) {
14206 step("throw", err);
14211 return step("next");
14218 /***/ (function(module, exports, __webpack_require__) {
14220 /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
14221 (typeof self !== "undefined" && self) ||
14223 var apply = Function.prototype.apply;
14225 // DOM APIs, for completeness
14227 exports.setTimeout = function() {
14228 return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
14230 exports.setInterval = function() {
14231 return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
14233 exports.clearTimeout =
14234 exports.clearInterval = function(timeout) {
14240 function Timeout(id, clearFn) {
14242 this._clearFn = clearFn;
14244 Timeout.prototype.unref = Timeout.prototype.ref = function() {};
14245 Timeout.prototype.close = function() {
14246 this._clearFn.call(scope, this._id);
14249 // Does not start the time, just sets up the members needed.
14250 exports.enroll = function(item, msecs) {
14251 clearTimeout(item._idleTimeoutId);
14252 item._idleTimeout = msecs;
14255 exports.unenroll = function(item) {
14256 clearTimeout(item._idleTimeoutId);
14257 item._idleTimeout = -1;
14260 exports._unrefActive = exports.active = function(item) {
14261 clearTimeout(item._idleTimeoutId);
14263 var msecs = item._idleTimeout;
14265 item._idleTimeoutId = setTimeout(function onTimeout() {
14266 if (item._onTimeout)
14272 // setimmediate attaches itself to the global object
14273 __webpack_require__(147);
14274 // On some exotic environments, it's not clear which object `setimmediate` was
14275 // able to install onto. Search each possibility in the same order as the
14276 // `setimmediate` library.
14277 exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
14278 (typeof global !== "undefined" && global.setImmediate) ||
14279 (this && this.setImmediate);
14280 exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
14281 (typeof global !== "undefined" && global.clearImmediate) ||
14282 (this && this.clearImmediate);
14284 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
14288 /***/ (function(module, exports, __webpack_require__) {
14292 // 19.1.2.1 Object.assign(target, source, ...)
14293 var getKeys = __webpack_require__(39);
14294 var gOPS = __webpack_require__(73);
14295 var pIE = __webpack_require__(49);
14296 var toObject = __webpack_require__(54);
14297 var IObject = __webpack_require__(74);
14298 var $assign = Object.assign;
14300 // should work with symbols and should have deterministic property order (V8 bug)
14301 module.exports = !$assign || __webpack_require__(22)(function () {
14304 // eslint-disable-next-line no-undef
14306 var K = 'abcdefghijklmnopqrst';
14308 K.split('').forEach(function (k) { B[k] = k; });
14309 return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
14310 }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
14311 var T = toObject(target);
14312 var aLen = arguments.length;
14314 var getSymbols = gOPS.f;
14315 var isEnum = pIE.f;
14316 while (aLen > index) {
14317 var S = IObject(arguments[index++]);
14318 var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
14319 var length = keys.length;
14322 while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
14329 /***/ (function(module, exports, __webpack_require__) {
14331 // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
14332 var $keys = __webpack_require__(131);
14333 var hiddenKeys = __webpack_require__(71).concat('length', 'prototype');
14335 exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
14336 return $keys(O, hiddenKeys);
14342 /***/ (function(module, exports, __webpack_require__) {
14344 // 7.2.2 IsArray(argument)
14345 var cof = __webpack_require__(27);
14346 module.exports = Array.isArray || function isArray(arg) {
14347 return cof(arg) == 'Array';
14354 /***/ (function(module, exports, __webpack_require__) {
14359 exports.__esModule = true;
14361 var _iterator = __webpack_require__(272);
14363 var _iterator2 = _interopRequireDefault(_iterator);
14365 var _symbol = __webpack_require__(274);
14367 var _symbol2 = _interopRequireDefault(_symbol);
14369 var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
14371 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14373 exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
14374 return typeof obj === "undefined" ? "undefined" : _typeof(obj);
14375 } : function (obj) {
14376 return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
14382 /***/ (function(module, exports, __webpack_require__) {
14384 /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
14387 if (global.setImmediate) {
14391 var nextHandle = 1; // Spec says greater than zero
14392 var tasksByHandle = {};
14393 var currentlyRunningATask = false;
14394 var doc = global.document;
14395 var registerImmediate;
14397 function setImmediate(callback) {
14398 // Callback can either be a function or a string
14399 if (typeof callback !== "function") {
14400 callback = new Function("" + callback);
14402 // Copy function arguments
14403 var args = new Array(arguments.length - 1);
14404 for (var i = 0; i < args.length; i++) {
14405 args[i] = arguments[i + 1];
14407 // Store and register the task
14408 var task = { callback: callback, args: args };
14409 tasksByHandle[nextHandle] = task;
14410 registerImmediate(nextHandle);
14411 return nextHandle++;
14414 function clearImmediate(handle) {
14415 delete tasksByHandle[handle];
14418 function run(task) {
14419 var callback = task.callback;
14420 var args = task.args;
14421 switch (args.length) {
14429 callback(args[0], args[1]);
14432 callback(args[0], args[1], args[2]);
14435 callback.apply(undefined, args);
14440 function runIfPresent(handle) {
14441 // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
14442 // So if we're currently running a task, we'll need to delay this invocation.
14443 if (currentlyRunningATask) {
14444 // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
14445 // "too much recursion" error.
14446 setTimeout(runIfPresent, 0, handle);
14448 var task = tasksByHandle[handle];
14450 currentlyRunningATask = true;
14454 clearImmediate(handle);
14455 currentlyRunningATask = false;
14461 function installNextTickImplementation() {
14462 registerImmediate = function(handle) {
14463 process.nextTick(function () { runIfPresent(handle); });
14467 function canUsePostMessage() {
14468 // The test against `importScripts` prevents this implementation from being installed inside a web worker,
14469 // where `global.postMessage` means something completely different and can't be used for this purpose.
14470 if (global.postMessage && !global.importScripts) {
14471 var postMessageIsAsynchronous = true;
14472 var oldOnMessage = global.onmessage;
14473 global.onmessage = function() {
14474 postMessageIsAsynchronous = false;
14476 global.postMessage("", "*");
14477 global.onmessage = oldOnMessage;
14478 return postMessageIsAsynchronous;
14482 function installPostMessageImplementation() {
14483 // Installs an event handler on `global` for the `message` event: see
14484 // * https://developer.mozilla.org/en/DOM/window.postMessage
14485 // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
14487 var messagePrefix = "setImmediate$" + Math.random() + "$";
14488 var onGlobalMessage = function(event) {
14489 if (event.source === global &&
14490 typeof event.data === "string" &&
14491 event.data.indexOf(messagePrefix) === 0) {
14492 runIfPresent(+event.data.slice(messagePrefix.length));
14496 if (global.addEventListener) {
14497 global.addEventListener("message", onGlobalMessage, false);
14499 global.attachEvent("onmessage", onGlobalMessage);
14502 registerImmediate = function(handle) {
14503 global.postMessage(messagePrefix + handle, "*");
14507 function installMessageChannelImplementation() {
14508 var channel = new MessageChannel();
14509 channel.port1.onmessage = function(event) {
14510 var handle = event.data;
14511 runIfPresent(handle);
14514 registerImmediate = function(handle) {
14515 channel.port2.postMessage(handle);
14519 function installReadyStateChangeImplementation() {
14520 var html = doc.documentElement;
14521 registerImmediate = function(handle) {
14522 // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
14523 // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
14524 var script = doc.createElement("script");
14525 script.onreadystatechange = function () {
14526 runIfPresent(handle);
14527 script.onreadystatechange = null;
14528 html.removeChild(script);
14531 html.appendChild(script);
14535 function installSetTimeoutImplementation() {
14536 registerImmediate = function(handle) {
14537 setTimeout(runIfPresent, 0, handle);
14541 // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
14542 var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
14543 attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
14545 // Don't get fooled by e.g. browserify environments.
14546 if ({}.toString.call(global.process) === "[object process]") {
14547 // For Node.js before 0.9
14548 installNextTickImplementation();
14550 } else if (canUsePostMessage()) {
14551 // For non-IE10 modern browsers
14552 installPostMessageImplementation();
14554 } else if (global.MessageChannel) {
14555 // For web workers, where supported
14556 installMessageChannelImplementation();
14558 } else if (doc && "onreadystatechange" in doc.createElement("script")) {
14560 installReadyStateChangeImplementation();
14563 // For older browsers
14564 installSetTimeoutImplementation();
14567 attachTo.setImmediate = setImmediate;
14568 attachTo.clearImmediate = clearImmediate;
14569 }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
14571 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10), __webpack_require__(14)))
14575 /***/ (function(module, exports, __webpack_require__) {
14577 __webpack_require__(149);
14578 module.exports = __webpack_require__(8).Object.assign;
14583 /***/ (function(module, exports, __webpack_require__) {
14585 // 19.1.3.1 Object.assign(target, source)
14586 var $export = __webpack_require__(13);
14588 $export($export.S + $export.F, 'Object', { assign: __webpack_require__(141) });
14593 /***/ (function(module, exports, __webpack_require__) {
14595 // false -> Array#indexOf
14596 // true -> Array#includes
14597 var toIObject = __webpack_require__(25);
14598 var toLength = __webpack_require__(75);
14599 var toAbsoluteIndex = __webpack_require__(151);
14600 module.exports = function (IS_INCLUDES) {
14601 return function ($this, el, fromIndex) {
14602 var O = toIObject($this);
14603 var length = toLength(O.length);
14604 var index = toAbsoluteIndex(fromIndex, length);
14606 // Array#includes uses SameValueZero equality algorithm
14607 // eslint-disable-next-line no-self-compare
14608 if (IS_INCLUDES && el != el) while (length > index) {
14609 value = O[index++];
14610 // eslint-disable-next-line no-self-compare
14611 if (value != value) return true;
14612 // Array#indexOf ignores holes, Array#includes - not
14613 } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
14614 if (O[index] === el) return IS_INCLUDES || index || 0;
14615 } return !IS_INCLUDES && -1;
14622 /***/ (function(module, exports, __webpack_require__) {
14624 var toInteger = __webpack_require__(52);
14625 var max = Math.max;
14626 var min = Math.min;
14627 module.exports = function (index, length) {
14628 index = toInteger(index);
14629 return index < 0 ? max(index + length, 0) : min(index, length);
14635 /***/ (function(module, exports, __webpack_require__) {
14637 __webpack_require__(153);
14638 var $Object = __webpack_require__(8).Object;
14639 module.exports = function defineProperty(it, key, desc) {
14640 return $Object.defineProperty(it, key, desc);
14646 /***/ (function(module, exports, __webpack_require__) {
14648 var $export = __webpack_require__(13);
14649 // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
14650 $export($export.S + $export.F * !__webpack_require__(17), 'Object', { defineProperty: __webpack_require__(16).f });
14655 /***/ (function(module, exports, __webpack_require__) {
14658 * Copyright (c) 2014-present, Facebook, Inc.
14660 * This source code is licensed under the MIT license found in the
14661 * LICENSE file in the root directory of this source tree.
14664 // This method of obtaining a reference to the global object needs to be
14665 // kept identical to the way it is obtained in runtime.js
14666 var g = (function() { return this })() || Function("return this")();
14668 // Use `getOwnPropertyNames` because not all browsers support calling
14669 // `hasOwnProperty` on the global `self` object in a worker. See #183.
14670 var hadRuntime = g.regeneratorRuntime &&
14671 Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;
14673 // Save the old regeneratorRuntime in case it needs to be restored later.
14674 var oldRuntime = hadRuntime && g.regeneratorRuntime;
14676 // Force reevalutation of runtime.js.
14677 g.regeneratorRuntime = undefined;
14679 module.exports = __webpack_require__(155);
14682 // Restore the original runtime.
14683 g.regeneratorRuntime = oldRuntime;
14685 // Remove the global property added by runtime.js.
14687 delete g.regeneratorRuntime;
14689 g.regeneratorRuntime = undefined;
14696 /***/ (function(module, exports) {
14699 * Copyright (c) 2014-present, Facebook, Inc.
14701 * This source code is licensed under the MIT license found in the
14702 * LICENSE file in the root directory of this source tree.
14705 !(function(global) {
14708 var Op = Object.prototype;
14709 var hasOwn = Op.hasOwnProperty;
14710 var undefined; // More compressible than void 0.
14711 var $Symbol = typeof Symbol === "function" ? Symbol : {};
14712 var iteratorSymbol = $Symbol.iterator || "@@iterator";
14713 var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
14714 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
14716 var inModule = typeof module === "object";
14717 var runtime = global.regeneratorRuntime;
14720 // If regeneratorRuntime is defined globally and we're in a module,
14721 // make the exports object identical to regeneratorRuntime.
14722 module.exports = runtime;
14724 // Don't bother evaluating the rest of this file if the runtime was
14725 // already defined globally.
14729 // Define the runtime globally (as expected by generated code) as either
14730 // module.exports (if we're in a module) or a new, empty object.
14731 runtime = global.regeneratorRuntime = inModule ? module.exports : {};
14733 function wrap(innerFn, outerFn, self, tryLocsList) {
14734 // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
14735 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
14736 var generator = Object.create(protoGenerator.prototype);
14737 var context = new Context(tryLocsList || []);
14739 // The ._invoke method unifies the implementations of the .next,
14740 // .throw, and .return methods.
14741 generator._invoke = makeInvokeMethod(innerFn, self, context);
14745 runtime.wrap = wrap;
14747 // Try/catch helper to minimize deoptimizations. Returns a completion
14748 // record like context.tryEntries[i].completion. This interface could
14749 // have been (and was previously) designed to take a closure to be
14750 // invoked without arguments, but in all the cases we care about we
14751 // already have an existing method we want to call, so there's no need
14752 // to create a new function object. We can even get away with assuming
14753 // the method takes exactly one argument, since that happens to be true
14754 // in every case, so we don't have to touch the arguments object. The
14755 // only additional allocation required is the completion record, which
14756 // has a stable shape and so hopefully should be cheap to allocate.
14757 function tryCatch(fn, obj, arg) {
14759 return { type: "normal", arg: fn.call(obj, arg) };
14761 return { type: "throw", arg: err };
14765 var GenStateSuspendedStart = "suspendedStart";
14766 var GenStateSuspendedYield = "suspendedYield";
14767 var GenStateExecuting = "executing";
14768 var GenStateCompleted = "completed";
14770 // Returning this object from the innerFn has the same effect as
14771 // breaking out of the dispatch switch statement.
14772 var ContinueSentinel = {};
14774 // Dummy constructor functions that we use as the .constructor and
14775 // .constructor.prototype properties for functions that return Generator
14776 // objects. For full spec compliance, you may wish to configure your
14777 // minifier not to mangle the names of these two functions.
14778 function Generator() {}
14779 function GeneratorFunction() {}
14780 function GeneratorFunctionPrototype() {}
14782 // This is a polyfill for %IteratorPrototype% for environments that
14783 // don't natively support it.
14784 var IteratorPrototype = {};
14785 IteratorPrototype[iteratorSymbol] = function () {
14789 var getProto = Object.getPrototypeOf;
14790 var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
14791 if (NativeIteratorPrototype &&
14792 NativeIteratorPrototype !== Op &&
14793 hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
14794 // This environment has a native %IteratorPrototype%; use it instead
14795 // of the polyfill.
14796 IteratorPrototype = NativeIteratorPrototype;
14799 var Gp = GeneratorFunctionPrototype.prototype =
14800 Generator.prototype = Object.create(IteratorPrototype);
14801 GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
14802 GeneratorFunctionPrototype.constructor = GeneratorFunction;
14803 GeneratorFunctionPrototype[toStringTagSymbol] =
14804 GeneratorFunction.displayName = "GeneratorFunction";
14806 // Helper for defining the .next, .throw, and .return methods of the
14807 // Iterator interface in terms of a single ._invoke method.
14808 function defineIteratorMethods(prototype) {
14809 ["next", "throw", "return"].forEach(function(method) {
14810 prototype[method] = function(arg) {
14811 return this._invoke(method, arg);
14816 runtime.isGeneratorFunction = function(genFun) {
14817 var ctor = typeof genFun === "function" && genFun.constructor;
14819 ? ctor === GeneratorFunction ||
14820 // For the native GeneratorFunction constructor, the best we can
14821 // do is to check its .name property.
14822 (ctor.displayName || ctor.name) === "GeneratorFunction"
14826 runtime.mark = function(genFun) {
14827 if (Object.setPrototypeOf) {
14828 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
14830 genFun.__proto__ = GeneratorFunctionPrototype;
14831 if (!(toStringTagSymbol in genFun)) {
14832 genFun[toStringTagSymbol] = "GeneratorFunction";
14835 genFun.prototype = Object.create(Gp);
14839 // Within the body of any async function, `await x` is transformed to
14840 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
14841 // `hasOwn.call(value, "__await")` to determine if the yielded value is
14842 // meant to be awaited.
14843 runtime.awrap = function(arg) {
14844 return { __await: arg };
14847 function AsyncIterator(generator) {
14848 function invoke(method, arg, resolve, reject) {
14849 var record = tryCatch(generator[method], generator, arg);
14850 if (record.type === "throw") {
14851 reject(record.arg);
14853 var result = record.arg;
14854 var value = result.value;
14856 typeof value === "object" &&
14857 hasOwn.call(value, "__await")) {
14858 return Promise.resolve(value.__await).then(function(value) {
14859 invoke("next", value, resolve, reject);
14861 invoke("throw", err, resolve, reject);
14865 return Promise.resolve(value).then(function(unwrapped) {
14866 // When a yielded Promise is resolved, its final value becomes
14867 // the .value of the Promise<{value,done}> result for the
14868 // current iteration. If the Promise is rejected, however, the
14869 // result for this iteration will be rejected with the same
14870 // reason. Note that rejections of yielded Promises are not
14871 // thrown back into the generator function, as is the case
14872 // when an awaited Promise is rejected. This difference in
14873 // behavior between yield and await is important, because it
14874 // allows the consumer to decide what to do with the yielded
14875 // rejection (swallow it and continue, manually .throw it back
14876 // into the generator, abandon iteration, whatever). With
14877 // await, by contrast, there is no opportunity to examine the
14878 // rejection reason outside the generator function, so the
14879 // only option is to throw it from the await expression, and
14880 // let the generator function handle the exception.
14881 result.value = unwrapped;
14887 var previousPromise;
14889 function enqueue(method, arg) {
14890 function callInvokeWithMethodAndArg() {
14891 return new Promise(function(resolve, reject) {
14892 invoke(method, arg, resolve, reject);
14896 return previousPromise =
14897 // If enqueue has been called before, then we want to wait until
14898 // all previous Promises have been resolved before calling invoke,
14899 // so that results are always delivered in the correct order. If
14900 // enqueue has not been called before, then it is important to
14901 // call invoke immediately, without waiting on a callback to fire,
14902 // so that the async generator function has the opportunity to do
14903 // any necessary setup in a predictable way. This predictability
14904 // is why the Promise constructor synchronously invokes its
14905 // executor callback, and why async functions synchronously
14906 // execute code before the first await. Since we implement simple
14907 // async functions in terms of async generators, it is especially
14908 // important to get this right, even though it requires care.
14909 previousPromise ? previousPromise.then(
14910 callInvokeWithMethodAndArg,
14911 // Avoid propagating failures to Promises returned by later
14912 // invocations of the iterator.
14913 callInvokeWithMethodAndArg
14914 ) : callInvokeWithMethodAndArg();
14917 // Define the unified helper method that is used to implement .next,
14918 // .throw, and .return (see defineIteratorMethods).
14919 this._invoke = enqueue;
14922 defineIteratorMethods(AsyncIterator.prototype);
14923 AsyncIterator.prototype[asyncIteratorSymbol] = function () {
14926 runtime.AsyncIterator = AsyncIterator;
14928 // Note that simple async functions are implemented on top of
14929 // AsyncIterator objects; they just return a Promise for the value of
14930 // the final result produced by the iterator.
14931 runtime.async = function(innerFn, outerFn, self, tryLocsList) {
14932 var iter = new AsyncIterator(
14933 wrap(innerFn, outerFn, self, tryLocsList)
14936 return runtime.isGeneratorFunction(outerFn)
14937 ? iter // If outerFn is a generator, return the full iterator.
14938 : iter.next().then(function(result) {
14939 return result.done ? result.value : iter.next();
14943 function makeInvokeMethod(innerFn, self, context) {
14944 var state = GenStateSuspendedStart;
14946 return function invoke(method, arg) {
14947 if (state === GenStateExecuting) {
14948 throw new Error("Generator is already running");
14951 if (state === GenStateCompleted) {
14952 if (method === "throw") {
14956 // Be forgiving, per 25.3.3.3.3 of the spec:
14957 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
14958 return doneResult();
14961 context.method = method;
14965 var delegate = context.delegate;
14967 var delegateResult = maybeInvokeDelegate(delegate, context);
14968 if (delegateResult) {
14969 if (delegateResult === ContinueSentinel) continue;
14970 return delegateResult;
14974 if (context.method === "next") {
14975 // Setting context._sent for legacy support of Babel's
14976 // function.sent implementation.
14977 context.sent = context._sent = context.arg;
14979 } else if (context.method === "throw") {
14980 if (state === GenStateSuspendedStart) {
14981 state = GenStateCompleted;
14985 context.dispatchException(context.arg);
14987 } else if (context.method === "return") {
14988 context.abrupt("return", context.arg);
14991 state = GenStateExecuting;
14993 var record = tryCatch(innerFn, self, context);
14994 if (record.type === "normal") {
14995 // If an exception is thrown from innerFn, we leave state ===
14996 // GenStateExecuting and loop back for another invocation.
14997 state = context.done
14998 ? GenStateCompleted
14999 : GenStateSuspendedYield;
15001 if (record.arg === ContinueSentinel) {
15010 } else if (record.type === "throw") {
15011 state = GenStateCompleted;
15012 // Dispatch the exception by looping back around to the
15013 // context.dispatchException(context.arg) call above.
15014 context.method = "throw";
15015 context.arg = record.arg;
15021 // Call delegate.iterator[context.method](context.arg) and handle the
15022 // result, either by returning a { value, done } result from the
15023 // delegate iterator, or by modifying context.method and context.arg,
15024 // setting context.delegate to null, and returning the ContinueSentinel.
15025 function maybeInvokeDelegate(delegate, context) {
15026 var method = delegate.iterator[context.method];
15027 if (method === undefined) {
15028 // A .throw or .return when the delegate iterator has no .throw
15029 // method always terminates the yield* loop.
15030 context.delegate = null;
15032 if (context.method === "throw") {
15033 if (delegate.iterator.return) {
15034 // If the delegate iterator has a return method, give it a
15035 // chance to clean up.
15036 context.method = "return";
15037 context.arg = undefined;
15038 maybeInvokeDelegate(delegate, context);
15040 if (context.method === "throw") {
15041 // If maybeInvokeDelegate(context) changed context.method from
15042 // "return" to "throw", let that override the TypeError below.
15043 return ContinueSentinel;
15047 context.method = "throw";
15048 context.arg = new TypeError(
15049 "The iterator does not provide a 'throw' method");
15052 return ContinueSentinel;
15055 var record = tryCatch(method, delegate.iterator, context.arg);
15057 if (record.type === "throw") {
15058 context.method = "throw";
15059 context.arg = record.arg;
15060 context.delegate = null;
15061 return ContinueSentinel;
15064 var info = record.arg;
15067 context.method = "throw";
15068 context.arg = new TypeError("iterator result is not an object");
15069 context.delegate = null;
15070 return ContinueSentinel;
15074 // Assign the result of the finished delegate to the temporary
15075 // variable specified by delegate.resultName (see delegateYield).
15076 context[delegate.resultName] = info.value;
15078 // Resume execution at the desired location (see delegateYield).
15079 context.next = delegate.nextLoc;
15081 // If context.method was "throw" but the delegate handled the
15082 // exception, let the outer generator proceed normally. If
15083 // context.method was "next", forget context.arg since it has been
15084 // "consumed" by the delegate iterator. If context.method was
15085 // "return", allow the original .return call to continue in the
15086 // outer generator.
15087 if (context.method !== "return") {
15088 context.method = "next";
15089 context.arg = undefined;
15093 // Re-yield the result returned by the delegate method.
15097 // The delegate iterator is finished, so forget it and continue with
15098 // the outer generator.
15099 context.delegate = null;
15100 return ContinueSentinel;
15103 // Define Generator.prototype.{next,throw,return} in terms of the
15104 // unified ._invoke helper method.
15105 defineIteratorMethods(Gp);
15107 Gp[toStringTagSymbol] = "Generator";
15109 // A Generator should always return itself as the iterator object when the
15110 // @@iterator function is called on it. Some browsers' implementations of the
15111 // iterator prototype chain incorrectly implement this, causing the Generator
15112 // object to not be returned from this call. This ensures that doesn't happen.
15113 // See https://github.com/facebook/regenerator/issues/274 for more details.
15114 Gp[iteratorSymbol] = function() {
15118 Gp.toString = function() {
15119 return "[object Generator]";
15122 function pushTryEntry(locs) {
15123 var entry = { tryLoc: locs[0] };
15126 entry.catchLoc = locs[1];
15130 entry.finallyLoc = locs[2];
15131 entry.afterLoc = locs[3];
15134 this.tryEntries.push(entry);
15137 function resetTryEntry(entry) {
15138 var record = entry.completion || {};
15139 record.type = "normal";
15141 entry.completion = record;
15144 function Context(tryLocsList) {
15145 // The root entry object (effectively a try statement without a catch
15146 // or a finally block) gives us a place to store values thrown from
15147 // locations where there is no enclosing try statement.
15148 this.tryEntries = [{ tryLoc: "root" }];
15149 tryLocsList.forEach(pushTryEntry, this);
15153 runtime.keys = function(object) {
15155 for (var key in object) {
15160 // Rather than returning an object with a next method, we keep
15161 // things simple and return the next function itself.
15162 return function next() {
15163 while (keys.length) {
15164 var key = keys.pop();
15165 if (key in object) {
15172 // To avoid creating an additional object, we just hang the .value
15173 // and .done properties off the next function object itself. This
15174 // also ensures that the minifier will not anonymize the function.
15180 function values(iterable) {
15182 var iteratorMethod = iterable[iteratorSymbol];
15183 if (iteratorMethod) {
15184 return iteratorMethod.call(iterable);
15187 if (typeof iterable.next === "function") {
15191 if (!isNaN(iterable.length)) {
15192 var i = -1, next = function next() {
15193 while (++i < iterable.length) {
15194 if (hasOwn.call(iterable, i)) {
15195 next.value = iterable[i];
15201 next.value = undefined;
15207 return next.next = next;
15211 // Return an iterator with no values.
15212 return { next: doneResult };
15214 runtime.values = values;
15216 function doneResult() {
15217 return { value: undefined, done: true };
15220 Context.prototype = {
15221 constructor: Context,
15223 reset: function(skipTempReset) {
15226 // Resetting context._sent for legacy support of Babel's
15227 // function.sent implementation.
15228 this.sent = this._sent = undefined;
15230 this.delegate = null;
15232 this.method = "next";
15233 this.arg = undefined;
15235 this.tryEntries.forEach(resetTryEntry);
15237 if (!skipTempReset) {
15238 for (var name in this) {
15239 // Not sure about the optimal order of these conditions:
15240 if (name.charAt(0) === "t" &&
15241 hasOwn.call(this, name) &&
15242 !isNaN(+name.slice(1))) {
15243 this[name] = undefined;
15252 var rootEntry = this.tryEntries[0];
15253 var rootRecord = rootEntry.completion;
15254 if (rootRecord.type === "throw") {
15255 throw rootRecord.arg;
15261 dispatchException: function(exception) {
15266 var context = this;
15267 function handle(loc, caught) {
15268 record.type = "throw";
15269 record.arg = exception;
15270 context.next = loc;
15273 // If the dispatched exception was caught by a catch block,
15274 // then let that catch block handle the exception normally.
15275 context.method = "next";
15276 context.arg = undefined;
15282 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
15283 var entry = this.tryEntries[i];
15284 var record = entry.completion;
15286 if (entry.tryLoc === "root") {
15287 // Exception thrown outside of any try block that could handle
15288 // it, so set the completion value of the entire function to
15289 // throw the exception.
15290 return handle("end");
15293 if (entry.tryLoc <= this.prev) {
15294 var hasCatch = hasOwn.call(entry, "catchLoc");
15295 var hasFinally = hasOwn.call(entry, "finallyLoc");
15297 if (hasCatch && hasFinally) {
15298 if (this.prev < entry.catchLoc) {
15299 return handle(entry.catchLoc, true);
15300 } else if (this.prev < entry.finallyLoc) {
15301 return handle(entry.finallyLoc);
15304 } else if (hasCatch) {
15305 if (this.prev < entry.catchLoc) {
15306 return handle(entry.catchLoc, true);
15309 } else if (hasFinally) {
15310 if (this.prev < entry.finallyLoc) {
15311 return handle(entry.finallyLoc);
15315 throw new Error("try statement without catch or finally");
15321 abrupt: function(type, arg) {
15322 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
15323 var entry = this.tryEntries[i];
15324 if (entry.tryLoc <= this.prev &&
15325 hasOwn.call(entry, "finallyLoc") &&
15326 this.prev < entry.finallyLoc) {
15327 var finallyEntry = entry;
15332 if (finallyEntry &&
15333 (type === "break" ||
15334 type === "continue") &&
15335 finallyEntry.tryLoc <= arg &&
15336 arg <= finallyEntry.finallyLoc) {
15337 // Ignore the finally entry if control is not jumping to a
15338 // location outside the try/catch block.
15339 finallyEntry = null;
15342 var record = finallyEntry ? finallyEntry.completion : {};
15343 record.type = type;
15346 if (finallyEntry) {
15347 this.method = "next";
15348 this.next = finallyEntry.finallyLoc;
15349 return ContinueSentinel;
15352 return this.complete(record);
15355 complete: function(record, afterLoc) {
15356 if (record.type === "throw") {
15360 if (record.type === "break" ||
15361 record.type === "continue") {
15362 this.next = record.arg;
15363 } else if (record.type === "return") {
15364 this.rval = this.arg = record.arg;
15365 this.method = "return";
15367 } else if (record.type === "normal" && afterLoc) {
15368 this.next = afterLoc;
15371 return ContinueSentinel;
15374 finish: function(finallyLoc) {
15375 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
15376 var entry = this.tryEntries[i];
15377 if (entry.finallyLoc === finallyLoc) {
15378 this.complete(entry.completion, entry.afterLoc);
15379 resetTryEntry(entry);
15380 return ContinueSentinel;
15385 "catch": function(tryLoc) {
15386 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
15387 var entry = this.tryEntries[i];
15388 if (entry.tryLoc === tryLoc) {
15389 var record = entry.completion;
15390 if (record.type === "throw") {
15391 var thrown = record.arg;
15392 resetTryEntry(entry);
15398 // The context.catch method must only be called with a location
15399 // argument that corresponds to a known catch block.
15400 throw new Error("illegal catch attempt");
15403 delegateYield: function(iterable, resultName, nextLoc) {
15405 iterator: values(iterable),
15406 resultName: resultName,
15410 if (this.method === "next") {
15411 // Deliberately forget the last sent value so that we don't
15412 // accidentally pass it on to the delegate.
15413 this.arg = undefined;
15416 return ContinueSentinel;
15420 // In sloppy mode, unbound `this` refers to the global object, fallback to
15421 // Function constructor if we're in global strict mode. That is sadly a form
15422 // of indirect eval which violates Content Security Policy.
15423 (function() { return this })() || Function("return this")()
15429 /***/ (function(module, exports, __webpack_require__) {
15431 __webpack_require__(77);
15432 __webpack_require__(132);
15433 __webpack_require__(79);
15434 __webpack_require__(164);
15435 __webpack_require__(173);
15436 __webpack_require__(174);
15437 module.exports = __webpack_require__(8).Promise;
15442 /***/ (function(module, exports, __webpack_require__) {
15444 var toInteger = __webpack_require__(52);
15445 var defined = __webpack_require__(51);
15446 // true -> String#at
15447 // false -> String#codePointAt
15448 module.exports = function (TO_STRING) {
15449 return function (that, pos) {
15450 var s = String(defined(that));
15451 var i = toInteger(pos);
15454 if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
15455 a = s.charCodeAt(i);
15456 return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
15457 ? TO_STRING ? s.charAt(i) : a
15458 : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
15465 /***/ (function(module, exports, __webpack_require__) {
15469 var create = __webpack_require__(133);
15470 var descriptor = __webpack_require__(48);
15471 var setToStringTag = __webpack_require__(40);
15472 var IteratorPrototype = {};
15474 // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
15475 __webpack_require__(19)(IteratorPrototype, __webpack_require__(7)('iterator'), function () { return this; });
15477 module.exports = function (Constructor, NAME, next) {
15478 Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
15479 setToStringTag(Constructor, NAME + ' Iterator');
15485 /***/ (function(module, exports, __webpack_require__) {
15487 var dP = __webpack_require__(16);
15488 var anObject = __webpack_require__(15);
15489 var getKeys = __webpack_require__(39);
15491 module.exports = __webpack_require__(17) ? Object.defineProperties : function defineProperties(O, Properties) {
15493 var keys = getKeys(Properties);
15494 var length = keys.length;
15497 while (length > i) dP.f(O, P = keys[i++], Properties[P]);
15504 /***/ (function(module, exports, __webpack_require__) {
15506 // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
15507 var has = __webpack_require__(20);
15508 var toObject = __webpack_require__(54);
15509 var IE_PROTO = __webpack_require__(53)('IE_PROTO');
15510 var ObjectProto = Object.prototype;
15512 module.exports = Object.getPrototypeOf || function (O) {
15514 if (has(O, IE_PROTO)) return O[IE_PROTO];
15515 if (typeof O.constructor == 'function' && O instanceof O.constructor) {
15516 return O.constructor.prototype;
15517 } return O instanceof Object ? ObjectProto : null;
15523 /***/ (function(module, exports, __webpack_require__) {
15527 var addToUnscopables = __webpack_require__(162);
15528 var step = __webpack_require__(163);
15529 var Iterators = __webpack_require__(28);
15530 var toIObject = __webpack_require__(25);
15532 // 22.1.3.4 Array.prototype.entries()
15533 // 22.1.3.13 Array.prototype.keys()
15534 // 22.1.3.29 Array.prototype.values()
15535 // 22.1.3.30 Array.prototype[@@iterator]()
15536 module.exports = __webpack_require__(85)(Array, 'Array', function (iterated, kind) {
15537 this._t = toIObject(iterated); // target
15538 this._i = 0; // next index
15539 this._k = kind; // kind
15540 // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
15543 var kind = this._k;
15544 var index = this._i++;
15545 if (!O || index >= O.length) {
15546 this._t = undefined;
15549 if (kind == 'keys') return step(0, index);
15550 if (kind == 'values') return step(0, O[index]);
15551 return step(0, [index, O[index]]);
15554 // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
15555 Iterators.Arguments = Iterators.Array;
15557 addToUnscopables('keys');
15558 addToUnscopables('values');
15559 addToUnscopables('entries');
15564 /***/ (function(module, exports) {
15566 module.exports = function () { /* empty */ };
15571 /***/ (function(module, exports) {
15573 module.exports = function (done, value) {
15574 return { value: value, done: !!done };
15580 /***/ (function(module, exports, __webpack_require__) {
15584 var LIBRARY = __webpack_require__(37);
15585 var global = __webpack_require__(5);
15586 var ctx = __webpack_require__(35);
15587 var classof = __webpack_require__(87);
15588 var $export = __webpack_require__(13);
15589 var isObject = __webpack_require__(12);
15590 var aFunction = __webpack_require__(38);
15591 var anInstance = __webpack_require__(134);
15592 var forOf = __webpack_require__(80);
15593 var speciesConstructor = __webpack_require__(88);
15594 var task = __webpack_require__(89).set;
15595 var microtask = __webpack_require__(169)();
15596 var newPromiseCapabilityModule = __webpack_require__(55);
15597 var perform = __webpack_require__(90);
15598 var userAgent = __webpack_require__(170);
15599 var promiseResolve = __webpack_require__(91);
15600 var PROMISE = 'Promise';
15601 var TypeError = global.TypeError;
15602 var process = global.process;
15603 var versions = process && process.versions;
15604 var v8 = versions && versions.v8 || '';
15605 var $Promise = global[PROMISE];
15606 var isNode = classof(process) == 'process';
15607 var empty = function () { /* empty */ };
15608 var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
15609 var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;
15611 var USE_NATIVE = !!function () {
15613 // correct subclassing with @@species support
15614 var promise = $Promise.resolve(1);
15615 var FakePromise = (promise.constructor = {})[__webpack_require__(7)('species')] = function (exec) {
15616 exec(empty, empty);
15618 // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
15619 return (isNode || typeof PromiseRejectionEvent == 'function')
15620 && promise.then(empty) instanceof FakePromise
15621 // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
15622 // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
15623 // we can't detect it synchronously, so just check versions
15624 && v8.indexOf('6.6') !== 0
15625 && userAgent.indexOf('Chrome/66') === -1;
15626 } catch (e) { /* empty */ }
15630 var isThenable = function (it) {
15632 return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
15634 var notify = function (promise, isReject) {
15635 if (promise._n) return;
15637 var chain = promise._c;
15638 microtask(function () {
15639 var value = promise._v;
15640 var ok = promise._s == 1;
15642 var run = function (reaction) {
15643 var handler = ok ? reaction.ok : reaction.fail;
15644 var resolve = reaction.resolve;
15645 var reject = reaction.reject;
15646 var domain = reaction.domain;
15647 var result, then, exited;
15651 if (promise._h == 2) onHandleUnhandled(promise);
15654 if (handler === true) result = value;
15656 if (domain) domain.enter();
15657 result = handler(value); // may throw
15663 if (result === reaction.promise) {
15664 reject(TypeError('Promise-chain cycle'));
15665 } else if (then = isThenable(result)) {
15666 then.call(result, resolve, reject);
15667 } else resolve(result);
15668 } else reject(value);
15670 if (domain && !exited) domain.exit();
15674 while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
15676 promise._n = false;
15677 if (isReject && !promise._h) onUnhandled(promise);
15680 var onUnhandled = function (promise) {
15681 task.call(global, function () {
15682 var value = promise._v;
15683 var unhandled = isUnhandled(promise);
15684 var result, handler, console;
15686 result = perform(function () {
15688 process.emit('unhandledRejection', value, promise);
15689 } else if (handler = global.onunhandledrejection) {
15690 handler({ promise: promise, reason: value });
15691 } else if ((console = global.console) && console.error) {
15692 console.error('Unhandled promise rejection', value);
15695 // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
15696 promise._h = isNode || isUnhandled(promise) ? 2 : 1;
15697 } promise._a = undefined;
15698 if (unhandled && result.e) throw result.v;
15701 var isUnhandled = function (promise) {
15702 return promise._h !== 1 && (promise._a || promise._c).length === 0;
15704 var onHandleUnhandled = function (promise) {
15705 task.call(global, function () {
15708 process.emit('rejectionHandled', promise);
15709 } else if (handler = global.onrejectionhandled) {
15710 handler({ promise: promise, reason: promise._v });
15714 var $reject = function (value) {
15715 var promise = this;
15716 if (promise._d) return;
15718 promise = promise._w || promise; // unwrap
15719 promise._v = value;
15721 if (!promise._a) promise._a = promise._c.slice();
15722 notify(promise, true);
15724 var $resolve = function (value) {
15725 var promise = this;
15727 if (promise._d) return;
15729 promise = promise._w || promise; // unwrap
15731 if (promise === value) throw TypeError("Promise can't be resolved itself");
15732 if (then = isThenable(value)) {
15733 microtask(function () {
15734 var wrapper = { _w: promise, _d: false }; // wrap
15736 then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
15738 $reject.call(wrapper, e);
15742 promise._v = value;
15744 notify(promise, false);
15747 $reject.call({ _w: promise, _d: false }, e); // wrap
15751 // constructor polyfill
15753 // 25.4.3.1 Promise(executor)
15754 $Promise = function Promise(executor) {
15755 anInstance(this, $Promise, PROMISE, '_h');
15756 aFunction(executor);
15757 Internal.call(this);
15759 executor(ctx($resolve, this, 1), ctx($reject, this, 1));
15761 $reject.call(this, err);
15764 // eslint-disable-next-line no-unused-vars
15765 Internal = function Promise(executor) {
15766 this._c = []; // <- awaiting reactions
15767 this._a = undefined; // <- checked in isUnhandled reactions
15768 this._s = 0; // <- state
15769 this._d = false; // <- done
15770 this._v = undefined; // <- value
15771 this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
15772 this._n = false; // <- notify
15774 Internal.prototype = __webpack_require__(135)($Promise.prototype, {
15775 // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
15776 then: function then(onFulfilled, onRejected) {
15777 var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
15778 reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
15779 reaction.fail = typeof onRejected == 'function' && onRejected;
15780 reaction.domain = isNode ? process.domain : undefined;
15781 this._c.push(reaction);
15782 if (this._a) this._a.push(reaction);
15783 if (this._s) notify(this, false);
15784 return reaction.promise;
15786 // 25.4.5.1 Promise.prototype.catch(onRejected)
15787 'catch': function (onRejected) {
15788 return this.then(undefined, onRejected);
15791 OwnPromiseCapability = function () {
15792 var promise = new Internal();
15793 this.promise = promise;
15794 this.resolve = ctx($resolve, promise, 1);
15795 this.reject = ctx($reject, promise, 1);
15797 newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
15798 return C === $Promise || C === Wrapper
15799 ? new OwnPromiseCapability(C)
15800 : newGenericPromiseCapability(C);
15804 $export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise });
15805 __webpack_require__(40)($Promise, PROMISE);
15806 __webpack_require__(171)(PROMISE);
15807 Wrapper = __webpack_require__(8)[PROMISE];
15810 $export($export.S + $export.F * !USE_NATIVE, PROMISE, {
15811 // 25.4.4.5 Promise.reject(r)
15812 reject: function reject(r) {
15813 var capability = newPromiseCapability(this);
15814 var $$reject = capability.reject;
15816 return capability.promise;
15819 $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
15820 // 25.4.4.6 Promise.resolve(x)
15821 resolve: function resolve(x) {
15822 return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
15825 $export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(172)(function (iter) {
15826 $Promise.all(iter)['catch'](empty);
15828 // 25.4.4.1 Promise.all(iterable)
15829 all: function all(iterable) {
15831 var capability = newPromiseCapability(C);
15832 var resolve = capability.resolve;
15833 var reject = capability.reject;
15834 var result = perform(function () {
15838 forOf(iterable, false, function (promise) {
15839 var $index = index++;
15840 var alreadyCalled = false;
15841 values.push(undefined);
15843 C.resolve(promise).then(function (value) {
15844 if (alreadyCalled) return;
15845 alreadyCalled = true;
15846 values[$index] = value;
15847 --remaining || resolve(values);
15850 --remaining || resolve(values);
15852 if (result.e) reject(result.v);
15853 return capability.promise;
15855 // 25.4.4.4 Promise.race(iterable)
15856 race: function race(iterable) {
15858 var capability = newPromiseCapability(C);
15859 var reject = capability.reject;
15860 var result = perform(function () {
15861 forOf(iterable, false, function (promise) {
15862 C.resolve(promise).then(capability.resolve, reject);
15865 if (result.e) reject(result.v);
15866 return capability.promise;
15873 /***/ (function(module, exports, __webpack_require__) {
15875 // call something on iterator step with safe closing on error
15876 var anObject = __webpack_require__(15);
15877 module.exports = function (iterator, fn, value, entries) {
15879 return entries ? fn(anObject(value)[0], value[1]) : fn(value);
15880 // 7.4.6 IteratorClose(iterator, completion)
15882 var ret = iterator['return'];
15883 if (ret !== undefined) anObject(ret.call(iterator));
15891 /***/ (function(module, exports, __webpack_require__) {
15893 // check on default Array iterator
15894 var Iterators = __webpack_require__(28);
15895 var ITERATOR = __webpack_require__(7)('iterator');
15896 var ArrayProto = Array.prototype;
15898 module.exports = function (it) {
15899 return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
15905 /***/ (function(module, exports, __webpack_require__) {
15907 var classof = __webpack_require__(87);
15908 var ITERATOR = __webpack_require__(7)('iterator');
15909 var Iterators = __webpack_require__(28);
15910 module.exports = __webpack_require__(8).getIteratorMethod = function (it) {
15911 if (it != undefined) return it[ITERATOR]
15912 || it['@@iterator']
15913 || Iterators[classof(it)];
15919 /***/ (function(module, exports) {
15921 // fast apply, http://jsperf.lnkit.com/fast-apply/5
15922 module.exports = function (fn, args, that) {
15923 var un = that === undefined;
15924 switch (args.length) {
15925 case 0: return un ? fn()
15927 case 1: return un ? fn(args[0])
15928 : fn.call(that, args[0]);
15929 case 2: return un ? fn(args[0], args[1])
15930 : fn.call(that, args[0], args[1]);
15931 case 3: return un ? fn(args[0], args[1], args[2])
15932 : fn.call(that, args[0], args[1], args[2]);
15933 case 4: return un ? fn(args[0], args[1], args[2], args[3])
15934 : fn.call(that, args[0], args[1], args[2], args[3]);
15935 } return fn.apply(that, args);
15941 /***/ (function(module, exports, __webpack_require__) {
15943 var global = __webpack_require__(5);
15944 var macrotask = __webpack_require__(89).set;
15945 var Observer = global.MutationObserver || global.WebKitMutationObserver;
15946 var process = global.process;
15947 var Promise = global.Promise;
15948 var isNode = __webpack_require__(27)(process) == 'process';
15950 module.exports = function () {
15951 var head, last, notify;
15953 var flush = function () {
15955 if (isNode && (parent = process.domain)) parent.exit();
15962 if (head) notify();
15963 else last = undefined;
15966 } last = undefined;
15967 if (parent) parent.enter();
15972 notify = function () {
15973 process.nextTick(flush);
15975 // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
15976 } else if (Observer && !(global.navigator && global.navigator.standalone)) {
15978 var node = document.createTextNode('');
15979 new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
15980 notify = function () {
15981 node.data = toggle = !toggle;
15983 // environments with maybe non-completely correct, but existent Promise
15984 } else if (Promise && Promise.resolve) {
15985 // Promise.resolve without an argument throws an error in LG WebOS 2
15986 var promise = Promise.resolve(undefined);
15987 notify = function () {
15988 promise.then(flush);
15990 // for other environments - macrotask based on:
15992 // - MessageChannel
15993 // - window.postMessag
15994 // - onreadystatechange
15997 notify = function () {
15998 // strange IE + webpack dev server bug - use .call(global)
15999 macrotask.call(global, flush);
16003 return function (fn) {
16004 var task = { fn: fn, next: undefined };
16005 if (last) last.next = task;
16016 /***/ (function(module, exports, __webpack_require__) {
16018 var global = __webpack_require__(5);
16019 var navigator = global.navigator;
16021 module.exports = navigator && navigator.userAgent || '';
16026 /***/ (function(module, exports, __webpack_require__) {
16030 var global = __webpack_require__(5);
16031 var core = __webpack_require__(8);
16032 var dP = __webpack_require__(16);
16033 var DESCRIPTORS = __webpack_require__(17);
16034 var SPECIES = __webpack_require__(7)('species');
16036 module.exports = function (KEY) {
16037 var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY];
16038 if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
16039 configurable: true,
16040 get: function () { return this; }
16047 /***/ (function(module, exports, __webpack_require__) {
16049 var ITERATOR = __webpack_require__(7)('iterator');
16050 var SAFE_CLOSING = false;
16053 var riter = [7][ITERATOR]();
16054 riter['return'] = function () { SAFE_CLOSING = true; };
16055 // eslint-disable-next-line no-throw-literal
16056 Array.from(riter, function () { throw 2; });
16057 } catch (e) { /* empty */ }
16059 module.exports = function (exec, skipClosing) {
16060 if (!skipClosing && !SAFE_CLOSING) return false;
16064 var iter = arr[ITERATOR]();
16065 iter.next = function () { return { done: safe = true }; };
16066 arr[ITERATOR] = function () { return iter; };
16068 } catch (e) { /* empty */ }
16075 /***/ (function(module, exports, __webpack_require__) {
16078 // https://github.com/tc39/proposal-promise-finally
16080 var $export = __webpack_require__(13);
16081 var core = __webpack_require__(8);
16082 var global = __webpack_require__(5);
16083 var speciesConstructor = __webpack_require__(88);
16084 var promiseResolve = __webpack_require__(91);
16086 $export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) {
16087 var C = speciesConstructor(this, core.Promise || global.Promise);
16088 var isFunction = typeof onFinally == 'function';
16090 isFunction ? function (x) {
16091 return promiseResolve(C, onFinally()).then(function () { return x; });
16093 isFunction ? function (e) {
16094 return promiseResolve(C, onFinally()).then(function () { throw e; });
16102 /***/ (function(module, exports, __webpack_require__) {
16106 // https://github.com/tc39/proposal-promise-try
16107 var $export = __webpack_require__(13);
16108 var newPromiseCapability = __webpack_require__(55);
16109 var perform = __webpack_require__(90);
16111 $export($export.S, 'Promise', { 'try': function (callbackfn) {
16112 var promiseCapability = newPromiseCapability.f(this);
16113 var result = perform(callbackfn);
16114 (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
16115 return promiseCapability.promise;
16121 /***/ (function(module, exports, __webpack_require__) {
16126 exports.byteLength = byteLength
16127 exports.toByteArray = toByteArray
16128 exports.fromByteArray = fromByteArray
16132 var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
16134 var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
16135 for (var i = 0, len = code.length; i < len; ++i) {
16136 lookup[i] = code[i]
16137 revLookup[code.charCodeAt(i)] = i
16140 // Support decoding URL-safe base64 strings, as Node.js does.
16141 // See: https://en.wikipedia.org/wiki/Base64#URL_applications
16142 revLookup['-'.charCodeAt(0)] = 62
16143 revLookup['_'.charCodeAt(0)] = 63
16145 function getLens (b64) {
16146 var len = b64.length
16149 throw new Error('Invalid string. Length must be a multiple of 4')
16152 // Trim off extra bytes after placeholder bytes are found
16153 // See: https://github.com/beatgammit/base64-js/issues/42
16154 var validLen = b64.indexOf('=')
16155 if (validLen === -1) validLen = len
16157 var placeHoldersLen = validLen === len
16159 : 4 - (validLen % 4)
16161 return [validLen, placeHoldersLen]
16164 // base64 is 4/3 + up to two characters of the original data
16165 function byteLength (b64) {
16166 var lens = getLens(b64)
16167 var validLen = lens[0]
16168 var placeHoldersLen = lens[1]
16169 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
16172 function _byteLength (b64, validLen, placeHoldersLen) {
16173 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
16176 function toByteArray (b64) {
16178 var lens = getLens(b64)
16179 var validLen = lens[0]
16180 var placeHoldersLen = lens[1]
16182 var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
16186 // if there are placeholders, only get up to the last complete 4 chars
16187 var len = placeHoldersLen > 0
16191 for (var i = 0; i < len; i += 4) {
16193 (revLookup[b64.charCodeAt(i)] << 18) |
16194 (revLookup[b64.charCodeAt(i + 1)] << 12) |
16195 (revLookup[b64.charCodeAt(i + 2)] << 6) |
16196 revLookup[b64.charCodeAt(i + 3)]
16197 arr[curByte++] = (tmp >> 16) & 0xFF
16198 arr[curByte++] = (tmp >> 8) & 0xFF
16199 arr[curByte++] = tmp & 0xFF
16202 if (placeHoldersLen === 2) {
16204 (revLookup[b64.charCodeAt(i)] << 2) |
16205 (revLookup[b64.charCodeAt(i + 1)] >> 4)
16206 arr[curByte++] = tmp & 0xFF
16209 if (placeHoldersLen === 1) {
16211 (revLookup[b64.charCodeAt(i)] << 10) |
16212 (revLookup[b64.charCodeAt(i + 1)] << 4) |
16213 (revLookup[b64.charCodeAt(i + 2)] >> 2)
16214 arr[curByte++] = (tmp >> 8) & 0xFF
16215 arr[curByte++] = tmp & 0xFF
16221 function tripletToBase64 (num) {
16222 return lookup[num >> 18 & 0x3F] +
16223 lookup[num >> 12 & 0x3F] +
16224 lookup[num >> 6 & 0x3F] +
16228 function encodeChunk (uint8, start, end) {
16231 for (var i = start; i < end; i += 3) {
16233 ((uint8[i] << 16) & 0xFF0000) +
16234 ((uint8[i + 1] << 8) & 0xFF00) +
16235 (uint8[i + 2] & 0xFF)
16236 output.push(tripletToBase64(tmp))
16238 return output.join('')
16241 function fromByteArray (uint8) {
16243 var len = uint8.length
16244 var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
16246 var maxChunkLength = 16383 // must be multiple of 3
16248 // go through the array every three bytes, we'll deal with trailing stuff later
16249 for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
16250 parts.push(encodeChunk(
16251 uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
16255 // pad the end with zeros, but make sure to not forget the extra bytes
16256 if (extraBytes === 1) {
16257 tmp = uint8[len - 1]
16260 lookup[(tmp << 4) & 0x3F] +
16263 } else if (extraBytes === 2) {
16264 tmp = (uint8[len - 2] << 8) + uint8[len - 1]
16266 lookup[tmp >> 10] +
16267 lookup[(tmp >> 4) & 0x3F] +
16268 lookup[(tmp << 2) & 0x3F] +
16273 return parts.join('')
16279 /***/ (function(module, exports) {
16281 exports.read = function (buffer, offset, isLE, mLen, nBytes) {
16283 var eLen = (nBytes * 8) - mLen - 1
16284 var eMax = (1 << eLen) - 1
16285 var eBias = eMax >> 1
16287 var i = isLE ? (nBytes - 1) : 0
16288 var d = isLE ? -1 : 1
16289 var s = buffer[offset + i]
16293 e = s & ((1 << (-nBits)) - 1)
16296 for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
16298 m = e & ((1 << (-nBits)) - 1)
16301 for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
16305 } else if (e === eMax) {
16306 return m ? NaN : ((s ? -1 : 1) * Infinity)
16308 m = m + Math.pow(2, mLen)
16311 return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
16314 exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
16316 var eLen = (nBytes * 8) - mLen - 1
16317 var eMax = (1 << eLen) - 1
16318 var eBias = eMax >> 1
16319 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
16320 var i = isLE ? 0 : (nBytes - 1)
16321 var d = isLE ? 1 : -1
16322 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
16324 value = Math.abs(value)
16326 if (isNaN(value) || value === Infinity) {
16327 m = isNaN(value) ? 1 : 0
16330 e = Math.floor(Math.log(value) / Math.LN2)
16331 if (value * (c = Math.pow(2, -e)) < 1) {
16335 if (e + eBias >= 1) {
16338 value += rt * Math.pow(2, 1 - eBias)
16340 if (value * c >= 2) {
16345 if (e + eBias >= eMax) {
16348 } else if (e + eBias >= 1) {
16349 m = ((value * c) - 1) * Math.pow(2, mLen)
16352 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
16357 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
16359 e = (e << mLen) | m
16361 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
16363 buffer[offset + i - d] |= s * 128
16371 /***/ (function(module, exports, __webpack_require__) {
16375 Object.defineProperty(exports, "__esModule", { value: true });
\r
16376 const aes_oop_1 = __webpack_require__(180);
\r
16377 class EncryptedStream {
\r
16378 constructor(_eventName, _randomized) {
\r
16379 this.eventName = _eventName;
\r
16380 this.key = _randomized;
\r
16381 this.synced = false;
\r
16382 this.syncFn = null;
\r
16383 this.listenForSync();
\r
16385 listenWith(func) {
\r
16386 document.addEventListener(this.eventName, (event) => {
\r
16387 if (!this.synced) return false;
\r
16388 let msg = JSON.parse(event.detail);
\r
16389 msg = (this.synced && typeof msg === 'string') ? aes_oop_1.default.decrypt(msg, this.key) : msg;
\r
16394 const addSender = () => { data.from = this.eventName; };
\r
16395 const encryptIfSynced = () => { data = (this.synced) ? aes_oop_1.default.encrypt(data, this.key) : data; };
\r
16396 if (typeof data !== 'object')
\r
16397 throw new Error("Payloads must be objects");
\r
16399 encryptIfSynced();
\r
16400 this.dispatch(JSON.stringify(data), to);
\r
16403 this.syncFn = fn;
\r
16405 sync(to, handshake) {
\r
16406 this.send({ type: 'sync', handshake }, to);
\r
16408 listenForSync() {
\r
16409 document.addEventListener(this.eventName, (event) => {
\r
16410 let msg = JSON.parse(event.detail);
\r
16411 if(!msg.hasOwnProperty('type')) return false;
\r
16412 if(msg.type === 'sync') this.ackSync(msg);
\r
16413 if(msg.type === 'synced') this.synced = true;
\r
16417 this.send({ type: 'synced' }, msg.from);
\r
16418 this.key = msg.handshake;
\r
16419 this.synced = true;
\r
16422 dispatch(encryptedData, to) { document.dispatchEvent(this.getEvent(encryptedData, to)); }
\r
16423 getEvent(encryptedData, to) { return new CustomEvent(to, this.getEventInit(encryptedData)); }
\r
16424 getEventInit(encryptedData) { return { detail: encryptedData }; }
\r
16426 exports.EncryptedStream = EncryptedStream;
\r
16427 exports.default = EncryptedStream;
\r
16428 //# sourceMappingURL=EncryptedStream.js.map
16432 /***/ (function(module, exports, __webpack_require__) {
16436 const sjcl = __webpack_require__(181);
\r
16438 static encrypt(data, key) {
\r
16439 if (typeof data === 'object')
\r
16440 data = JSON.stringify(data);
\r
16441 const { iv, salt, ct } = JSON.parse(sjcl.encrypt(key, data, { mode: 'gcm' }));
\r
16442 return JSON.stringify({ iv, salt, ct });
\r
16444 static decrypt(encryptedData, key) {
\r
16445 encryptedData = JSON.stringify(Object.assign(JSON.parse(encryptedData), { mode: 'gcm' }));
\r
16446 let clear = sjcl.decrypt(key, encryptedData);
\r
16448 return JSON.parse(clear);
\r
16455 exports.AES = AES;
\r
16456 Object.defineProperty(exports, "__esModule", { value: true });
\r
16457 exports.default = AES;
\r
16458 //# sourceMappingURL=AES.js.map
16462 /***/ (function(module, exports, __webpack_require__) {
16465 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var sjcl={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(a){this.toString=function(){return"CORRUPT: "+this.message};this.message=a},invalid:function(a){this.toString=function(){return"INVALID: "+this.message};this.message=a},bug:function(a){this.toString=function(){return"BUG: "+this.message};this.message=a},notReady:function(a){this.toString=function(){return"NOT READY: "+this.message};this.message=a}}};
16466 sjcl.cipher.aes=function(a){this.s[0][0][0]||this.O();var b,c,d,e,f=this.s[0][4],g=this.s[1];b=a.length;var h=1;if(4!==b&&6!==b&&8!==b)throw new sjcl.exception.invalid("invalid aes key size");this.b=[d=a.slice(0),e=[]];for(a=b;a<4*b+28;a++){c=d[a-1];if(0===a%b||8===b&&4===a%b)c=f[c>>>24]<<24^f[c>>16&255]<<16^f[c>>8&255]<<8^f[c&255],0===a%b&&(c=c<<8^c>>>24^h<<24,h=h<<1^283*(h>>7));d[a]=d[a-b]^c}for(b=0;a;b++,a--)c=d[b&3?a:a-4],e[b]=4>=a||4>b?c:g[0][f[c>>>24]]^g[1][f[c>>16&255]]^g[2][f[c>>8&255]]^g[3][f[c&
16468 sjcl.cipher.aes.prototype={encrypt:function(a){return t(this,a,0)},decrypt:function(a){return t(this,a,1)},s:[[[],[],[],[],[]],[[],[],[],[],[]]],O:function(){var a=this.s[0],b=this.s[1],c=a[4],d=b[4],e,f,g,h=[],k=[],l,n,m,p;for(e=0;0x100>e;e++)k[(h[e]=e<<1^283*(e>>7))^e]=e;for(f=g=0;!c[f];f^=l||1,g=k[g]||1)for(m=g^g<<1^g<<2^g<<3^g<<4,m=m>>8^m&255^99,c[f]=m,d[m]=f,n=h[e=h[l=h[f]]],p=0x1010101*n^0x10001*e^0x101*l^0x1010100*f,n=0x101*h[m]^0x1010100*m,e=0;4>e;e++)a[e][f]=n=n<<24^n>>>8,b[e][m]=p=p<<24^p>>>8;for(e=
16469 0;5>e;e++)a[e]=a[e].slice(0),b[e]=b[e].slice(0)}};
16470 function t(a,b,c){if(4!==b.length)throw new sjcl.exception.invalid("invalid aes block size");var d=a.b[c],e=b[0]^d[0],f=b[c?3:1]^d[1],g=b[2]^d[2];b=b[c?1:3]^d[3];var h,k,l,n=d.length/4-2,m,p=4,r=[0,0,0,0];h=a.s[c];a=h[0];var q=h[1],v=h[2],w=h[3],x=h[4];for(m=0;m<n;m++)h=a[e>>>24]^q[f>>16&255]^v[g>>8&255]^w[b&255]^d[p],k=a[f>>>24]^q[g>>16&255]^v[b>>8&255]^w[e&255]^d[p+1],l=a[g>>>24]^q[b>>16&255]^v[e>>8&255]^w[f&255]^d[p+2],b=a[b>>>24]^q[e>>16&255]^v[f>>8&255]^w[g&255]^d[p+3],p+=4,e=h,f=k,g=l;for(m=
16471 0;4>m;m++)r[c?3&-m:m]=x[e>>>24]<<24^x[f>>16&255]<<16^x[g>>8&255]<<8^x[b&255]^d[p++],h=e,e=f,f=g,g=b,b=h;return r}
16472 sjcl.bitArray={bitSlice:function(a,b,c){a=sjcl.bitArray.$(a.slice(b/32),32-(b&31)).slice(1);return void 0===c?a:sjcl.bitArray.clamp(a,c-b)},extract:function(a,b,c){var d=Math.floor(-b-c&31);return((b+c-1^b)&-32?a[b/32|0]<<32-d^a[b/32+1|0]>>>d:a[b/32|0]>>>d)&(1<<c)-1},concat:function(a,b){if(0===a.length||0===b.length)return a.concat(b);var c=a[a.length-1],d=sjcl.bitArray.getPartial(c);return 32===d?a.concat(b):sjcl.bitArray.$(b,d,c|0,a.slice(0,a.length-1))},bitLength:function(a){var b=a.length;return 0===
16473 b?0:32*(b-1)+sjcl.bitArray.getPartial(a[b-1])},clamp:function(a,b){if(32*a.length<b)return a;a=a.slice(0,Math.ceil(b/32));var c=a.length;b=b&31;0<c&&b&&(a[c-1]=sjcl.bitArray.partial(b,a[c-1]&2147483648>>b-1,1));return a},partial:function(a,b,c){return 32===a?b:(c?b|0:b<<32-a)+0x10000000000*a},getPartial:function(a){return Math.round(a/0x10000000000)||32},equal:function(a,b){if(sjcl.bitArray.bitLength(a)!==sjcl.bitArray.bitLength(b))return!1;var c=0,d;for(d=0;d<a.length;d++)c|=a[d]^b[d];return 0===
16474 c},$:function(a,b,c,d){var e;e=0;for(void 0===d&&(d=[]);32<=b;b-=32)d.push(c),c=0;if(0===b)return d.concat(a);for(e=0;e<a.length;e++)d.push(c|a[e]>>>b),c=a[e]<<32-b;e=a.length?a[a.length-1]:0;a=sjcl.bitArray.getPartial(e);d.push(sjcl.bitArray.partial(b+a&31,32<b+a?c:d.pop(),1));return d},i:function(a,b){return[a[0]^b[0],a[1]^b[1],a[2]^b[2],a[3]^b[3]]},byteswapM:function(a){var b,c;for(b=0;b<a.length;++b)c=a[b],a[b]=c>>>24|c>>>8&0xff00|(c&0xff00)<<8|c<<24;return a}};
16475 sjcl.codec.utf8String={fromBits:function(a){var b="",c=sjcl.bitArray.bitLength(a),d,e;for(d=0;d<c/8;d++)0===(d&3)&&(e=a[d/4]),b+=String.fromCharCode(e>>>8>>>8>>>8),e<<=8;return decodeURIComponent(escape(b))},toBits:function(a){a=unescape(encodeURIComponent(a));var b=[],c,d=0;for(c=0;c<a.length;c++)d=d<<8|a.charCodeAt(c),3===(c&3)&&(b.push(d),d=0);c&3&&b.push(sjcl.bitArray.partial(8*(c&3),d));return b}};
16476 sjcl.codec.hex={fromBits:function(a){var b="",c;for(c=0;c<a.length;c++)b+=((a[c]|0)+0xf00000000000).toString(16).substr(4);return b.substr(0,sjcl.bitArray.bitLength(a)/4)},toBits:function(a){var b,c=[],d;a=a.replace(/\s|0x/g,"");d=a.length;a=a+"00000000";for(b=0;b<a.length;b+=8)c.push(parseInt(a.substr(b,8),16)^0);return sjcl.bitArray.clamp(c,4*d)}};
16477 sjcl.codec.base32={B:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",X:"0123456789ABCDEFGHIJKLMNOPQRSTUV",BITS:32,BASE:5,REMAINING:27,fromBits:function(a,b,c){var d=sjcl.codec.base32.BASE,e=sjcl.codec.base32.REMAINING,f="",g=0,h=sjcl.codec.base32.B,k=0,l=sjcl.bitArray.bitLength(a);c&&(h=sjcl.codec.base32.X);for(c=0;f.length*d<l;)f+=h.charAt((k^a[c]>>>g)>>>e),g<d?(k=a[c]<<d-g,g+=e,c++):(k<<=d,g-=d);for(;f.length&7&&!b;)f+="=";return f},toBits:function(a,b){a=a.replace(/\s|=/g,"").toUpperCase();var c=sjcl.codec.base32.BITS,
16478 d=sjcl.codec.base32.BASE,e=sjcl.codec.base32.REMAINING,f=[],g,h=0,k=sjcl.codec.base32.B,l=0,n,m="base32";b&&(k=sjcl.codec.base32.X,m="base32hex");for(g=0;g<a.length;g++){n=k.indexOf(a.charAt(g));if(0>n){if(!b)try{return sjcl.codec.base32hex.toBits(a)}catch(p){}throw new sjcl.exception.invalid("this isn't "+m+"!");}h>e?(h-=e,f.push(l^n>>>h),l=n<<c-h):(h+=d,l^=n<<c-h)}h&56&&f.push(sjcl.bitArray.partial(h&56,l,1));return f}};
16479 sjcl.codec.base32hex={fromBits:function(a,b){return sjcl.codec.base32.fromBits(a,b,1)},toBits:function(a){return sjcl.codec.base32.toBits(a,1)}};
16480 sjcl.codec.base64={B:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fromBits:function(a,b,c){var d="",e=0,f=sjcl.codec.base64.B,g=0,h=sjcl.bitArray.bitLength(a);c&&(f=f.substr(0,62)+"-_");for(c=0;6*d.length<h;)d+=f.charAt((g^a[c]>>>e)>>>26),6>e?(g=a[c]<<6-e,e+=26,c++):(g<<=6,e-=6);for(;d.length&3&&!b;)d+="=";return d},toBits:function(a,b){a=a.replace(/\s|=/g,"");var c=[],d,e=0,f=sjcl.codec.base64.B,g=0,h;b&&(f=f.substr(0,62)+"-_");for(d=0;d<a.length;d++){h=f.indexOf(a.charAt(d));
16481 if(0>h)throw new sjcl.exception.invalid("this isn't base64!");26<e?(e-=26,c.push(g^h>>>e),g=h<<32-e):(e+=6,g^=h<<32-e)}e&56&&c.push(sjcl.bitArray.partial(e&56,g,1));return c}};sjcl.codec.base64url={fromBits:function(a){return sjcl.codec.base64.fromBits(a,1,1)},toBits:function(a){return sjcl.codec.base64.toBits(a,1)}};sjcl.hash.sha256=function(a){this.b[0]||this.O();a?(this.F=a.F.slice(0),this.A=a.A.slice(0),this.l=a.l):this.reset()};sjcl.hash.sha256.hash=function(a){return(new sjcl.hash.sha256).update(a).finalize()};
16482 sjcl.hash.sha256.prototype={blockSize:512,reset:function(){this.F=this.Y.slice(0);this.A=[];this.l=0;return this},update:function(a){"string"===typeof a&&(a=sjcl.codec.utf8String.toBits(a));var b,c=this.A=sjcl.bitArray.concat(this.A,a);b=this.l;a=this.l=b+sjcl.bitArray.bitLength(a);if(0x1fffffffffffff<a)throw new sjcl.exception.invalid("Cannot hash more than 2^53 - 1 bits");if("undefined"!==typeof Uint32Array){var d=new Uint32Array(c),e=0;for(b=512+b-(512+b&0x1ff);b<=a;b+=512)u(this,d.subarray(16*e,
16483 16*(e+1))),e+=1;c.splice(0,16*e)}else for(b=512+b-(512+b&0x1ff);b<=a;b+=512)u(this,c.splice(0,16));return this},finalize:function(){var a,b=this.A,c=this.F,b=sjcl.bitArray.concat(b,[sjcl.bitArray.partial(1,1)]);for(a=b.length+2;a&15;a++)b.push(0);b.push(Math.floor(this.l/0x100000000));for(b.push(this.l|0);b.length;)u(this,b.splice(0,16));this.reset();return c},Y:[],b:[],O:function(){function a(a){return 0x100000000*(a-Math.floor(a))|0}for(var b=0,c=2,d,e;64>b;c++){e=!0;for(d=2;d*d<=c;d++)if(0===c%d){e=
16484 !1;break}e&&(8>b&&(this.Y[b]=a(Math.pow(c,.5))),this.b[b]=a(Math.pow(c,1/3)),b++)}}};
16485 function u(a,b){var c,d,e,f=a.F,g=a.b,h=f[0],k=f[1],l=f[2],n=f[3],m=f[4],p=f[5],r=f[6],q=f[7];for(c=0;64>c;c++)16>c?d=b[c]:(d=b[c+1&15],e=b[c+14&15],d=b[c&15]=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+b[c&15]+b[c+9&15]|0),d=d+q+(m>>>6^m>>>11^m>>>25^m<<26^m<<21^m<<7)+(r^m&(p^r))+g[c],q=r,r=p,p=m,m=n+d|0,n=l,l=k,k=h,h=d+(k&l^n&(k^l))+(k>>>2^k>>>13^k>>>22^k<<30^k<<19^k<<10)|0;f[0]=f[0]+h|0;f[1]=f[1]+k|0;f[2]=f[2]+l|0;f[3]=f[3]+n|0;f[4]=f[4]+m|0;f[5]=f[5]+p|0;f[6]=f[6]+r|0;f[7]=
16487 sjcl.mode.ccm={name:"ccm",G:[],listenProgress:function(a){sjcl.mode.ccm.G.push(a)},unListenProgress:function(a){a=sjcl.mode.ccm.G.indexOf(a);-1<a&&sjcl.mode.ccm.G.splice(a,1)},fa:function(a){var b=sjcl.mode.ccm.G.slice(),c;for(c=0;c<b.length;c+=1)b[c](a)},encrypt:function(a,b,c,d,e){var f,g=b.slice(0),h=sjcl.bitArray,k=h.bitLength(c)/8,l=h.bitLength(g)/8;e=e||64;d=d||[];if(7>k)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(f=2;4>f&&l>>>8*f;f++);f<15-k&&(f=15-k);c=h.clamp(c,
16488 8*(15-f));b=sjcl.mode.ccm.V(a,b,c,d,e,f);g=sjcl.mode.ccm.C(a,g,c,b,e,f);return h.concat(g.data,g.tag)},decrypt:function(a,b,c,d,e){e=e||64;d=d||[];var f=sjcl.bitArray,g=f.bitLength(c)/8,h=f.bitLength(b),k=f.clamp(b,h-e),l=f.bitSlice(b,h-e),h=(h-e)/8;if(7>g)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(b=2;4>b&&h>>>8*b;b++);b<15-g&&(b=15-g);c=f.clamp(c,8*(15-b));k=sjcl.mode.ccm.C(a,k,c,l,e,b);a=sjcl.mode.ccm.V(a,k.data,c,d,e,b);if(!f.equal(k.tag,a))throw new sjcl.exception.corrupt("ccm: tag doesn't match");
16489 return k.data},na:function(a,b,c,d,e,f){var g=[],h=sjcl.bitArray,k=h.i;d=[h.partial(8,(b.length?64:0)|d-2<<2|f-1)];d=h.concat(d,c);d[3]|=e;d=a.encrypt(d);if(b.length)for(c=h.bitLength(b)/8,65279>=c?g=[h.partial(16,c)]:0xffffffff>=c&&(g=h.concat([h.partial(16,65534)],[c])),g=h.concat(g,b),b=0;b<g.length;b+=4)d=a.encrypt(k(d,g.slice(b,b+4).concat([0,0,0])));return d},V:function(a,b,c,d,e,f){var g=sjcl.bitArray,h=g.i;e/=8;if(e%2||4>e||16<e)throw new sjcl.exception.invalid("ccm: invalid tag length");
16490 if(0xffffffff<d.length||0xffffffff<b.length)throw new sjcl.exception.bug("ccm: can't deal with 4GiB or more data");c=sjcl.mode.ccm.na(a,d,c,e,g.bitLength(b)/8,f);for(d=0;d<b.length;d+=4)c=a.encrypt(h(c,b.slice(d,d+4).concat([0,0,0])));return g.clamp(c,8*e)},C:function(a,b,c,d,e,f){var g,h=sjcl.bitArray;g=h.i;var k=b.length,l=h.bitLength(b),n=k/50,m=n;c=h.concat([h.partial(8,f-1)],c).concat([0,0,0]).slice(0,4);d=h.bitSlice(g(d,a.encrypt(c)),0,e);if(!k)return{tag:d,data:[]};for(g=0;g<k;g+=4)g>n&&(sjcl.mode.ccm.fa(g/
16491 k),n+=m),c[3]++,e=a.encrypt(c),b[g]^=e[0],b[g+1]^=e[1],b[g+2]^=e[2],b[g+3]^=e[3];return{tag:d,data:h.clamp(b,l)}}};
16492 sjcl.mode.ocb2={name:"ocb2",encrypt:function(a,b,c,d,e,f){if(128!==sjcl.bitArray.bitLength(c))throw new sjcl.exception.invalid("ocb iv must be 128 bits");var g,h=sjcl.mode.ocb2.S,k=sjcl.bitArray,l=k.i,n=[0,0,0,0];c=h(a.encrypt(c));var m,p=[];d=d||[];e=e||64;for(g=0;g+4<b.length;g+=4)m=b.slice(g,g+4),n=l(n,m),p=p.concat(l(c,a.encrypt(l(c,m)))),c=h(c);m=b.slice(g);b=k.bitLength(m);g=a.encrypt(l(c,[0,0,0,b]));m=k.clamp(l(m.concat([0,0,0]),g),b);n=l(n,l(m.concat([0,0,0]),g));n=a.encrypt(l(n,l(c,h(c))));
16493 d.length&&(n=l(n,f?d:sjcl.mode.ocb2.pmac(a,d)));return p.concat(k.concat(m,k.clamp(n,e)))},decrypt:function(a,b,c,d,e,f){if(128!==sjcl.bitArray.bitLength(c))throw new sjcl.exception.invalid("ocb iv must be 128 bits");e=e||64;var g=sjcl.mode.ocb2.S,h=sjcl.bitArray,k=h.i,l=[0,0,0,0],n=g(a.encrypt(c)),m,p,r=sjcl.bitArray.bitLength(b)-e,q=[];d=d||[];for(c=0;c+4<r/32;c+=4)m=k(n,a.decrypt(k(n,b.slice(c,c+4)))),l=k(l,m),q=q.concat(m),n=g(n);p=r-32*c;m=a.encrypt(k(n,[0,0,0,p]));m=k(m,h.clamp(b.slice(c),p).concat([0,
16494 0,0]));l=k(l,m);l=a.encrypt(k(l,k(n,g(n))));d.length&&(l=k(l,f?d:sjcl.mode.ocb2.pmac(a,d)));if(!h.equal(h.clamp(l,e),h.bitSlice(b,r)))throw new sjcl.exception.corrupt("ocb: tag doesn't match");return q.concat(h.clamp(m,p))},pmac:function(a,b){var c,d=sjcl.mode.ocb2.S,e=sjcl.bitArray,f=e.i,g=[0,0,0,0],h=a.encrypt([0,0,0,0]),h=f(h,d(d(h)));for(c=0;c+4<b.length;c+=4)h=d(h),g=f(g,a.encrypt(f(h,b.slice(c,c+4))));c=b.slice(c);128>e.bitLength(c)&&(h=f(h,d(h)),c=e.concat(c,[-2147483648,0,0,0]));g=f(g,c);
16495 return a.encrypt(f(d(f(h,d(h))),g))},S:function(a){return[a[0]<<1^a[1]>>>31,a[1]<<1^a[2]>>>31,a[2]<<1^a[3]>>>31,a[3]<<1^135*(a[0]>>>31)]}};
16496 sjcl.mode.gcm={name:"gcm",encrypt:function(a,b,c,d,e){var f=b.slice(0);b=sjcl.bitArray;d=d||[];a=sjcl.mode.gcm.C(!0,a,f,d,c,e||128);return b.concat(a.data,a.tag)},decrypt:function(a,b,c,d,e){var f=b.slice(0),g=sjcl.bitArray,h=g.bitLength(f);e=e||128;d=d||[];e<=h?(b=g.bitSlice(f,h-e),f=g.bitSlice(f,0,h-e)):(b=f,f=[]);a=sjcl.mode.gcm.C(!1,a,f,d,c,e);if(!g.equal(a.tag,b))throw new sjcl.exception.corrupt("gcm: tag doesn't match");return a.data},ka:function(a,b){var c,d,e,f,g,h=sjcl.bitArray.i;e=[0,0,
16497 0,0];f=b.slice(0);for(c=0;128>c;c++){(d=0!==(a[Math.floor(c/32)]&1<<31-c%32))&&(e=h(e,f));g=0!==(f[3]&1);for(d=3;0<d;d--)f[d]=f[d]>>>1|(f[d-1]&1)<<31;f[0]>>>=1;g&&(f[0]^=-0x1f000000)}return e},j:function(a,b,c){var d,e=c.length;b=b.slice(0);for(d=0;d<e;d+=4)b[0]^=0xffffffff&c[d],b[1]^=0xffffffff&c[d+1],b[2]^=0xffffffff&c[d+2],b[3]^=0xffffffff&c[d+3],b=sjcl.mode.gcm.ka(b,a);return b},C:function(a,b,c,d,e,f){var g,h,k,l,n,m,p,r,q=sjcl.bitArray;m=c.length;p=q.bitLength(c);r=q.bitLength(d);h=q.bitLength(e);
16498 g=b.encrypt([0,0,0,0]);96===h?(e=e.slice(0),e=q.concat(e,[1])):(e=sjcl.mode.gcm.j(g,[0,0,0,0],e),e=sjcl.mode.gcm.j(g,e,[0,0,Math.floor(h/0x100000000),h&0xffffffff]));h=sjcl.mode.gcm.j(g,[0,0,0,0],d);n=e.slice(0);d=h.slice(0);a||(d=sjcl.mode.gcm.j(g,h,c));for(l=0;l<m;l+=4)n[3]++,k=b.encrypt(n),c[l]^=k[0],c[l+1]^=k[1],c[l+2]^=k[2],c[l+3]^=k[3];c=q.clamp(c,p);a&&(d=sjcl.mode.gcm.j(g,h,c));a=[Math.floor(r/0x100000000),r&0xffffffff,Math.floor(p/0x100000000),p&0xffffffff];d=sjcl.mode.gcm.j(g,d,a);k=b.encrypt(e);
16499 d[0]^=k[0];d[1]^=k[1];d[2]^=k[2];d[3]^=k[3];return{tag:q.bitSlice(d,0,f),data:c}}};sjcl.misc.hmac=function(a,b){this.W=b=b||sjcl.hash.sha256;var c=[[],[]],d,e=b.prototype.blockSize/32;this.w=[new b,new b];a.length>e&&(a=b.hash(a));for(d=0;d<e;d++)c[0][d]=a[d]^909522486,c[1][d]=a[d]^1549556828;this.w[0].update(c[0]);this.w[1].update(c[1]);this.R=new b(this.w[0])};
16500 sjcl.misc.hmac.prototype.encrypt=sjcl.misc.hmac.prototype.mac=function(a){if(this.aa)throw new sjcl.exception.invalid("encrypt on already updated hmac called!");this.update(a);return this.digest(a)};sjcl.misc.hmac.prototype.reset=function(){this.R=new this.W(this.w[0]);this.aa=!1};sjcl.misc.hmac.prototype.update=function(a){this.aa=!0;this.R.update(a)};sjcl.misc.hmac.prototype.digest=function(){var a=this.R.finalize(),a=(new this.W(this.w[1])).update(a).finalize();this.reset();return a};
16501 sjcl.misc.pbkdf2=function(a,b,c,d,e){c=c||1E4;if(0>d||0>c)throw new sjcl.exception.invalid("invalid params to pbkdf2");"string"===typeof a&&(a=sjcl.codec.utf8String.toBits(a));"string"===typeof b&&(b=sjcl.codec.utf8String.toBits(b));e=e||sjcl.misc.hmac;a=new e(a);var f,g,h,k,l=[],n=sjcl.bitArray;for(k=1;32*l.length<(d||1);k++){e=f=a.encrypt(n.concat(b,[k]));for(g=1;g<c;g++)for(f=a.encrypt(f),h=0;h<f.length;h++)e[h]^=f[h];l=l.concat(e)}d&&(l=n.clamp(l,d));return l};
16502 sjcl.prng=function(a){this.c=[new sjcl.hash.sha256];this.m=[0];this.P=0;this.H={};this.N=0;this.U={};this.Z=this.f=this.o=this.ha=0;this.b=[0,0,0,0,0,0,0,0];this.h=[0,0,0,0];this.L=void 0;this.M=a;this.D=!1;this.K={progress:{},seeded:{}};this.u=this.ga=0;this.I=1;this.J=2;this.ca=0x10000;this.T=[0,48,64,96,128,192,0x100,384,512,768,1024];this.da=3E4;this.ba=80};
16503 sjcl.prng.prototype={randomWords:function(a,b){var c=[],d;d=this.isReady(b);var e;if(d===this.u)throw new sjcl.exception.notReady("generator isn't seeded");if(d&this.J){d=!(d&this.I);e=[];var f=0,g;this.Z=e[0]=(new Date).valueOf()+this.da;for(g=0;16>g;g++)e.push(0x100000000*Math.random()|0);for(g=0;g<this.c.length&&(e=e.concat(this.c[g].finalize()),f+=this.m[g],this.m[g]=0,d||!(this.P&1<<g));g++);this.P>=1<<this.c.length&&(this.c.push(new sjcl.hash.sha256),this.m.push(0));this.f-=f;f>this.o&&(this.o=
16504 f);this.P++;this.b=sjcl.hash.sha256.hash(this.b.concat(e));this.L=new sjcl.cipher.aes(this.b);for(d=0;4>d&&(this.h[d]=this.h[d]+1|0,!this.h[d]);d++);}for(d=0;d<a;d+=4)0===(d+1)%this.ca&&y(this),e=z(this),c.push(e[0],e[1],e[2],e[3]);y(this);return c.slice(0,a)},setDefaultParanoia:function(a,b){if(0===a&&"Setting paranoia=0 will ruin your security; use it only for testing"!==b)throw new sjcl.exception.invalid("Setting paranoia=0 will ruin your security; use it only for testing");this.M=a},addEntropy:function(a,
16505 b,c){c=c||"user";var d,e,f=(new Date).valueOf(),g=this.H[c],h=this.isReady(),k=0;d=this.U[c];void 0===d&&(d=this.U[c]=this.ha++);void 0===g&&(g=this.H[c]=0);this.H[c]=(this.H[c]+1)%this.c.length;switch(typeof a){case "number":void 0===b&&(b=1);this.c[g].update([d,this.N++,1,b,f,1,a|0]);break;case "object":c=Object.prototype.toString.call(a);if("[object Uint32Array]"===c){e=[];for(c=0;c<a.length;c++)e.push(a[c]);a=e}else for("[object Array]"!==c&&(k=1),c=0;c<a.length&&!k;c++)"number"!==typeof a[c]&&
16506 (k=1);if(!k){if(void 0===b)for(c=b=0;c<a.length;c++)for(e=a[c];0<e;)b++,e=e>>>1;this.c[g].update([d,this.N++,2,b,f,a.length].concat(a))}break;case "string":void 0===b&&(b=a.length);this.c[g].update([d,this.N++,3,b,f,a.length]);this.c[g].update(a);break;default:k=1}if(k)throw new sjcl.exception.bug("random: addEntropy only supports number, array of numbers or string");this.m[g]+=b;this.f+=b;h===this.u&&(this.isReady()!==this.u&&A("seeded",Math.max(this.o,this.f)),A("progress",this.getProgress()))},
16507 isReady:function(a){a=this.T[void 0!==a?a:this.M];return this.o&&this.o>=a?this.m[0]>this.ba&&(new Date).valueOf()>this.Z?this.J|this.I:this.I:this.f>=a?this.J|this.u:this.u},getProgress:function(a){a=this.T[a?a:this.M];return this.o>=a?1:this.f>a?1:this.f/a},startCollectors:function(){if(!this.D){this.a={loadTimeCollector:B(this,this.ma),mouseCollector:B(this,this.oa),keyboardCollector:B(this,this.la),accelerometerCollector:B(this,this.ea),touchCollector:B(this,this.qa)};if(window.addEventListener)window.addEventListener("load",
16508 this.a.loadTimeCollector,!1),window.addEventListener("mousemove",this.a.mouseCollector,!1),window.addEventListener("keypress",this.a.keyboardCollector,!1),window.addEventListener("devicemotion",this.a.accelerometerCollector,!1),window.addEventListener("touchmove",this.a.touchCollector,!1);else if(document.attachEvent)document.attachEvent("onload",this.a.loadTimeCollector),document.attachEvent("onmousemove",this.a.mouseCollector),document.attachEvent("keypress",this.a.keyboardCollector);else throw new sjcl.exception.bug("can't attach event");
16509 this.D=!0}},stopCollectors:function(){this.D&&(window.removeEventListener?(window.removeEventListener("load",this.a.loadTimeCollector,!1),window.removeEventListener("mousemove",this.a.mouseCollector,!1),window.removeEventListener("keypress",this.a.keyboardCollector,!1),window.removeEventListener("devicemotion",this.a.accelerometerCollector,!1),window.removeEventListener("touchmove",this.a.touchCollector,!1)):document.detachEvent&&(document.detachEvent("onload",this.a.loadTimeCollector),document.detachEvent("onmousemove",
16510 this.a.mouseCollector),document.detachEvent("keypress",this.a.keyboardCollector)),this.D=!1)},addEventListener:function(a,b){this.K[a][this.ga++]=b},removeEventListener:function(a,b){var c,d,e=this.K[a],f=[];for(d in e)e.hasOwnProperty(d)&&e[d]===b&&f.push(d);for(c=0;c<f.length;c++)d=f[c],delete e[d]},la:function(){C(this,1)},oa:function(a){var b,c;try{b=a.x||a.clientX||a.offsetX||0,c=a.y||a.clientY||a.offsetY||0}catch(d){c=b=0}0!=b&&0!=c&&this.addEntropy([b,c],2,"mouse");C(this,0)},qa:function(a){a=
16511 a.touches[0]||a.changedTouches[0];this.addEntropy([a.pageX||a.clientX,a.pageY||a.clientY],1,"touch");C(this,0)},ma:function(){C(this,2)},ea:function(a){a=a.accelerationIncludingGravity.x||a.accelerationIncludingGravity.y||a.accelerationIncludingGravity.z;if(window.orientation){var b=window.orientation;"number"===typeof b&&this.addEntropy(b,1,"accelerometer")}a&&this.addEntropy(a,2,"accelerometer");C(this,0)}};
16512 function A(a,b){var c,d=sjcl.random.K[a],e=[];for(c in d)d.hasOwnProperty(c)&&e.push(d[c]);for(c=0;c<e.length;c++)e[c](b)}function C(a,b){"undefined"!==typeof window&&window.performance&&"function"===typeof window.performance.now?a.addEntropy(window.performance.now(),b,"loadtime"):a.addEntropy((new Date).valueOf(),b,"loadtime")}function y(a){a.b=z(a).concat(z(a));a.L=new sjcl.cipher.aes(a.b)}function z(a){for(var b=0;4>b&&(a.h[b]=a.h[b]+1|0,!a.h[b]);b++);return a.L.encrypt(a.h)}
16513 function B(a,b){return function(){b.apply(a,arguments)}}sjcl.random=new sjcl.prng(6);
16514 a:try{var D,E,F,G;if(G="undefined"!==typeof module&&module.exports){var H;try{H=__webpack_require__(182)}catch(a){H=null}G=E=H}if(G&&E.randomBytes)D=E.randomBytes(128),D=new Uint32Array((new Uint8Array(D)).buffer),sjcl.random.addEntropy(D,1024,"crypto['randomBytes']");else if("undefined"!==typeof window&&"undefined"!==typeof Uint32Array){F=new Uint32Array(32);if(window.crypto&&window.crypto.getRandomValues)window.crypto.getRandomValues(F);else if(window.msCrypto&&window.msCrypto.getRandomValues)window.msCrypto.getRandomValues(F);
16515 else break a;sjcl.random.addEntropy(F,1024,"crypto['getRandomValues']")}}catch(a){"undefined"!==typeof window&&window.console&&(console.log("There was an error collecting entropy from the browser:"),console.log(a))}
16516 sjcl.json={defaults:{v:1,iter:1E4,ks:128,ts:64,mode:"ccm",adata:"",cipher:"aes"},ja:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json,f=e.g({iv:sjcl.random.randomWords(4,0)},e.defaults),g;e.g(f,c);c=f.adata;"string"===typeof f.salt&&(f.salt=sjcl.codec.base64.toBits(f.salt));"string"===typeof f.iv&&(f.iv=sjcl.codec.base64.toBits(f.iv));if(!sjcl.mode[f.mode]||!sjcl.cipher[f.cipher]||"string"===typeof a&&100>=f.iter||64!==f.ts&&96!==f.ts&&128!==f.ts||128!==f.ks&&192!==f.ks&&0x100!==f.ks||2>f.iv.length||
16517 4<f.iv.length)throw new sjcl.exception.invalid("json encrypt: invalid parameters");"string"===typeof a?(g=sjcl.misc.cachedPbkdf2(a,f),a=g.key.slice(0,f.ks/32),f.salt=g.salt):sjcl.ecc&&a instanceof sjcl.ecc.elGamal.publicKey&&(g=a.kem(),f.kemtag=g.tag,a=g.key.slice(0,f.ks/32));"string"===typeof b&&(b=sjcl.codec.utf8String.toBits(b));"string"===typeof c&&(f.adata=c=sjcl.codec.utf8String.toBits(c));g=new sjcl.cipher[f.cipher](a);e.g(d,f);d.key=a;f.ct="ccm"===f.mode&&sjcl.arrayBuffer&&sjcl.arrayBuffer.ccm&&
16518 b instanceof ArrayBuffer?sjcl.arrayBuffer.ccm.encrypt(g,b,f.iv,c,f.ts):sjcl.mode[f.mode].encrypt(g,b,f.iv,c,f.ts);return f},encrypt:function(a,b,c,d){var e=sjcl.json,f=e.ja.apply(e,arguments);return e.encode(f)},ia:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json;b=e.g(e.g(e.g({},e.defaults),b),c,!0);var f,g;f=b.adata;"string"===typeof b.salt&&(b.salt=sjcl.codec.base64.toBits(b.salt));"string"===typeof b.iv&&(b.iv=sjcl.codec.base64.toBits(b.iv));if(!sjcl.mode[b.mode]||!sjcl.cipher[b.cipher]||"string"===
16519 typeof a&&100>=b.iter||64!==b.ts&&96!==b.ts&&128!==b.ts||128!==b.ks&&192!==b.ks&&0x100!==b.ks||!b.iv||2>b.iv.length||4<b.iv.length)throw new sjcl.exception.invalid("json decrypt: invalid parameters");"string"===typeof a?(g=sjcl.misc.cachedPbkdf2(a,b),a=g.key.slice(0,b.ks/32),b.salt=g.salt):sjcl.ecc&&a instanceof sjcl.ecc.elGamal.secretKey&&(a=a.unkem(sjcl.codec.base64.toBits(b.kemtag)).slice(0,b.ks/32));"string"===typeof f&&(f=sjcl.codec.utf8String.toBits(f));g=new sjcl.cipher[b.cipher](a);f="ccm"===
16520 b.mode&&sjcl.arrayBuffer&&sjcl.arrayBuffer.ccm&&b.ct instanceof ArrayBuffer?sjcl.arrayBuffer.ccm.decrypt(g,b.ct,b.iv,b.tag,f,b.ts):sjcl.mode[b.mode].decrypt(g,b.ct,b.iv,f,b.ts);e.g(d,b);d.key=a;return 1===c.raw?f:sjcl.codec.utf8String.fromBits(f)},decrypt:function(a,b,c,d){var e=sjcl.json;return e.ia(a,e.decode(b),c,d)},encode:function(a){var b,c="{",d="";for(b in a)if(a.hasOwnProperty(b)){if(!b.match(/^[a-z0-9]+$/i))throw new sjcl.exception.invalid("json encode: invalid property name");c+=d+'"'+
16521 b+'":';d=",";switch(typeof a[b]){case "number":case "boolean":c+=a[b];break;case "string":c+='"'+escape(a[b])+'"';break;case "object":c+='"'+sjcl.codec.base64.fromBits(a[b],0)+'"';break;default:throw new sjcl.exception.bug("json encode: unsupported type");}}return c+"}"},decode:function(a){a=a.replace(/\s/g,"");if(!a.match(/^\{.*\}$/))throw new sjcl.exception.invalid("json decode: this isn't json!");a=a.replace(/^\{|\}$/g,"").split(/,/);var b={},c,d;for(c=0;c<a.length;c++){if(!(d=a[c].match(/^\s*(?:(["']?)([a-z][a-z0-9]*)\1)\s*:\s*(?:(-?\d+)|"([a-z0-9+\/%*_.@=\-]*)"|(true|false))$/i)))throw new sjcl.exception.invalid("json decode: this isn't json!");
16522 null!=d[3]?b[d[2]]=parseInt(d[3],10):null!=d[4]?b[d[2]]=d[2].match(/^(ct|adata|salt|iv)$/)?sjcl.codec.base64.toBits(d[4]):unescape(d[4]):null!=d[5]&&(b[d[2]]="true"===d[5])}return b},g:function(a,b,c){void 0===a&&(a={});if(void 0===b)return a;for(var d in b)if(b.hasOwnProperty(d)){if(c&&void 0!==a[d]&&a[d]!==b[d])throw new sjcl.exception.invalid("required parameter overridden");a[d]=b[d]}return a},sa:function(a,b){var c={},d;for(d in a)a.hasOwnProperty(d)&&a[d]!==b[d]&&(c[d]=a[d]);return c},ra:function(a,
16523 b){var c={},d;for(d=0;d<b.length;d++)void 0!==a[b[d]]&&(c[b[d]]=a[b[d]]);return c}};sjcl.encrypt=sjcl.json.encrypt;sjcl.decrypt=sjcl.json.decrypt;sjcl.misc.pa={};sjcl.misc.cachedPbkdf2=function(a,b){var c=sjcl.misc.pa,d;b=b||{};d=b.iter||1E3;c=c[a]=c[a]||{};d=c[d]=c[d]||{firstSalt:b.salt&&b.salt.length?b.salt.slice(0):sjcl.random.randomWords(2,0)};c=void 0===b.salt?d.firstSalt:b.salt;d[c]=d[c]||sjcl.misc.pbkdf2(a,c,b.iter);return{key:d[c].slice(0),salt:c.slice(0)}};
16524 "undefined"!==typeof module&&module.exports&&(module.exports=sjcl);"function"==="function"&&!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function(){return sjcl}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
16525 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
16530 /***/ (function(module, exports, __webpack_require__) {
16535 exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = __webpack_require__(23)
16536 exports.createHash = exports.Hash = __webpack_require__(29)
16537 exports.createHmac = exports.Hmac = __webpack_require__(101)
16539 var algos = __webpack_require__(197)
16540 var algoKeys = Object.keys(algos)
16541 var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys)
16542 exports.getHashes = function () {
16546 var p = __webpack_require__(104)
16547 exports.pbkdf2 = p.pbkdf2
16548 exports.pbkdf2Sync = p.pbkdf2Sync
16550 var aes = __webpack_require__(199)
16552 exports.Cipher = aes.Cipher
16553 exports.createCipher = aes.createCipher
16554 exports.Cipheriv = aes.Cipheriv
16555 exports.createCipheriv = aes.createCipheriv
16556 exports.Decipher = aes.Decipher
16557 exports.createDecipher = aes.createDecipher
16558 exports.Decipheriv = aes.Decipheriv
16559 exports.createDecipheriv = aes.createDecipheriv
16560 exports.getCiphers = aes.getCiphers
16561 exports.listCiphers = aes.listCiphers
16563 var dh = __webpack_require__(216)
16565 exports.DiffieHellmanGroup = dh.DiffieHellmanGroup
16566 exports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup
16567 exports.getDiffieHellman = dh.getDiffieHellman
16568 exports.createDiffieHellman = dh.createDiffieHellman
16569 exports.DiffieHellman = dh.DiffieHellman
16571 var sign = __webpack_require__(221)
16573 exports.createSign = sign.createSign
16574 exports.Sign = sign.Sign
16575 exports.createVerify = sign.createVerify
16576 exports.Verify = sign.Verify
16578 exports.createECDH = __webpack_require__(259)
16580 var publicEncrypt = __webpack_require__(260)
16582 exports.publicEncrypt = publicEncrypt.publicEncrypt
16583 exports.privateEncrypt = publicEncrypt.privateEncrypt
16584 exports.publicDecrypt = publicEncrypt.publicDecrypt
16585 exports.privateDecrypt = publicEncrypt.privateDecrypt
16587 // the least I can do is make error messages for the rest of the node.js/crypto api.
16589 // 'createCredentials'
16590 // ].forEach(function (name) {
16591 // exports[name] = function () {
16592 // throw new Error([
16593 // 'sorry, ' + name + ' is not implemented yet',
16594 // 'we accept pull requests',
16595 // 'https://github.com/crypto-browserify/crypto-browserify'
16600 var rf = __webpack_require__(263)
16602 exports.randomFill = rf.randomFill
16603 exports.randomFillSync = rf.randomFillSync
16605 exports.createCredentials = function () {
16607 'sorry, createCredentials is not implemented yet',
16608 'we accept pull requests',
16609 'https://github.com/crypto-browserify/crypto-browserify'
16613 exports.constants = {
16614 'DH_CHECK_P_NOT_SAFE_PRIME': 2,
16615 'DH_CHECK_P_NOT_PRIME': 1,
16616 'DH_UNABLE_TO_CHECK_GENERATOR': 4,
16617 'DH_NOT_SUITABLE_GENERATOR': 8,
16620 'RSA_PKCS1_PADDING': 1,
16621 'RSA_SSLV23_PADDING': 2,
16622 'RSA_NO_PADDING': 3,
16623 'RSA_PKCS1_OAEP_PADDING': 4,
16624 'RSA_X931_PADDING': 5,
16625 'RSA_PKCS1_PSS_PADDING': 6,
16626 'POINT_CONVERSION_COMPRESSED': 2,
16627 'POINT_CONVERSION_UNCOMPRESSED': 4,
16628 'POINT_CONVERSION_HYBRID': 6
16634 /***/ (function(module, exports) {
16640 /***/ (function(module, exports, __webpack_require__) {
16645 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16647 var Buffer = __webpack_require__(2).Buffer;
16648 var util = __webpack_require__(185);
16650 function copyBuffer(src, target, offset) {
16651 src.copy(target, offset);
16654 module.exports = function () {
16655 function BufferList() {
16656 _classCallCheck(this, BufferList);
16663 BufferList.prototype.push = function push(v) {
16664 var entry = { data: v, next: null };
16665 if (this.length > 0) this.tail.next = entry;else this.head = entry;
16670 BufferList.prototype.unshift = function unshift(v) {
16671 var entry = { data: v, next: this.head };
16672 if (this.length === 0) this.tail = entry;
16677 BufferList.prototype.shift = function shift() {
16678 if (this.length === 0) return;
16679 var ret = this.head.data;
16680 if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
16685 BufferList.prototype.clear = function clear() {
16686 this.head = this.tail = null;
16690 BufferList.prototype.join = function join(s) {
16691 if (this.length === 0) return '';
16693 var ret = '' + p.data;
16694 while (p = p.next) {
16699 BufferList.prototype.concat = function concat(n) {
16700 if (this.length === 0) return Buffer.alloc(0);
16701 if (this.length === 1) return this.head.data;
16702 var ret = Buffer.allocUnsafe(n >>> 0);
16706 copyBuffer(p.data, ret, i);
16707 i += p.data.length;
16716 if (util && util.inspect && util.inspect.custom) {
16717 module.exports.prototype[util.inspect.custom] = function () {
16718 var obj = util.inspect({ length: this.length });
16719 return this.constructor.name + ' ' + obj;
16725 /***/ (function(module, exports) {
16731 /***/ (function(module, exports, __webpack_require__) {
16733 /* WEBPACK VAR INJECTION */(function(global) {
16738 module.exports = deprecate;
16741 * Mark that a method should not be used.
16742 * Returns a modified function which warns once by default.
16744 * If `localStorage.noDeprecation = true` is set, then it is a no-op.
16746 * If `localStorage.throwDeprecation = true` is set, then deprecated functions
16747 * will throw an Error when invoked.
16749 * If `localStorage.traceDeprecation = true` is set, then deprecated functions
16750 * will invoke `console.trace()` instead of `console.error()`.
16752 * @param {Function} fn - the function to deprecate
16753 * @param {String} msg - the string to print to the console when `fn` is invoked
16754 * @returns {Function} a new "deprecated" version of `fn`
16758 function deprecate (fn, msg) {
16759 if (config('noDeprecation')) {
16763 var warned = false;
16764 function deprecated() {
16766 if (config('throwDeprecation')) {
16767 throw new Error(msg);
16768 } else if (config('traceDeprecation')) {
16769 console.trace(msg);
16775 return fn.apply(this, arguments);
16782 * Checks `localStorage` for boolean values for the given `name`.
16784 * @param {String} name
16785 * @returns {Boolean}
16789 function config (name) {
16790 // accessing global.localStorage can trigger a DOMException in sandboxed iframes
16792 if (!global.localStorage) return false;
16796 var val = global.localStorage[name];
16797 if (null == val) return false;
16798 return String(val).toLowerCase() === 'true';
16801 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
16805 /***/ (function(module, exports, __webpack_require__) {
16808 // Copyright Joyent, Inc. and other Node contributors.
16810 // Permission is hereby granted, free of charge, to any person obtaining a
16811 // copy of this software and associated documentation files (the
16812 // "Software"), to deal in the Software without restriction, including
16813 // without limitation the rights to use, copy, modify, merge, publish,
16814 // distribute, sublicense, and/or sell copies of the Software, and to permit
16815 // persons to whom the Software is furnished to do so, subject to the
16816 // following conditions:
16818 // The above copyright notice and this permission notice shall be included
16819 // in all copies or substantial portions of the Software.
16821 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16822 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16823 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
16824 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16825 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16826 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
16827 // USE OR OTHER DEALINGS IN THE SOFTWARE.
16829 // a passthrough stream.
16830 // basically just the most minimal sort of Transform stream.
16831 // Every written chunk gets output as-is.
16835 module.exports = PassThrough;
16837 var Transform = __webpack_require__(98);
16840 var util = __webpack_require__(30);
16841 util.inherits = __webpack_require__(1);
16844 util.inherits(PassThrough, Transform);
16846 function PassThrough(options) {
16847 if (!(this instanceof PassThrough)) return new PassThrough(options);
16849 Transform.call(this, options);
16852 PassThrough.prototype._transform = function (chunk, encoding, cb) {
16858 /***/ (function(module, exports, __webpack_require__) {
16860 module.exports = __webpack_require__(60);
16865 /***/ (function(module, exports, __webpack_require__) {
16867 module.exports = __webpack_require__(21);
16872 /***/ (function(module, exports, __webpack_require__) {
16874 module.exports = __webpack_require__(59).Transform
16879 /***/ (function(module, exports, __webpack_require__) {
16881 module.exports = __webpack_require__(59).PassThrough
16886 /***/ (function(module, exports, __webpack_require__) {
16889 * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined
16890 * in FIPS PUB 180-1
16891 * This source code is derived from sha1.js of the same repository.
16892 * The difference between SHA-0 and SHA-1 is just a bitwise rotate left
16893 * operation was added.
16896 var inherits = __webpack_require__(1)
16897 var Hash = __webpack_require__(24)
16898 var Buffer = __webpack_require__(2).Buffer
16901 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
16904 var W = new Array(80)
16910 Hash.call(this, 64, 56)
16913 inherits(Sha, Hash)
16915 Sha.prototype.init = function () {
16916 this._a = 0x67452301
16917 this._b = 0xefcdab89
16918 this._c = 0x98badcfe
16919 this._d = 0x10325476
16920 this._e = 0xc3d2e1f0
16925 function rotl5 (num) {
16926 return (num << 5) | (num >>> 27)
16929 function rotl30 (num) {
16930 return (num << 30) | (num >>> 2)
16933 function ft (s, b, c, d) {
16934 if (s === 0) return (b & c) | ((~b) & d)
16935 if (s === 2) return (b & c) | (b & d) | (c & d)
16939 Sha.prototype._update = function (M) {
16942 var a = this._a | 0
16943 var b = this._b | 0
16944 var c = this._c | 0
16945 var d = this._d | 0
16946 var e = this._e | 0
16948 for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
16949 for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]
16951 for (var j = 0; j < 80; ++j) {
16953 var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
16962 this._a = (a + this._a) | 0
16963 this._b = (b + this._b) | 0
16964 this._c = (c + this._c) | 0
16965 this._d = (d + this._d) | 0
16966 this._e = (e + this._e) | 0
16969 Sha.prototype._hash = function () {
16970 var H = Buffer.allocUnsafe(20)
16972 H.writeInt32BE(this._a | 0, 0)
16973 H.writeInt32BE(this._b | 0, 4)
16974 H.writeInt32BE(this._c | 0, 8)
16975 H.writeInt32BE(this._d | 0, 12)
16976 H.writeInt32BE(this._e | 0, 16)
16981 module.exports = Sha
16986 /***/ (function(module, exports, __webpack_require__) {
16989 * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
16990 * in FIPS PUB 180-1
16991 * Version 2.1a Copyright Paul Johnston 2000 - 2002.
16992 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
16993 * Distributed under the BSD License
16994 * See http://pajhome.org.uk/crypt/md5 for details.
16997 var inherits = __webpack_require__(1)
16998 var Hash = __webpack_require__(24)
16999 var Buffer = __webpack_require__(2).Buffer
17002 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
17005 var W = new Array(80)
17011 Hash.call(this, 64, 56)
17014 inherits(Sha1, Hash)
17016 Sha1.prototype.init = function () {
17017 this._a = 0x67452301
17018 this._b = 0xefcdab89
17019 this._c = 0x98badcfe
17020 this._d = 0x10325476
17021 this._e = 0xc3d2e1f0
17026 function rotl1 (num) {
17027 return (num << 1) | (num >>> 31)
17030 function rotl5 (num) {
17031 return (num << 5) | (num >>> 27)
17034 function rotl30 (num) {
17035 return (num << 30) | (num >>> 2)
17038 function ft (s, b, c, d) {
17039 if (s === 0) return (b & c) | ((~b) & d)
17040 if (s === 2) return (b & c) | (b & d) | (c & d)
17044 Sha1.prototype._update = function (M) {
17047 var a = this._a | 0
17048 var b = this._b | 0
17049 var c = this._c | 0
17050 var d = this._d | 0
17051 var e = this._e | 0
17053 for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
17054 for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16])
17056 for (var j = 0; j < 80; ++j) {
17058 var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
17067 this._a = (a + this._a) | 0
17068 this._b = (b + this._b) | 0
17069 this._c = (c + this._c) | 0
17070 this._d = (d + this._d) | 0
17071 this._e = (e + this._e) | 0
17074 Sha1.prototype._hash = function () {
17075 var H = Buffer.allocUnsafe(20)
17077 H.writeInt32BE(this._a | 0, 0)
17078 H.writeInt32BE(this._b | 0, 4)
17079 H.writeInt32BE(this._c | 0, 8)
17080 H.writeInt32BE(this._d | 0, 12)
17081 H.writeInt32BE(this._e | 0, 16)
17086 module.exports = Sha1
17091 /***/ (function(module, exports, __webpack_require__) {
17094 * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
17096 * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
17097 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
17101 var inherits = __webpack_require__(1)
17102 var Sha256 = __webpack_require__(99)
17103 var Hash = __webpack_require__(24)
17104 var Buffer = __webpack_require__(2).Buffer
17106 var W = new Array(64)
17108 function Sha224 () {
17111 this._w = W // new Array(64)
17113 Hash.call(this, 64, 56)
17116 inherits(Sha224, Sha256)
17118 Sha224.prototype.init = function () {
17119 this._a = 0xc1059ed8
17120 this._b = 0x367cd507
17121 this._c = 0x3070dd17
17122 this._d = 0xf70e5939
17123 this._e = 0xffc00b31
17124 this._f = 0x68581511
17125 this._g = 0x64f98fa7
17126 this._h = 0xbefa4fa4
17131 Sha224.prototype._hash = function () {
17132 var H = Buffer.allocUnsafe(28)
17134 H.writeInt32BE(this._a, 0)
17135 H.writeInt32BE(this._b, 4)
17136 H.writeInt32BE(this._c, 8)
17137 H.writeInt32BE(this._d, 12)
17138 H.writeInt32BE(this._e, 16)
17139 H.writeInt32BE(this._f, 20)
17140 H.writeInt32BE(this._g, 24)
17145 module.exports = Sha224
17150 /***/ (function(module, exports, __webpack_require__) {
17152 var inherits = __webpack_require__(1)
17153 var SHA512 = __webpack_require__(100)
17154 var Hash = __webpack_require__(24)
17155 var Buffer = __webpack_require__(2).Buffer
17157 var W = new Array(160)
17159 function Sha384 () {
17163 Hash.call(this, 128, 112)
17166 inherits(Sha384, SHA512)
17168 Sha384.prototype.init = function () {
17169 this._ah = 0xcbbb9d5d
17170 this._bh = 0x629a292a
17171 this._ch = 0x9159015a
17172 this._dh = 0x152fecd8
17173 this._eh = 0x67332667
17174 this._fh = 0x8eb44a87
17175 this._gh = 0xdb0c2e0d
17176 this._hh = 0x47b5481d
17178 this._al = 0xc1059ed8
17179 this._bl = 0x367cd507
17180 this._cl = 0x3070dd17
17181 this._dl = 0xf70e5939
17182 this._el = 0xffc00b31
17183 this._fl = 0x68581511
17184 this._gl = 0x64f98fa7
17185 this._hl = 0xbefa4fa4
17190 Sha384.prototype._hash = function () {
17191 var H = Buffer.allocUnsafe(48)
17193 function writeInt64BE (h, l, offset) {
17194 H.writeInt32BE(h, offset)
17195 H.writeInt32BE(l, offset + 4)
17198 writeInt64BE(this._ah, this._al, 0)
17199 writeInt64BE(this._bh, this._bl, 8)
17200 writeInt64BE(this._ch, this._cl, 16)
17201 writeInt64BE(this._dh, this._dl, 24)
17202 writeInt64BE(this._eh, this._el, 32)
17203 writeInt64BE(this._fh, this._fl, 40)
17208 module.exports = Sha384
17213 /***/ (function(module, exports, __webpack_require__) {
17217 var inherits = __webpack_require__(1)
17218 var Buffer = __webpack_require__(2).Buffer
17220 var Base = __webpack_require__(18)
17222 var ZEROS = Buffer.alloc(128)
17225 function Hmac (alg, key) {
17226 Base.call(this, 'digest')
17227 if (typeof key === 'string') {
17228 key = Buffer.from(key)
17234 if (key.length > blocksize) {
17236 } else if (key.length < blocksize) {
17237 key = Buffer.concat([key, ZEROS], blocksize)
17240 var ipad = this._ipad = Buffer.allocUnsafe(blocksize)
17241 var opad = this._opad = Buffer.allocUnsafe(blocksize)
17243 for (var i = 0; i < blocksize; i++) {
17244 ipad[i] = key[i] ^ 0x36
17245 opad[i] = key[i] ^ 0x5C
17248 this._hash = [ipad]
17251 inherits(Hmac, Base)
17253 Hmac.prototype._update = function (data) {
17254 this._hash.push(data)
17257 Hmac.prototype._final = function () {
17258 var h = this._alg(Buffer.concat(this._hash))
17259 return this._alg(Buffer.concat([this._opad, h]))
17261 module.exports = Hmac
17266 /***/ (function(module, exports, __webpack_require__) {
17268 module.exports = __webpack_require__(103)
17273 /***/ (function(module, exports, __webpack_require__) {
17275 /* WEBPACK VAR INJECTION */(function(global, process) {var checkParameters = __webpack_require__(105)
17276 var defaultEncoding = __webpack_require__(106)
17277 var sync = __webpack_require__(107)
17278 var Buffer = __webpack_require__(2).Buffer
17281 var subtle = global.crypto && global.crypto.subtle
17286 'sha256': 'SHA-256',
17287 'sha-256': 'SHA-256',
17288 'sha384': 'SHA-384',
17289 'sha-384': 'SHA-384',
17290 'sha-512': 'SHA-512',
17291 'sha512': 'SHA-512'
17294 function checkNative (algo) {
17295 if (global.process && !global.process.browser) {
17296 return Promise.resolve(false)
17298 if (!subtle || !subtle.importKey || !subtle.deriveBits) {
17299 return Promise.resolve(false)
17301 if (checks[algo] !== undefined) {
17302 return checks[algo]
17304 ZERO_BUF = ZERO_BUF || Buffer.alloc(8)
17305 var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo)
17306 .then(function () {
17308 }).catch(function () {
17311 checks[algo] = prom
17315 function browserPbkdf2 (password, salt, iterations, length, algo) {
17316 return subtle.importKey(
17317 'raw', password, {name: 'PBKDF2'}, false, ['deriveBits']
17318 ).then(function (key) {
17319 return subtle.deriveBits({
17322 iterations: iterations,
17326 }, key, length << 3)
17327 }).then(function (res) {
17328 return Buffer.from(res)
17332 function resolvePromise (promise, callback) {
17333 promise.then(function (out) {
17334 process.nextTick(function () {
17335 callback(null, out)
17338 process.nextTick(function () {
17343 module.exports = function (password, salt, iterations, keylen, digest, callback) {
17344 if (typeof digest === 'function') {
17349 digest = digest || 'sha1'
17350 var algo = toBrowser[digest.toLowerCase()]
17352 if (!algo || typeof global.Promise !== 'function') {
17353 return process.nextTick(function () {
17356 out = sync(password, salt, iterations, keylen, digest)
17360 callback(null, out)
17364 checkParameters(password, salt, iterations, keylen)
17365 if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2')
17366 if (!Buffer.isBuffer(password)) password = Buffer.from(password, defaultEncoding)
17367 if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, defaultEncoding)
17369 resolvePromise(checkNative(algo).then(function (resp) {
17370 if (resp) return browserPbkdf2(password, salt, iterations, keylen, algo)
17372 return sync(password, salt, iterations, keylen, digest)
17376 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10), __webpack_require__(14)))
17380 /***/ (function(module, exports, __webpack_require__) {
17382 var DES = __webpack_require__(200)
17383 var aes = __webpack_require__(65)
17384 var aesModes = __webpack_require__(66)
17385 var desModes = __webpack_require__(215)
17386 var ebtk = __webpack_require__(44)
17388 function createCipher (suite, password) {
17389 suite = suite.toLowerCase()
17392 if (aesModes[suite]) {
17393 keyLen = aesModes[suite].key
17394 ivLen = aesModes[suite].iv
17395 } else if (desModes[suite]) {
17396 keyLen = desModes[suite].key * 8
17397 ivLen = desModes[suite].iv
17399 throw new TypeError('invalid suite type')
17402 var keys = ebtk(password, false, keyLen, ivLen)
17403 return createCipheriv(suite, keys.key, keys.iv)
17406 function createDecipher (suite, password) {
17407 suite = suite.toLowerCase()
17410 if (aesModes[suite]) {
17411 keyLen = aesModes[suite].key
17412 ivLen = aesModes[suite].iv
17413 } else if (desModes[suite]) {
17414 keyLen = desModes[suite].key * 8
17415 ivLen = desModes[suite].iv
17417 throw new TypeError('invalid suite type')
17420 var keys = ebtk(password, false, keyLen, ivLen)
17421 return createDecipheriv(suite, keys.key, keys.iv)
17424 function createCipheriv (suite, key, iv) {
17425 suite = suite.toLowerCase()
17426 if (aesModes[suite]) return aes.createCipheriv(suite, key, iv)
17427 if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite })
17429 throw new TypeError('invalid suite type')
17432 function createDecipheriv (suite, key, iv) {
17433 suite = suite.toLowerCase()
17434 if (aesModes[suite]) return aes.createDecipheriv(suite, key, iv)
17435 if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite, decrypt: true })
17437 throw new TypeError('invalid suite type')
17440 function getCiphers () {
17441 return Object.keys(desModes).concat(aes.getCiphers())
17444 exports.createCipher = exports.Cipher = createCipher
17445 exports.createCipheriv = exports.Cipheriv = createCipheriv
17446 exports.createDecipher = exports.Decipher = createDecipher
17447 exports.createDecipheriv = exports.Decipheriv = createDecipheriv
17448 exports.listCiphers = exports.getCiphers = getCiphers
17453 /***/ (function(module, exports, __webpack_require__) {
17455 var CipherBase = __webpack_require__(18)
17456 var des = __webpack_require__(64)
17457 var inherits = __webpack_require__(1)
17458 var Buffer = __webpack_require__(2).Buffer
17461 'des-ede3-cbc': des.CBC.instantiate(des.EDE),
17462 'des-ede3': des.EDE,
17463 'des-ede-cbc': des.CBC.instantiate(des.EDE),
17464 'des-ede': des.EDE,
17465 'des-cbc': des.CBC.instantiate(des.DES),
17468 modes.des = modes['des-cbc']
17469 modes.des3 = modes['des-ede3-cbc']
17470 module.exports = DES
17471 inherits(DES, CipherBase)
17472 function DES (opts) {
17473 CipherBase.call(this)
17474 var modeName = opts.mode.toLowerCase()
17475 var mode = modes[modeName]
17477 if (opts.decrypt) {
17483 if (!Buffer.isBuffer(key)) {
17484 key = Buffer.from(key)
17486 if (modeName === 'des-ede' || modeName === 'des-ede-cbc') {
17487 key = Buffer.concat([key, key.slice(0, 8)])
17490 if (!Buffer.isBuffer(iv)) {
17491 iv = Buffer.from(iv)
17493 this._des = mode.create({
17499 DES.prototype._update = function (data) {
17500 return Buffer.from(this._des.update(data))
17502 DES.prototype._final = function () {
17503 return Buffer.from(this._des.final())
17509 /***/ (function(module, exports, __webpack_require__) {
17514 exports.readUInt32BE = function readUInt32BE(bytes, off) {
17515 var res = (bytes[0 + off] << 24) |
17516 (bytes[1 + off] << 16) |
17517 (bytes[2 + off] << 8) |
17522 exports.writeUInt32BE = function writeUInt32BE(bytes, value, off) {
17523 bytes[0 + off] = value >>> 24;
17524 bytes[1 + off] = (value >>> 16) & 0xff;
17525 bytes[2 + off] = (value >>> 8) & 0xff;
17526 bytes[3 + off] = value & 0xff;
17529 exports.ip = function ip(inL, inR, out, off) {
17533 for (var i = 6; i >= 0; i -= 2) {
17534 for (var j = 0; j <= 24; j += 8) {
17536 outL |= (inR >>> (j + i)) & 1;
17538 for (var j = 0; j <= 24; j += 8) {
17540 outL |= (inL >>> (j + i)) & 1;
17544 for (var i = 6; i >= 0; i -= 2) {
17545 for (var j = 1; j <= 25; j += 8) {
17547 outR |= (inR >>> (j + i)) & 1;
17549 for (var j = 1; j <= 25; j += 8) {
17551 outR |= (inL >>> (j + i)) & 1;
17555 out[off + 0] = outL >>> 0;
17556 out[off + 1] = outR >>> 0;
17559 exports.rip = function rip(inL, inR, out, off) {
17563 for (var i = 0; i < 4; i++) {
17564 for (var j = 24; j >= 0; j -= 8) {
17566 outL |= (inR >>> (j + i)) & 1;
17568 outL |= (inL >>> (j + i)) & 1;
17571 for (var i = 4; i < 8; i++) {
17572 for (var j = 24; j >= 0; j -= 8) {
17574 outR |= (inR >>> (j + i)) & 1;
17576 outR |= (inL >>> (j + i)) & 1;
17580 out[off + 0] = outL >>> 0;
17581 out[off + 1] = outR >>> 0;
17584 exports.pc1 = function pc1(inL, inR, out, off) {
17588 // 7, 15, 23, 31, 39, 47, 55, 63
17589 // 6, 14, 22, 30, 39, 47, 55, 63
17590 // 5, 13, 21, 29, 39, 47, 55, 63
17592 for (var i = 7; i >= 5; i--) {
17593 for (var j = 0; j <= 24; j += 8) {
17595 outL |= (inR >> (j + i)) & 1;
17597 for (var j = 0; j <= 24; j += 8) {
17599 outL |= (inL >> (j + i)) & 1;
17602 for (var j = 0; j <= 24; j += 8) {
17604 outL |= (inR >> (j + i)) & 1;
17607 // 1, 9, 17, 25, 33, 41, 49, 57
17608 // 2, 10, 18, 26, 34, 42, 50, 58
17609 // 3, 11, 19, 27, 35, 43, 51, 59
17611 for (var i = 1; i <= 3; i++) {
17612 for (var j = 0; j <= 24; j += 8) {
17614 outR |= (inR >> (j + i)) & 1;
17616 for (var j = 0; j <= 24; j += 8) {
17618 outR |= (inL >> (j + i)) & 1;
17621 for (var j = 0; j <= 24; j += 8) {
17623 outR |= (inL >> (j + i)) & 1;
17626 out[off + 0] = outL >>> 0;
17627 out[off + 1] = outR >>> 0;
17630 exports.r28shl = function r28shl(num, shift) {
17631 return ((num << shift) & 0xfffffff) | (num >>> (28 - shift));
17636 14, 11, 17, 4, 27, 23, 25, 0,
17637 13, 22, 7, 18, 5, 9, 16, 24,
17638 2, 20, 12, 21, 1, 8, 15, 26,
17641 15, 4, 25, 19, 9, 1, 26, 16,
17642 5, 11, 23, 8, 12, 7, 17, 0,
17643 22, 3, 10, 14, 6, 20, 27, 24
17646 exports.pc2 = function pc2(inL, inR, out, off) {
17650 var len = pc2table.length >>> 1;
17651 for (var i = 0; i < len; i++) {
17653 outL |= (inL >>> pc2table[i]) & 0x1;
17655 for (var i = len; i < pc2table.length; i++) {
17657 outR |= (inR >>> pc2table[i]) & 0x1;
17660 out[off + 0] = outL >>> 0;
17661 out[off + 1] = outR >>> 0;
17664 exports.expand = function expand(r, out, off) {
17668 outL = ((r & 1) << 5) | (r >>> 27);
17669 for (var i = 23; i >= 15; i -= 4) {
17671 outL |= (r >>> i) & 0x3f;
17673 for (var i = 11; i >= 3; i -= 4) {
17674 outR |= (r >>> i) & 0x3f;
17677 outR |= ((r & 0x1f) << 1) | (r >>> 31);
17679 out[off + 0] = outL >>> 0;
17680 out[off + 1] = outR >>> 0;
17684 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1,
17685 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8,
17686 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7,
17687 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13,
17689 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14,
17690 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5,
17691 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2,
17692 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9,
17694 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10,
17695 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1,
17696 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7,
17697 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12,
17699 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3,
17700 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9,
17701 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8,
17702 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14,
17704 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1,
17705 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6,
17706 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13,
17707 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3,
17709 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5,
17710 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8,
17711 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10,
17712 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13,
17714 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10,
17715 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6,
17716 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7,
17717 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12,
17719 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4,
17720 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2,
17721 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13,
17722 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11
17725 exports.substitute = function substitute(inL, inR) {
17727 for (var i = 0; i < 4; i++) {
17728 var b = (inL >>> (18 - i * 6)) & 0x3f;
17729 var sb = sTable[i * 0x40 + b];
17734 for (var i = 0; i < 4; i++) {
17735 var b = (inR >>> (18 - i * 6)) & 0x3f;
17736 var sb = sTable[4 * 0x40 + i * 0x40 + b];
17744 var permuteTable = [
17745 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22,
17746 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7
17749 exports.permute = function permute(num) {
17751 for (var i = 0; i < permuteTable.length; i++) {
17753 out |= (num >>> permuteTable[i]) & 0x1;
17758 exports.padSplit = function padSplit(num, size, group) {
17759 var str = num.toString(2);
17760 while (str.length < size)
17764 for (var i = 0; i < size; i += group)
17765 out.push(str.slice(i, i + group));
17766 return out.join(' ');
17772 /***/ (function(module, exports, __webpack_require__) {
17777 var assert = __webpack_require__(9);
17779 function Cipher(options) {
17780 this.options = options;
17782 this.type = this.options.type;
17783 this.blockSize = 8;
17786 this.buffer = new Array(this.blockSize);
17787 this.bufferOff = 0;
17789 module.exports = Cipher;
17791 Cipher.prototype._init = function _init() {
17792 // Might be overrided
17795 Cipher.prototype.update = function update(data) {
17796 if (data.length === 0)
17799 if (this.type === 'decrypt')
17800 return this._updateDecrypt(data);
17802 return this._updateEncrypt(data);
17805 Cipher.prototype._buffer = function _buffer(data, off) {
17806 // Append data to buffer
17807 var min = Math.min(this.buffer.length - this.bufferOff, data.length - off);
17808 for (var i = 0; i < min; i++)
17809 this.buffer[this.bufferOff + i] = data[off + i];
17810 this.bufferOff += min;
17816 Cipher.prototype._flushBuffer = function _flushBuffer(out, off) {
17817 this._update(this.buffer, 0, out, off);
17818 this.bufferOff = 0;
17819 return this.blockSize;
17822 Cipher.prototype._updateEncrypt = function _updateEncrypt(data) {
17826 var count = ((this.bufferOff + data.length) / this.blockSize) | 0;
17827 var out = new Array(count * this.blockSize);
17829 if (this.bufferOff !== 0) {
17830 inputOff += this._buffer(data, inputOff);
17832 if (this.bufferOff === this.buffer.length)
17833 outputOff += this._flushBuffer(out, outputOff);
17837 var max = data.length - ((data.length - inputOff) % this.blockSize);
17838 for (; inputOff < max; inputOff += this.blockSize) {
17839 this._update(data, inputOff, out, outputOff);
17840 outputOff += this.blockSize;
17844 for (; inputOff < data.length; inputOff++, this.bufferOff++)
17845 this.buffer[this.bufferOff] = data[inputOff];
17850 Cipher.prototype._updateDecrypt = function _updateDecrypt(data) {
17854 var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1;
17855 var out = new Array(count * this.blockSize);
17857 // TODO(indutny): optimize it, this is far from optimal
17858 for (; count > 0; count--) {
17859 inputOff += this._buffer(data, inputOff);
17860 outputOff += this._flushBuffer(out, outputOff);
17863 // Buffer rest of the input
17864 inputOff += this._buffer(data, inputOff);
17869 Cipher.prototype.final = function final(buffer) {
17872 first = this.update(buffer);
17875 if (this.type === 'encrypt')
17876 last = this._finalEncrypt();
17878 last = this._finalDecrypt();
17881 return first.concat(last);
17886 Cipher.prototype._pad = function _pad(buffer, off) {
17890 while (off < buffer.length)
17896 Cipher.prototype._finalEncrypt = function _finalEncrypt() {
17897 if (!this._pad(this.buffer, this.bufferOff))
17900 var out = new Array(this.blockSize);
17901 this._update(this.buffer, 0, out, 0);
17905 Cipher.prototype._unpad = function _unpad(buffer) {
17909 Cipher.prototype._finalDecrypt = function _finalDecrypt() {
17910 assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt');
17911 var out = new Array(this.blockSize);
17912 this._flushBuffer(out, 0);
17914 return this._unpad(out);
17920 /***/ (function(module, exports, __webpack_require__) {
17925 var assert = __webpack_require__(9);
17926 var inherits = __webpack_require__(1);
17928 var des = __webpack_require__(64);
17929 var utils = des.utils;
17930 var Cipher = des.Cipher;
17932 function DESState() {
17933 this.tmp = new Array(2);
17937 function DES(options) {
17938 Cipher.call(this, options);
17940 var state = new DESState();
17941 this._desState = state;
17943 this.deriveKeys(state, options.key);
17945 inherits(DES, Cipher);
17946 module.exports = DES;
17948 DES.create = function create(options) {
17949 return new DES(options);
17953 1, 1, 2, 2, 2, 2, 2, 2,
17954 1, 2, 2, 2, 2, 2, 2, 1
17957 DES.prototype.deriveKeys = function deriveKeys(state, key) {
17958 state.keys = new Array(16 * 2);
17960 assert.equal(key.length, this.blockSize, 'Invalid key length');
17962 var kL = utils.readUInt32BE(key, 0);
17963 var kR = utils.readUInt32BE(key, 4);
17965 utils.pc1(kL, kR, state.tmp, 0);
17968 for (var i = 0; i < state.keys.length; i += 2) {
17969 var shift = shiftTable[i >>> 1];
17970 kL = utils.r28shl(kL, shift);
17971 kR = utils.r28shl(kR, shift);
17972 utils.pc2(kL, kR, state.keys, i);
17976 DES.prototype._update = function _update(inp, inOff, out, outOff) {
17977 var state = this._desState;
17979 var l = utils.readUInt32BE(inp, inOff);
17980 var r = utils.readUInt32BE(inp, inOff + 4);
17982 // Initial Permutation
17983 utils.ip(l, r, state.tmp, 0);
17987 if (this.type === 'encrypt')
17988 this._encrypt(state, l, r, state.tmp, 0);
17990 this._decrypt(state, l, r, state.tmp, 0);
17995 utils.writeUInt32BE(out, l, outOff);
17996 utils.writeUInt32BE(out, r, outOff + 4);
17999 DES.prototype._pad = function _pad(buffer, off) {
18000 var value = buffer.length - off;
18001 for (var i = off; i < buffer.length; i++)
18007 DES.prototype._unpad = function _unpad(buffer) {
18008 var pad = buffer[buffer.length - 1];
18009 for (var i = buffer.length - pad; i < buffer.length; i++)
18010 assert.equal(buffer[i], pad);
18012 return buffer.slice(0, buffer.length - pad);
18015 DES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) {
18019 // Apply f() x16 times
18020 for (var i = 0; i < state.keys.length; i += 2) {
18021 var keyL = state.keys[i];
18022 var keyR = state.keys[i + 1];
18025 utils.expand(r, state.tmp, 0);
18027 keyL ^= state.tmp[0];
18028 keyR ^= state.tmp[1];
18029 var s = utils.substitute(keyL, keyR);
18030 var f = utils.permute(s);
18037 // Reverse Initial Permutation
18038 utils.rip(r, l, out, off);
18041 DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) {
18045 // Apply f() x16 times
18046 for (var i = state.keys.length - 2; i >= 0; i -= 2) {
18047 var keyL = state.keys[i];
18048 var keyR = state.keys[i + 1];
18051 utils.expand(l, state.tmp, 0);
18053 keyL ^= state.tmp[0];
18054 keyR ^= state.tmp[1];
18055 var s = utils.substitute(keyL, keyR);
18056 var f = utils.permute(s);
18063 // Reverse Initial Permutation
18064 utils.rip(l, r, out, off);
18070 /***/ (function(module, exports, __webpack_require__) {
18075 var assert = __webpack_require__(9);
18076 var inherits = __webpack_require__(1);
18080 function CBCState(iv) {
18081 assert.equal(iv.length, 8, 'Invalid IV length');
18083 this.iv = new Array(8);
18084 for (var i = 0; i < this.iv.length; i++)
18085 this.iv[i] = iv[i];
18088 function instantiate(Base) {
18089 function CBC(options) {
18090 Base.call(this, options);
18093 inherits(CBC, Base);
18095 var keys = Object.keys(proto);
18096 for (var i = 0; i < keys.length; i++) {
18098 CBC.prototype[key] = proto[key];
18101 CBC.create = function create(options) {
18102 return new CBC(options);
18108 exports.instantiate = instantiate;
18110 proto._cbcInit = function _cbcInit() {
18111 var state = new CBCState(this.options.iv);
18112 this._cbcState = state;
18115 proto._update = function _update(inp, inOff, out, outOff) {
18116 var state = this._cbcState;
18117 var superProto = this.constructor.super_.prototype;
18120 if (this.type === 'encrypt') {
18121 for (var i = 0; i < this.blockSize; i++)
18122 iv[i] ^= inp[inOff + i];
18124 superProto._update.call(this, iv, 0, out, outOff);
18126 for (var i = 0; i < this.blockSize; i++)
18127 iv[i] = out[outOff + i];
18129 superProto._update.call(this, inp, inOff, out, outOff);
18131 for (var i = 0; i < this.blockSize; i++)
18132 out[outOff + i] ^= iv[i];
18134 for (var i = 0; i < this.blockSize; i++)
18135 iv[i] = inp[inOff + i];
18142 /***/ (function(module, exports, __webpack_require__) {
18147 var assert = __webpack_require__(9);
18148 var inherits = __webpack_require__(1);
18150 var des = __webpack_require__(64);
18151 var Cipher = des.Cipher;
18154 function EDEState(type, key) {
18155 assert.equal(key.length, 24, 'Invalid key length');
18157 var k1 = key.slice(0, 8);
18158 var k2 = key.slice(8, 16);
18159 var k3 = key.slice(16, 24);
18161 if (type === 'encrypt') {
18163 DES.create({ type: 'encrypt', key: k1 }),
18164 DES.create({ type: 'decrypt', key: k2 }),
18165 DES.create({ type: 'encrypt', key: k3 })
18169 DES.create({ type: 'decrypt', key: k3 }),
18170 DES.create({ type: 'encrypt', key: k2 }),
18171 DES.create({ type: 'decrypt', key: k1 })
18176 function EDE(options) {
18177 Cipher.call(this, options);
18179 var state = new EDEState(this.type, this.options.key);
18180 this._edeState = state;
18182 inherits(EDE, Cipher);
18184 module.exports = EDE;
18186 EDE.create = function create(options) {
18187 return new EDE(options);
18190 EDE.prototype._update = function _update(inp, inOff, out, outOff) {
18191 var state = this._edeState;
18193 state.ciphers[0]._update(inp, inOff, out, outOff);
18194 state.ciphers[1]._update(out, outOff, out, outOff);
18195 state.ciphers[2]._update(out, outOff, out, outOff);
18198 EDE.prototype._pad = DES.prototype._pad;
18199 EDE.prototype._unpad = DES.prototype._unpad;
18204 /***/ (function(module, exports, __webpack_require__) {
18206 var MODES = __webpack_require__(66)
18207 var AuthCipher = __webpack_require__(111)
18208 var Buffer = __webpack_require__(2).Buffer
18209 var StreamCipher = __webpack_require__(112)
18210 var Transform = __webpack_require__(18)
18211 var aes = __webpack_require__(43)
18212 var ebtk = __webpack_require__(44)
18213 var inherits = __webpack_require__(1)
18215 function Cipher (mode, key, iv) {
18216 Transform.call(this)
18218 this._cache = new Splitter()
18219 this._cipher = new aes.AES(key)
18220 this._prev = Buffer.from(iv)
18222 this._autopadding = true
18225 inherits(Cipher, Transform)
18227 Cipher.prototype._update = function (data) {
18228 this._cache.add(data)
18233 while ((chunk = this._cache.get())) {
18234 thing = this._mode.encrypt(this, chunk)
18238 return Buffer.concat(out)
18241 var PADDING = Buffer.alloc(16, 0x10)
18243 Cipher.prototype._final = function () {
18244 var chunk = this._cache.flush()
18245 if (this._autopadding) {
18246 chunk = this._mode.encrypt(this, chunk)
18247 this._cipher.scrub()
18251 if (!chunk.equals(PADDING)) {
18252 this._cipher.scrub()
18253 throw new Error('data not multiple of block length')
18257 Cipher.prototype.setAutoPadding = function (setTo) {
18258 this._autopadding = !!setTo
18262 function Splitter () {
18263 this.cache = Buffer.allocUnsafe(0)
18266 Splitter.prototype.add = function (data) {
18267 this.cache = Buffer.concat([this.cache, data])
18270 Splitter.prototype.get = function () {
18271 if (this.cache.length > 15) {
18272 var out = this.cache.slice(0, 16)
18273 this.cache = this.cache.slice(16)
18279 Splitter.prototype.flush = function () {
18280 var len = 16 - this.cache.length
18281 var padBuff = Buffer.allocUnsafe(len)
18284 while (++i < len) {
18285 padBuff.writeUInt8(len, i)
18288 return Buffer.concat([this.cache, padBuff])
18291 function createCipheriv (suite, password, iv) {
18292 var config = MODES[suite.toLowerCase()]
18293 if (!config) throw new TypeError('invalid suite type')
18295 if (typeof password === 'string') password = Buffer.from(password)
18296 if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length)
18298 if (typeof iv === 'string') iv = Buffer.from(iv)
18299 if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)
18301 if (config.type === 'stream') {
18302 return new StreamCipher(config.module, password, iv)
18303 } else if (config.type === 'auth') {
18304 return new AuthCipher(config.module, password, iv)
18307 return new Cipher(config.module, password, iv)
18310 function createCipher (suite, password) {
18311 var config = MODES[suite.toLowerCase()]
18312 if (!config) throw new TypeError('invalid suite type')
18314 var keys = ebtk(password, false, config.key, config.iv)
18315 return createCipheriv(suite, keys.key, keys.iv)
18318 exports.createCipheriv = createCipheriv
18319 exports.createCipher = createCipher
18324 /***/ (function(module, exports) {
18326 exports.encrypt = function (self, block) {
18327 return self._cipher.encryptBlock(block)
18330 exports.decrypt = function (self, block) {
18331 return self._cipher.decryptBlock(block)
18337 /***/ (function(module, exports, __webpack_require__) {
18339 var xor = __webpack_require__(31)
18341 exports.encrypt = function (self, block) {
18342 var data = xor(block, self._prev)
18344 self._prev = self._cipher.encryptBlock(data)
18348 exports.decrypt = function (self, block) {
18349 var pad = self._prev
18352 var out = self._cipher.decryptBlock(block)
18354 return xor(out, pad)
18360 /***/ (function(module, exports, __webpack_require__) {
18362 var Buffer = __webpack_require__(2).Buffer
18363 var xor = __webpack_require__(31)
18365 function encryptStart (self, data, decrypt) {
18366 var len = data.length
18367 var out = xor(data, self._cache)
18368 self._cache = self._cache.slice(len)
18369 self._prev = Buffer.concat([self._prev, decrypt ? data : out])
18373 exports.encrypt = function (self, data, decrypt) {
18374 var out = Buffer.allocUnsafe(0)
18377 while (data.length) {
18378 if (self._cache.length === 0) {
18379 self._cache = self._cipher.encryptBlock(self._prev)
18380 self._prev = Buffer.allocUnsafe(0)
18383 if (self._cache.length <= data.length) {
18384 len = self._cache.length
18385 out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)])
18386 data = data.slice(len)
18388 out = Buffer.concat([out, encryptStart(self, data, decrypt)])
18399 /***/ (function(module, exports, __webpack_require__) {
18401 var Buffer = __webpack_require__(2).Buffer
18403 function encryptByte (self, byteParam, decrypt) {
18404 var pad = self._cipher.encryptBlock(self._prev)
18405 var out = pad[0] ^ byteParam
18407 self._prev = Buffer.concat([
18408 self._prev.slice(1),
18409 Buffer.from([decrypt ? byteParam : out])
18415 exports.encrypt = function (self, chunk, decrypt) {
18416 var len = chunk.length
18417 var out = Buffer.allocUnsafe(len)
18420 while (++i < len) {
18421 out[i] = encryptByte(self, chunk[i], decrypt)
18430 /***/ (function(module, exports, __webpack_require__) {
18432 var Buffer = __webpack_require__(2).Buffer
18434 function encryptByte (self, byteParam, decrypt) {
18440 while (++i < len) {
18441 pad = self._cipher.encryptBlock(self._prev)
18442 bit = (byteParam & (1 << (7 - i))) ? 0x80 : 0
18443 value = pad[0] ^ bit
18444 out += ((value & 0x80) >> (i % 8))
18445 self._prev = shiftIn(self._prev, decrypt ? bit : value)
18450 function shiftIn (buffer, value) {
18451 var len = buffer.length
18453 var out = Buffer.allocUnsafe(buffer.length)
18454 buffer = Buffer.concat([buffer, Buffer.from([value])])
18456 while (++i < len) {
18457 out[i] = buffer[i] << 1 | buffer[i + 1] >> (7)
18463 exports.encrypt = function (self, chunk, decrypt) {
18464 var len = chunk.length
18465 var out = Buffer.allocUnsafe(len)
18468 while (++i < len) {
18469 out[i] = encryptByte(self, chunk[i], decrypt)
18478 /***/ (function(module, exports, __webpack_require__) {
18480 /* WEBPACK VAR INJECTION */(function(Buffer) {var xor = __webpack_require__(31)
18482 function getBlock (self) {
18483 self._prev = self._cipher.encryptBlock(self._prev)
18487 exports.encrypt = function (self, chunk) {
18488 while (self._cache.length < chunk.length) {
18489 self._cache = Buffer.concat([self._cache, getBlock(self)])
18492 var pad = self._cache.slice(0, chunk.length)
18493 self._cache = self._cache.slice(chunk.length)
18494 return xor(chunk, pad)
18497 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
18501 /***/ (function(module, exports, __webpack_require__) {
18503 var Buffer = __webpack_require__(2).Buffer
18504 var ZEROES = Buffer.alloc(16, 0)
18506 function toArray (buf) {
18508 buf.readUInt32BE(0),
18509 buf.readUInt32BE(4),
18510 buf.readUInt32BE(8),
18511 buf.readUInt32BE(12)
18515 function fromArray (out) {
18516 var buf = Buffer.allocUnsafe(16)
18517 buf.writeUInt32BE(out[0] >>> 0, 0)
18518 buf.writeUInt32BE(out[1] >>> 0, 4)
18519 buf.writeUInt32BE(out[2] >>> 0, 8)
18520 buf.writeUInt32BE(out[3] >>> 0, 12)
18524 function GHASH (key) {
18526 this.state = Buffer.alloc(16, 0)
18527 this.cache = Buffer.allocUnsafe(0)
18530 // from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html
18531 // by Juho Vähä-Herttua
18532 GHASH.prototype.ghash = function (block) {
18534 while (++i < block.length) {
18535 this.state[i] ^= block[i]
18540 GHASH.prototype._multiply = function () {
18541 var Vi = toArray(this.h)
18542 var Zi = [0, 0, 0, 0]
18545 while (++i < 128) {
18546 xi = (this.state[~~(i / 8)] & (1 << (7 - (i % 8)))) !== 0
18548 // Z_i+1 = Z_i ^ V_i
18555 // Store the value of LSB(V_i)
18556 lsbVi = (Vi[3] & 1) !== 0
18558 // V_i+1 = V_i >> 1
18559 for (j = 3; j > 0; j--) {
18560 Vi[j] = (Vi[j] >>> 1) | ((Vi[j - 1] & 1) << 31)
18562 Vi[0] = Vi[0] >>> 1
18564 // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R
18566 Vi[0] = Vi[0] ^ (0xe1 << 24)
18569 this.state = fromArray(Zi)
18572 GHASH.prototype.update = function (buf) {
18573 this.cache = Buffer.concat([this.cache, buf])
18575 while (this.cache.length >= 16) {
18576 chunk = this.cache.slice(0, 16)
18577 this.cache = this.cache.slice(16)
18582 GHASH.prototype.final = function (abl, bl) {
18583 if (this.cache.length) {
18584 this.ghash(Buffer.concat([this.cache, ZEROES], 16))
18587 this.ghash(fromArray([0, abl, 0, bl]))
18591 module.exports = GHASH
18596 /***/ (function(module, exports, __webpack_require__) {
18598 var AuthCipher = __webpack_require__(111)
18599 var Buffer = __webpack_require__(2).Buffer
18600 var MODES = __webpack_require__(66)
18601 var StreamCipher = __webpack_require__(112)
18602 var Transform = __webpack_require__(18)
18603 var aes = __webpack_require__(43)
18604 var ebtk = __webpack_require__(44)
18605 var inherits = __webpack_require__(1)
18607 function Decipher (mode, key, iv) {
18608 Transform.call(this)
18610 this._cache = new Splitter()
18611 this._last = void 0
18612 this._cipher = new aes.AES(key)
18613 this._prev = Buffer.from(iv)
18615 this._autopadding = true
18618 inherits(Decipher, Transform)
18620 Decipher.prototype._update = function (data) {
18621 this._cache.add(data)
18625 while ((chunk = this._cache.get(this._autopadding))) {
18626 thing = this._mode.decrypt(this, chunk)
18629 return Buffer.concat(out)
18632 Decipher.prototype._final = function () {
18633 var chunk = this._cache.flush()
18634 if (this._autopadding) {
18635 return unpad(this._mode.decrypt(this, chunk))
18636 } else if (chunk) {
18637 throw new Error('data not multiple of block length')
18641 Decipher.prototype.setAutoPadding = function (setTo) {
18642 this._autopadding = !!setTo
18646 function Splitter () {
18647 this.cache = Buffer.allocUnsafe(0)
18650 Splitter.prototype.add = function (data) {
18651 this.cache = Buffer.concat([this.cache, data])
18654 Splitter.prototype.get = function (autoPadding) {
18657 if (this.cache.length > 16) {
18658 out = this.cache.slice(0, 16)
18659 this.cache = this.cache.slice(16)
18663 if (this.cache.length >= 16) {
18664 out = this.cache.slice(0, 16)
18665 this.cache = this.cache.slice(16)
18673 Splitter.prototype.flush = function () {
18674 if (this.cache.length) return this.cache
18677 function unpad (last) {
18678 var padded = last[15]
18679 if (padded < 1 || padded > 16) {
18680 throw new Error('unable to decrypt data')
18683 while (++i < padded) {
18684 if (last[(i + (16 - padded))] !== padded) {
18685 throw new Error('unable to decrypt data')
18688 if (padded === 16) return
18690 return last.slice(0, 16 - padded)
18693 function createDecipheriv (suite, password, iv) {
18694 var config = MODES[suite.toLowerCase()]
18695 if (!config) throw new TypeError('invalid suite type')
18697 if (typeof iv === 'string') iv = Buffer.from(iv)
18698 if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)
18700 if (typeof password === 'string') password = Buffer.from(password)
18701 if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length)
18703 if (config.type === 'stream') {
18704 return new StreamCipher(config.module, password, iv, true)
18705 } else if (config.type === 'auth') {
18706 return new AuthCipher(config.module, password, iv, true)
18709 return new Decipher(config.module, password, iv)
18712 function createDecipher (suite, password) {
18713 var config = MODES[suite.toLowerCase()]
18714 if (!config) throw new TypeError('invalid suite type')
18716 var keys = ebtk(password, false, config.key, config.iv)
18717 return createDecipheriv(suite, keys.key, keys.iv)
18720 exports.createDecipher = createDecipher
18721 exports.createDecipheriv = createDecipheriv
18726 /***/ (function(module, exports) {
18728 exports['des-ecb'] = {
18732 exports['des-cbc'] = exports.des = {
18736 exports['des-ede3-cbc'] = exports.des3 = {
18740 exports['des-ede3'] = {
18744 exports['des-ede-cbc'] = {
18748 exports['des-ede'] = {
18756 /***/ (function(module, exports, __webpack_require__) {
18758 /* WEBPACK VAR INJECTION */(function(Buffer) {var generatePrime = __webpack_require__(113)
18759 var primes = __webpack_require__(219)
18761 var DH = __webpack_require__(220)
18763 function getDiffieHellman (mod) {
18764 var prime = new Buffer(primes[mod].prime, 'hex')
18765 var gen = new Buffer(primes[mod].gen, 'hex')
18767 return new DH(prime, gen)
18771 'binary': true, 'hex': true, 'base64': true
18774 function createDiffieHellman (prime, enc, generator, genc) {
18775 if (Buffer.isBuffer(enc) || ENCODINGS[enc] === undefined) {
18776 return createDiffieHellman(prime, 'binary', enc, generator)
18779 enc = enc || 'binary'
18780 genc = genc || 'binary'
18781 generator = generator || new Buffer([2])
18783 if (!Buffer.isBuffer(generator)) {
18784 generator = new Buffer(generator, genc)
18787 if (typeof prime === 'number') {
18788 return new DH(generatePrime(prime, generator), generator, true)
18791 if (!Buffer.isBuffer(prime)) {
18792 prime = new Buffer(prime, enc)
18795 return new DH(prime, generator, true)
18798 exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman
18799 exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman
18801 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
18805 /***/ (function(module, exports) {
18811 /***/ (function(module, exports) {
18817 /***/ (function(module, exports) {
18819 module.exports = {"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}
18823 /***/ (function(module, exports, __webpack_require__) {
18825 /* WEBPACK VAR INJECTION */(function(Buffer) {var BN = __webpack_require__(4);
18826 var MillerRabin = __webpack_require__(114);
18827 var millerRabin = new MillerRabin();
18828 var TWENTYFOUR = new BN(24);
18829 var ELEVEN = new BN(11);
18830 var TEN = new BN(10);
18831 var THREE = new BN(3);
18832 var SEVEN = new BN(7);
18833 var primes = __webpack_require__(113);
18834 var randomBytes = __webpack_require__(23);
18835 module.exports = DH;
18837 function setPublicKey(pub, enc) {
18838 enc = enc || 'utf8';
18839 if (!Buffer.isBuffer(pub)) {
18840 pub = new Buffer(pub, enc);
18842 this._pub = new BN(pub);
18846 function setPrivateKey(priv, enc) {
18847 enc = enc || 'utf8';
18848 if (!Buffer.isBuffer(priv)) {
18849 priv = new Buffer(priv, enc);
18851 this._priv = new BN(priv);
18855 var primeCache = {};
18856 function checkPrime(prime, generator) {
18857 var gen = generator.toString('hex');
18858 var hex = [gen, prime.toString(16)].join('_');
18859 if (hex in primeCache) {
18860 return primeCache[hex];
18864 if (prime.isEven() ||
18865 !primes.simpleSieve ||
18866 !primes.fermatTest(prime) ||
18867 !millerRabin.test(prime)) {
18868 //not a prime so +1
18871 if (gen === '02' || gen === '05') {
18872 // we'd be able to check the generator
18873 // it would fail so +8
18876 //we wouldn't be able to test the generator
18880 primeCache[hex] = error;
18883 if (!millerRabin.test(prime.shrn(1))) {
18890 if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) {
18891 // unsuidable generator
18896 rem = prime.mod(TEN);
18897 if (rem.cmp(THREE) && rem.cmp(SEVEN)) {
18898 // prime mod 10 needs to equal 3 or 7
18905 primeCache[hex] = error;
18909 function DH(prime, generator, malleable) {
18910 this.setGenerator(generator);
18911 this.__prime = new BN(prime);
18912 this._prime = BN.mont(this.__prime);
18913 this._primeLen = prime.length;
18914 this._pub = undefined;
18915 this._priv = undefined;
18916 this._primeCode = undefined;
18918 this.setPublicKey = setPublicKey;
18919 this.setPrivateKey = setPrivateKey;
18921 this._primeCode = 8;
18924 Object.defineProperty(DH.prototype, 'verifyError', {
18927 if (typeof this._primeCode !== 'number') {
18928 this._primeCode = checkPrime(this.__prime, this.__gen);
18930 return this._primeCode;
18933 DH.prototype.generateKeys = function () {
18935 this._priv = new BN(randomBytes(this._primeLen));
18937 this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed();
18938 return this.getPublicKey();
18941 DH.prototype.computeSecret = function (other) {
18942 other = new BN(other);
18943 other = other.toRed(this._prime);
18944 var secret = other.redPow(this._priv).fromRed();
18945 var out = new Buffer(secret.toArray());
18946 var prime = this.getPrime();
18947 if (out.length < prime.length) {
18948 var front = new Buffer(prime.length - out.length);
18950 out = Buffer.concat([front, out]);
18955 DH.prototype.getPublicKey = function getPublicKey(enc) {
18956 return formatReturnValue(this._pub, enc);
18959 DH.prototype.getPrivateKey = function getPrivateKey(enc) {
18960 return formatReturnValue(this._priv, enc);
18963 DH.prototype.getPrime = function (enc) {
18964 return formatReturnValue(this.__prime, enc);
18967 DH.prototype.getGenerator = function (enc) {
18968 return formatReturnValue(this._gen, enc);
18971 DH.prototype.setGenerator = function (gen, enc) {
18972 enc = enc || 'utf8';
18973 if (!Buffer.isBuffer(gen)) {
18974 gen = new Buffer(gen, enc);
18977 this._gen = new BN(gen);
18981 function formatReturnValue(bn, enc) {
18982 var buf = new Buffer(bn.toArray());
18986 return buf.toString(enc);
18990 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
18994 /***/ (function(module, exports, __webpack_require__) {
18996 /* WEBPACK VAR INJECTION */(function(Buffer) {var createHash = __webpack_require__(29)
18997 var stream = __webpack_require__(57)
18998 var inherits = __webpack_require__(1)
18999 var sign = __webpack_require__(222)
19000 var verify = __webpack_require__(258)
19002 var algorithms = __webpack_require__(103)
19003 Object.keys(algorithms).forEach(function (key) {
19004 algorithms[key].id = new Buffer(algorithms[key].id, 'hex')
19005 algorithms[key.toLowerCase()] = algorithms[key]
19008 function Sign (algorithm) {
19009 stream.Writable.call(this)
19011 var data = algorithms[algorithm]
19012 if (!data) throw new Error('Unknown message digest')
19014 this._hashType = data.hash
19015 this._hash = createHash(data.hash)
19016 this._tag = data.id
19017 this._signType = data.sign
19019 inherits(Sign, stream.Writable)
19021 Sign.prototype._write = function _write (data, _, done) {
19022 this._hash.update(data)
19026 Sign.prototype.update = function update (data, enc) {
19027 if (typeof data === 'string') data = new Buffer(data, enc)
19029 this._hash.update(data)
19033 Sign.prototype.sign = function signMethod (key, enc) {
19035 var hash = this._hash.digest()
19036 var sig = sign(hash, key, this._hashType, this._signType, this._tag)
19038 return enc ? sig.toString(enc) : sig
19041 function Verify (algorithm) {
19042 stream.Writable.call(this)
19044 var data = algorithms[algorithm]
19045 if (!data) throw new Error('Unknown message digest')
19047 this._hash = createHash(data.hash)
19048 this._tag = data.id
19049 this._signType = data.sign
19051 inherits(Verify, stream.Writable)
19053 Verify.prototype._write = function _write (data, _, done) {
19054 this._hash.update(data)
19058 Verify.prototype.update = function update (data, enc) {
19059 if (typeof data === 'string') data = new Buffer(data, enc)
19061 this._hash.update(data)
19065 Verify.prototype.verify = function verifyMethod (key, sig, enc) {
19066 if (typeof sig === 'string') sig = new Buffer(sig, enc)
19069 var hash = this._hash.digest()
19070 return verify(sig, hash, key, this._signType, this._tag)
19073 function createSign (algorithm) {
19074 return new Sign(algorithm)
19077 function createVerify (algorithm) {
19078 return new Verify(algorithm)
19083 Verify: createVerify,
19084 createSign: createSign,
19085 createVerify: createVerify
19088 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
19092 /***/ (function(module, exports, __webpack_require__) {
19094 /* WEBPACK VAR INJECTION */(function(Buffer) {// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
19095 var createHmac = __webpack_require__(101)
19096 var crt = __webpack_require__(67)
19097 var EC = __webpack_require__(6).ec
19098 var BN = __webpack_require__(4)
19099 var parseKeys = __webpack_require__(46)
19100 var curves = __webpack_require__(124)
19102 function sign (hash, key, hashType, signType, tag) {
19103 var priv = parseKeys(key)
19105 // rsa keys can be interpreted as ecdsa ones in openssl
19106 if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type')
19107 return ecSign(hash, priv)
19108 } else if (priv.type === 'dsa') {
19109 if (signType !== 'dsa') throw new Error('wrong private key type')
19110 return dsaSign(hash, priv, hashType)
19112 if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type')
19114 hash = Buffer.concat([tag, hash])
19115 var len = priv.modulus.byteLength()
19117 while (hash.length + pad.length + 1 < len) pad.push(0xff)
19120 while (++i < hash.length) pad.push(hash[i])
19122 var out = crt(pad, priv)
19126 function ecSign (hash, priv) {
19127 var curveId = curves[priv.curve.join('.')]
19128 if (!curveId) throw new Error('unknown curve ' + priv.curve.join('.'))
19130 var curve = new EC(curveId)
19131 var key = curve.keyFromPrivate(priv.privateKey)
19132 var out = key.sign(hash)
19134 return new Buffer(out.toDER())
19137 function dsaSign (hash, priv, algo) {
19138 var x = priv.params.priv_key
19139 var p = priv.params.p
19140 var q = priv.params.q
19141 var g = priv.params.g
19144 var H = bits2int(hash, q).mod(q)
19146 var kv = getKey(x, q, hash, algo)
19147 while (s === false) {
19148 k = makeKey(q, kv, algo)
19149 r = makeR(g, k, p, q)
19150 s = k.invm(q).imul(H.add(x.mul(r))).mod(q)
19151 if (s.cmpn(0) === 0) {
19159 function toDER (r, s) {
19164 if (r[0] & 0x80) r = [ 0 ].concat(r)
19165 if (s[0] & 0x80) s = [ 0 ].concat(s)
19167 var total = r.length + s.length + 4
19168 var res = [ 0x30, total, 0x02, r.length ]
19169 res = res.concat(r, [ 0x02, s.length ], s)
19170 return new Buffer(res)
19173 function getKey (x, q, hash, algo) {
19174 x = new Buffer(x.toArray())
19175 if (x.length < q.byteLength()) {
19176 var zeros = new Buffer(q.byteLength() - x.length)
19178 x = Buffer.concat([ zeros, x ])
19180 var hlen = hash.length
19181 var hbits = bits2octets(hash, q)
19182 var v = new Buffer(hlen)
19184 var k = new Buffer(hlen)
19186 k = createHmac(algo, k).update(v).update(new Buffer([ 0 ])).update(x).update(hbits).digest()
19187 v = createHmac(algo, k).update(v).digest()
19188 k = createHmac(algo, k).update(v).update(new Buffer([ 1 ])).update(x).update(hbits).digest()
19189 v = createHmac(algo, k).update(v).digest()
19190 return { k: k, v: v }
19193 function bits2int (obits, q) {
19194 var bits = new BN(obits)
19195 var shift = (obits.length << 3) - q.bitLength()
19196 if (shift > 0) bits.ishrn(shift)
19200 function bits2octets (bits, q) {
19201 bits = bits2int(bits, q)
19203 var out = new Buffer(bits.toArray())
19204 if (out.length < q.byteLength()) {
19205 var zeros = new Buffer(q.byteLength() - out.length)
19207 out = Buffer.concat([ zeros, out ])
19212 function makeKey (q, kv, algo) {
19219 while (t.length * 8 < q.bitLength()) {
19220 kv.v = createHmac(algo, kv.k).update(kv.v).digest()
19221 t = Buffer.concat([ t, kv.v ])
19225 kv.k = createHmac(algo, kv.k).update(kv.v).update(new Buffer([ 0 ])).digest()
19226 kv.v = createHmac(algo, kv.k).update(kv.v).digest()
19227 } while (k.cmp(q) !== -1)
19232 function makeR (g, k, p, q) {
19233 return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q)
19236 module.exports = sign
19237 module.exports.getKey = getKey
19238 module.exports.makeKey = makeKey
19240 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
19244 /***/ (function(module, exports) {
19246 module.exports = {"_args":[["elliptic@6.4.1","/Users/jnet/Documents/random/Bytom-Chrome-Extension"]],"_development":true,"_from":"elliptic@6.4.1","_id":"elliptic@6.4.1","_inBundle":false,"_integrity":"sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==","_location":"/elliptic","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"elliptic@6.4.1","name":"elliptic","escapedName":"elliptic","rawSpec":"6.4.1","saveSpec":null,"fetchSpec":"6.4.1"},"_requiredBy":["/browserify-sign","/create-ecdh"],"_resolved":"https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz","_spec":"6.4.1","_where":"/Users/jnet/Documents/random/Bytom-Chrome-Extension","author":{"name":"Fedor Indutny","email":"fedor@indutny.com"},"bugs":{"url":"https://github.com/indutny/elliptic/issues"},"dependencies":{"bn.js":"^4.4.0","brorand":"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0","inherits":"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},"description":"EC cryptography","devDependencies":{"brfs":"^1.4.3","coveralls":"^2.11.3","grunt":"^0.4.5","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2","istanbul":"^0.4.2","jscs":"^2.9.0","jshint":"^2.6.0","mocha":"^2.1.0"},"files":["lib"],"homepage":"https://github.com/indutny/elliptic","keywords":["EC","Elliptic","curve","Cryptography"],"license":"MIT","main":"lib/elliptic.js","name":"elliptic","repository":{"type":"git","url":"git+ssh://git@github.com/indutny/elliptic.git"},"scripts":{"jscs":"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js","jshint":"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js","lint":"npm run jscs && npm run jshint","test":"npm run lint && npm run unit","unit":"istanbul test _mocha --reporter=spec test/index.js","version":"grunt dist && git add dist/"},"version":"6.4.1"}
19250 /***/ (function(module, exports, __webpack_require__) {
19255 var utils = exports;
19256 var BN = __webpack_require__(4);
19257 var minAssert = __webpack_require__(9);
19258 var minUtils = __webpack_require__(116);
19260 utils.assert = minAssert;
19261 utils.toArray = minUtils.toArray;
19262 utils.zero2 = minUtils.zero2;
19263 utils.toHex = minUtils.toHex;
19264 utils.encode = minUtils.encode;
19266 // Represent num in a w-NAF form
19267 function getNAF(num, w) {
19269 var ws = 1 << (w + 1);
19270 var k = num.clone();
19271 while (k.cmpn(1) >= 0) {
19274 var mod = k.andln(ws - 1);
19275 if (mod > (ws >> 1) - 1)
19276 z = (ws >> 1) - mod;
19285 // Optimization, shift by word if possible
19286 var shift = (k.cmpn(0) !== 0 && k.andln(ws - 1) === 0) ? (w + 1) : 1;
19287 for (var i = 1; i < shift; i++)
19294 utils.getNAF = getNAF;
19296 // Represent k1, k2 in a Joint Sparse Form
19297 function getJSF(k1, k2) {
19307 while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {
19310 var m14 = (k1.andln(3) + d1) & 3;
19311 var m24 = (k2.andln(3) + d2) & 3;
19317 if ((m14 & 1) === 0) {
19320 var m8 = (k1.andln(7) + d1) & 7;
19321 if ((m8 === 3 || m8 === 5) && m24 === 2)
19329 if ((m24 & 1) === 0) {
19332 var m8 = (k2.andln(7) + d2) & 7;
19333 if ((m8 === 3 || m8 === 5) && m14 === 2)
19341 if (2 * d1 === u1 + 1)
19343 if (2 * d2 === u2 + 1)
19351 utils.getJSF = getJSF;
19353 function cachedProperty(obj, name, computer) {
19354 var key = '_' + name;
19355 obj.prototype[name] = function cachedProperty() {
19356 return this[key] !== undefined ? this[key] :
19357 this[key] = computer.call(this);
19360 utils.cachedProperty = cachedProperty;
19362 function parseBytes(bytes) {
19363 return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') :
19366 utils.parseBytes = parseBytes;
19368 function intFromLE(bytes) {
19369 return new BN(bytes, 'hex', 'le');
19371 utils.intFromLE = intFromLE;
19377 /***/ (function(module, exports, __webpack_require__) {
19382 var BN = __webpack_require__(4);
19383 var elliptic = __webpack_require__(6);
19384 var utils = elliptic.utils;
19385 var getNAF = utils.getNAF;
19386 var getJSF = utils.getJSF;
19387 var assert = utils.assert;
19389 function BaseCurve(type, conf) {
19391 this.p = new BN(conf.p, 16);
19393 // Use Montgomery, when there is no fast reduction for the prime
19394 this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p);
19396 // Useful for many curves
19397 this.zero = new BN(0).toRed(this.red);
19398 this.one = new BN(1).toRed(this.red);
19399 this.two = new BN(2).toRed(this.red);
19401 // Curve configuration, optional
19402 this.n = conf.n && new BN(conf.n, 16);
19403 this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);
19405 // Temporary arrays
19406 this._wnafT1 = new Array(4);
19407 this._wnafT2 = new Array(4);
19408 this._wnafT3 = new Array(4);
19409 this._wnafT4 = new Array(4);
19411 // Generalized Greg Maxwell's trick
19412 var adjustCount = this.n && this.p.div(this.n);
19413 if (!adjustCount || adjustCount.cmpn(100) > 0) {
19416 this._maxwellTrick = true;
19417 this.redN = this.n.toRed(this.red);
19420 module.exports = BaseCurve;
19422 BaseCurve.prototype.point = function point() {
19423 throw new Error('Not implemented');
19426 BaseCurve.prototype.validate = function validate() {
19427 throw new Error('Not implemented');
19430 BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
19431 assert(p.precomputed);
19432 var doubles = p._getDoubles();
19434 var naf = getNAF(k, 1);
19435 var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);
19438 // Translate into more windowed form
19440 for (var j = 0; j < naf.length; j += doubles.step) {
19442 for (var k = j + doubles.step - 1; k >= j; k--)
19443 nafW = (nafW << 1) + naf[k];
19447 var a = this.jpoint(null, null, null);
19448 var b = this.jpoint(null, null, null);
19449 for (var i = I; i > 0; i--) {
19450 for (var j = 0; j < repr.length; j++) {
19451 var nafW = repr[j];
19453 b = b.mixedAdd(doubles.points[j]);
19454 else if (nafW === -i)
19455 b = b.mixedAdd(doubles.points[j].neg());
19462 BaseCurve.prototype._wnafMul = function _wnafMul(p, k) {
19465 // Precompute window
19466 var nafPoints = p._getNAFPoints(w);
19468 var wnd = nafPoints.points;
19471 var naf = getNAF(k, w);
19473 // Add `this`*(N+1) for every w-NAF index
19474 var acc = this.jpoint(null, null, null);
19475 for (var i = naf.length - 1; i >= 0; i--) {
19477 for (var k = 0; i >= 0 && naf[i] === 0; i--)
19487 if (p.type === 'affine') {
19490 acc = acc.mixedAdd(wnd[(z - 1) >> 1]);
19492 acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());
19496 acc = acc.add(wnd[(z - 1) >> 1]);
19498 acc = acc.add(wnd[(-z - 1) >> 1].neg());
19501 return p.type === 'affine' ? acc.toP() : acc;
19504 BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,
19509 var wndWidth = this._wnafT1;
19510 var wnd = this._wnafT2;
19511 var naf = this._wnafT3;
19515 for (var i = 0; i < len; i++) {
19517 var nafPoints = p._getNAFPoints(defW);
19518 wndWidth[i] = nafPoints.wnd;
19519 wnd[i] = nafPoints.points;
19522 // Comb small window NAFs
19523 for (var i = len - 1; i >= 1; i -= 2) {
19526 if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {
19527 naf[a] = getNAF(coeffs[a], wndWidth[a]);
19528 naf[b] = getNAF(coeffs[b], wndWidth[b]);
19529 max = Math.max(naf[a].length, max);
19530 max = Math.max(naf[b].length, max);
19541 // Try to avoid Projective points, if possible
19542 if (points[a].y.cmp(points[b].y) === 0) {
19543 comb[1] = points[a].add(points[b]);
19544 comb[2] = points[a].toJ().mixedAdd(points[b].neg());
19545 } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {
19546 comb[1] = points[a].toJ().mixedAdd(points[b]);
19547 comb[2] = points[a].add(points[b].neg());
19549 comb[1] = points[a].toJ().mixedAdd(points[b]);
19550 comb[2] = points[a].toJ().mixedAdd(points[b].neg());
19565 var jsf = getJSF(coeffs[a], coeffs[b]);
19566 max = Math.max(jsf[0].length, max);
19567 naf[a] = new Array(max);
19568 naf[b] = new Array(max);
19569 for (var j = 0; j < max; j++) {
19570 var ja = jsf[0][j] | 0;
19571 var jb = jsf[1][j] | 0;
19573 naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];
19579 var acc = this.jpoint(null, null, null);
19580 var tmp = this._wnafT4;
19581 for (var i = max; i >= 0; i--) {
19586 for (var j = 0; j < len; j++) {
19587 tmp[j] = naf[j][i] | 0;
19602 for (var j = 0; j < len; j++) {
19608 p = wnd[j][(z - 1) >> 1];
19610 p = wnd[j][(-z - 1) >> 1].neg();
19612 if (p.type === 'affine')
19613 acc = acc.mixedAdd(p);
19618 // Zeroify references
19619 for (var i = 0; i < len; i++)
19622 if (jacobianResult)
19628 function BasePoint(curve, type) {
19629 this.curve = curve;
19631 this.precomputed = null;
19633 BaseCurve.BasePoint = BasePoint;
19635 BasePoint.prototype.eq = function eq(/*other*/) {
19636 throw new Error('Not implemented');
19639 BasePoint.prototype.validate = function validate() {
19640 return this.curve.validate(this);
19643 BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
19644 bytes = utils.toArray(bytes, enc);
19646 var len = this.p.byteLength();
19648 // uncompressed, hybrid-odd, hybrid-even
19649 if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&
19650 bytes.length - 1 === 2 * len) {
19651 if (bytes[0] === 0x06)
19652 assert(bytes[bytes.length - 1] % 2 === 0);
19653 else if (bytes[0] === 0x07)
19654 assert(bytes[bytes.length - 1] % 2 === 1);
19656 var res = this.point(bytes.slice(1, 1 + len),
19657 bytes.slice(1 + len, 1 + 2 * len));
19660 } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) &&
19661 bytes.length - 1 === len) {
19662 return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);
19664 throw new Error('Unknown point format');
19667 BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {
19668 return this.encode(enc, true);
19671 BasePoint.prototype._encode = function _encode(compact) {
19672 var len = this.curve.p.byteLength();
19673 var x = this.getX().toArray('be', len);
19676 return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x);
19678 return [ 0x04 ].concat(x, this.getY().toArray('be', len)) ;
19681 BasePoint.prototype.encode = function encode(enc, compact) {
19682 return utils.encode(this._encode(compact), enc);
19685 BasePoint.prototype.precompute = function precompute(power) {
19686 if (this.precomputed)
19689 var precomputed = {
19694 precomputed.naf = this._getNAFPoints(8);
19695 precomputed.doubles = this._getDoubles(4, power);
19696 precomputed.beta = this._getBeta();
19697 this.precomputed = precomputed;
19702 BasePoint.prototype._hasDoubles = function _hasDoubles(k) {
19703 if (!this.precomputed)
19706 var doubles = this.precomputed.doubles;
19710 return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);
19713 BasePoint.prototype._getDoubles = function _getDoubles(step, power) {
19714 if (this.precomputed && this.precomputed.doubles)
19715 return this.precomputed.doubles;
19717 var doubles = [ this ];
19719 for (var i = 0; i < power; i += step) {
19720 for (var j = 0; j < step; j++)
19730 BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {
19731 if (this.precomputed && this.precomputed.naf)
19732 return this.precomputed.naf;
19734 var res = [ this ];
19735 var max = (1 << wnd) - 1;
19736 var dbl = max === 1 ? null : this.dbl();
19737 for (var i = 1; i < max; i++)
19738 res[i] = res[i - 1].add(dbl);
19745 BasePoint.prototype._getBeta = function _getBeta() {
19749 BasePoint.prototype.dblp = function dblp(k) {
19751 for (var i = 0; i < k; i++)
19759 /***/ (function(module, exports, __webpack_require__) {
19764 var curve = __webpack_require__(45);
19765 var elliptic = __webpack_require__(6);
19766 var BN = __webpack_require__(4);
19767 var inherits = __webpack_require__(1);
19768 var Base = curve.base;
19770 var assert = elliptic.utils.assert;
19772 function ShortCurve(conf) {
19773 Base.call(this, 'short', conf);
19775 this.a = new BN(conf.a, 16).toRed(this.red);
19776 this.b = new BN(conf.b, 16).toRed(this.red);
19777 this.tinv = this.two.redInvm();
19779 this.zeroA = this.a.fromRed().cmpn(0) === 0;
19780 this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0;
19782 // If the curve is endomorphic, precalculate beta and lambda
19783 this.endo = this._getEndomorphism(conf);
19784 this._endoWnafT1 = new Array(4);
19785 this._endoWnafT2 = new Array(4);
19787 inherits(ShortCurve, Base);
19788 module.exports = ShortCurve;
19790 ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {
19791 // No efficient endomorphism
19792 if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)
19795 // Compute beta and lambda, that lambda * P = (beta * Px; Py)
19799 beta = new BN(conf.beta, 16).toRed(this.red);
19801 var betas = this._getEndoRoots(this.p);
19802 // Choose the smallest beta
19803 beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];
19804 beta = beta.toRed(this.red);
19807 lambda = new BN(conf.lambda, 16);
19809 // Choose the lambda that is matching selected beta
19810 var lambdas = this._getEndoRoots(this.n);
19811 if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {
19812 lambda = lambdas[0];
19814 lambda = lambdas[1];
19815 assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);
19819 // Get basis vectors, used for balanced length-two representation
19822 basis = conf.basis.map(function(vec) {
19824 a: new BN(vec.a, 16),
19825 b: new BN(vec.b, 16)
19829 basis = this._getEndoBasis(lambda);
19839 ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {
19840 // Find roots of for x^2 + x + 1 in F
19841 // Root = (-1 +- Sqrt(-3)) / 2
19843 var red = num === this.p ? this.red : BN.mont(num);
19844 var tinv = new BN(2).toRed(red).redInvm();
19845 var ntinv = tinv.redNeg();
19847 var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);
19849 var l1 = ntinv.redAdd(s).fromRed();
19850 var l2 = ntinv.redSub(s).fromRed();
19854 ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {
19855 // aprxSqrt >= sqrt(this.n)
19856 var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));
19859 // Run EGCD, until r(L + 1) < aprxSqrt
19861 var v = this.n.clone();
19862 var x1 = new BN(1);
19863 var y1 = new BN(0);
19864 var x2 = new BN(0);
19865 var y2 = new BN(1);
19867 // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)
19881 while (u.cmpn(0) !== 0) {
19883 r = v.sub(q.mul(u));
19884 x = x2.sub(q.mul(x1));
19885 var y = y2.sub(q.mul(y1));
19887 if (!a1 && r.cmp(aprxSqrt) < 0) {
19892 } else if (a1 && ++i === 2) {
19907 var len1 = a1.sqr().add(b1.sqr());
19908 var len2 = a2.sqr().add(b2.sqr());
19909 if (len2.cmp(len1) >= 0) {
19930 ShortCurve.prototype._endoSplit = function _endoSplit(k) {
19931 var basis = this.endo.basis;
19935 var c1 = v2.b.mul(k).divRound(this.n);
19936 var c2 = v1.b.neg().mul(k).divRound(this.n);
19938 var p1 = c1.mul(v1.a);
19939 var p2 = c2.mul(v2.a);
19940 var q1 = c1.mul(v1.b);
19941 var q2 = c2.mul(v2.b);
19943 // Calculate answer
19944 var k1 = k.sub(p1).sub(p2);
19945 var k2 = q1.add(q2).neg();
19946 return { k1: k1, k2: k2 };
19949 ShortCurve.prototype.pointFromX = function pointFromX(x, odd) {
19952 x = x.toRed(this.red);
19954 var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);
19955 var y = y2.redSqrt();
19956 if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
19957 throw new Error('invalid point');
19959 // XXX Is there any way to tell if the number is odd without converting it
19960 // to non-red form?
19961 var isOdd = y.fromRed().isOdd();
19962 if (odd && !isOdd || !odd && isOdd)
19965 return this.point(x, y);
19968 ShortCurve.prototype.validate = function validate(point) {
19975 var ax = this.a.redMul(x);
19976 var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);
19977 return y.redSqr().redISub(rhs).cmpn(0) === 0;
19980 ShortCurve.prototype._endoWnafMulAdd =
19981 function _endoWnafMulAdd(points, coeffs, jacobianResult) {
19982 var npoints = this._endoWnafT1;
19983 var ncoeffs = this._endoWnafT2;
19984 for (var i = 0; i < points.length; i++) {
19985 var split = this._endoSplit(coeffs[i]);
19987 var beta = p._getBeta();
19989 if (split.k1.negative) {
19993 if (split.k2.negative) {
19995 beta = beta.neg(true);
19998 npoints[i * 2] = p;
19999 npoints[i * 2 + 1] = beta;
20000 ncoeffs[i * 2] = split.k1;
20001 ncoeffs[i * 2 + 1] = split.k2;
20003 var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult);
20005 // Clean-up references to points and coefficients
20006 for (var j = 0; j < i * 2; j++) {
20013 function Point(curve, x, y, isRed) {
20014 Base.BasePoint.call(this, curve, 'affine');
20015 if (x === null && y === null) {
20020 this.x = new BN(x, 16);
20021 this.y = new BN(y, 16);
20022 // Force redgomery representation when loading from JSON
20024 this.x.forceRed(this.curve.red);
20025 this.y.forceRed(this.curve.red);
20028 this.x = this.x.toRed(this.curve.red);
20030 this.y = this.y.toRed(this.curve.red);
20034 inherits(Point, Base.BasePoint);
20036 ShortCurve.prototype.point = function point(x, y, isRed) {
20037 return new Point(this, x, y, isRed);
20040 ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {
20041 return Point.fromJSON(this, obj, red);
20044 Point.prototype._getBeta = function _getBeta() {
20045 if (!this.curve.endo)
20048 var pre = this.precomputed;
20049 if (pre && pre.beta)
20052 var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);
20054 var curve = this.curve;
20055 var endoMul = function(p) {
20056 return curve.point(p.x.redMul(curve.endo.beta), p.y);
20059 beta.precomputed = {
20063 points: pre.naf.points.map(endoMul)
20065 doubles: pre.doubles && {
20066 step: pre.doubles.step,
20067 points: pre.doubles.points.map(endoMul)
20074 Point.prototype.toJSON = function toJSON() {
20075 if (!this.precomputed)
20076 return [ this.x, this.y ];
20078 return [ this.x, this.y, this.precomputed && {
20079 doubles: this.precomputed.doubles && {
20080 step: this.precomputed.doubles.step,
20081 points: this.precomputed.doubles.points.slice(1)
20083 naf: this.precomputed.naf && {
20084 wnd: this.precomputed.naf.wnd,
20085 points: this.precomputed.naf.points.slice(1)
20090 Point.fromJSON = function fromJSON(curve, obj, red) {
20091 if (typeof obj === 'string')
20092 obj = JSON.parse(obj);
20093 var res = curve.point(obj[0], obj[1], red);
20097 function obj2point(obj) {
20098 return curve.point(obj[0], obj[1], red);
20102 res.precomputed = {
20104 doubles: pre.doubles && {
20105 step: pre.doubles.step,
20106 points: [ res ].concat(pre.doubles.points.map(obj2point))
20110 points: [ res ].concat(pre.naf.points.map(obj2point))
20116 Point.prototype.inspect = function inspect() {
20117 if (this.isInfinity())
20118 return '<EC Point Infinity>';
20119 return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
20120 ' y: ' + this.y.fromRed().toString(16, 2) + '>';
20123 Point.prototype.isInfinity = function isInfinity() {
20127 Point.prototype.add = function add(p) {
20141 if (this.neg().eq(p))
20142 return this.curve.point(null, null);
20145 if (this.x.cmp(p.x) === 0)
20146 return this.curve.point(null, null);
20148 var c = this.y.redSub(p.y);
20149 if (c.cmpn(0) !== 0)
20150 c = c.redMul(this.x.redSub(p.x).redInvm());
20151 var nx = c.redSqr().redISub(this.x).redISub(p.x);
20152 var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
20153 return this.curve.point(nx, ny);
20156 Point.prototype.dbl = function dbl() {
20161 var ys1 = this.y.redAdd(this.y);
20162 if (ys1.cmpn(0) === 0)
20163 return this.curve.point(null, null);
20165 var a = this.curve.a;
20167 var x2 = this.x.redSqr();
20168 var dyinv = ys1.redInvm();
20169 var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);
20171 var nx = c.redSqr().redISub(this.x.redAdd(this.x));
20172 var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
20173 return this.curve.point(nx, ny);
20176 Point.prototype.getX = function getX() {
20177 return this.x.fromRed();
20180 Point.prototype.getY = function getY() {
20181 return this.y.fromRed();
20184 Point.prototype.mul = function mul(k) {
20187 if (this._hasDoubles(k))
20188 return this.curve._fixedNafMul(this, k);
20189 else if (this.curve.endo)
20190 return this.curve._endoWnafMulAdd([ this ], [ k ]);
20192 return this.curve._wnafMul(this, k);
20195 Point.prototype.mulAdd = function mulAdd(k1, p2, k2) {
20196 var points = [ this, p2 ];
20197 var coeffs = [ k1, k2 ];
20198 if (this.curve.endo)
20199 return this.curve._endoWnafMulAdd(points, coeffs);
20201 return this.curve._wnafMulAdd(1, points, coeffs, 2);
20204 Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) {
20205 var points = [ this, p2 ];
20206 var coeffs = [ k1, k2 ];
20207 if (this.curve.endo)
20208 return this.curve._endoWnafMulAdd(points, coeffs, true);
20210 return this.curve._wnafMulAdd(1, points, coeffs, 2, true);
20213 Point.prototype.eq = function eq(p) {
20214 return this === p ||
20215 this.inf === p.inf &&
20216 (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);
20219 Point.prototype.neg = function neg(_precompute) {
20223 var res = this.curve.point(this.x, this.y.redNeg());
20224 if (_precompute && this.precomputed) {
20225 var pre = this.precomputed;
20226 var negate = function(p) {
20229 res.precomputed = {
20232 points: pre.naf.points.map(negate)
20234 doubles: pre.doubles && {
20235 step: pre.doubles.step,
20236 points: pre.doubles.points.map(negate)
20243 Point.prototype.toJ = function toJ() {
20245 return this.curve.jpoint(null, null, null);
20247 var res = this.curve.jpoint(this.x, this.y, this.curve.one);
20251 function JPoint(curve, x, y, z) {
20252 Base.BasePoint.call(this, curve, 'jacobian');
20253 if (x === null && y === null && z === null) {
20254 this.x = this.curve.one;
20255 this.y = this.curve.one;
20256 this.z = new BN(0);
20258 this.x = new BN(x, 16);
20259 this.y = new BN(y, 16);
20260 this.z = new BN(z, 16);
20263 this.x = this.x.toRed(this.curve.red);
20265 this.y = this.y.toRed(this.curve.red);
20267 this.z = this.z.toRed(this.curve.red);
20269 this.zOne = this.z === this.curve.one;
20271 inherits(JPoint, Base.BasePoint);
20273 ShortCurve.prototype.jpoint = function jpoint(x, y, z) {
20274 return new JPoint(this, x, y, z);
20277 JPoint.prototype.toP = function toP() {
20278 if (this.isInfinity())
20279 return this.curve.point(null, null);
20281 var zinv = this.z.redInvm();
20282 var zinv2 = zinv.redSqr();
20283 var ax = this.x.redMul(zinv2);
20284 var ay = this.y.redMul(zinv2).redMul(zinv);
20286 return this.curve.point(ax, ay);
20289 JPoint.prototype.neg = function neg() {
20290 return this.curve.jpoint(this.x, this.y.redNeg(), this.z);
20293 JPoint.prototype.add = function add(p) {
20295 if (this.isInfinity())
20299 if (p.isInfinity())
20303 var pz2 = p.z.redSqr();
20304 var z2 = this.z.redSqr();
20305 var u1 = this.x.redMul(pz2);
20306 var u2 = p.x.redMul(z2);
20307 var s1 = this.y.redMul(pz2.redMul(p.z));
20308 var s2 = p.y.redMul(z2.redMul(this.z));
20310 var h = u1.redSub(u2);
20311 var r = s1.redSub(s2);
20312 if (h.cmpn(0) === 0) {
20313 if (r.cmpn(0) !== 0)
20314 return this.curve.jpoint(null, null, null);
20319 var h2 = h.redSqr();
20320 var h3 = h2.redMul(h);
20321 var v = u1.redMul(h2);
20323 var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
20324 var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
20325 var nz = this.z.redMul(p.z).redMul(h);
20327 return this.curve.jpoint(nx, ny, nz);
20330 JPoint.prototype.mixedAdd = function mixedAdd(p) {
20332 if (this.isInfinity())
20336 if (p.isInfinity())
20340 var z2 = this.z.redSqr();
20342 var u2 = p.x.redMul(z2);
20344 var s2 = p.y.redMul(z2).redMul(this.z);
20346 var h = u1.redSub(u2);
20347 var r = s1.redSub(s2);
20348 if (h.cmpn(0) === 0) {
20349 if (r.cmpn(0) !== 0)
20350 return this.curve.jpoint(null, null, null);
20355 var h2 = h.redSqr();
20356 var h3 = h2.redMul(h);
20357 var v = u1.redMul(h2);
20359 var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
20360 var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
20361 var nz = this.z.redMul(h);
20363 return this.curve.jpoint(nx, ny, nz);
20366 JPoint.prototype.dblp = function dblp(pow) {
20369 if (this.isInfinity())
20374 if (this.curve.zeroA || this.curve.threeA) {
20376 for (var i = 0; i < pow; i++)
20381 // 1M + 2S + 1A + N * (4S + 5M + 8A)
20382 // N = 1 => 6M + 6S + 9A
20383 var a = this.curve.a;
20384 var tinv = this.curve.tinv;
20389 var jz4 = jz.redSqr().redSqr();
20392 var jyd = jy.redAdd(jy);
20393 for (var i = 0; i < pow; i++) {
20394 var jx2 = jx.redSqr();
20395 var jyd2 = jyd.redSqr();
20396 var jyd4 = jyd2.redSqr();
20397 var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
20399 var t1 = jx.redMul(jyd2);
20400 var nx = c.redSqr().redISub(t1.redAdd(t1));
20401 var t2 = t1.redISub(nx);
20402 var dny = c.redMul(t2);
20403 dny = dny.redIAdd(dny).redISub(jyd4);
20404 var nz = jyd.redMul(jz);
20406 jz4 = jz4.redMul(jyd4);
20413 return this.curve.jpoint(jx, jyd.redMul(tinv), jz);
20416 JPoint.prototype.dbl = function dbl() {
20417 if (this.isInfinity())
20420 if (this.curve.zeroA)
20421 return this._zeroDbl();
20422 else if (this.curve.threeA)
20423 return this._threeDbl();
20425 return this._dbl();
20428 JPoint.prototype._zeroDbl = function _zeroDbl() {
20434 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
20435 // #doubling-mdbl-2007-bl
20439 var xx = this.x.redSqr();
20441 var yy = this.y.redSqr();
20443 var yyyy = yy.redSqr();
20444 // S = 2 * ((X1 + YY)^2 - XX - YYYY)
20445 var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
20447 // M = 3 * XX + a; a = 0
20448 var m = xx.redAdd(xx).redIAdd(xx);
20450 var t = m.redSqr().redISub(s).redISub(s);
20453 var yyyy8 = yyyy.redIAdd(yyyy);
20454 yyyy8 = yyyy8.redIAdd(yyyy8);
20455 yyyy8 = yyyy8.redIAdd(yyyy8);
20459 // Y3 = M * (S - T) - 8 * YYYY
20460 ny = m.redMul(s.redISub(t)).redISub(yyyy8);
20462 nz = this.y.redAdd(this.y);
20464 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
20465 // #doubling-dbl-2009-l
20469 var a = this.x.redSqr();
20471 var b = this.y.redSqr();
20473 var c = b.redSqr();
20474 // D = 2 * ((X1 + B)^2 - A - C)
20475 var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);
20478 var e = a.redAdd(a).redIAdd(a);
20480 var f = e.redSqr();
20483 var c8 = c.redIAdd(c);
20484 c8 = c8.redIAdd(c8);
20485 c8 = c8.redIAdd(c8);
20488 nx = f.redISub(d).redISub(d);
20489 // Y3 = E * (D - X3) - 8 * C
20490 ny = e.redMul(d.redISub(nx)).redISub(c8);
20491 // Z3 = 2 * Y1 * Z1
20492 nz = this.y.redMul(this.z);
20493 nz = nz.redIAdd(nz);
20496 return this.curve.jpoint(nx, ny, nz);
20499 JPoint.prototype._threeDbl = function _threeDbl() {
20505 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html
20506 // #doubling-mdbl-2007-bl
20510 var xx = this.x.redSqr();
20512 var yy = this.y.redSqr();
20514 var yyyy = yy.redSqr();
20515 // S = 2 * ((X1 + YY)^2 - XX - YYYY)
20516 var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
20519 var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);
20521 var t = m.redSqr().redISub(s).redISub(s);
20524 // Y3 = M * (S - T) - 8 * YYYY
20525 var yyyy8 = yyyy.redIAdd(yyyy);
20526 yyyy8 = yyyy8.redIAdd(yyyy8);
20527 yyyy8 = yyyy8.redIAdd(yyyy8);
20528 ny = m.redMul(s.redISub(t)).redISub(yyyy8);
20530 nz = this.y.redAdd(this.y);
20532 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b
20536 var delta = this.z.redSqr();
20538 var gamma = this.y.redSqr();
20539 // beta = X1 * gamma
20540 var beta = this.x.redMul(gamma);
20541 // alpha = 3 * (X1 - delta) * (X1 + delta)
20542 var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));
20543 alpha = alpha.redAdd(alpha).redIAdd(alpha);
20544 // X3 = alpha^2 - 8 * beta
20545 var beta4 = beta.redIAdd(beta);
20546 beta4 = beta4.redIAdd(beta4);
20547 var beta8 = beta4.redAdd(beta4);
20548 nx = alpha.redSqr().redISub(beta8);
20549 // Z3 = (Y1 + Z1)^2 - gamma - delta
20550 nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);
20551 // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2
20552 var ggamma8 = gamma.redSqr();
20553 ggamma8 = ggamma8.redIAdd(ggamma8);
20554 ggamma8 = ggamma8.redIAdd(ggamma8);
20555 ggamma8 = ggamma8.redIAdd(ggamma8);
20556 ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);
20559 return this.curve.jpoint(nx, ny, nz);
20562 JPoint.prototype._dbl = function _dbl() {
20563 var a = this.curve.a;
20569 var jz4 = jz.redSqr().redSqr();
20571 var jx2 = jx.redSqr();
20572 var jy2 = jy.redSqr();
20574 var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
20576 var jxd4 = jx.redAdd(jx);
20577 jxd4 = jxd4.redIAdd(jxd4);
20578 var t1 = jxd4.redMul(jy2);
20579 var nx = c.redSqr().redISub(t1.redAdd(t1));
20580 var t2 = t1.redISub(nx);
20582 var jyd8 = jy2.redSqr();
20583 jyd8 = jyd8.redIAdd(jyd8);
20584 jyd8 = jyd8.redIAdd(jyd8);
20585 jyd8 = jyd8.redIAdd(jyd8);
20586 var ny = c.redMul(t2).redISub(jyd8);
20587 var nz = jy.redAdd(jy).redMul(jz);
20589 return this.curve.jpoint(nx, ny, nz);
20592 JPoint.prototype.trpl = function trpl() {
20593 if (!this.curve.zeroA)
20594 return this.dbl().add(this);
20596 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl
20600 var xx = this.x.redSqr();
20602 var yy = this.y.redSqr();
20604 var zz = this.z.redSqr();
20606 var yyyy = yy.redSqr();
20607 // M = 3 * XX + a * ZZ2; a = 0
20608 var m = xx.redAdd(xx).redIAdd(xx);
20610 var mm = m.redSqr();
20611 // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM
20612 var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
20614 e = e.redAdd(e).redIAdd(e);
20617 var ee = e.redSqr();
20619 var t = yyyy.redIAdd(yyyy);
20623 // U = (M + E)^2 - MM - EE - T
20624 var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);
20625 // X3 = 4 * (X1 * EE - 4 * YY * U)
20626 var yyu4 = yy.redMul(u);
20627 yyu4 = yyu4.redIAdd(yyu4);
20628 yyu4 = yyu4.redIAdd(yyu4);
20629 var nx = this.x.redMul(ee).redISub(yyu4);
20630 nx = nx.redIAdd(nx);
20631 nx = nx.redIAdd(nx);
20632 // Y3 = 8 * Y1 * (U * (T - U) - E * EE)
20633 var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));
20634 ny = ny.redIAdd(ny);
20635 ny = ny.redIAdd(ny);
20636 ny = ny.redIAdd(ny);
20637 // Z3 = (Z1 + E)^2 - ZZ - EE
20638 var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);
20640 return this.curve.jpoint(nx, ny, nz);
20643 JPoint.prototype.mul = function mul(k, kbase) {
20644 k = new BN(k, kbase);
20646 return this.curve._wnafMul(this, k);
20649 JPoint.prototype.eq = function eq(p) {
20650 if (p.type === 'affine')
20651 return this.eq(p.toJ());
20656 // x1 * z2^2 == x2 * z1^2
20657 var z2 = this.z.redSqr();
20658 var pz2 = p.z.redSqr();
20659 if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)
20662 // y1 * z2^3 == y2 * z1^3
20663 var z3 = z2.redMul(this.z);
20664 var pz3 = pz2.redMul(p.z);
20665 return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;
20668 JPoint.prototype.eqXToP = function eqXToP(x) {
20669 var zs = this.z.redSqr();
20670 var rx = x.toRed(this.curve.red).redMul(zs);
20671 if (this.x.cmp(rx) === 0)
20674 var xc = x.clone();
20675 var t = this.curve.redN.redMul(zs);
20677 xc.iadd(this.curve.n);
20678 if (xc.cmp(this.curve.p) >= 0)
20682 if (this.x.cmp(rx) === 0)
20687 JPoint.prototype.inspect = function inspect() {
20688 if (this.isInfinity())
20689 return '<EC JPoint Infinity>';
20690 return '<EC JPoint x: ' + this.x.toString(16, 2) +
20691 ' y: ' + this.y.toString(16, 2) +
20692 ' z: ' + this.z.toString(16, 2) + '>';
20695 JPoint.prototype.isInfinity = function isInfinity() {
20696 // XXX This code assumes that zero is always zero in red
20697 return this.z.cmpn(0) === 0;
20703 /***/ (function(module, exports, __webpack_require__) {
20708 var curve = __webpack_require__(45);
20709 var BN = __webpack_require__(4);
20710 var inherits = __webpack_require__(1);
20711 var Base = curve.base;
20713 var elliptic = __webpack_require__(6);
20714 var utils = elliptic.utils;
20716 function MontCurve(conf) {
20717 Base.call(this, 'mont', conf);
20719 this.a = new BN(conf.a, 16).toRed(this.red);
20720 this.b = new BN(conf.b, 16).toRed(this.red);
20721 this.i4 = new BN(4).toRed(this.red).redInvm();
20722 this.two = new BN(2).toRed(this.red);
20723 this.a24 = this.i4.redMul(this.a.redAdd(this.two));
20725 inherits(MontCurve, Base);
20726 module.exports = MontCurve;
20728 MontCurve.prototype.validate = function validate(point) {
20729 var x = point.normalize().x;
20730 var x2 = x.redSqr();
20731 var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);
20732 var y = rhs.redSqrt();
20734 return y.redSqr().cmp(rhs) === 0;
20737 function Point(curve, x, z) {
20738 Base.BasePoint.call(this, curve, 'projective');
20739 if (x === null && z === null) {
20740 this.x = this.curve.one;
20741 this.z = this.curve.zero;
20743 this.x = new BN(x, 16);
20744 this.z = new BN(z, 16);
20746 this.x = this.x.toRed(this.curve.red);
20748 this.z = this.z.toRed(this.curve.red);
20751 inherits(Point, Base.BasePoint);
20753 MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
20754 return this.point(utils.toArray(bytes, enc), 1);
20757 MontCurve.prototype.point = function point(x, z) {
20758 return new Point(this, x, z);
20761 MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
20762 return Point.fromJSON(this, obj);
20765 Point.prototype.precompute = function precompute() {
20769 Point.prototype._encode = function _encode() {
20770 return this.getX().toArray('be', this.curve.p.byteLength());
20773 Point.fromJSON = function fromJSON(curve, obj) {
20774 return new Point(curve, obj[0], obj[1] || curve.one);
20777 Point.prototype.inspect = function inspect() {
20778 if (this.isInfinity())
20779 return '<EC Point Infinity>';
20780 return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
20781 ' z: ' + this.z.fromRed().toString(16, 2) + '>';
20784 Point.prototype.isInfinity = function isInfinity() {
20785 // XXX This code assumes that zero is always zero in red
20786 return this.z.cmpn(0) === 0;
20789 Point.prototype.dbl = function dbl() {
20790 // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3
20794 var a = this.x.redAdd(this.z);
20796 var aa = a.redSqr();
20798 var b = this.x.redSub(this.z);
20800 var bb = b.redSqr();
20802 var c = aa.redSub(bb);
20804 var nx = aa.redMul(bb);
20805 // Z3 = C * (BB + A24 * C)
20806 var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));
20807 return this.curve.point(nx, nz);
20810 Point.prototype.add = function add() {
20811 throw new Error('Not supported on Montgomery curve');
20814 Point.prototype.diffAdd = function diffAdd(p, diff) {
20815 // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3
20819 var a = this.x.redAdd(this.z);
20821 var b = this.x.redSub(this.z);
20823 var c = p.x.redAdd(p.z);
20825 var d = p.x.redSub(p.z);
20827 var da = d.redMul(a);
20829 var cb = c.redMul(b);
20830 // X5 = Z1 * (DA + CB)^2
20831 var nx = diff.z.redMul(da.redAdd(cb).redSqr());
20832 // Z5 = X1 * (DA - CB)^2
20833 var nz = diff.x.redMul(da.redISub(cb).redSqr());
20834 return this.curve.point(nx, nz);
20837 Point.prototype.mul = function mul(k) {
20839 var a = this; // (N / 2) * Q + Q
20840 var b = this.curve.point(null, null); // (N / 2) * Q
20843 for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1))
20844 bits.push(t.andln(1));
20846 for (var i = bits.length - 1; i >= 0; i--) {
20847 if (bits[i] === 0) {
20848 // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q
20849 a = a.diffAdd(b, c);
20850 // N * Q = 2 * ((N / 2) * Q + Q))
20853 // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q)
20854 b = a.diffAdd(b, c);
20855 // N * Q + Q = 2 * ((N / 2) * Q + Q)
20862 Point.prototype.mulAdd = function mulAdd() {
20863 throw new Error('Not supported on Montgomery curve');
20866 Point.prototype.jumlAdd = function jumlAdd() {
20867 throw new Error('Not supported on Montgomery curve');
20870 Point.prototype.eq = function eq(other) {
20871 return this.getX().cmp(other.getX()) === 0;
20874 Point.prototype.normalize = function normalize() {
20875 this.x = this.x.redMul(this.z.redInvm());
20876 this.z = this.curve.one;
20880 Point.prototype.getX = function getX() {
20881 // Normalize coordinates
20884 return this.x.fromRed();
20890 /***/ (function(module, exports, __webpack_require__) {
20895 var curve = __webpack_require__(45);
20896 var elliptic = __webpack_require__(6);
20897 var BN = __webpack_require__(4);
20898 var inherits = __webpack_require__(1);
20899 var Base = curve.base;
20901 var assert = elliptic.utils.assert;
20903 function EdwardsCurve(conf) {
20904 // NOTE: Important as we are creating point in Base.call()
20905 this.twisted = (conf.a | 0) !== 1;
20906 this.mOneA = this.twisted && (conf.a | 0) === -1;
20907 this.extended = this.mOneA;
20909 Base.call(this, 'edwards', conf);
20911 this.a = new BN(conf.a, 16).umod(this.red.m);
20912 this.a = this.a.toRed(this.red);
20913 this.c = new BN(conf.c, 16).toRed(this.red);
20914 this.c2 = this.c.redSqr();
20915 this.d = new BN(conf.d, 16).toRed(this.red);
20916 this.dd = this.d.redAdd(this.d);
20918 assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);
20919 this.oneC = (conf.c | 0) === 1;
20921 inherits(EdwardsCurve, Base);
20922 module.exports = EdwardsCurve;
20924 EdwardsCurve.prototype._mulA = function _mulA(num) {
20926 return num.redNeg();
20928 return this.a.redMul(num);
20931 EdwardsCurve.prototype._mulC = function _mulC(num) {
20935 return this.c.redMul(num);
20938 // Just for compatibility with Short curve
20939 EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) {
20940 return this.point(x, y, z, t);
20943 EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) {
20946 x = x.toRed(this.red);
20948 var x2 = x.redSqr();
20949 var rhs = this.c2.redSub(this.a.redMul(x2));
20950 var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2));
20952 var y2 = rhs.redMul(lhs.redInvm());
20953 var y = y2.redSqrt();
20954 if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
20955 throw new Error('invalid point');
20957 var isOdd = y.fromRed().isOdd();
20958 if (odd && !isOdd || !odd && isOdd)
20961 return this.point(x, y);
20964 EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) {
20967 y = y.toRed(this.red);
20969 // x^2 = (y^2 - c^2) / (c^2 d y^2 - a)
20970 var y2 = y.redSqr();
20971 var lhs = y2.redSub(this.c2);
20972 var rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a);
20973 var x2 = lhs.redMul(rhs.redInvm());
20975 if (x2.cmp(this.zero) === 0) {
20977 throw new Error('invalid point');
20979 return this.point(this.zero, y);
20982 var x = x2.redSqrt();
20983 if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)
20984 throw new Error('invalid point');
20986 if (x.fromRed().isOdd() !== odd)
20989 return this.point(x, y);
20992 EdwardsCurve.prototype.validate = function validate(point) {
20993 if (point.isInfinity())
20996 // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2)
20999 var x2 = point.x.redSqr();
21000 var y2 = point.y.redSqr();
21001 var lhs = x2.redMul(this.a).redAdd(y2);
21002 var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));
21004 return lhs.cmp(rhs) === 0;
21007 function Point(curve, x, y, z, t) {
21008 Base.BasePoint.call(this, curve, 'projective');
21009 if (x === null && y === null && z === null) {
21010 this.x = this.curve.zero;
21011 this.y = this.curve.one;
21012 this.z = this.curve.one;
21013 this.t = this.curve.zero;
21016 this.x = new BN(x, 16);
21017 this.y = new BN(y, 16);
21018 this.z = z ? new BN(z, 16) : this.curve.one;
21019 this.t = t && new BN(t, 16);
21021 this.x = this.x.toRed(this.curve.red);
21023 this.y = this.y.toRed(this.curve.red);
21025 this.z = this.z.toRed(this.curve.red);
21026 if (this.t && !this.t.red)
21027 this.t = this.t.toRed(this.curve.red);
21028 this.zOne = this.z === this.curve.one;
21030 // Use extended coordinates
21031 if (this.curve.extended && !this.t) {
21032 this.t = this.x.redMul(this.y);
21034 this.t = this.t.redMul(this.z.redInvm());
21038 inherits(Point, Base.BasePoint);
21040 EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
21041 return Point.fromJSON(this, obj);
21044 EdwardsCurve.prototype.point = function point(x, y, z, t) {
21045 return new Point(this, x, y, z, t);
21048 Point.fromJSON = function fromJSON(curve, obj) {
21049 return new Point(curve, obj[0], obj[1], obj[2]);
21052 Point.prototype.inspect = function inspect() {
21053 if (this.isInfinity())
21054 return '<EC Point Infinity>';
21055 return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
21056 ' y: ' + this.y.fromRed().toString(16, 2) +
21057 ' z: ' + this.z.fromRed().toString(16, 2) + '>';
21060 Point.prototype.isInfinity = function isInfinity() {
21061 // XXX This code assumes that zero is always zero in red
21062 return this.x.cmpn(0) === 0 &&
21063 (this.y.cmp(this.z) === 0 ||
21064 (this.zOne && this.y.cmp(this.curve.c) === 0));
21067 Point.prototype._extDbl = function _extDbl() {
21068 // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
21069 // #doubling-dbl-2008-hwcd
21073 var a = this.x.redSqr();
21075 var b = this.y.redSqr();
21077 var c = this.z.redSqr();
21080 var d = this.curve._mulA(a);
21081 // E = (X1 + Y1)^2 - A - B
21082 var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);
21084 var g = d.redAdd(b);
21086 var f = g.redSub(c);
21088 var h = d.redSub(b);
21090 var nx = e.redMul(f);
21092 var ny = g.redMul(h);
21094 var nt = e.redMul(h);
21096 var nz = f.redMul(g);
21097 return this.curve.point(nx, ny, nz, nt);
21100 Point.prototype._projDbl = function _projDbl() {
21101 // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
21102 // #doubling-dbl-2008-bbjlp
21103 // #doubling-dbl-2007-bl
21105 // Generally 3M + 4S or 2M + 4S
21108 var b = this.x.redAdd(this.y).redSqr();
21110 var c = this.x.redSqr();
21112 var d = this.y.redSqr();
21117 if (this.curve.twisted) {
21119 var e = this.curve._mulA(c);
21121 var f = e.redAdd(d);
21123 // X3 = (B - C - D) * (F - 2)
21124 nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));
21125 // Y3 = F * (E - D)
21126 ny = f.redMul(e.redSub(d));
21127 // Z3 = F^2 - 2 * F
21128 nz = f.redSqr().redSub(f).redSub(f);
21131 var h = this.z.redSqr();
21133 var j = f.redSub(h).redISub(h);
21135 nx = b.redSub(c).redISub(d).redMul(j);
21136 // Y3 = F * (E - D)
21137 ny = f.redMul(e.redSub(d));
21143 var e = c.redAdd(d);
21145 var h = this.curve._mulC(this.z).redSqr();
21147 var j = e.redSub(h).redSub(h);
21148 // X3 = c * (B - E) * J
21149 nx = this.curve._mulC(b.redISub(e)).redMul(j);
21150 // Y3 = c * E * (C - D)
21151 ny = this.curve._mulC(e).redMul(c.redISub(d));
21155 return this.curve.point(nx, ny, nz);
21158 Point.prototype.dbl = function dbl() {
21159 if (this.isInfinity())
21162 // Double in extended coordinates
21163 if (this.curve.extended)
21164 return this._extDbl();
21166 return this._projDbl();
21169 Point.prototype._extAdd = function _extAdd(p) {
21170 // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
21171 // #addition-add-2008-hwcd-3
21174 // A = (Y1 - X1) * (Y2 - X2)
21175 var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x));
21176 // B = (Y1 + X1) * (Y2 + X2)
21177 var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));
21179 var c = this.t.redMul(this.curve.dd).redMul(p.t);
21181 var d = this.z.redMul(p.z.redAdd(p.z));
21183 var e = b.redSub(a);
21185 var f = d.redSub(c);
21187 var g = d.redAdd(c);
21189 var h = b.redAdd(a);
21191 var nx = e.redMul(f);
21193 var ny = g.redMul(h);
21195 var nt = e.redMul(h);
21197 var nz = f.redMul(g);
21198 return this.curve.point(nx, ny, nz, nt);
21201 Point.prototype._projAdd = function _projAdd(p) {
21202 // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
21203 // #addition-add-2008-bbjlp
21204 // #addition-add-2007-bl
21208 var a = this.z.redMul(p.z);
21210 var b = a.redSqr();
21212 var c = this.x.redMul(p.x);
21214 var d = this.y.redMul(p.y);
21216 var e = this.curve.d.redMul(c).redMul(d);
21218 var f = b.redSub(e);
21220 var g = b.redAdd(e);
21221 // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D)
21222 var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);
21223 var nx = a.redMul(f).redMul(tmp);
21226 if (this.curve.twisted) {
21227 // Y3 = A * G * (D - a * C)
21228 ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));
21232 // Y3 = A * G * (D - C)
21233 ny = a.redMul(g).redMul(d.redSub(c));
21235 nz = this.curve._mulC(f).redMul(g);
21237 return this.curve.point(nx, ny, nz);
21240 Point.prototype.add = function add(p) {
21241 if (this.isInfinity())
21243 if (p.isInfinity())
21246 if (this.curve.extended)
21247 return this._extAdd(p);
21249 return this._projAdd(p);
21252 Point.prototype.mul = function mul(k) {
21253 if (this._hasDoubles(k))
21254 return this.curve._fixedNafMul(this, k);
21256 return this.curve._wnafMul(this, k);
21259 Point.prototype.mulAdd = function mulAdd(k1, p, k2) {
21260 return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false);
21263 Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) {
21264 return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true);
21267 Point.prototype.normalize = function normalize() {
21271 // Normalize coordinates
21272 var zi = this.z.redInvm();
21273 this.x = this.x.redMul(zi);
21274 this.y = this.y.redMul(zi);
21276 this.t = this.t.redMul(zi);
21277 this.z = this.curve.one;
21282 Point.prototype.neg = function neg() {
21283 return this.curve.point(this.x.redNeg(),
21286 this.t && this.t.redNeg());
21289 Point.prototype.getX = function getX() {
21291 return this.x.fromRed();
21294 Point.prototype.getY = function getY() {
21296 return this.y.fromRed();
21299 Point.prototype.eq = function eq(other) {
21300 return this === other ||
21301 this.getX().cmp(other.getX()) === 0 &&
21302 this.getY().cmp(other.getY()) === 0;
21305 Point.prototype.eqXToP = function eqXToP(x) {
21306 var rx = x.toRed(this.curve.red).redMul(this.z);
21307 if (this.x.cmp(rx) === 0)
21310 var xc = x.clone();
21311 var t = this.curve.redN.redMul(this.z);
21313 xc.iadd(this.curve.n);
21314 if (xc.cmp(this.curve.p) >= 0)
21318 if (this.x.cmp(rx) === 0)
21323 // Compatibility with BaseCurve
21324 Point.prototype.toP = Point.prototype.normalize;
21325 Point.prototype.mixedAdd = Point.prototype.add;
21330 /***/ (function(module, exports, __webpack_require__) {
21335 var curves = exports;
21337 var hash = __webpack_require__(68);
21338 var elliptic = __webpack_require__(6);
21340 var assert = elliptic.utils.assert;
21342 function PresetCurve(options) {
21343 if (options.type === 'short')
21344 this.curve = new elliptic.curve.short(options);
21345 else if (options.type === 'edwards')
21346 this.curve = new elliptic.curve.edwards(options);
21348 this.curve = new elliptic.curve.mont(options);
21349 this.g = this.curve.g;
21350 this.n = this.curve.n;
21351 this.hash = options.hash;
21353 assert(this.g.validate(), 'Invalid curve');
21354 assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');
21356 curves.PresetCurve = PresetCurve;
21358 function defineCurve(name, options) {
21359 Object.defineProperty(curves, name, {
21360 configurable: true,
21363 var curve = new PresetCurve(options);
21364 Object.defineProperty(curves, name, {
21365 configurable: true,
21374 defineCurve('p192', {
21377 p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',
21378 a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',
21379 b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',
21380 n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',
21384 '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',
21385 '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811'
21389 defineCurve('p224', {
21392 p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',
21393 a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',
21394 b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',
21395 n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',
21399 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',
21400 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34'
21404 defineCurve('p256', {
21407 p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',
21408 a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',
21409 b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',
21410 n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',
21414 '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',
21415 '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5'
21419 defineCurve('p384', {
21422 p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
21423 'fffffffe ffffffff 00000000 00000000 ffffffff',
21424 a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
21425 'fffffffe ffffffff 00000000 00000000 fffffffc',
21426 b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' +
21427 '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',
21428 n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' +
21429 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',
21433 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' +
21434 '5502f25d bf55296c 3a545e38 72760ab7',
21435 '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' +
21436 '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f'
21440 defineCurve('p521', {
21443 p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
21444 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
21445 'ffffffff ffffffff ffffffff ffffffff ffffffff',
21446 a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
21447 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
21448 'ffffffff ffffffff ffffffff ffffffff fffffffc',
21449 b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' +
21450 '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' +
21451 '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',
21452 n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
21453 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' +
21454 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',
21458 '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' +
21459 '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' +
21460 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66',
21461 '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' +
21462 '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' +
21463 '3fad0761 353c7086 a272c240 88be9476 9fd16650'
21467 defineCurve('curve25519', {
21470 p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
21473 n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
21481 defineCurve('ed25519', {
21484 p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
21487 // -121665 * (121666^(-1)) (mod P)
21488 d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',
21489 n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
21493 '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',
21496 '6666666666666666666666666666666666666666666666666666666666666658'
21502 pre = __webpack_require__(236);
21507 defineCurve('secp256k1', {
21510 p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',
21513 n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',
21517 // Precomputed endomorphism
21518 beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',
21519 lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',
21522 a: '3086d221a7d46bcde86c90e49284eb15',
21523 b: '-e4437ed6010e88286f547fa90abfe4c3'
21526 a: '114ca50f7a8e2f3f657c1108d9d44cfd8',
21527 b: '3086d221a7d46bcde86c90e49284eb15'
21533 '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
21534 '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',
21542 /***/ (function(module, exports, __webpack_require__) {
21547 exports.sha1 = __webpack_require__(231);
21548 exports.sha224 = __webpack_require__(232);
21549 exports.sha256 = __webpack_require__(118);
21550 exports.sha384 = __webpack_require__(233);
21551 exports.sha512 = __webpack_require__(119);
21556 /***/ (function(module, exports, __webpack_require__) {
21561 var utils = __webpack_require__(11);
21562 var common = __webpack_require__(32);
21563 var shaCommon = __webpack_require__(117);
21565 var rotl32 = utils.rotl32;
21566 var sum32 = utils.sum32;
21567 var sum32_5 = utils.sum32_5;
21568 var ft_1 = shaCommon.ft_1;
21569 var BlockHash = common.BlockHash;
21572 0x5A827999, 0x6ED9EBA1,
21573 0x8F1BBCDC, 0xCA62C1D6
21577 if (!(this instanceof SHA1))
21580 BlockHash.call(this);
21582 0x67452301, 0xefcdab89, 0x98badcfe,
21583 0x10325476, 0xc3d2e1f0 ];
21584 this.W = new Array(80);
21587 utils.inherits(SHA1, BlockHash);
21588 module.exports = SHA1;
21590 SHA1.blockSize = 512;
21591 SHA1.outSize = 160;
21592 SHA1.hmacStrength = 80;
21593 SHA1.padLength = 64;
21595 SHA1.prototype._update = function _update(msg, start) {
21598 for (var i = 0; i < 16; i++)
21599 W[i] = msg[start + i];
21601 for(; i < W.length; i++)
21602 W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);
21610 for (i = 0; i < W.length; i++) {
21611 var s = ~~(i / 20);
21612 var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);
21620 this.h[0] = sum32(this.h[0], a);
21621 this.h[1] = sum32(this.h[1], b);
21622 this.h[2] = sum32(this.h[2], c);
21623 this.h[3] = sum32(this.h[3], d);
21624 this.h[4] = sum32(this.h[4], e);
21627 SHA1.prototype._digest = function digest(enc) {
21629 return utils.toHex32(this.h, 'big');
21631 return utils.split32(this.h, 'big');
21637 /***/ (function(module, exports, __webpack_require__) {
21642 var utils = __webpack_require__(11);
21643 var SHA256 = __webpack_require__(118);
21645 function SHA224() {
21646 if (!(this instanceof SHA224))
21647 return new SHA224();
21651 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
21652 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ];
21654 utils.inherits(SHA224, SHA256);
21655 module.exports = SHA224;
21657 SHA224.blockSize = 512;
21658 SHA224.outSize = 224;
21659 SHA224.hmacStrength = 192;
21660 SHA224.padLength = 64;
21662 SHA224.prototype._digest = function digest(enc) {
21663 // Just truncate output
21665 return utils.toHex32(this.h.slice(0, 7), 'big');
21667 return utils.split32(this.h.slice(0, 7), 'big');
21674 /***/ (function(module, exports, __webpack_require__) {
21679 var utils = __webpack_require__(11);
21681 var SHA512 = __webpack_require__(119);
21683 function SHA384() {
21684 if (!(this instanceof SHA384))
21685 return new SHA384();
21689 0xcbbb9d5d, 0xc1059ed8,
21690 0x629a292a, 0x367cd507,
21691 0x9159015a, 0x3070dd17,
21692 0x152fecd8, 0xf70e5939,
21693 0x67332667, 0xffc00b31,
21694 0x8eb44a87, 0x68581511,
21695 0xdb0c2e0d, 0x64f98fa7,
21696 0x47b5481d, 0xbefa4fa4 ];
21698 utils.inherits(SHA384, SHA512);
21699 module.exports = SHA384;
21701 SHA384.blockSize = 1024;
21702 SHA384.outSize = 384;
21703 SHA384.hmacStrength = 192;
21704 SHA384.padLength = 128;
21706 SHA384.prototype._digest = function digest(enc) {
21708 return utils.toHex32(this.h.slice(0, 12), 'big');
21710 return utils.split32(this.h.slice(0, 12), 'big');
21716 /***/ (function(module, exports, __webpack_require__) {
21721 var utils = __webpack_require__(11);
21722 var common = __webpack_require__(32);
21724 var rotl32 = utils.rotl32;
21725 var sum32 = utils.sum32;
21726 var sum32_3 = utils.sum32_3;
21727 var sum32_4 = utils.sum32_4;
21728 var BlockHash = common.BlockHash;
21730 function RIPEMD160() {
21731 if (!(this instanceof RIPEMD160))
21732 return new RIPEMD160();
21734 BlockHash.call(this);
21736 this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ];
21737 this.endian = 'little';
21739 utils.inherits(RIPEMD160, BlockHash);
21740 exports.ripemd160 = RIPEMD160;
21742 RIPEMD160.blockSize = 512;
21743 RIPEMD160.outSize = 160;
21744 RIPEMD160.hmacStrength = 192;
21745 RIPEMD160.padLength = 64;
21747 RIPEMD160.prototype._update = function update(msg, start) {
21758 for (var j = 0; j < 80; j++) {
21761 sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)),
21771 sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)),
21776 Dh = rotl32(Ch, 10);
21780 T = sum32_3(this.h[1], C, Dh);
21781 this.h[1] = sum32_3(this.h[2], D, Eh);
21782 this.h[2] = sum32_3(this.h[3], E, Ah);
21783 this.h[3] = sum32_3(this.h[4], A, Bh);
21784 this.h[4] = sum32_3(this.h[0], B, Ch);
21788 RIPEMD160.prototype._digest = function digest(enc) {
21790 return utils.toHex32(this.h, 'little');
21792 return utils.split32(this.h, 'little');
21795 function f(j, x, y, z) {
21799 return (x & y) | ((~x) & z);
21801 return (x | (~y)) ^ z;
21803 return (x & z) | (y & (~z));
21805 return x ^ (y | (~z));
21835 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
21836 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
21837 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
21838 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
21839 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
21843 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
21844 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
21845 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
21846 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
21847 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
21851 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
21852 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
21853 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
21854 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
21855 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
21859 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
21860 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
21861 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
21862 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
21863 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
21869 /***/ (function(module, exports, __webpack_require__) {
21874 var utils = __webpack_require__(11);
21875 var assert = __webpack_require__(9);
21877 function Hmac(hash, key, enc) {
21878 if (!(this instanceof Hmac))
21879 return new Hmac(hash, key, enc);
21881 this.blockSize = hash.blockSize / 8;
21882 this.outSize = hash.outSize / 8;
21886 this._init(utils.toArray(key, enc));
21888 module.exports = Hmac;
21890 Hmac.prototype._init = function init(key) {
21891 // Shorten key, if needed
21892 if (key.length > this.blockSize)
21893 key = new this.Hash().update(key).digest();
21894 assert(key.length <= this.blockSize);
21896 // Add padding to key
21897 for (var i = key.length; i < this.blockSize; i++)
21900 for (i = 0; i < key.length; i++)
21902 this.inner = new this.Hash().update(key);
21904 // 0x36 ^ 0x5c = 0x6a
21905 for (i = 0; i < key.length; i++)
21907 this.outer = new this.Hash().update(key);
21910 Hmac.prototype.update = function update(msg, enc) {
21911 this.inner.update(msg, enc);
21915 Hmac.prototype.digest = function digest(enc) {
21916 this.outer.update(this.inner.digest());
21917 return this.outer.digest(enc);
21923 /***/ (function(module, exports) {
21930 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a',
21931 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821'
21934 '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508',
21935 '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf'
21938 '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739',
21939 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695'
21942 '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640',
21943 '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9'
21946 '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c',
21947 '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36'
21950 '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda',
21951 '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f'
21954 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa',
21955 '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999'
21958 '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0',
21959 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09'
21962 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d',
21963 '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d'
21966 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d',
21967 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088'
21970 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1',
21971 '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d'
21974 '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0',
21975 '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8'
21978 '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047',
21979 '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a'
21982 '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862',
21983 '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453'
21986 '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7',
21987 '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160'
21990 '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd',
21991 '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0'
21994 '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83',
21995 '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6'
21998 '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a',
21999 '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589'
22002 '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8',
22003 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17'
22006 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d',
22007 '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda'
22010 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725',
22011 '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd'
22014 '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754',
22015 '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2'
22018 '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c',
22019 '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6'
22022 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6',
22023 '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f'
22026 '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39',
22027 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01'
22030 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891',
22031 '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3'
22034 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b',
22035 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f'
22038 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03',
22039 '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7'
22042 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d',
22043 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78'
22046 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070',
22047 '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1'
22050 '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4',
22051 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150'
22054 '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da',
22055 '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82'
22058 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11',
22059 '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc'
22062 '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e',
22063 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b'
22066 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41',
22067 '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51'
22070 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef',
22071 '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45'
22074 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8',
22075 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120'
22078 '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d',
22079 '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84'
22082 '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96',
22083 '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d'
22086 '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd',
22087 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d'
22090 '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5',
22091 '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8'
22094 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266',
22095 '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8'
22098 '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71',
22099 '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac'
22102 '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac',
22103 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f'
22106 '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751',
22107 '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962'
22110 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e',
22111 '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907'
22114 '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241',
22115 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec'
22118 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3',
22119 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d'
22122 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f',
22123 '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414'
22126 '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19',
22127 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd'
22130 '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be',
22131 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0'
22134 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9',
22135 '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811'
22138 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2',
22139 '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1'
22142 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13',
22143 '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c'
22146 '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c',
22147 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73'
22150 '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba',
22151 '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd'
22154 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151',
22155 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405'
22158 '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073',
22159 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589'
22162 '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458',
22163 '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e'
22166 '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b',
22167 '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27'
22170 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366',
22171 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1'
22174 '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa',
22175 '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482'
22178 '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0',
22179 '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945'
22182 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787',
22183 '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573'
22186 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e',
22187 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82'
22195 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9',
22196 '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672'
22199 '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4',
22200 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6'
22203 '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc',
22204 '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da'
22207 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe',
22208 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37'
22211 '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb',
22212 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b'
22215 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8',
22216 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81'
22219 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e',
22220 '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58'
22223 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34',
22224 '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77'
22227 '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c',
22228 '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a'
22231 '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5',
22232 '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c'
22235 '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f',
22236 '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67'
22239 '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714',
22240 '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402'
22243 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729',
22244 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55'
22247 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db',
22248 '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482'
22251 '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4',
22252 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82'
22255 '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5',
22256 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396'
22259 '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479',
22260 '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49'
22263 '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d',
22264 '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf'
22267 '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f',
22268 '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a'
22271 '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb',
22272 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7'
22275 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9',
22276 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933'
22279 '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963',
22280 '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a'
22283 '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74',
22284 '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6'
22287 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530',
22288 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37'
22291 '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b',
22292 '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e'
22295 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247',
22296 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6'
22299 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1',
22300 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476'
22303 '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120',
22304 '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40'
22307 '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435',
22308 '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61'
22311 '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18',
22312 '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683'
22315 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8',
22316 '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5'
22319 '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb',
22320 '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b'
22323 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f',
22324 '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417'
22327 '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143',
22328 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868'
22331 '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba',
22332 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a'
22335 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45',
22336 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6'
22339 '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a',
22340 '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996'
22343 '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e',
22344 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e'
22347 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8',
22348 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d'
22351 '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c',
22352 '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2'
22355 '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519',
22356 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e'
22359 '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab',
22360 '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437'
22363 '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca',
22364 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311'
22367 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf',
22368 '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4'
22371 '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610',
22372 '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575'
22375 '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4',
22376 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d'
22379 '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c',
22380 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d'
22383 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940',
22384 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629'
22387 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980',
22388 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06'
22391 '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3',
22392 '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374'
22395 '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf',
22396 '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee'
22399 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63',
22400 '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1'
22403 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448',
22404 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b'
22407 '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf',
22408 '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661'
22411 '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5',
22412 '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6'
22415 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6',
22416 '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e'
22419 '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5',
22420 '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d'
22423 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99',
22424 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc'
22427 '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51',
22428 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4'
22431 '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5',
22432 '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c'
22435 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5',
22436 '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b'
22439 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997',
22440 '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913'
22443 '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881',
22444 '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154'
22447 '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5',
22448 '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865'
22451 '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66',
22452 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc'
22455 '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726',
22456 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224'
22459 '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede',
22460 '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e'
22463 '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94',
22464 '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6'
22467 '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31',
22468 '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511'
22471 '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51',
22472 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b'
22475 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252',
22476 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2'
22479 '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5',
22480 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c'
22483 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b',
22484 '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3'
22487 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4',
22488 '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d'
22491 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f',
22492 '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700'
22495 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889',
22496 '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4'
22499 '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246',
22500 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196'
22503 '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984',
22504 '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4'
22507 '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a',
22508 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257'
22511 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030',
22512 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13'
22515 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197',
22516 '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096'
22519 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593',
22520 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38'
22523 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef',
22524 '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f'
22527 '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38',
22528 '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448'
22531 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a',
22532 '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a'
22535 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111',
22536 '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4'
22539 '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502',
22540 '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437'
22543 '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea',
22544 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7'
22547 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26',
22548 '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d'
22551 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986',
22552 '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a'
22555 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e',
22556 '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54'
22559 '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4',
22560 '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77'
22563 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda',
22564 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517'
22567 '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859',
22568 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10'
22571 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f',
22572 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125'
22575 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c',
22576 '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e'
22579 '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942',
22580 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1'
22583 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a',
22584 '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2'
22587 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80',
22588 '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423'
22591 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d',
22592 '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8'
22595 '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1',
22596 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758'
22599 '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63',
22600 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375'
22603 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352',
22604 '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d'
22607 '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193',
22608 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec'
22611 '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00',
22612 '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0'
22615 '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58',
22616 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c'
22619 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7',
22620 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4'
22623 '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8',
22624 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f'
22627 '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e',
22628 '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649'
22631 '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d',
22632 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826'
22635 '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b',
22636 '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5'
22639 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f',
22640 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87'
22643 '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6',
22644 '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b'
22647 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297',
22648 '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc'
22651 '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a',
22652 '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c'
22655 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c',
22656 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f'
22659 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52',
22660 '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a'
22663 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb',
22664 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46'
22667 '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065',
22668 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f'
22671 '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917',
22672 '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03'
22675 '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9',
22676 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08'
22679 '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3',
22680 '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8'
22683 '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57',
22684 '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373'
22687 '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66',
22688 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3'
22691 '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8',
22692 '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8'
22695 '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721',
22696 '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1'
22699 '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180',
22700 '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9'
22709 /***/ (function(module, exports, __webpack_require__) {
22714 var BN = __webpack_require__(4);
22715 var HmacDRBG = __webpack_require__(238);
22716 var elliptic = __webpack_require__(6);
22717 var utils = elliptic.utils;
22718 var assert = utils.assert;
22720 var KeyPair = __webpack_require__(239);
22721 var Signature = __webpack_require__(240);
22723 function EC(options) {
22724 if (!(this instanceof EC))
22725 return new EC(options);
22727 // Shortcut `elliptic.ec(curve-name)`
22728 if (typeof options === 'string') {
22729 assert(elliptic.curves.hasOwnProperty(options), 'Unknown curve ' + options);
22731 options = elliptic.curves[options];
22734 // Shortcut for `elliptic.ec(elliptic.curves.curveName)`
22735 if (options instanceof elliptic.curves.PresetCurve)
22736 options = { curve: options };
22738 this.curve = options.curve.curve;
22739 this.n = this.curve.n;
22740 this.nh = this.n.ushrn(1);
22741 this.g = this.curve.g;
22744 this.g = options.curve.g;
22745 this.g.precompute(options.curve.n.bitLength() + 1);
22747 // Hash for function for DRBG
22748 this.hash = options.hash || options.curve.hash;
22750 module.exports = EC;
22752 EC.prototype.keyPair = function keyPair(options) {
22753 return new KeyPair(this, options);
22756 EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) {
22757 return KeyPair.fromPrivate(this, priv, enc);
22760 EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) {
22761 return KeyPair.fromPublic(this, pub, enc);
22764 EC.prototype.genKeyPair = function genKeyPair(options) {
22768 // Instantiate Hmac_DRBG
22769 var drbg = new HmacDRBG({
22771 pers: options.pers,
22772 persEnc: options.persEnc || 'utf8',
22773 entropy: options.entropy || elliptic.rand(this.hash.hmacStrength),
22774 entropyEnc: options.entropy && options.entropyEnc || 'utf8',
22775 nonce: this.n.toArray()
22778 var bytes = this.n.byteLength();
22779 var ns2 = this.n.sub(new BN(2));
22781 var priv = new BN(drbg.generate(bytes));
22782 if (priv.cmp(ns2) > 0)
22786 return this.keyFromPrivate(priv);
22790 EC.prototype._truncateToN = function truncateToN(msg, truncOnly) {
22791 var delta = msg.byteLength() * 8 - this.n.bitLength();
22793 msg = msg.ushrn(delta);
22794 if (!truncOnly && msg.cmp(this.n) >= 0)
22795 return msg.sub(this.n);
22800 EC.prototype.sign = function sign(msg, key, enc, options) {
22801 if (typeof enc === 'object') {
22808 key = this.keyFromPrivate(key, enc);
22809 msg = this._truncateToN(new BN(msg, 16));
22811 // Zero-extend key to provide enough entropy
22812 var bytes = this.n.byteLength();
22813 var bkey = key.getPrivate().toArray('be', bytes);
22815 // Zero-extend nonce to have the same byte size as N
22816 var nonce = msg.toArray('be', bytes);
22818 // Instantiate Hmac_DRBG
22819 var drbg = new HmacDRBG({
22823 pers: options.pers,
22824 persEnc: options.persEnc || 'utf8'
22827 // Number of bytes to generate
22828 var ns1 = this.n.sub(new BN(1));
22830 for (var iter = 0; true; iter++) {
22831 var k = options.k ?
22833 new BN(drbg.generate(this.n.byteLength()));
22834 k = this._truncateToN(k, true);
22835 if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)
22838 var kp = this.g.mul(k);
22839 if (kp.isInfinity())
22842 var kpX = kp.getX();
22843 var r = kpX.umod(this.n);
22844 if (r.cmpn(0) === 0)
22847 var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));
22848 s = s.umod(this.n);
22849 if (s.cmpn(0) === 0)
22852 var recoveryParam = (kp.getY().isOdd() ? 1 : 0) |
22853 (kpX.cmp(r) !== 0 ? 2 : 0);
22855 // Use complement of `s`, if it is > `n / 2`
22856 if (options.canonical && s.cmp(this.nh) > 0) {
22858 recoveryParam ^= 1;
22861 return new Signature({ r: r, s: s, recoveryParam: recoveryParam });
22865 EC.prototype.verify = function verify(msg, signature, key, enc) {
22866 msg = this._truncateToN(new BN(msg, 16));
22867 key = this.keyFromPublic(key, enc);
22868 signature = new Signature(signature, 'hex');
22870 // Perform primitive values validation
22871 var r = signature.r;
22872 var s = signature.s;
22873 if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0)
22875 if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0)
22878 // Validate signature
22879 var sinv = s.invm(this.n);
22880 var u1 = sinv.mul(msg).umod(this.n);
22881 var u2 = sinv.mul(r).umod(this.n);
22883 if (!this.curve._maxwellTrick) {
22884 var p = this.g.mulAdd(u1, key.getPublic(), u2);
22885 if (p.isInfinity())
22888 return p.getX().umod(this.n).cmp(r) === 0;
22891 // NOTE: Greg Maxwell's trick, inspired by:
22892 // https://git.io/vad3K
22894 var p = this.g.jmulAdd(u1, key.getPublic(), u2);
22895 if (p.isInfinity())
22898 // Compare `p.x` of Jacobian point with `r`,
22899 // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the
22900 // inverse of `p.z^2`
22901 return p.eqXToP(r);
22904 EC.prototype.recoverPubKey = function(msg, signature, j, enc) {
22905 assert((3 & j) === j, 'The recovery param is more than two bits');
22906 signature = new Signature(signature, enc);
22909 var e = new BN(msg);
22910 var r = signature.r;
22911 var s = signature.s;
22913 // A set LSB signifies that the y-coordinate is odd
22914 var isYOdd = j & 1;
22915 var isSecondKey = j >> 1;
22916 if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)
22917 throw new Error('Unable to find sencond key candinate');
22919 // 1.1. Let x = r + jn.
22921 r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);
22923 r = this.curve.pointFromX(r, isYOdd);
22925 var rInv = signature.r.invm(n);
22926 var s1 = n.sub(e).mul(rInv).umod(n);
22927 var s2 = s.mul(rInv).umod(n);
22929 // 1.6.1 Compute Q = r^-1 (sR - eG)
22930 // Q = r^-1 (sR + -eG)
22931 return this.g.mulAdd(s1, r, s2);
22934 EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {
22935 signature = new Signature(signature, enc);
22936 if (signature.recoveryParam !== null)
22937 return signature.recoveryParam;
22939 for (var i = 0; i < 4; i++) {
22942 Qprime = this.recoverPubKey(e, signature, i);
22950 throw new Error('Unable to find valid recovery factor');
22956 /***/ (function(module, exports, __webpack_require__) {
22961 var hash = __webpack_require__(68);
22962 var utils = __webpack_require__(116);
22963 var assert = __webpack_require__(9);
22965 function HmacDRBG(options) {
22966 if (!(this instanceof HmacDRBG))
22967 return new HmacDRBG(options);
22968 this.hash = options.hash;
22969 this.predResist = !!options.predResist;
22971 this.outLen = this.hash.outSize;
22972 this.minEntropy = options.minEntropy || this.hash.hmacStrength;
22974 this._reseed = null;
22975 this.reseedInterval = null;
22979 var entropy = utils.toArray(options.entropy, options.entropyEnc || 'hex');
22980 var nonce = utils.toArray(options.nonce, options.nonceEnc || 'hex');
22981 var pers = utils.toArray(options.pers, options.persEnc || 'hex');
22982 assert(entropy.length >= (this.minEntropy / 8),
22983 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
22984 this._init(entropy, nonce, pers);
22986 module.exports = HmacDRBG;
22988 HmacDRBG.prototype._init = function init(entropy, nonce, pers) {
22989 var seed = entropy.concat(nonce).concat(pers);
22991 this.K = new Array(this.outLen / 8);
22992 this.V = new Array(this.outLen / 8);
22993 for (var i = 0; i < this.V.length; i++) {
22998 this._update(seed);
23000 this.reseedInterval = 0x1000000000000; // 2^48
23003 HmacDRBG.prototype._hmac = function hmac() {
23004 return new hash.hmac(this.hash, this.K);
23007 HmacDRBG.prototype._update = function update(seed) {
23008 var kmac = this._hmac()
23012 kmac = kmac.update(seed);
23013 this.K = kmac.digest();
23014 this.V = this._hmac().update(this.V).digest();
23018 this.K = this._hmac()
23023 this.V = this._hmac().update(this.V).digest();
23026 HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) {
23027 // Optional entropy enc
23028 if (typeof entropyEnc !== 'string') {
23034 entropy = utils.toArray(entropy, entropyEnc);
23035 add = utils.toArray(add, addEnc);
23037 assert(entropy.length >= (this.minEntropy / 8),
23038 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
23040 this._update(entropy.concat(add || []));
23044 HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) {
23045 if (this._reseed > this.reseedInterval)
23046 throw new Error('Reseed is required');
23048 // Optional encoding
23049 if (typeof enc !== 'string') {
23055 // Optional additional data
23057 add = utils.toArray(add, addEnc || 'hex');
23062 while (temp.length < len) {
23063 this.V = this._hmac().update(this.V).digest();
23064 temp = temp.concat(this.V);
23067 var res = temp.slice(0, len);
23070 return utils.encode(res, enc);
23076 /***/ (function(module, exports, __webpack_require__) {
23081 var BN = __webpack_require__(4);
23082 var elliptic = __webpack_require__(6);
23083 var utils = elliptic.utils;
23084 var assert = utils.assert;
23086 function KeyPair(ec, options) {
23091 // KeyPair(ec, { priv: ..., pub: ... })
23093 this._importPrivate(options.priv, options.privEnc);
23095 this._importPublic(options.pub, options.pubEnc);
23097 module.exports = KeyPair;
23099 KeyPair.fromPublic = function fromPublic(ec, pub, enc) {
23100 if (pub instanceof KeyPair)
23103 return new KeyPair(ec, {
23109 KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) {
23110 if (priv instanceof KeyPair)
23113 return new KeyPair(ec, {
23119 KeyPair.prototype.validate = function validate() {
23120 var pub = this.getPublic();
23122 if (pub.isInfinity())
23123 return { result: false, reason: 'Invalid public key' };
23124 if (!pub.validate())
23125 return { result: false, reason: 'Public key is not a point' };
23126 if (!pub.mul(this.ec.curve.n).isInfinity())
23127 return { result: false, reason: 'Public key * N != O' };
23129 return { result: true, reason: null };
23132 KeyPair.prototype.getPublic = function getPublic(compact, enc) {
23133 // compact is optional argument
23134 if (typeof compact === 'string') {
23140 this.pub = this.ec.g.mul(this.priv);
23145 return this.pub.encode(enc, compact);
23148 KeyPair.prototype.getPrivate = function getPrivate(enc) {
23150 return this.priv.toString(16, 2);
23155 KeyPair.prototype._importPrivate = function _importPrivate(key, enc) {
23156 this.priv = new BN(key, enc || 16);
23158 // Ensure that the priv won't be bigger than n, otherwise we may fail
23159 // in fixed multiplication method
23160 this.priv = this.priv.umod(this.ec.curve.n);
23163 KeyPair.prototype._importPublic = function _importPublic(key, enc) {
23164 if (key.x || key.y) {
23165 // Montgomery points only have an `x` coordinate.
23166 // Weierstrass/Edwards points on the other hand have both `x` and
23167 // `y` coordinates.
23168 if (this.ec.curve.type === 'mont') {
23169 assert(key.x, 'Need x coordinate');
23170 } else if (this.ec.curve.type === 'short' ||
23171 this.ec.curve.type === 'edwards') {
23172 assert(key.x && key.y, 'Need both x and y coordinate');
23174 this.pub = this.ec.curve.point(key.x, key.y);
23177 this.pub = this.ec.curve.decodePoint(key, enc);
23181 KeyPair.prototype.derive = function derive(pub) {
23182 return pub.mul(this.priv).getX();
23186 KeyPair.prototype.sign = function sign(msg, enc, options) {
23187 return this.ec.sign(msg, this, enc, options);
23190 KeyPair.prototype.verify = function verify(msg, signature) {
23191 return this.ec.verify(msg, signature, this);
23194 KeyPair.prototype.inspect = function inspect() {
23195 return '<Key priv: ' + (this.priv && this.priv.toString(16, 2)) +
23196 ' pub: ' + (this.pub && this.pub.inspect()) + ' >';
23202 /***/ (function(module, exports, __webpack_require__) {
23207 var BN = __webpack_require__(4);
23209 var elliptic = __webpack_require__(6);
23210 var utils = elliptic.utils;
23211 var assert = utils.assert;
23213 function Signature(options, enc) {
23214 if (options instanceof Signature)
23217 if (this._importDER(options, enc))
23220 assert(options.r && options.s, 'Signature without r or s');
23221 this.r = new BN(options.r, 16);
23222 this.s = new BN(options.s, 16);
23223 if (options.recoveryParam === undefined)
23224 this.recoveryParam = null;
23226 this.recoveryParam = options.recoveryParam;
23228 module.exports = Signature;
23230 function Position() {
23234 function getLength(buf, p) {
23235 var initial = buf[p.place++];
23236 if (!(initial & 0x80)) {
23239 var octetLen = initial & 0xf;
23241 for (var i = 0, off = p.place; i < octetLen; i++, off++) {
23249 function rmPadding(buf) {
23251 var len = buf.length - 1;
23252 while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) {
23258 return buf.slice(i);
23261 Signature.prototype._importDER = function _importDER(data, enc) {
23262 data = utils.toArray(data, enc);
23263 var p = new Position();
23264 if (data[p.place++] !== 0x30) {
23267 var len = getLength(data, p);
23268 if ((len + p.place) !== data.length) {
23271 if (data[p.place++] !== 0x02) {
23274 var rlen = getLength(data, p);
23275 var r = data.slice(p.place, rlen + p.place);
23277 if (data[p.place++] !== 0x02) {
23280 var slen = getLength(data, p);
23281 if (data.length !== slen + p.place) {
23284 var s = data.slice(p.place, slen + p.place);
23285 if (r[0] === 0 && (r[1] & 0x80)) {
23288 if (s[0] === 0 && (s[1] & 0x80)) {
23292 this.r = new BN(r);
23293 this.s = new BN(s);
23294 this.recoveryParam = null;
23299 function constructLength(arr, len) {
23304 var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);
23305 arr.push(octets | 0x80);
23307 arr.push((len >>> (octets << 3)) & 0xff);
23312 Signature.prototype.toDER = function toDER(enc) {
23313 var r = this.r.toArray();
23314 var s = this.s.toArray();
23318 r = [ 0 ].concat(r);
23321 s = [ 0 ].concat(s);
23326 while (!s[0] && !(s[1] & 0x80)) {
23329 var arr = [ 0x02 ];
23330 constructLength(arr, r.length);
23331 arr = arr.concat(r);
23333 constructLength(arr, s.length);
23334 var backHalf = arr.concat(s);
23335 var res = [ 0x30 ];
23336 constructLength(res, backHalf.length);
23337 res = res.concat(backHalf);
23338 return utils.encode(res, enc);
23344 /***/ (function(module, exports, __webpack_require__) {
23349 var hash = __webpack_require__(68);
23350 var elliptic = __webpack_require__(6);
23351 var utils = elliptic.utils;
23352 var assert = utils.assert;
23353 var parseBytes = utils.parseBytes;
23354 var KeyPair = __webpack_require__(242);
23355 var Signature = __webpack_require__(243);
23357 function EDDSA(curve) {
23358 assert(curve === 'ed25519', 'only tested with ed25519 so far');
23360 if (!(this instanceof EDDSA))
23361 return new EDDSA(curve);
23363 var curve = elliptic.curves[curve].curve;
23364 this.curve = curve;
23366 this.g.precompute(curve.n.bitLength() + 1);
23368 this.pointClass = curve.point().constructor;
23369 this.encodingLength = Math.ceil(curve.n.bitLength() / 8);
23370 this.hash = hash.sha512;
23373 module.exports = EDDSA;
23376 * @param {Array|String} message - message bytes
23377 * @param {Array|String|KeyPair} secret - secret bytes or a keypair
23378 * @returns {Signature} - signature
23380 EDDSA.prototype.sign = function sign(message, secret) {
23381 message = parseBytes(message);
23382 var key = this.keyFromSecret(secret);
23383 var r = this.hashInt(key.messagePrefix(), message);
23384 var R = this.g.mul(r);
23385 var Rencoded = this.encodePoint(R);
23386 var s_ = this.hashInt(Rencoded, key.pubBytes(), message)
23388 var S = r.add(s_).umod(this.curve.n);
23389 return this.makeSignature({ R: R, S: S, Rencoded: Rencoded });
23393 * @param {Array} message - message bytes
23394 * @param {Array|String|Signature} sig - sig bytes
23395 * @param {Array|String|Point|KeyPair} pub - public key
23396 * @returns {Boolean} - true if public key matches sig of message
23398 EDDSA.prototype.verify = function verify(message, sig, pub) {
23399 message = parseBytes(message);
23400 sig = this.makeSignature(sig);
23401 var key = this.keyFromPublic(pub);
23402 var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message);
23403 var SG = this.g.mul(sig.S());
23404 var RplusAh = sig.R().add(key.pub().mul(h));
23405 return RplusAh.eq(SG);
23408 EDDSA.prototype.hashInt = function hashInt() {
23409 var hash = this.hash();
23410 for (var i = 0; i < arguments.length; i++)
23411 hash.update(arguments[i]);
23412 return utils.intFromLE(hash.digest()).umod(this.curve.n);
23415 EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) {
23416 return KeyPair.fromPublic(this, pub);
23419 EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) {
23420 return KeyPair.fromSecret(this, secret);
23423 EDDSA.prototype.makeSignature = function makeSignature(sig) {
23424 if (sig instanceof Signature)
23426 return new Signature(this, sig);
23430 * * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2
23432 * EDDSA defines methods for encoding and decoding points and integers. These are
23433 * helper convenience methods, that pass along to utility functions implied
23437 EDDSA.prototype.encodePoint = function encodePoint(point) {
23438 var enc = point.getY().toArray('le', this.encodingLength);
23439 enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0;
23443 EDDSA.prototype.decodePoint = function decodePoint(bytes) {
23444 bytes = utils.parseBytes(bytes);
23446 var lastIx = bytes.length - 1;
23447 var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80);
23448 var xIsOdd = (bytes[lastIx] & 0x80) !== 0;
23450 var y = utils.intFromLE(normed);
23451 return this.curve.pointFromY(y, xIsOdd);
23454 EDDSA.prototype.encodeInt = function encodeInt(num) {
23455 return num.toArray('le', this.encodingLength);
23458 EDDSA.prototype.decodeInt = function decodeInt(bytes) {
23459 return utils.intFromLE(bytes);
23462 EDDSA.prototype.isPoint = function isPoint(val) {
23463 return val instanceof this.pointClass;
23469 /***/ (function(module, exports, __webpack_require__) {
23474 var elliptic = __webpack_require__(6);
23475 var utils = elliptic.utils;
23476 var assert = utils.assert;
23477 var parseBytes = utils.parseBytes;
23478 var cachedProperty = utils.cachedProperty;
23481 * @param {EDDSA} eddsa - instance
23482 * @param {Object} params - public/private key parameters
23484 * @param {Array<Byte>} [params.secret] - secret seed bytes
23485 * @param {Point} [params.pub] - public key point (aka `A` in eddsa terms)
23486 * @param {Array<Byte>} [params.pub] - public key point encoded as bytes
23489 function KeyPair(eddsa, params) {
23490 this.eddsa = eddsa;
23491 this._secret = parseBytes(params.secret);
23492 if (eddsa.isPoint(params.pub))
23493 this._pub = params.pub;
23495 this._pubBytes = parseBytes(params.pub);
23498 KeyPair.fromPublic = function fromPublic(eddsa, pub) {
23499 if (pub instanceof KeyPair)
23501 return new KeyPair(eddsa, { pub: pub });
23504 KeyPair.fromSecret = function fromSecret(eddsa, secret) {
23505 if (secret instanceof KeyPair)
23507 return new KeyPair(eddsa, { secret: secret });
23510 KeyPair.prototype.secret = function secret() {
23511 return this._secret;
23514 cachedProperty(KeyPair, 'pubBytes', function pubBytes() {
23515 return this.eddsa.encodePoint(this.pub());
23518 cachedProperty(KeyPair, 'pub', function pub() {
23519 if (this._pubBytes)
23520 return this.eddsa.decodePoint(this._pubBytes);
23521 return this.eddsa.g.mul(this.priv());
23524 cachedProperty(KeyPair, 'privBytes', function privBytes() {
23525 var eddsa = this.eddsa;
23526 var hash = this.hash();
23527 var lastIx = eddsa.encodingLength - 1;
23529 var a = hash.slice(0, eddsa.encodingLength);
23537 cachedProperty(KeyPair, 'priv', function priv() {
23538 return this.eddsa.decodeInt(this.privBytes());
23541 cachedProperty(KeyPair, 'hash', function hash() {
23542 return this.eddsa.hash().update(this.secret()).digest();
23545 cachedProperty(KeyPair, 'messagePrefix', function messagePrefix() {
23546 return this.hash().slice(this.eddsa.encodingLength);
23549 KeyPair.prototype.sign = function sign(message) {
23550 assert(this._secret, 'KeyPair can only verify');
23551 return this.eddsa.sign(message, this);
23554 KeyPair.prototype.verify = function verify(message, sig) {
23555 return this.eddsa.verify(message, sig, this);
23558 KeyPair.prototype.getSecret = function getSecret(enc) {
23559 assert(this._secret, 'KeyPair is public only');
23560 return utils.encode(this.secret(), enc);
23563 KeyPair.prototype.getPublic = function getPublic(enc) {
23564 return utils.encode(this.pubBytes(), enc);
23567 module.exports = KeyPair;
23572 /***/ (function(module, exports, __webpack_require__) {
23577 var BN = __webpack_require__(4);
23578 var elliptic = __webpack_require__(6);
23579 var utils = elliptic.utils;
23580 var assert = utils.assert;
23581 var cachedProperty = utils.cachedProperty;
23582 var parseBytes = utils.parseBytes;
23585 * @param {EDDSA} eddsa - eddsa instance
23586 * @param {Array<Bytes>|Object} sig -
23587 * @param {Array<Bytes>|Point} [sig.R] - R point as Point or bytes
23588 * @param {Array<Bytes>|bn} [sig.S] - S scalar as bn or bytes
23589 * @param {Array<Bytes>} [sig.Rencoded] - R point encoded
23590 * @param {Array<Bytes>} [sig.Sencoded] - S scalar encoded
23592 function Signature(eddsa, sig) {
23593 this.eddsa = eddsa;
23595 if (typeof sig !== 'object')
23596 sig = parseBytes(sig);
23598 if (Array.isArray(sig)) {
23600 R: sig.slice(0, eddsa.encodingLength),
23601 S: sig.slice(eddsa.encodingLength)
23605 assert(sig.R && sig.S, 'Signature without R or S');
23607 if (eddsa.isPoint(sig.R))
23609 if (sig.S instanceof BN)
23612 this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded;
23613 this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded;
23616 cachedProperty(Signature, 'S', function S() {
23617 return this.eddsa.decodeInt(this.Sencoded());
23620 cachedProperty(Signature, 'R', function R() {
23621 return this.eddsa.decodePoint(this.Rencoded());
23624 cachedProperty(Signature, 'Rencoded', function Rencoded() {
23625 return this.eddsa.encodePoint(this.R());
23628 cachedProperty(Signature, 'Sencoded', function Sencoded() {
23629 return this.eddsa.encodeInt(this.S());
23632 Signature.prototype.toBytes = function toBytes() {
23633 return this.Rencoded().concat(this.Sencoded());
23636 Signature.prototype.toHex = function toHex() {
23637 return utils.encode(this.toBytes(), 'hex').toUpperCase();
23640 module.exports = Signature;
23645 /***/ (function(module, exports, __webpack_require__) {
23648 // from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js
23649 // Fedor, you are amazing.
23652 var asn1 = __webpack_require__(33)
23654 exports.certificate = __webpack_require__(255)
23656 var RSAPrivateKey = asn1.define('RSAPrivateKey', function () {
23658 this.key('version').int(),
23659 this.key('modulus').int(),
23660 this.key('publicExponent').int(),
23661 this.key('privateExponent').int(),
23662 this.key('prime1').int(),
23663 this.key('prime2').int(),
23664 this.key('exponent1').int(),
23665 this.key('exponent2').int(),
23666 this.key('coefficient').int()
23669 exports.RSAPrivateKey = RSAPrivateKey
23671 var RSAPublicKey = asn1.define('RSAPublicKey', function () {
23673 this.key('modulus').int(),
23674 this.key('publicExponent').int()
23677 exports.RSAPublicKey = RSAPublicKey
23679 var PublicKey = asn1.define('SubjectPublicKeyInfo', function () {
23681 this.key('algorithm').use(AlgorithmIdentifier),
23682 this.key('subjectPublicKey').bitstr()
23685 exports.PublicKey = PublicKey
23687 var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () {
23689 this.key('algorithm').objid(),
23690 this.key('none').null_().optional(),
23691 this.key('curve').objid().optional(),
23692 this.key('params').seq().obj(
23693 this.key('p').int(),
23694 this.key('q').int(),
23695 this.key('g').int()
23700 var PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () {
23702 this.key('version').int(),
23703 this.key('algorithm').use(AlgorithmIdentifier),
23704 this.key('subjectPrivateKey').octstr()
23707 exports.PrivateKey = PrivateKeyInfo
23708 var EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () {
23710 this.key('algorithm').seq().obj(
23711 this.key('id').objid(),
23712 this.key('decrypt').seq().obj(
23713 this.key('kde').seq().obj(
23714 this.key('id').objid(),
23715 this.key('kdeparams').seq().obj(
23716 this.key('salt').octstr(),
23717 this.key('iters').int()
23720 this.key('cipher').seq().obj(
23721 this.key('algo').objid(),
23722 this.key('iv').octstr()
23726 this.key('subjectPrivateKey').octstr()
23730 exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo
23732 var DSAPrivateKey = asn1.define('DSAPrivateKey', function () {
23734 this.key('version').int(),
23735 this.key('p').int(),
23736 this.key('q').int(),
23737 this.key('g').int(),
23738 this.key('pub_key').int(),
23739 this.key('priv_key').int()
23742 exports.DSAPrivateKey = DSAPrivateKey
23744 exports.DSAparam = asn1.define('DSAparam', function () {
23748 var ECPrivateKey = asn1.define('ECPrivateKey', function () {
23750 this.key('version').int(),
23751 this.key('privateKey').octstr(),
23752 this.key('parameters').optional().explicit(0).use(ECParameters),
23753 this.key('publicKey').optional().explicit(1).bitstr()
23756 exports.ECPrivateKey = ECPrivateKey
23758 var ECParameters = asn1.define('ECParameters', function () {
23760 namedCurve: this.objid()
23764 exports.signature = asn1.define('signature', function () {
23766 this.key('r').int(),
23767 this.key('s').int()
23774 /***/ (function(module, exports, __webpack_require__) {
23776 var asn1 = __webpack_require__(33);
23777 var inherits = __webpack_require__(1);
23781 api.define = function define(name, body) {
23782 return new Entity(name, body);
23785 function Entity(name, body) {
23789 this.decoders = {};
23790 this.encoders = {};
23793 Entity.prototype._createNamed = function createNamed(base) {
23796 named = __webpack_require__(246).runInThisContext(
23797 '(function ' + this.name + '(entity) {\n' +
23798 ' this._initNamed(entity);\n' +
23802 named = function (entity) {
23803 this._initNamed(entity);
23806 inherits(named, base);
23807 named.prototype._initNamed = function initnamed(entity) {
23808 base.call(this, entity);
23811 return new named(this);
23814 Entity.prototype._getDecoder = function _getDecoder(enc) {
23815 enc = enc || 'der';
23816 // Lazily create decoder
23817 if (!this.decoders.hasOwnProperty(enc))
23818 this.decoders[enc] = this._createNamed(asn1.decoders[enc]);
23819 return this.decoders[enc];
23822 Entity.prototype.decode = function decode(data, enc, options) {
23823 return this._getDecoder(enc).decode(data, options);
23826 Entity.prototype._getEncoder = function _getEncoder(enc) {
23827 enc = enc || 'der';
23828 // Lazily create encoder
23829 if (!this.encoders.hasOwnProperty(enc))
23830 this.encoders[enc] = this._createNamed(asn1.encoders[enc]);
23831 return this.encoders[enc];
23834 Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) {
23835 return this._getEncoder(enc).encode(data, reporter);
23841 /***/ (function(module, exports, __webpack_require__) {
23843 var indexOf = __webpack_require__(247);
23845 var Object_keys = function (obj) {
23846 if (Object.keys) return Object.keys(obj)
23849 for (var key in obj) res.push(key)
23854 var forEach = function (xs, fn) {
23855 if (xs.forEach) return xs.forEach(fn)
23856 else for (var i = 0; i < xs.length; i++) {
23861 var defineProp = (function() {
23863 Object.defineProperty({}, '_', {});
23864 return function(obj, name, value) {
23865 Object.defineProperty(obj, name, {
23868 configurable: true,
23873 return function(obj, name, value) {
23879 var globals = ['Array', 'Boolean', 'Date', 'Error', 'EvalError', 'Function',
23880 'Infinity', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'RangeError',
23881 'ReferenceError', 'RegExp', 'String', 'SyntaxError', 'TypeError', 'URIError',
23882 'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape',
23883 'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined', 'unescape'];
23885 function Context() {}
23886 Context.prototype = {};
23888 var Script = exports.Script = function NodeScript (code) {
23889 if (!(this instanceof Script)) return new Script(code);
23893 Script.prototype.runInContext = function (context) {
23894 if (!(context instanceof Context)) {
23895 throw new TypeError("needs a 'context' argument.");
23898 var iframe = document.createElement('iframe');
23899 if (!iframe.style) iframe.style = {};
23900 iframe.style.display = 'none';
23902 document.body.appendChild(iframe);
23904 var win = iframe.contentWindow;
23905 var wEval = win.eval, wExecScript = win.execScript;
23907 if (!wEval && wExecScript) {
23908 // win.eval() magically appears when this is called in IE:
23909 wExecScript.call(win, 'null');
23913 forEach(Object_keys(context), function (key) {
23914 win[key] = context[key];
23916 forEach(globals, function (key) {
23917 if (context[key]) {
23918 win[key] = context[key];
23922 var winKeys = Object_keys(win);
23924 var res = wEval.call(win, this.code);
23926 forEach(Object_keys(win), function (key) {
23927 // Avoid copying circular objects like `top` and `window` by only
23928 // updating existing context properties or new properties in the `win`
23929 // that was only introduced after the eval.
23930 if (key in context || indexOf(winKeys, key) === -1) {
23931 context[key] = win[key];
23935 forEach(globals, function (key) {
23936 if (!(key in context)) {
23937 defineProp(context, key, win[key]);
23941 document.body.removeChild(iframe);
23946 Script.prototype.runInThisContext = function () {
23947 return eval(this.code); // maybe...
23950 Script.prototype.runInNewContext = function (context) {
23951 var ctx = Script.createContext(context);
23952 var res = this.runInContext(ctx);
23954 forEach(Object_keys(ctx), function (key) {
23955 context[key] = ctx[key];
23961 forEach(Object_keys(Script.prototype), function (name) {
23962 exports[name] = Script[name] = function (code) {
23963 var s = Script(code);
23964 return s[name].apply(s, [].slice.call(arguments, 1));
23968 exports.createScript = function (code) {
23969 return exports.Script(code);
23972 exports.createContext = Script.createContext = function (context) {
23973 var copy = new Context();
23974 if(typeof context === 'object') {
23975 forEach(Object_keys(context), function (key) {
23976 copy[key] = context[key];
23985 /***/ (function(module, exports) {
23988 var indexOf = [].indexOf;
23990 module.exports = function(arr, obj){
23991 if (indexOf) return arr.indexOf(obj);
23992 for (var i = 0; i < arr.length; ++i) {
23993 if (arr[i] === obj) return i;
24000 /***/ (function(module, exports, __webpack_require__) {
24002 var inherits = __webpack_require__(1);
24004 function Reporter(options) {
24005 this._reporterState = {
24008 options: options || {},
24012 exports.Reporter = Reporter;
24014 Reporter.prototype.isError = function isError(obj) {
24015 return obj instanceof ReporterError;
24018 Reporter.prototype.save = function save() {
24019 var state = this._reporterState;
24021 return { obj: state.obj, pathLen: state.path.length };
24024 Reporter.prototype.restore = function restore(data) {
24025 var state = this._reporterState;
24027 state.obj = data.obj;
24028 state.path = state.path.slice(0, data.pathLen);
24031 Reporter.prototype.enterKey = function enterKey(key) {
24032 return this._reporterState.path.push(key);
24035 Reporter.prototype.exitKey = function exitKey(index) {
24036 var state = this._reporterState;
24038 state.path = state.path.slice(0, index - 1);
24041 Reporter.prototype.leaveKey = function leaveKey(index, key, value) {
24042 var state = this._reporterState;
24044 this.exitKey(index);
24045 if (state.obj !== null)
24046 state.obj[key] = value;
24049 Reporter.prototype.path = function path() {
24050 return this._reporterState.path.join('/');
24053 Reporter.prototype.enterObject = function enterObject() {
24054 var state = this._reporterState;
24056 var prev = state.obj;
24061 Reporter.prototype.leaveObject = function leaveObject(prev) {
24062 var state = this._reporterState;
24064 var now = state.obj;
24069 Reporter.prototype.error = function error(msg) {
24071 var state = this._reporterState;
24073 var inherited = msg instanceof ReporterError;
24077 err = new ReporterError(state.path.map(function(elem) {
24078 return '[' + JSON.stringify(elem) + ']';
24079 }).join(''), msg.message || msg, msg.stack);
24082 if (!state.options.partial)
24086 state.errors.push(err);
24091 Reporter.prototype.wrapResult = function wrapResult(result) {
24092 var state = this._reporterState;
24093 if (!state.options.partial)
24097 result: this.isError(result) ? null : result,
24098 errors: state.errors
24102 function ReporterError(path, msg) {
24106 inherits(ReporterError, Error);
24108 ReporterError.prototype.rethrow = function rethrow(msg) {
24109 this.message = msg + ' at: ' + (this.path || '(shallow)');
24110 if (Error.captureStackTrace)
24111 Error.captureStackTrace(this, ReporterError);
24115 // IE only adds stack when thrown
24116 throw new Error(this.message);
24118 this.stack = e.stack;
24127 /***/ (function(module, exports, __webpack_require__) {
24129 var Reporter = __webpack_require__(34).Reporter;
24130 var EncoderBuffer = __webpack_require__(34).EncoderBuffer;
24131 var DecoderBuffer = __webpack_require__(34).DecoderBuffer;
24132 var assert = __webpack_require__(9);
24136 'seq', 'seqof', 'set', 'setof', 'objid', 'bool',
24137 'gentime', 'utctime', 'null_', 'enum', 'int', 'objDesc',
24138 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str',
24139 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr'
24142 // Public methods list
24144 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice',
24148 // Overrided methods list
24150 '_peekTag', '_decodeTag', '_use',
24151 '_decodeStr', '_decodeObjid', '_decodeTime',
24152 '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList',
24154 '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime',
24155 '_encodeNull', '_encodeInt', '_encodeBool'
24158 function Node(enc, parent) {
24160 this._baseState = state;
24164 state.parent = parent || null;
24165 state.children = null;
24170 state.reverseArgs = null;
24171 state.choice = null;
24172 state.optional = false;
24176 state.useDecoder = null;
24178 state['default'] = null;
24179 state.explicit = null;
24180 state.implicit = null;
24181 state.contains = null;
24183 // Should create new instance on each method
24184 if (!state.parent) {
24185 state.children = [];
24189 module.exports = Node;
24192 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice',
24193 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit',
24194 'implicit', 'contains'
24197 Node.prototype.clone = function clone() {
24198 var state = this._baseState;
24200 stateProps.forEach(function(prop) {
24201 cstate[prop] = state[prop];
24203 var res = new this.constructor(cstate.parent);
24204 res._baseState = cstate;
24208 Node.prototype._wrap = function wrap() {
24209 var state = this._baseState;
24210 methods.forEach(function(method) {
24211 this[method] = function _wrappedMethod() {
24212 var clone = new this.constructor(this);
24213 state.children.push(clone);
24214 return clone[method].apply(clone, arguments);
24219 Node.prototype._init = function init(body) {
24220 var state = this._baseState;
24222 assert(state.parent === null);
24226 state.children = state.children.filter(function(child) {
24227 return child._baseState.parent === this;
24229 assert.equal(state.children.length, 1, 'Root node can have only one child');
24232 Node.prototype._useArgs = function useArgs(args) {
24233 var state = this._baseState;
24235 // Filter children and args
24236 var children = args.filter(function(arg) {
24237 return arg instanceof this.constructor;
24239 args = args.filter(function(arg) {
24240 return !(arg instanceof this.constructor);
24243 if (children.length !== 0) {
24244 assert(state.children === null);
24245 state.children = children;
24247 // Replace parent to maintain backward link
24248 children.forEach(function(child) {
24249 child._baseState.parent = this;
24252 if (args.length !== 0) {
24253 assert(state.args === null);
24255 state.reverseArgs = args.map(function(arg) {
24256 if (typeof arg !== 'object' || arg.constructor !== Object)
24260 Object.keys(arg).forEach(function(key) {
24261 if (key == (key | 0))
24263 var value = arg[key];
24272 // Overrided methods
24275 overrided.forEach(function(method) {
24276 Node.prototype[method] = function _overrided() {
24277 var state = this._baseState;
24278 throw new Error(method + ' not implemented for encoding: ' + state.enc);
24286 tags.forEach(function(tag) {
24287 Node.prototype[tag] = function _tagMethod() {
24288 var state = this._baseState;
24289 var args = Array.prototype.slice.call(arguments);
24291 assert(state.tag === null);
24294 this._useArgs(args);
24300 Node.prototype.use = function use(item) {
24302 var state = this._baseState;
24304 assert(state.use === null);
24310 Node.prototype.optional = function optional() {
24311 var state = this._baseState;
24313 state.optional = true;
24318 Node.prototype.def = function def(val) {
24319 var state = this._baseState;
24321 assert(state['default'] === null);
24322 state['default'] = val;
24323 state.optional = true;
24328 Node.prototype.explicit = function explicit(num) {
24329 var state = this._baseState;
24331 assert(state.explicit === null && state.implicit === null);
24332 state.explicit = num;
24337 Node.prototype.implicit = function implicit(num) {
24338 var state = this._baseState;
24340 assert(state.explicit === null && state.implicit === null);
24341 state.implicit = num;
24346 Node.prototype.obj = function obj() {
24347 var state = this._baseState;
24348 var args = Array.prototype.slice.call(arguments);
24352 if (args.length !== 0)
24353 this._useArgs(args);
24358 Node.prototype.key = function key(newKey) {
24359 var state = this._baseState;
24361 assert(state.key === null);
24362 state.key = newKey;
24367 Node.prototype.any = function any() {
24368 var state = this._baseState;
24375 Node.prototype.choice = function choice(obj) {
24376 var state = this._baseState;
24378 assert(state.choice === null);
24379 state.choice = obj;
24380 this._useArgs(Object.keys(obj).map(function(key) {
24387 Node.prototype.contains = function contains(item) {
24388 var state = this._baseState;
24390 assert(state.use === null);
24391 state.contains = item;
24400 Node.prototype._decode = function decode(input, options) {
24401 var state = this._baseState;
24403 // Decode root node
24404 if (state.parent === null)
24405 return input.wrapResult(state.children[0]._decode(input, options));
24407 var result = state['default'];
24408 var present = true;
24410 var prevKey = null;
24411 if (state.key !== null)
24412 prevKey = input.enterKey(state.key);
24414 // Check if tag is there
24415 if (state.optional) {
24417 if (state.explicit !== null)
24418 tag = state.explicit;
24419 else if (state.implicit !== null)
24420 tag = state.implicit;
24421 else if (state.tag !== null)
24424 if (tag === null && !state.any) {
24426 var save = input.save();
24428 if (state.choice === null)
24429 this._decodeGeneric(state.tag, input, options);
24431 this._decodeChoice(input, options);
24436 input.restore(save);
24438 present = this._peekTag(input, tag, state.any);
24440 if (input.isError(present))
24445 // Push object on stack
24447 if (state.obj && present)
24448 prevObj = input.enterObject();
24451 // Unwrap explicit values
24452 if (state.explicit !== null) {
24453 var explicit = this._decodeTag(input, state.explicit);
24454 if (input.isError(explicit))
24459 var start = input.offset;
24461 // Unwrap implicit and normal values
24462 if (state.use === null && state.choice === null) {
24464 var save = input.save();
24465 var body = this._decodeTag(
24467 state.implicit !== null ? state.implicit : state.tag,
24470 if (input.isError(body))
24474 result = input.raw(save);
24479 if (options && options.track && state.tag !== null)
24480 options.track(input.path(), start, input.length, 'tagged');
24482 if (options && options.track && state.tag !== null)
24483 options.track(input.path(), input.offset, input.length, 'content');
24485 // Select proper method for tag
24488 else if (state.choice === null)
24489 result = this._decodeGeneric(state.tag, input, options);
24491 result = this._decodeChoice(input, options);
24493 if (input.isError(result))
24497 if (!state.any && state.choice === null && state.children !== null) {
24498 state.children.forEach(function decodeChildren(child) {
24499 // NOTE: We are ignoring errors here, to let parser continue with other
24500 // parts of encoded data
24501 child._decode(input, options);
24505 // Decode contained/encoded by schema, only in bit or octet strings
24506 if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) {
24507 var data = new DecoderBuffer(result);
24508 result = this._getUse(state.contains, input._reporterState.obj)
24509 ._decode(data, options);
24514 if (state.obj && present)
24515 result = input.leaveObject(prevObj);
24518 if (state.key !== null && (result !== null || present === true))
24519 input.leaveKey(prevKey, state.key, result);
24520 else if (prevKey !== null)
24521 input.exitKey(prevKey);
24526 Node.prototype._decodeGeneric = function decodeGeneric(tag, input, options) {
24527 var state = this._baseState;
24529 if (tag === 'seq' || tag === 'set')
24531 if (tag === 'seqof' || tag === 'setof')
24532 return this._decodeList(input, tag, state.args[0], options);
24533 else if (/str$/.test(tag))
24534 return this._decodeStr(input, tag, options);
24535 else if (tag === 'objid' && state.args)
24536 return this._decodeObjid(input, state.args[0], state.args[1], options);
24537 else if (tag === 'objid')
24538 return this._decodeObjid(input, null, null, options);
24539 else if (tag === 'gentime' || tag === 'utctime')
24540 return this._decodeTime(input, tag, options);
24541 else if (tag === 'null_')
24542 return this._decodeNull(input, options);
24543 else if (tag === 'bool')
24544 return this._decodeBool(input, options);
24545 else if (tag === 'objDesc')
24546 return this._decodeStr(input, tag, options);
24547 else if (tag === 'int' || tag === 'enum')
24548 return this._decodeInt(input, state.args && state.args[0], options);
24550 if (state.use !== null) {
24551 return this._getUse(state.use, input._reporterState.obj)
24552 ._decode(input, options);
24554 return input.error('unknown tag: ' + tag);
24558 Node.prototype._getUse = function _getUse(entity, obj) {
24560 var state = this._baseState;
24561 // Create altered use decoder if implicit is set
24562 state.useDecoder = this._use(entity, obj);
24563 assert(state.useDecoder._baseState.parent === null);
24564 state.useDecoder = state.useDecoder._baseState.children[0];
24565 if (state.implicit !== state.useDecoder._baseState.implicit) {
24566 state.useDecoder = state.useDecoder.clone();
24567 state.useDecoder._baseState.implicit = state.implicit;
24569 return state.useDecoder;
24572 Node.prototype._decodeChoice = function decodeChoice(input, options) {
24573 var state = this._baseState;
24577 Object.keys(state.choice).some(function(key) {
24578 var save = input.save();
24579 var node = state.choice[key];
24581 var value = node._decode(input, options);
24582 if (input.isError(value))
24585 result = { type: key, value: value };
24588 input.restore(save);
24595 return input.error('Choice not matched');
24604 Node.prototype._createEncoderBuffer = function createEncoderBuffer(data) {
24605 return new EncoderBuffer(data, this.reporter);
24608 Node.prototype._encode = function encode(data, reporter, parent) {
24609 var state = this._baseState;
24610 if (state['default'] !== null && state['default'] === data)
24613 var result = this._encodeValue(data, reporter, parent);
24614 if (result === undefined)
24617 if (this._skipDefault(result, reporter, parent))
24623 Node.prototype._encodeValue = function encode(data, reporter, parent) {
24624 var state = this._baseState;
24626 // Decode root node
24627 if (state.parent === null)
24628 return state.children[0]._encode(data, reporter || new Reporter());
24632 // Set reporter to share it with a child class
24633 this.reporter = reporter;
24635 // Check if data is there
24636 if (state.optional && data === undefined) {
24637 if (state['default'] !== null)
24638 data = state['default']
24643 // Encode children first
24644 var content = null;
24645 var primitive = false;
24647 // Anything that was given is translated to buffer
24648 result = this._createEncoderBuffer(data);
24649 } else if (state.choice) {
24650 result = this._encodeChoice(data, reporter);
24651 } else if (state.contains) {
24652 content = this._getUse(state.contains, parent)._encode(data, reporter);
24654 } else if (state.children) {
24655 content = state.children.map(function(child) {
24656 if (child._baseState.tag === 'null_')
24657 return child._encode(null, reporter, data);
24659 if (child._baseState.key === null)
24660 return reporter.error('Child should have a key');
24661 var prevKey = reporter.enterKey(child._baseState.key);
24663 if (typeof data !== 'object')
24664 return reporter.error('Child expected, but input is not object');
24666 var res = child._encode(data[child._baseState.key], reporter, data);
24667 reporter.leaveKey(prevKey);
24670 }, this).filter(function(child) {
24673 content = this._createEncoderBuffer(content);
24675 if (state.tag === 'seqof' || state.tag === 'setof') {
24676 // TODO(indutny): this should be thrown on DSL level
24677 if (!(state.args && state.args.length === 1))
24678 return reporter.error('Too many args for : ' + state.tag);
24680 if (!Array.isArray(data))
24681 return reporter.error('seqof/setof, but data is not Array');
24683 var child = this.clone();
24684 child._baseState.implicit = null;
24685 content = this._createEncoderBuffer(data.map(function(item) {
24686 var state = this._baseState;
24688 return this._getUse(state.args[0], data)._encode(item, reporter);
24690 } else if (state.use !== null) {
24691 result = this._getUse(state.use, parent)._encode(data, reporter);
24693 content = this._encodePrimitive(state.tag, data);
24698 // Encode data itself
24700 if (!state.any && state.choice === null) {
24701 var tag = state.implicit !== null ? state.implicit : state.tag;
24702 var cls = state.implicit === null ? 'universal' : 'context';
24704 if (tag === null) {
24705 if (state.use === null)
24706 reporter.error('Tag could be omitted only for .use()');
24708 if (state.use === null)
24709 result = this._encodeComposite(tag, primitive, cls, content);
24713 // Wrap in explicit
24714 if (state.explicit !== null)
24715 result = this._encodeComposite(state.explicit, false, 'context', result);
24720 Node.prototype._encodeChoice = function encodeChoice(data, reporter) {
24721 var state = this._baseState;
24723 var node = state.choice[data.type];
24727 data.type + ' not found in ' +
24728 JSON.stringify(Object.keys(state.choice)));
24730 return node._encode(data.value, reporter);
24733 Node.prototype._encodePrimitive = function encodePrimitive(tag, data) {
24734 var state = this._baseState;
24736 if (/str$/.test(tag))
24737 return this._encodeStr(data, tag);
24738 else if (tag === 'objid' && state.args)
24739 return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);
24740 else if (tag === 'objid')
24741 return this._encodeObjid(data, null, null);
24742 else if (tag === 'gentime' || tag === 'utctime')
24743 return this._encodeTime(data, tag);
24744 else if (tag === 'null_')
24745 return this._encodeNull();
24746 else if (tag === 'int' || tag === 'enum')
24747 return this._encodeInt(data, state.args && state.reverseArgs[0]);
24748 else if (tag === 'bool')
24749 return this._encodeBool(data);
24750 else if (tag === 'objDesc')
24751 return this._encodeStr(data, tag);
24753 throw new Error('Unsupported tag: ' + tag);
24756 Node.prototype._isNumstr = function isNumstr(str) {
24757 return /^[0-9 ]*$/.test(str);
24760 Node.prototype._isPrintstr = function isPrintstr(str) {
24761 return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str);
24767 /***/ (function(module, exports, __webpack_require__) {
24769 var constants = __webpack_require__(121);
24771 exports.tagClass = {
24777 exports.tagClassByName = constants._reverse(exports.tagClass);
24793 0x0d: 'relativeOid',
24810 exports.tagByName = constants._reverse(exports.tag);
24815 /***/ (function(module, exports, __webpack_require__) {
24817 var decoders = exports;
24819 decoders.der = __webpack_require__(122);
24820 decoders.pem = __webpack_require__(252);
24825 /***/ (function(module, exports, __webpack_require__) {
24827 var inherits = __webpack_require__(1);
24828 var Buffer = __webpack_require__(3).Buffer;
24830 var DERDecoder = __webpack_require__(122);
24832 function PEMDecoder(entity) {
24833 DERDecoder.call(this, entity);
24836 inherits(PEMDecoder, DERDecoder);
24837 module.exports = PEMDecoder;
24839 PEMDecoder.prototype.decode = function decode(data, options) {
24840 var lines = data.toString().split(/[\r\n]+/g);
24842 var label = options.label.toUpperCase();
24844 var re = /^-----(BEGIN|END) ([^-]+)-----$/;
24847 for (var i = 0; i < lines.length; i++) {
24848 var match = lines[i].match(re);
24849 if (match === null)
24852 if (match[2] !== label)
24855 if (start === -1) {
24856 if (match[1] !== 'BEGIN')
24860 if (match[1] !== 'END')
24866 if (start === -1 || end === -1)
24867 throw new Error('PEM section not found for: ' + label);
24869 var base64 = lines.slice(start + 1, end).join('');
24870 // Remove excessive symbols
24871 base64.replace(/[^a-z0-9\+\/=]+/gi, '');
24873 var input = new Buffer(base64, 'base64');
24874 return DERDecoder.prototype.decode.call(this, input, options);
24880 /***/ (function(module, exports, __webpack_require__) {
24882 var encoders = exports;
24884 encoders.der = __webpack_require__(123);
24885 encoders.pem = __webpack_require__(254);
24890 /***/ (function(module, exports, __webpack_require__) {
24892 var inherits = __webpack_require__(1);
24894 var DEREncoder = __webpack_require__(123);
24896 function PEMEncoder(entity) {
24897 DEREncoder.call(this, entity);
24900 inherits(PEMEncoder, DEREncoder);
24901 module.exports = PEMEncoder;
24903 PEMEncoder.prototype.encode = function encode(data, options) {
24904 var buf = DEREncoder.prototype.encode.call(this, data);
24906 var p = buf.toString('base64');
24907 var out = [ '-----BEGIN ' + options.label + '-----' ];
24908 for (var i = 0; i < p.length; i += 64)
24909 out.push(p.slice(i, i + 64));
24910 out.push('-----END ' + options.label + '-----');
24911 return out.join('\n');
24917 /***/ (function(module, exports, __webpack_require__) {
24920 // from https://github.com/Rantanen/node-dtls/blob/25a7dc861bda38cfeac93a723500eea4f0ac2e86/Certificate.js
24921 // thanks to @Rantanen
24925 var asn = __webpack_require__(33)
24927 var Time = asn.define('Time', function () {
24929 utcTime: this.utctime(),
24930 generalTime: this.gentime()
24934 var AttributeTypeValue = asn.define('AttributeTypeValue', function () {
24936 this.key('type').objid(),
24937 this.key('value').any()
24941 var AlgorithmIdentifier = asn.define('AlgorithmIdentifier', function () {
24943 this.key('algorithm').objid(),
24944 this.key('parameters').optional()
24948 var SubjectPublicKeyInfo = asn.define('SubjectPublicKeyInfo', function () {
24950 this.key('algorithm').use(AlgorithmIdentifier),
24951 this.key('subjectPublicKey').bitstr()
24955 var RelativeDistinguishedName = asn.define('RelativeDistinguishedName', function () {
24956 this.setof(AttributeTypeValue)
24959 var RDNSequence = asn.define('RDNSequence', function () {
24960 this.seqof(RelativeDistinguishedName)
24963 var Name = asn.define('Name', function () {
24965 rdnSequence: this.use(RDNSequence)
24969 var Validity = asn.define('Validity', function () {
24971 this.key('notBefore').use(Time),
24972 this.key('notAfter').use(Time)
24976 var Extension = asn.define('Extension', function () {
24978 this.key('extnID').objid(),
24979 this.key('critical').bool().def(false),
24980 this.key('extnValue').octstr()
24984 var TBSCertificate = asn.define('TBSCertificate', function () {
24986 this.key('version').explicit(0).int(),
24987 this.key('serialNumber').int(),
24988 this.key('signature').use(AlgorithmIdentifier),
24989 this.key('issuer').use(Name),
24990 this.key('validity').use(Validity),
24991 this.key('subject').use(Name),
24992 this.key('subjectPublicKeyInfo').use(SubjectPublicKeyInfo),
24993 this.key('issuerUniqueID').implicit(1).bitstr().optional(),
24994 this.key('subjectUniqueID').implicit(2).bitstr().optional(),
24995 this.key('extensions').explicit(3).seqof(Extension).optional()
24999 var X509Certificate = asn.define('X509Certificate', function () {
25001 this.key('tbsCertificate').use(TBSCertificate),
25002 this.key('signatureAlgorithm').use(AlgorithmIdentifier),
25003 this.key('signatureValue').bitstr()
25007 module.exports = X509Certificate
25012 /***/ (function(module, exports) {
25014 module.exports = {"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}
25018 /***/ (function(module, exports, __webpack_require__) {
25020 /* WEBPACK VAR INJECTION */(function(Buffer) {// adapted from https://github.com/apatil/pemstrip
25021 var findProc = /Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m
25022 var startRegex = /^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----/m
25023 var fullRegex = /^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m
25024 var evp = __webpack_require__(44)
25025 var ciphers = __webpack_require__(65)
25026 module.exports = function (okey, password) {
25027 var key = okey.toString()
25028 var match = key.match(findProc)
25031 var match2 = key.match(fullRegex)
25032 decrypted = new Buffer(match2[2].replace(/[\r\n]/g, ''), 'base64')
25034 var suite = 'aes' + match[1]
25035 var iv = new Buffer(match[2], 'hex')
25036 var cipherText = new Buffer(match[3].replace(/[\r\n]/g, ''), 'base64')
25037 var cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key
25039 var cipher = ciphers.createDecipheriv(suite, cipherKey, iv)
25040 out.push(cipher.update(cipherText))
25041 out.push(cipher.final())
25042 decrypted = Buffer.concat(out)
25044 var tag = key.match(startRegex)[1]
25051 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
25055 /***/ (function(module, exports, __webpack_require__) {
25057 /* WEBPACK VAR INJECTION */(function(Buffer) {// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
25058 var BN = __webpack_require__(4)
25059 var EC = __webpack_require__(6).ec
25060 var parseKeys = __webpack_require__(46)
25061 var curves = __webpack_require__(124)
25063 function verify (sig, hash, key, signType, tag) {
25064 var pub = parseKeys(key)
25065 if (pub.type === 'ec') {
25066 // rsa keys can be interpreted as ecdsa ones in openssl
25067 if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type')
25068 return ecVerify(sig, hash, pub)
25069 } else if (pub.type === 'dsa') {
25070 if (signType !== 'dsa') throw new Error('wrong public key type')
25071 return dsaVerify(sig, hash, pub)
25073 if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type')
25075 hash = Buffer.concat([tag, hash])
25076 var len = pub.modulus.byteLength()
25079 while (hash.length + pad.length + 2 < len) {
25085 while (++i < hash.length) {
25088 pad = new Buffer(pad)
25089 var red = BN.mont(pub.modulus)
25090 sig = new BN(sig).toRed(red)
25092 sig = sig.redPow(new BN(pub.publicExponent))
25093 sig = new Buffer(sig.fromRed().toArray())
25094 var out = padNum < 8 ? 1 : 0
25095 len = Math.min(sig.length, pad.length)
25096 if (sig.length !== pad.length) out = 1
25099 while (++i < len) out |= sig[i] ^ pad[i]
25103 function ecVerify (sig, hash, pub) {
25104 var curveId = curves[pub.data.algorithm.curve.join('.')]
25105 if (!curveId) throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.'))
25107 var curve = new EC(curveId)
25108 var pubkey = pub.data.subjectPrivateKey.data
25110 return curve.verify(hash, sig, pubkey)
25113 function dsaVerify (sig, hash, pub) {
25117 var y = pub.data.pub_key
25118 var unpacked = parseKeys.signature.decode(sig, 'der')
25123 var montp = BN.mont(p)
25125 var v = g.toRed(montp)
25126 .redPow(new BN(hash).mul(w).mod(q))
25128 .mul(y.toRed(montp).redPow(r.mul(w).mod(q)).fromRed())
25131 return v.cmp(r) === 0
25134 function checkValue (b, q) {
25135 if (b.cmpn(0) <= 0) throw new Error('invalid sig')
25136 if (b.cmp(q) >= q) throw new Error('invalid sig')
25139 module.exports = verify
25141 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
25145 /***/ (function(module, exports, __webpack_require__) {
25147 /* WEBPACK VAR INJECTION */(function(Buffer) {var elliptic = __webpack_require__(6)
25148 var BN = __webpack_require__(4)
25150 module.exports = function createECDH (curve) {
25151 return new ECDH(curve)
25185 aliases.p224 = aliases.secp224r1
25186 aliases.p256 = aliases.secp256r1 = aliases.prime256v1
25187 aliases.p192 = aliases.secp192r1 = aliases.prime192v1
25188 aliases.p384 = aliases.secp384r1
25189 aliases.p521 = aliases.secp521r1
25191 function ECDH (curve) {
25192 this.curveType = aliases[curve]
25193 if (!this.curveType) {
25198 this.curve = new elliptic.ec(this.curveType.name) // eslint-disable-line new-cap
25202 ECDH.prototype.generateKeys = function (enc, format) {
25203 this.keys = this.curve.genKeyPair()
25204 return this.getPublicKey(enc, format)
25207 ECDH.prototype.computeSecret = function (other, inenc, enc) {
25208 inenc = inenc || 'utf8'
25209 if (!Buffer.isBuffer(other)) {
25210 other = new Buffer(other, inenc)
25212 var otherPub = this.curve.keyFromPublic(other).getPublic()
25213 var out = otherPub.mul(this.keys.getPrivate()).getX()
25214 return formatReturnValue(out, enc, this.curveType.byteLength)
25217 ECDH.prototype.getPublicKey = function (enc, format) {
25218 var key = this.keys.getPublic(format === 'compressed', true)
25219 if (format === 'hybrid') {
25220 if (key[key.length - 1] % 2) {
25226 return formatReturnValue(key, enc)
25229 ECDH.prototype.getPrivateKey = function (enc) {
25230 return formatReturnValue(this.keys.getPrivate(), enc)
25233 ECDH.prototype.setPublicKey = function (pub, enc) {
25234 enc = enc || 'utf8'
25235 if (!Buffer.isBuffer(pub)) {
25236 pub = new Buffer(pub, enc)
25238 this.keys._importPublic(pub)
25242 ECDH.prototype.setPrivateKey = function (priv, enc) {
25243 enc = enc || 'utf8'
25244 if (!Buffer.isBuffer(priv)) {
25245 priv = new Buffer(priv, enc)
25248 var _priv = new BN(priv)
25249 _priv = _priv.toString(16)
25250 this.keys = this.curve.genKeyPair()
25251 this.keys._importPrivate(_priv)
25255 function formatReturnValue (bn, enc, len) {
25256 if (!Array.isArray(bn)) {
25259 var buf = new Buffer(bn)
25260 if (len && buf.length < len) {
25261 var zeros = new Buffer(len - buf.length)
25263 buf = Buffer.concat([zeros, buf])
25268 return buf.toString(enc)
25272 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
25276 /***/ (function(module, exports, __webpack_require__) {
25278 exports.publicEncrypt = __webpack_require__(261);
25279 exports.privateDecrypt = __webpack_require__(262);
25281 exports.privateEncrypt = function privateEncrypt(key, buf) {
25282 return exports.publicEncrypt(key, buf, true);
25285 exports.publicDecrypt = function publicDecrypt(key, buf) {
25286 return exports.privateDecrypt(key, buf, true);
25291 /***/ (function(module, exports, __webpack_require__) {
25293 /* WEBPACK VAR INJECTION */(function(Buffer) {var parseKeys = __webpack_require__(46);
25294 var randomBytes = __webpack_require__(23);
25295 var createHash = __webpack_require__(29);
25296 var mgf = __webpack_require__(125);
25297 var xor = __webpack_require__(126);
25298 var bn = __webpack_require__(4);
25299 var withPublic = __webpack_require__(127);
25300 var crt = __webpack_require__(67);
25303 RSA_PKCS1_OAEP_PADDING: 4,
25304 RSA_PKCS1_PADDIN: 1,
25308 module.exports = function publicEncrypt(public_key, msg, reverse) {
25310 if (public_key.padding) {
25311 padding = public_key.padding;
25312 } else if (reverse) {
25317 var key = parseKeys(public_key);
25319 if (padding === 4) {
25320 paddedMsg = oaep(key, msg);
25321 } else if (padding === 1) {
25322 paddedMsg = pkcs1(key, msg, reverse);
25323 } else if (padding === 3) {
25324 paddedMsg = new bn(msg);
25325 if (paddedMsg.cmp(key.modulus) >= 0) {
25326 throw new Error('data too long for modulus');
25329 throw new Error('unknown padding');
25332 return crt(paddedMsg, key);
25334 return withPublic(paddedMsg, key);
25338 function oaep(key, msg){
25339 var k = key.modulus.byteLength();
25340 var mLen = msg.length;
25341 var iHash = createHash('sha1').update(new Buffer('')).digest();
25342 var hLen = iHash.length;
25343 var hLen2 = 2 * hLen;
25344 if (mLen > k - hLen2 - 2) {
25345 throw new Error('message too long');
25347 var ps = new Buffer(k - mLen - hLen2 - 2);
25349 var dblen = k - hLen - 1;
25350 var seed = randomBytes(hLen);
25351 var maskedDb = xor(Buffer.concat([iHash, ps, new Buffer([1]), msg], dblen), mgf(seed, dblen));
25352 var maskedSeed = xor(seed, mgf(maskedDb, hLen));
25353 return new bn(Buffer.concat([new Buffer([0]), maskedSeed, maskedDb], k));
25355 function pkcs1(key, msg, reverse){
25356 var mLen = msg.length;
25357 var k = key.modulus.byteLength();
25358 if (mLen > k - 11) {
25359 throw new Error('message too long');
25363 ps = new Buffer(k - mLen - 3);
25366 ps = nonZero(k - mLen - 3);
25368 return new bn(Buffer.concat([new Buffer([0, reverse?1:2]), ps, new Buffer([0]), msg], k));
25370 function nonZero(len, crypto) {
25371 var out = new Buffer(len);
25373 var cache = randomBytes(len*2);
25377 if (cur === cache.length) {
25378 cache = randomBytes(len*2);
25381 num = cache[cur++];
25388 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
25392 /***/ (function(module, exports, __webpack_require__) {
25394 /* WEBPACK VAR INJECTION */(function(Buffer) {var parseKeys = __webpack_require__(46);
25395 var mgf = __webpack_require__(125);
25396 var xor = __webpack_require__(126);
25397 var bn = __webpack_require__(4);
25398 var crt = __webpack_require__(67);
25399 var createHash = __webpack_require__(29);
25400 var withPublic = __webpack_require__(127);
25401 module.exports = function privateDecrypt(private_key, enc, reverse) {
25403 if (private_key.padding) {
25404 padding = private_key.padding;
25405 } else if (reverse) {
25411 var key = parseKeys(private_key);
25412 var k = key.modulus.byteLength();
25413 if (enc.length > k || new bn(enc).cmp(key.modulus) >= 0) {
25414 throw new Error('decryption error');
25418 msg = withPublic(new bn(enc), key);
25420 msg = crt(enc, key);
25422 var zBuffer = new Buffer(k - msg.length);
25424 msg = Buffer.concat([zBuffer, msg], k);
25425 if (padding === 4) {
25426 return oaep(key, msg);
25427 } else if (padding === 1) {
25428 return pkcs1(key, msg, reverse);
25429 } else if (padding === 3) {
25432 throw new Error('unknown padding');
25436 function oaep(key, msg){
25437 var n = key.modulus;
25438 var k = key.modulus.byteLength();
25439 var mLen = msg.length;
25440 var iHash = createHash('sha1').update(new Buffer('')).digest();
25441 var hLen = iHash.length;
25442 var hLen2 = 2 * hLen;
25443 if (msg[0] !== 0) {
25444 throw new Error('decryption error');
25446 var maskedSeed = msg.slice(1, hLen + 1);
25447 var maskedDb = msg.slice(hLen + 1);
25448 var seed = xor(maskedSeed, mgf(maskedDb, hLen));
25449 var db = xor(maskedDb, mgf(seed, k - hLen - 1));
25450 if (compare(iHash, db.slice(0, hLen))) {
25451 throw new Error('decryption error');
25454 while (db[i] === 0) {
25457 if (db[i++] !== 1) {
25458 throw new Error('decryption error');
25460 return db.slice(i);
25463 function pkcs1(key, msg, reverse){
25464 var p1 = msg.slice(0, 2);
25467 while (msg[i++] !== 0) {
25468 if (i >= msg.length) {
25473 var ps = msg.slice(2, i - 1);
25474 var p2 = msg.slice(i - 1, i);
25476 if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)){
25479 if (ps.length < 8) {
25483 throw new Error('decryption error');
25485 return msg.slice(i);
25487 function compare(a, b){
25491 var len = a.length;
25492 if (a.length !== b.length) {
25494 len = Math.min(a.length, b.length);
25497 while (++i < len) {
25498 dif += (a[i] ^ b[i]);
25502 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
25506 /***/ (function(module, exports, __webpack_require__) {
25509 /* WEBPACK VAR INJECTION */(function(global, process) {
25511 function oldBrowser () {
25512 throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11')
25514 var safeBuffer = __webpack_require__(2)
25515 var randombytes = __webpack_require__(23)
25516 var Buffer = safeBuffer.Buffer
25517 var kBufferMaxLength = safeBuffer.kMaxLength
25518 var crypto = global.crypto || global.msCrypto
25519 var kMaxUint32 = Math.pow(2, 32) - 1
25520 function assertOffset (offset, length) {
25521 if (typeof offset !== 'number' || offset !== offset) { // eslint-disable-line no-self-compare
25522 throw new TypeError('offset must be a number')
25525 if (offset > kMaxUint32 || offset < 0) {
25526 throw new TypeError('offset must be a uint32')
25529 if (offset > kBufferMaxLength || offset > length) {
25530 throw new RangeError('offset out of range')
25534 function assertSize (size, offset, length) {
25535 if (typeof size !== 'number' || size !== size) { // eslint-disable-line no-self-compare
25536 throw new TypeError('size must be a number')
25539 if (size > kMaxUint32 || size < 0) {
25540 throw new TypeError('size must be a uint32')
25543 if (size + offset > length || size > kBufferMaxLength) {
25544 throw new RangeError('buffer too small')
25547 if ((crypto && crypto.getRandomValues) || !process.browser) {
25548 exports.randomFill = randomFill
25549 exports.randomFillSync = randomFillSync
25551 exports.randomFill = oldBrowser
25552 exports.randomFillSync = oldBrowser
25554 function randomFill (buf, offset, size, cb) {
25555 if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) {
25556 throw new TypeError('"buf" argument must be a Buffer or Uint8Array')
25559 if (typeof offset === 'function') {
25563 } else if (typeof size === 'function') {
25565 size = buf.length - offset
25566 } else if (typeof cb !== 'function') {
25567 throw new TypeError('"cb" argument must be a function')
25569 assertOffset(offset, buf.length)
25570 assertSize(size, offset, buf.length)
25571 return actualFill(buf, offset, size, cb)
25574 function actualFill (buf, offset, size, cb) {
25575 if (process.browser) {
25576 var ourBuf = buf.buffer
25577 var uint = new Uint8Array(ourBuf, offset, size)
25578 crypto.getRandomValues(uint)
25580 process.nextTick(function () {
25588 randombytes(size, function (err, bytes) {
25592 bytes.copy(buf, offset)
25597 var bytes = randombytes(size)
25598 bytes.copy(buf, offset)
25601 function randomFillSync (buf, offset, size) {
25602 if (typeof offset === 'undefined') {
25605 if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) {
25606 throw new TypeError('"buf" argument must be a Buffer or Uint8Array')
25609 assertOffset(offset, buf.length)
25611 if (size === undefined) size = buf.length - offset
25613 assertSize(size, offset, buf.length)
25615 return actualFill(buf, offset, size)
25618 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10), __webpack_require__(14)))
25622 /***/ (function(module, exports, __webpack_require__) {
25626 Object.defineProperty(exports, "__esModule", { value: true });
\r
25627 class LocalStream {
\r
25628 static send(msg) {
\r
25629 return new Promise((resolve, reject) => {
\r
25630 chrome.runtime.sendMessage(msg, (response) => resolve(response));
\r
25633 static watch(callback) {
\r
25634 chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
\r
25635 if (sender.id !== chrome.runtime.id)
\r
25637 callback(request, sendResponse);
\r
25642 exports.LocalStream = LocalStream;
\r
25643 exports.default = LocalStream;
\r
25644 //# sourceMappingURL=LocalStream.js.map
25651 /***/ (function(module, __webpack_exports__, __webpack_require__) {
25654 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BTM; });
25655 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return camelize; });
25656 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return networks; });
25657 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return networksJS; });
25658 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_typeof__ = __webpack_require__(145);
25659 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_typeof___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_typeof__);
25661 var BTM = 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff';
25663 var camelize = function camelize(object) {
25664 for (var key in object) {
25665 var value = object[key];
25668 if (/_/.test(key)) {
25669 newKey = key.replace(/([_][a-z])/g, function (v) {
25670 return v[1].toUpperCase();
25672 delete object[key];
25675 if ((typeof value === 'undefined' ? 'undefined' : __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_typeof___default()(value)) == 'object') {
25676 value = camelize(value);
25679 object[newKey] = value;
25686 mainnet: 'https://bcapi.movapi.com'
25690 mainnet: networks['mainnet'] + '/bytom/v3/',
25691 mainnetvapor: networks['mainnet'] + '/vapor/v3/'
25699 /***/ (function(module, exports, __webpack_require__) {
25701 module.exports = { "default": __webpack_require__(273), __esModule: true };
25705 /***/ (function(module, exports, __webpack_require__) {
25707 __webpack_require__(132);
25708 __webpack_require__(79);
25709 module.exports = __webpack_require__(81).f('iterator');
25714 /***/ (function(module, exports, __webpack_require__) {
25716 module.exports = { "default": __webpack_require__(275), __esModule: true };
25720 /***/ (function(module, exports, __webpack_require__) {
25722 __webpack_require__(276);
25723 __webpack_require__(77);
25724 __webpack_require__(280);
25725 __webpack_require__(281);
25726 module.exports = __webpack_require__(8).Symbol;
25731 /***/ (function(module, exports, __webpack_require__) {
25735 // ECMAScript 6 symbols shim
25736 var global = __webpack_require__(5);
25737 var has = __webpack_require__(20);
25738 var DESCRIPTORS = __webpack_require__(17);
25739 var $export = __webpack_require__(13);
25740 var redefine = __webpack_require__(78);
25741 var META = __webpack_require__(93).KEY;
25742 var $fails = __webpack_require__(22);
25743 var shared = __webpack_require__(70);
25744 var setToStringTag = __webpack_require__(40);
25745 var uid = __webpack_require__(47);
25746 var wks = __webpack_require__(7);
25747 var wksExt = __webpack_require__(81);
25748 var wksDefine = __webpack_require__(82);
25749 var enumKeys = __webpack_require__(277);
25750 var isArray = __webpack_require__(143);
25751 var anObject = __webpack_require__(15);
25752 var isObject = __webpack_require__(12);
25753 var toIObject = __webpack_require__(25);
25754 var toPrimitive = __webpack_require__(72);
25755 var createDesc = __webpack_require__(48);
25756 var _create = __webpack_require__(133);
25757 var gOPNExt = __webpack_require__(278);
25758 var $GOPD = __webpack_require__(279);
25759 var $DP = __webpack_require__(16);
25760 var $keys = __webpack_require__(39);
25761 var gOPD = $GOPD.f;
25763 var gOPN = gOPNExt.f;
25764 var $Symbol = global.Symbol;
25765 var $JSON = global.JSON;
25766 var _stringify = $JSON && $JSON.stringify;
25767 var PROTOTYPE = 'prototype';
25768 var HIDDEN = wks('_hidden');
25769 var TO_PRIMITIVE = wks('toPrimitive');
25770 var isEnum = {}.propertyIsEnumerable;
25771 var SymbolRegistry = shared('symbol-registry');
25772 var AllSymbols = shared('symbols');
25773 var OPSymbols = shared('op-symbols');
25774 var ObjectProto = Object[PROTOTYPE];
25775 var USE_NATIVE = typeof $Symbol == 'function';
25776 var QObject = global.QObject;
25777 // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
25778 var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
25780 // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
25781 var setSymbolDesc = DESCRIPTORS && $fails(function () {
25782 return _create(dP({}, 'a', {
25783 get: function () { return dP(this, 'a', { value: 7 }).a; }
25785 }) ? function (it, key, D) {
25786 var protoDesc = gOPD(ObjectProto, key);
25787 if (protoDesc) delete ObjectProto[key];
25789 if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
25792 var wrap = function (tag) {
25793 var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
25798 var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {
25799 return typeof it == 'symbol';
25800 } : function (it) {
25801 return it instanceof $Symbol;
25804 var $defineProperty = function defineProperty(it, key, D) {
25805 if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
25807 key = toPrimitive(key, true);
25809 if (has(AllSymbols, key)) {
25810 if (!D.enumerable) {
25811 if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
25812 it[HIDDEN][key] = true;
25814 if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
25815 D = _create(D, { enumerable: createDesc(0, false) });
25816 } return setSymbolDesc(it, key, D);
25817 } return dP(it, key, D);
25819 var $defineProperties = function defineProperties(it, P) {
25821 var keys = enumKeys(P = toIObject(P));
25823 var l = keys.length;
25825 while (l > i) $defineProperty(it, key = keys[i++], P[key]);
25828 var $create = function create(it, P) {
25829 return P === undefined ? _create(it) : $defineProperties(_create(it), P);
25831 var $propertyIsEnumerable = function propertyIsEnumerable(key) {
25832 var E = isEnum.call(this, key = toPrimitive(key, true));
25833 if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
25834 return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
25836 var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
25837 it = toIObject(it);
25838 key = toPrimitive(key, true);
25839 if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
25840 var D = gOPD(it, key);
25841 if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
25844 var $getOwnPropertyNames = function getOwnPropertyNames(it) {
25845 var names = gOPN(toIObject(it));
25849 while (names.length > i) {
25850 if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
25853 var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
25854 var IS_OP = it === ObjectProto;
25855 var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
25859 while (names.length > i) {
25860 if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
25864 // 19.4.1.1 Symbol([description])
25866 $Symbol = function Symbol() {
25867 if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
25868 var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
25869 var $set = function (value) {
25870 if (this === ObjectProto) $set.call(OPSymbols, value);
25871 if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
25872 setSymbolDesc(this, tag, createDesc(1, value));
25874 if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });
25877 redefine($Symbol[PROTOTYPE], 'toString', function toString() {
25881 $GOPD.f = $getOwnPropertyDescriptor;
25882 $DP.f = $defineProperty;
25883 __webpack_require__(142).f = gOPNExt.f = $getOwnPropertyNames;
25884 __webpack_require__(49).f = $propertyIsEnumerable;
25885 __webpack_require__(73).f = $getOwnPropertySymbols;
25887 if (DESCRIPTORS && !__webpack_require__(37)) {
25888 redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
25891 wksExt.f = function (name) {
25892 return wrap(wks(name));
25896 $export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });
25898 for (var es6Symbols = (
25899 // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
25900 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
25901 ).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);
25903 for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);
25905 $export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
25906 // 19.4.2.1 Symbol.for(key)
25907 'for': function (key) {
25908 return has(SymbolRegistry, key += '')
25909 ? SymbolRegistry[key]
25910 : SymbolRegistry[key] = $Symbol(key);
25912 // 19.4.2.5 Symbol.keyFor(sym)
25913 keyFor: function keyFor(sym) {
25914 if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
25915 for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
25917 useSetter: function () { setter = true; },
25918 useSimple: function () { setter = false; }
25921 $export($export.S + $export.F * !USE_NATIVE, 'Object', {
25922 // 19.1.2.2 Object.create(O [, Properties])
25924 // 19.1.2.4 Object.defineProperty(O, P, Attributes)
25925 defineProperty: $defineProperty,
25926 // 19.1.2.3 Object.defineProperties(O, Properties)
25927 defineProperties: $defineProperties,
25928 // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
25929 getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
25930 // 19.1.2.7 Object.getOwnPropertyNames(O)
25931 getOwnPropertyNames: $getOwnPropertyNames,
25932 // 19.1.2.8 Object.getOwnPropertySymbols(O)
25933 getOwnPropertySymbols: $getOwnPropertySymbols
25936 // 24.3.2 JSON.stringify(value [, replacer [, space]])
25937 $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
25939 // MS Edge converts symbol values to JSON as {}
25940 // WebKit converts symbol values to JSON as null
25941 // V8 throws on boxed symbols
25942 return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
25944 stringify: function stringify(it) {
25947 var replacer, $replacer;
25948 while (arguments.length > i) args.push(arguments[i++]);
25949 $replacer = replacer = args[1];
25950 if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
25951 if (!isArray(replacer)) replacer = function (key, value) {
25952 if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
25953 if (!isSymbol(value)) return value;
25955 args[1] = replacer;
25956 return _stringify.apply($JSON, args);
25960 // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
25961 $Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(19)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
25962 // 19.4.3.5 Symbol.prototype[@@toStringTag]
25963 setToStringTag($Symbol, 'Symbol');
25964 // 20.2.1.9 Math[@@toStringTag]
25965 setToStringTag(Math, 'Math', true);
25966 // 24.3.3 JSON[@@toStringTag]
25967 setToStringTag(global.JSON, 'JSON', true);
25972 /***/ (function(module, exports, __webpack_require__) {
25974 // all enumerable object keys, includes symbols
25975 var getKeys = __webpack_require__(39);
25976 var gOPS = __webpack_require__(73);
25977 var pIE = __webpack_require__(49);
25978 module.exports = function (it) {
25979 var result = getKeys(it);
25980 var getSymbols = gOPS.f;
25982 var symbols = getSymbols(it);
25983 var isEnum = pIE.f;
25986 while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
25993 /***/ (function(module, exports, __webpack_require__) {
25995 // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
25996 var toIObject = __webpack_require__(25);
25997 var gOPN = __webpack_require__(142).f;
25998 var toString = {}.toString;
26000 var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
26001 ? Object.getOwnPropertyNames(window) : [];
26003 var getWindowNames = function (it) {
26007 return windowNames.slice();
26011 module.exports.f = function getOwnPropertyNames(it) {
26012 return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
26018 /***/ (function(module, exports, __webpack_require__) {
26020 var pIE = __webpack_require__(49);
26021 var createDesc = __webpack_require__(48);
26022 var toIObject = __webpack_require__(25);
26023 var toPrimitive = __webpack_require__(72);
26024 var has = __webpack_require__(20);
26025 var IE8_DOM_DEFINE = __webpack_require__(130);
26026 var gOPD = Object.getOwnPropertyDescriptor;
26028 exports.f = __webpack_require__(17) ? gOPD : function getOwnPropertyDescriptor(O, P) {
26030 P = toPrimitive(P, true);
26031 if (IE8_DOM_DEFINE) try {
26033 } catch (e) { /* empty */ }
26034 if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
26040 /***/ (function(module, exports, __webpack_require__) {
26042 __webpack_require__(82)('asyncIterator');
26047 /***/ (function(module, exports, __webpack_require__) {
26049 __webpack_require__(82)('observable');
26054 /***/ (function(module, exports, __webpack_require__) {
26056 // 0 -> Array#forEach
26058 // 2 -> Array#filter
26060 // 4 -> Array#every
26062 // 6 -> Array#findIndex
26063 var ctx = __webpack_require__(35);
26064 var IObject = __webpack_require__(74);
26065 var toObject = __webpack_require__(54);
26066 var toLength = __webpack_require__(75);
26067 var asc = __webpack_require__(520);
26068 module.exports = function (TYPE, $create) {
26069 var IS_MAP = TYPE == 1;
26070 var IS_FILTER = TYPE == 2;
26071 var IS_SOME = TYPE == 3;
26072 var IS_EVERY = TYPE == 4;
26073 var IS_FIND_INDEX = TYPE == 6;
26074 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
26075 var create = $create || asc;
26076 return function ($this, callbackfn, that) {
26077 var O = toObject($this);
26078 var self = IObject(O);
26079 var f = ctx(callbackfn, that, 3);
26080 var length = toLength(self.length);
26082 var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
26084 for (;length > index; index++) if (NO_HOLES || index in self) {
26086 res = f(val, index, O);
26088 if (IS_MAP) result[index] = res; // map
26089 else if (res) switch (TYPE) {
26090 case 3: return true; // some
26091 case 5: return val; // find
26092 case 6: return index; // findIndex
26093 case 2: result.push(val); // filter
26094 } else if (IS_EVERY) return false; // every
26097 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
26251 /***/ (function(module, exports, __webpack_require__) {
26253 var isObject = __webpack_require__(12);
26254 module.exports = function (it, TYPE) {
26255 if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
26262 /***/ (function(module, __webpack_exports__, __webpack_require__) {
26265 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__ = __webpack_require__(26);
26266 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__);
26267 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass__ = __webpack_require__(36);
26268 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass__);
26272 var IdGenerator = function () {
26273 function IdGenerator() {
26274 __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default()(this, IdGenerator);
26277 __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass___default()(IdGenerator, null, [{
26279 value: function rand() {
26280 var arr = new Uint32Array(1);
26281 window.crypto.getRandomValues(arr);
26282 return arr[0] / (0xffffffff + 1);
26286 * Generates a random string of specified size
26287 * @param size - The length of the string to generate
26288 * @returns {string} - The generated random string
26293 value: function text(size) {
26295 var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
26296 for (var i = 0; i < size; i++) {
26297 text += possible.charAt(Math.floor(IdGenerator.rand() * possible.length));
26302 * Generates a random number of specified size
26303 * @param size - The length of the number to generate
26304 * @returns {string} - The generated random number ( as a string )
26309 value: function numeric(size) {
26311 var max = 12 - add;
26313 if (size > max) return IdGenerator.numeric(max) + IdGenerator.numeric(size - max);
26315 max = Math.pow(10, size + add);
26316 var min = max / 10,
26317 number = Math.floor(IdGenerator.rand() * (max - min + 1)) + min;
26319 return ('' + number).substring(add);
26323 return IdGenerator;
26326 /* harmony default export */ __webpack_exports__["a"] = (IdGenerator);
26330 /***/ (function(module, __webpack_exports__, __webpack_require__) {
26333 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return INJECT; });
26334 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BYTOM; });
26335 var INJECT = 'bytom-inject-js';
26336 var BYTOM = 'bytom-content-js';
26424 /***/ (function(module, exports, __webpack_require__) {
26426 module.exports = { "default": __webpack_require__(518), __esModule: true };
26430 /***/ (function(module, exports, __webpack_require__) {
26432 __webpack_require__(77);
26433 __webpack_require__(79);
26434 __webpack_require__(519);
26435 __webpack_require__(524);
26436 __webpack_require__(526);
26437 module.exports = __webpack_require__(8).WeakMap;
26442 /***/ (function(module, exports, __webpack_require__) {
26446 var each = __webpack_require__(282)(0);
26447 var redefine = __webpack_require__(78);
26448 var meta = __webpack_require__(93);
26449 var assign = __webpack_require__(141);
26450 var weak = __webpack_require__(522);
26451 var isObject = __webpack_require__(12);
26452 var fails = __webpack_require__(22);
26453 var validate = __webpack_require__(430);
26454 var WEAK_MAP = 'WeakMap';
26455 var getWeak = meta.getWeak;
26456 var isExtensible = Object.isExtensible;
26457 var uncaughtFrozenStore = weak.ufstore;
26461 var wrapper = function (get) {
26462 return function WeakMap() {
26463 return get(this, arguments.length > 0 ? arguments[0] : undefined);
26468 // 23.3.3.3 WeakMap.prototype.get(key)
26469 get: function get(key) {
26470 if (isObject(key)) {
26471 var data = getWeak(key);
26472 if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key);
26473 return data ? data[this._i] : undefined;
26476 // 23.3.3.5 WeakMap.prototype.set(key, value)
26477 set: function set(key, value) {
26478 return weak.def(validate(this, WEAK_MAP), key, value);
26482 // 23.3 WeakMap Objects
26483 var $WeakMap = module.exports = __webpack_require__(523)(WEAK_MAP, wrapper, methods, weak, true, true);
26485 // IE11 WeakMap frozen keys fix
26486 if (fails(function () { return new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7; })) {
26487 InternalMap = weak.getConstructor(wrapper, WEAK_MAP);
26488 assign(InternalMap.prototype, methods);
26490 each(['delete', 'has', 'get', 'set'], function (key) {
26491 var proto = $WeakMap.prototype;
26492 var method = proto[key];
26493 redefine(proto, key, function (a, b) {
26494 // store frozen objects on internal weakmap shim
26495 if (isObject(a) && !isExtensible(a)) {
26496 if (!this._f) this._f = new InternalMap();
26497 var result = this._f[key](a, b);
26498 return key == 'set' ? this : result;
26499 // store all the rest on native weakmap
26500 } return method.call(this, a, b);
26508 /***/ (function(module, exports, __webpack_require__) {
26510 // 9.4.2.3 ArraySpeciesCreate(originalArray, length)
26511 var speciesConstructor = __webpack_require__(521);
26513 module.exports = function (original, length) {
26514 return new (speciesConstructor(original))(length);
26520 /***/ (function(module, exports, __webpack_require__) {
26522 var isObject = __webpack_require__(12);
26523 var isArray = __webpack_require__(143);
26524 var SPECIES = __webpack_require__(7)('species');
26526 module.exports = function (original) {
26528 if (isArray(original)) {
26529 C = original.constructor;
26530 // cross-realm fallback
26531 if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
26534 if (C === null) C = undefined;
26536 } return C === undefined ? Array : C;
26542 /***/ (function(module, exports, __webpack_require__) {
26546 var redefineAll = __webpack_require__(135);
26547 var getWeak = __webpack_require__(93).getWeak;
26548 var anObject = __webpack_require__(15);
26549 var isObject = __webpack_require__(12);
26550 var anInstance = __webpack_require__(134);
26551 var forOf = __webpack_require__(80);
26552 var createArrayMethod = __webpack_require__(282);
26553 var $has = __webpack_require__(20);
26554 var validate = __webpack_require__(430);
26555 var arrayFind = createArrayMethod(5);
26556 var arrayFindIndex = createArrayMethod(6);
26559 // fallback for uncaught frozen keys
26560 var uncaughtFrozenStore = function (that) {
26561 return that._l || (that._l = new UncaughtFrozenStore());
26563 var UncaughtFrozenStore = function () {
26566 var findUncaughtFrozen = function (store, key) {
26567 return arrayFind(store.a, function (it) {
26568 return it[0] === key;
26571 UncaughtFrozenStore.prototype = {
26572 get: function (key) {
26573 var entry = findUncaughtFrozen(this, key);
26574 if (entry) return entry[1];
26576 has: function (key) {
26577 return !!findUncaughtFrozen(this, key);
26579 set: function (key, value) {
26580 var entry = findUncaughtFrozen(this, key);
26581 if (entry) entry[1] = value;
26582 else this.a.push([key, value]);
26584 'delete': function (key) {
26585 var index = arrayFindIndex(this.a, function (it) {
26586 return it[0] === key;
26588 if (~index) this.a.splice(index, 1);
26594 getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
26595 var C = wrapper(function (that, iterable) {
26596 anInstance(that, C, NAME, '_i');
26597 that._t = NAME; // collection type
26598 that._i = id++; // collection id
26599 that._l = undefined; // leak store for uncaught frozen objects
26600 if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
26602 redefineAll(C.prototype, {
26603 // 23.3.3.2 WeakMap.prototype.delete(key)
26604 // 23.4.3.3 WeakSet.prototype.delete(value)
26605 'delete': function (key) {
26606 if (!isObject(key)) return false;
26607 var data = getWeak(key);
26608 if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key);
26609 return data && $has(data, this._i) && delete data[this._i];
26611 // 23.3.3.4 WeakMap.prototype.has(key)
26612 // 23.4.3.4 WeakSet.prototype.has(value)
26613 has: function has(key) {
26614 if (!isObject(key)) return false;
26615 var data = getWeak(key);
26616 if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key);
26617 return data && $has(data, this._i);
26622 def: function (that, key, value) {
26623 var data = getWeak(anObject(key), true);
26624 if (data === true) uncaughtFrozenStore(that).set(key, value);
26625 else data[that._i] = value;
26628 ufstore: uncaughtFrozenStore
26634 /***/ (function(module, exports, __webpack_require__) {
26638 var global = __webpack_require__(5);
26639 var $export = __webpack_require__(13);
26640 var meta = __webpack_require__(93);
26641 var fails = __webpack_require__(22);
26642 var hide = __webpack_require__(19);
26643 var redefineAll = __webpack_require__(135);
26644 var forOf = __webpack_require__(80);
26645 var anInstance = __webpack_require__(134);
26646 var isObject = __webpack_require__(12);
26647 var setToStringTag = __webpack_require__(40);
26648 var dP = __webpack_require__(16).f;
26649 var each = __webpack_require__(282)(0);
26650 var DESCRIPTORS = __webpack_require__(17);
26652 module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
26653 var Base = global[NAME];
26655 var ADDER = IS_MAP ? 'set' : 'add';
26656 var proto = C && C.prototype;
26658 if (!DESCRIPTORS || typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () {
26659 new C().entries().next();
26661 // create collection constructor
26662 C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
26663 redefineAll(C.prototype, methods);
26666 C = wrapper(function (target, iterable) {
26667 anInstance(target, C, NAME, '_c');
26668 target._c = new Base();
26669 if (iterable != undefined) forOf(iterable, IS_MAP, target[ADDER], target);
26671 each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','), function (KEY) {
26672 var IS_ADDER = KEY == 'add' || KEY == 'set';
26673 if (KEY in proto && !(IS_WEAK && KEY == 'clear')) hide(C.prototype, KEY, function (a, b) {
26674 anInstance(this, C, KEY);
26675 if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
26676 var result = this._c[KEY](a === 0 ? 0 : a, b);
26677 return IS_ADDER ? this : result;
26680 IS_WEAK || dP(C.prototype, 'size', {
26682 return this._c.size;
26687 setToStringTag(C, NAME);
26690 $export($export.G + $export.W + $export.F, O);
26692 if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);
26700 /***/ (function(module, exports, __webpack_require__) {
26702 // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of
26703 __webpack_require__(525)('WeakMap');
26708 /***/ (function(module, exports, __webpack_require__) {
26712 // https://tc39.github.io/proposal-setmap-offrom/
26713 var $export = __webpack_require__(13);
26715 module.exports = function (COLLECTION) {
26716 $export($export.S, COLLECTION, { of: function of() {
26717 var length = arguments.length;
26718 var A = new Array(length);
26719 while (length--) A[length] = arguments[length];
26720 return new this(A);
26727 /***/ (function(module, exports, __webpack_require__) {
26729 // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from
26730 __webpack_require__(527)('WeakMap');
26735 /***/ (function(module, exports, __webpack_require__) {
26739 // https://tc39.github.io/proposal-setmap-offrom/
26740 var $export = __webpack_require__(13);
26741 var aFunction = __webpack_require__(38);
26742 var ctx = __webpack_require__(35);
26743 var forOf = __webpack_require__(80);
26745 module.exports = function (COLLECTION) {
26746 $export($export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) {
26747 var mapFn = arguments[1];
26748 var mapping, A, n, cb;
26750 mapping = mapFn !== undefined;
26751 if (mapping) aFunction(mapFn);
26752 if (source == undefined) return new this();
26756 cb = ctx(mapFn, arguments[2], 2);
26757 forOf(source, false, function (nextItem) {
26758 A.push(cb(nextItem, n++));
26761 forOf(source, false, A.push, A);
26763 return new this(A);
26770 /***/ (function(module, __webpack_exports__, __webpack_require__) {
26773 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(69);
26774 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
26775 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck__ = __webpack_require__(26);
26776 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck__);
26777 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass__ = __webpack_require__(36);
26778 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass__);
26779 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__types__ = __webpack_require__(129);
26785 var NetworkMessage = function () {
26786 function NetworkMessage() {
26787 var _type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
26789 var _payload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
26791 var _resolver = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
26793 var _domain = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
26795 __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck___default()(this, NetworkMessage);
26798 this.payload = _payload;
26799 this.resolver = _resolver;
26800 this.domain = _domain;
26803 __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass___default()(NetworkMessage, [{
26805 value: function respond(payload) {
26806 return new NetworkMessage(this.type, payload, this.resolver);
26810 value: function error(payload) {
26811 return new NetworkMessage(__WEBPACK_IMPORTED_MODULE_3__types__["c" /* ERROR */], payload, this.resolver);
26814 key: 'placeholder',
26815 value: function placeholder() {
26816 return new NetworkMessage();
26820 value: function fromJson(json) {
26821 var p = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default()(this.placeholder(), json);
26826 value: function payload(type, _payload2) {
26827 var p = this.placeholder();
26829 p.payload = _payload2;
26834 value: function signal(type) {
26835 var p = this.placeholder();
26841 return NetworkMessage;
26844 /* harmony default export */ __webpack_exports__["a"] = (NetworkMessage);
26888 /***/ (function(module, __webpack_exports__, __webpack_require__) {
26891 Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
26892 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__ = __webpack_require__(26);
26893 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__);
26894 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_IdGenerator__ = __webpack_require__(431);
26895 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_extension_streams__ = __webpack_require__(137);
26896 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_extension_streams___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_extension_streams__);
26897 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__messages_types__ = __webpack_require__(129);
26898 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__messages_event__ = __webpack_require__(432);
26899 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__dapp__ = __webpack_require__(570);
26908 * This is the javascript which gets injected into
26909 * the application and facilitates communication between
26910 * bytom chrome extension and the web application.
26913 var Inject = function Inject() {
26914 __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default()(this, Inject);
26916 // Injecting an encrypted stream into the web application.
26917 var stream = new __WEBPACK_IMPORTED_MODULE_2_extension_streams__["EncryptedStream"](__WEBPACK_IMPORTED_MODULE_4__messages_event__["b" /* INJECT */], __WEBPACK_IMPORTED_MODULE_1__utils_IdGenerator__["a" /* default */].text(64));
26919 // Waiting for bytomExtension to push itself onto the application
26920 stream.listenWith(function (msg) {
26921 console.log('inject.stream.listen:', msg);
26922 if (msg && msg.hasOwnProperty('type') && msg.type === __WEBPACK_IMPORTED_MODULE_3__messages_types__["f" /* PUSH_BYTOM */]) {
26923 window.bytom = new __WEBPACK_IMPORTED_MODULE_5__dapp__["a" /* default */](stream, msg.payload);
26926 if (msg && msg.hasOwnProperty('type') && msg.type === __WEBPACK_IMPORTED_MODULE_3__messages_types__["q" /* UPDATE_BYTOM */]) {
26927 window.bytom[msg.payload.type] = msg.payload.value;
26931 // Syncing the streams between the extension and the web application
26932 stream.sync(__WEBPACK_IMPORTED_MODULE_4__messages_event__["a" /* BYTOM */], stream.key);
26939 /***/ (function(module, __webpack_exports__, __webpack_require__) {
26942 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator__ = __webpack_require__(138);
26943 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator__);
26944 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_asyncToGenerator__ = __webpack_require__(139);
26945 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_asyncToGenerator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_asyncToGenerator__);
26946 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass__ = __webpack_require__(36);
26947 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass__);
26948 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise__ = __webpack_require__(76);
26949 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise__);
26950 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_weak_map__ = __webpack_require__(517);
26951 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_weak_map___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_weak_map__);
26952 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_helpers_classCallCheck__ = __webpack_require__(26);
26953 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_helpers_classCallCheck__);
26954 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__messages_network__ = __webpack_require__(528);
26955 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__messages_types__ = __webpack_require__(129);
26956 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__messages_event__ = __webpack_require__(432);
26957 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_IdGenerator__ = __webpack_require__(431);
26958 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_constants__ = __webpack_require__(268);
26971 * This is just a helper to manage resolving fake-async
26972 * requests using browser messaging.
26975 var DanglingResolver = function DanglingResolver(_id, _resolve, _reject) {
26976 __WEBPACK_IMPORTED_MODULE_5_babel_runtime_helpers_classCallCheck___default()(this, DanglingResolver);
26979 this.resolve = _resolve;
26980 this.reject = _reject;
26983 var stream = new __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_weak_map___default.a();
26984 var resolvers = new __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_weak_map___default.a();
26985 var currentVersion = new __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_weak_map___default.a();
26986 var requiredVersion = new __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_weak_map___default.a();
26989 * Messages do not come back on the same thread.
26990 * To accomplish a future promise structure this method
26991 * catches all incoming messages and dispenses
26992 * them to the open promises. */
26993 var _subscribe = function _subscribe() {
26994 stream.listenWith(function (msg) {
26995 if (!msg || !msg.hasOwnProperty('type')) return false;
26997 for (var i = 0; i < resolvers.length; i++) {
26998 if (resolvers[i].id === msg.resolver) {
26999 if (msg.type === 'error') resolvers[i].reject(msg.payload);else resolvers[i].resolve(msg.payload);
27000 resolvers.splice(i, 1);
27007 * Turns message sending between the application
27008 * and the content script into async promises
27012 var _send = function _send(_type, _payload) {
27013 return new __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise___default.a(function (resolve, reject) {
27014 var id = __WEBPACK_IMPORTED_MODULE_9__utils_IdGenerator__["a" /* default */].numeric(24);
27015 var message = new __WEBPACK_IMPORTED_MODULE_6__messages_network__["a" /* default */](_type, _payload, id);
27016 resolvers.push(new DanglingResolver(id, resolve, reject));
27017 stream.send(message, __WEBPACK_IMPORTED_MODULE_8__messages_event__["a" /* BYTOM */]);
27021 var Bytomdapp = function () {
27022 function Bytomdapp(_stream, _options) {
27023 __WEBPACK_IMPORTED_MODULE_5_babel_runtime_helpers_classCallCheck___default()(this, Bytomdapp);
27025 // currentVersion = parseFloat(_options.version)
27028 this.version = '2.0.0';
27031 this.defaultAccount = _options.defaultAccount;
27032 this.chain = _options.chain;
27033 this.currentProvider = __WEBPACK_IMPORTED_MODULE_10__utils_constants__["c" /* networks */][_options.net || 'mainnet'];
27035 this.default_account = _options.defaultAccount;
27036 this.net = _options.net;
27041 __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass___default()(Bytomdapp, [{
27043 value: function enable() {
27046 return _send(__WEBPACK_IMPORTED_MODULE_7__messages_types__["b" /* ENABLE */]).then(function () {
27047 var _ref = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_asyncToGenerator___default()( /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee(default_account) {
27048 return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee$(_context) {
27050 switch (_context.prev = _context.next) {
27052 _this.default_account = default_account;
27053 _this.defaultAccount = default_account;
27054 return _context.abrupt('return', default_account);
27058 return _context.stop();
27061 }, _callee, _this);
27064 return function (_x) {
27065 return _ref.apply(this, arguments);
27074 value: function setChain(params) {
27075 return _send(__WEBPACK_IMPORTED_MODULE_7__messages_types__["k" /* SETCHAIN */], params);
27078 key: 'sendTransaction',
27079 value: function sendTransaction(params) {
27080 return _send(__WEBPACK_IMPORTED_MODULE_7__messages_types__["o" /* TRANSFER */], params);
27083 key: 'sendAdvancedTransaction',
27084 value: function sendAdvancedTransaction(params) {
27085 return _send(__WEBPACK_IMPORTED_MODULE_7__messages_types__["a" /* ADVTRANSFER */], params);
27088 key: 'signMessage',
27089 value: function signMessage(params) {
27090 return _send(__WEBPACK_IMPORTED_MODULE_7__messages_types__["m" /* SIGNMESSAGE */], params);
27096 key: 'send_transaction',
27097 value: function send_transaction(params) {
27098 return _send(__WEBPACK_IMPORTED_MODULE_7__messages_types__["o" /* TRANSFER */], params);
27101 key: 'sign_transaction',
27102 value: function sign_transaction(params) {
27103 return _send(__WEBPACK_IMPORTED_MODULE_7__messages_types__["n" /* SIGNTRANSACTION */], params);
27106 key: 'send_advanced_transaction',
27107 value: function send_advanced_transaction(params) {
27108 return _send(__WEBPACK_IMPORTED_MODULE_7__messages_types__["a" /* ADVTRANSFER */], params);
27111 key: 'sign_message',
27112 value: function sign_message(params) {
27113 return _send(__WEBPACK_IMPORTED_MODULE_7__messages_types__["m" /* SIGNMESSAGE */], params);
27120 /* harmony default export */ __webpack_exports__["a"] = (Bytomdapp);
27124 //# sourceMappingURL=inject.js.map