上传文件至 lib
This commit is contained in:
Vendored
+10945
File diff suppressed because it is too large
Load Diff
+6192
@@ -0,0 +1,6192 @@
|
|||||||
|
;
|
||||||
|
(function(root, factory) {
|
||||||
|
if (typeof exports === "object") {
|
||||||
|
// CommonJS
|
||||||
|
module.exports = exports = factory();
|
||||||
|
} else if (typeof define === "function" && define.amd) {
|
||||||
|
// AMD
|
||||||
|
define([], factory);
|
||||||
|
} else {
|
||||||
|
// Global (browser)
|
||||||
|
globalThis.CryptoJS = factory();
|
||||||
|
}
|
||||||
|
}(this, function() {
|
||||||
|
|
||||||
|
/*globals window, global, require*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CryptoJS core components.
|
||||||
|
*/
|
||||||
|
var CryptoJS = CryptoJS || (function(Math, undefined) {
|
||||||
|
|
||||||
|
var crypto;
|
||||||
|
|
||||||
|
// Native crypto from window (Browser)
|
||||||
|
if (typeof window !== 'undefined' && window.crypto) {
|
||||||
|
crypto = window.crypto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Native crypto in web worker (Browser)
|
||||||
|
if (typeof self !== 'undefined' && self.crypto) {
|
||||||
|
crypto = self.crypto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Native crypto from worker
|
||||||
|
if (typeof globalThis !== 'undefined' && globalThis.crypto) {
|
||||||
|
crypto = globalThis.crypto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Native (experimental IE 11) crypto from window (Browser)
|
||||||
|
if (!crypto && typeof window !== 'undefined' && window.msCrypto) {
|
||||||
|
crypto = window.msCrypto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Native crypto from global (NodeJS)
|
||||||
|
if (!crypto && typeof global !== 'undefined' && global.crypto) {
|
||||||
|
crypto = global.crypto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Native crypto import via require (NodeJS)
|
||||||
|
if (!crypto && typeof require === 'function') {
|
||||||
|
try {
|
||||||
|
crypto = require('crypto');
|
||||||
|
} catch (err) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Cryptographically secure pseudorandom number generator
|
||||||
|
*
|
||||||
|
* As Math.random() is cryptographically not safe to use
|
||||||
|
*/
|
||||||
|
var cryptoSecureRandomInt = function() {
|
||||||
|
if (crypto) {
|
||||||
|
// Use getRandomValues method (Browser)
|
||||||
|
if (typeof crypto.getRandomValues === 'function') {
|
||||||
|
try {
|
||||||
|
return crypto.getRandomValues(new Uint32Array(1))[0];
|
||||||
|
} catch (err) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use randomBytes method (NodeJS)
|
||||||
|
if (typeof crypto.randomBytes === 'function') {
|
||||||
|
try {
|
||||||
|
return crypto.randomBytes(4).readInt32LE();
|
||||||
|
} catch (err) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error('Native crypto module could not be used to get secure random number.');
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Local polyfill of Object.create
|
||||||
|
|
||||||
|
*/
|
||||||
|
var create = Object.create || (function() {
|
||||||
|
function F() {}
|
||||||
|
|
||||||
|
return function(obj) {
|
||||||
|
var subtype;
|
||||||
|
|
||||||
|
F.prototype = obj;
|
||||||
|
|
||||||
|
subtype = new F();
|
||||||
|
|
||||||
|
F.prototype = null;
|
||||||
|
|
||||||
|
return subtype;
|
||||||
|
};
|
||||||
|
}());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CryptoJS namespace.
|
||||||
|
*/
|
||||||
|
var C = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Library namespace.
|
||||||
|
*/
|
||||||
|
var C_lib = C.lib = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base object for prototypal inheritance.
|
||||||
|
*/
|
||||||
|
var Base = C_lib.Base = (function() {
|
||||||
|
|
||||||
|
|
||||||
|
return {
|
||||||
|
/**
|
||||||
|
* Creates a new object that inherits from this object.
|
||||||
|
*
|
||||||
|
* @param {Object} overrides Properties to copy into the new object.
|
||||||
|
*
|
||||||
|
* @return {Object} The new object.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var MyType = CryptoJS.lib.Base.extend({
|
||||||
|
* field: 'value',
|
||||||
|
*
|
||||||
|
* method: function () {
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
extend: function(overrides) {
|
||||||
|
// Spawn
|
||||||
|
var subtype = create(this);
|
||||||
|
|
||||||
|
// Augment
|
||||||
|
if (overrides) {
|
||||||
|
subtype.mixIn(overrides);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create default initializer
|
||||||
|
if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
|
||||||
|
subtype.init = function() {
|
||||||
|
subtype.$super.init.apply(this, arguments);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initializer's prototype is the subtype object
|
||||||
|
subtype.init.prototype = subtype;
|
||||||
|
|
||||||
|
// Reference supertype
|
||||||
|
subtype.$super = this;
|
||||||
|
|
||||||
|
return subtype;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extends this object and runs the init method.
|
||||||
|
* Arguments to create() will be passed to init().
|
||||||
|
*
|
||||||
|
* @return {Object} The new object.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var instance = MyType.create();
|
||||||
|
*/
|
||||||
|
create: function() {
|
||||||
|
var instance = this.extend();
|
||||||
|
instance.init.apply(instance, arguments);
|
||||||
|
|
||||||
|
return instance;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes a newly created object.
|
||||||
|
* Override this method to add some logic when your objects are created.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var MyType = CryptoJS.lib.Base.extend({
|
||||||
|
* init: function () {
|
||||||
|
* // ...
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
init: function() {},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies properties into this object.
|
||||||
|
*
|
||||||
|
* @param {Object} properties The properties to mix in.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* MyType.mixIn({
|
||||||
|
* field: 'value'
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
mixIn: function(properties) {
|
||||||
|
for (var propertyName in properties) {
|
||||||
|
if (properties.hasOwnProperty(propertyName)) {
|
||||||
|
this[propertyName] = properties[propertyName];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// IE won't copy toString using the loop above
|
||||||
|
if (properties.hasOwnProperty('toString')) {
|
||||||
|
this.toString = properties.toString;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a copy of this object.
|
||||||
|
*
|
||||||
|
* @return {Object} The clone.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var clone = instance.clone();
|
||||||
|
*/
|
||||||
|
clone: function() {
|
||||||
|
return this.init.prototype.extend(this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of 32-bit words.
|
||||||
|
*
|
||||||
|
* @property {Array} words The array of 32-bit words.
|
||||||
|
* @property {number} sigBytes The number of significant bytes in this word array.
|
||||||
|
*/
|
||||||
|
var WordArray = C_lib.WordArray = Base.extend({
|
||||||
|
/**
|
||||||
|
* Initializes a newly created word array.
|
||||||
|
*
|
||||||
|
* @param {Array} words (Optional) An array of 32-bit words.
|
||||||
|
* @param {number} sigBytes (Optional) The number of significant bytes in the words.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var wordArray = CryptoJS.lib.WordArray.create();
|
||||||
|
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
|
||||||
|
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
|
||||||
|
*/
|
||||||
|
init: function(words, sigBytes) {
|
||||||
|
words = this.words = words || [];
|
||||||
|
|
||||||
|
if (sigBytes != undefined) {
|
||||||
|
this.sigBytes = sigBytes;
|
||||||
|
} else {
|
||||||
|
this.sigBytes = words.length * 4;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts this word array to a string.
|
||||||
|
*
|
||||||
|
* @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
|
||||||
|
*
|
||||||
|
* @return {string} The stringified word array.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var string = wordArray + '';
|
||||||
|
* var string = wordArray.toString();
|
||||||
|
* var string = wordArray.toString(CryptoJS.enc.Utf8);
|
||||||
|
*/
|
||||||
|
toString: function(encoder) {
|
||||||
|
return (encoder || Hex).stringify(this);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Concatenates a word array to this word array.
|
||||||
|
*
|
||||||
|
* @param {WordArray} wordArray The word array to append.
|
||||||
|
*
|
||||||
|
* @return {WordArray} This word array.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* wordArray1.concat(wordArray2);
|
||||||
|
*/
|
||||||
|
concat: function(wordArray) {
|
||||||
|
// Shortcuts
|
||||||
|
var thisWords = this.words;
|
||||||
|
var thatWords = wordArray.words;
|
||||||
|
var thisSigBytes = this.sigBytes;
|
||||||
|
var thatSigBytes = wordArray.sigBytes;
|
||||||
|
|
||||||
|
// Clamp excess bits
|
||||||
|
this.clamp();
|
||||||
|
|
||||||
|
// Concat
|
||||||
|
if (thisSigBytes % 4) {
|
||||||
|
// Copy one byte at a time
|
||||||
|
for (var i = 0; i < thatSigBytes; i++) {
|
||||||
|
var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
|
||||||
|
thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Copy one word at a time
|
||||||
|
for (var j = 0; j < thatSigBytes; j += 4) {
|
||||||
|
thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.sigBytes += thatSigBytes;
|
||||||
|
|
||||||
|
// Chainable
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes insignificant bits.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* wordArray.clamp();
|
||||||
|
*/
|
||||||
|
clamp: function() {
|
||||||
|
// Shortcuts
|
||||||
|
var words = this.words;
|
||||||
|
var sigBytes = this.sigBytes;
|
||||||
|
|
||||||
|
// Clamp
|
||||||
|
words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
|
||||||
|
words.length = Math.ceil(sigBytes / 4);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a copy of this word array.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The clone.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var clone = wordArray.clone();
|
||||||
|
*/
|
||||||
|
clone: function() {
|
||||||
|
var clone = Base.clone.call(this);
|
||||||
|
clone.words = this.words.slice(0);
|
||||||
|
|
||||||
|
return clone;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a word array filled with random bytes.
|
||||||
|
*
|
||||||
|
* @param {number} nBytes The number of random bytes to generate.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The random word array.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var wordArray = CryptoJS.lib.WordArray.random(16);
|
||||||
|
*/
|
||||||
|
random: function(nBytes) {
|
||||||
|
var words = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < nBytes; i += 4) {
|
||||||
|
words.push(cryptoSecureRandomInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
return new WordArray.init(words, nBytes);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encoder namespace.
|
||||||
|
*/
|
||||||
|
var C_enc = C.enc = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hex encoding strategy.
|
||||||
|
*/
|
||||||
|
var Hex = C_enc.Hex = {
|
||||||
|
/**
|
||||||
|
* Converts a word array to a hex string.
|
||||||
|
*
|
||||||
|
* @param {WordArray} wordArray The word array.
|
||||||
|
*
|
||||||
|
* @return {string} The hex string.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hexString = CryptoJS.enc.Hex.stringify(wordArray);
|
||||||
|
*/
|
||||||
|
stringify: function(wordArray) {
|
||||||
|
// Shortcuts
|
||||||
|
var words = wordArray.words;
|
||||||
|
var sigBytes = wordArray.sigBytes;
|
||||||
|
|
||||||
|
// Convert
|
||||||
|
var hexChars = [];
|
||||||
|
for (var i = 0; i < sigBytes; i++) {
|
||||||
|
var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
|
||||||
|
hexChars.push((bite >>> 4).toString(16));
|
||||||
|
hexChars.push((bite & 0x0f).toString(16));
|
||||||
|
}
|
||||||
|
|
||||||
|
return hexChars.join('');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a hex string to a word array.
|
||||||
|
*
|
||||||
|
* @param {string} hexStr The hex string.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The word array.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var wordArray = CryptoJS.enc.Hex.parse(hexString);
|
||||||
|
*/
|
||||||
|
parse: function(hexStr) {
|
||||||
|
// Shortcut
|
||||||
|
var hexStrLength = hexStr.length;
|
||||||
|
|
||||||
|
// Convert
|
||||||
|
var words = [];
|
||||||
|
for (var i = 0; i < hexStrLength; i += 2) {
|
||||||
|
words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new WordArray.init(words, hexStrLength / 2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Latin1 encoding strategy.
|
||||||
|
*/
|
||||||
|
var Latin1 = C_enc.Latin1 = {
|
||||||
|
/**
|
||||||
|
* Converts a word array to a Latin1 string.
|
||||||
|
*
|
||||||
|
* @param {WordArray} wordArray The word array.
|
||||||
|
*
|
||||||
|
* @return {string} The Latin1 string.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
|
||||||
|
*/
|
||||||
|
stringify: function(wordArray) {
|
||||||
|
// Shortcuts
|
||||||
|
var words = wordArray.words;
|
||||||
|
var sigBytes = wordArray.sigBytes;
|
||||||
|
|
||||||
|
// Convert
|
||||||
|
var latin1Chars = [];
|
||||||
|
for (var i = 0; i < sigBytes; i++) {
|
||||||
|
var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
|
||||||
|
latin1Chars.push(String.fromCharCode(bite));
|
||||||
|
}
|
||||||
|
|
||||||
|
return latin1Chars.join('');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a Latin1 string to a word array.
|
||||||
|
*
|
||||||
|
* @param {string} latin1Str The Latin1 string.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The word array.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
|
||||||
|
*/
|
||||||
|
parse: function(latin1Str) {
|
||||||
|
// Shortcut
|
||||||
|
var latin1StrLength = latin1Str.length;
|
||||||
|
|
||||||
|
// Convert
|
||||||
|
var words = [];
|
||||||
|
for (var i = 0; i < latin1StrLength; i++) {
|
||||||
|
words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new WordArray.init(words, latin1StrLength);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UTF-8 encoding strategy.
|
||||||
|
*/
|
||||||
|
var Utf8 = C_enc.Utf8 = {
|
||||||
|
/**
|
||||||
|
* Converts a word array to a UTF-8 string.
|
||||||
|
*
|
||||||
|
* @param {WordArray} wordArray The word array.
|
||||||
|
*
|
||||||
|
* @return {string} The UTF-8 string.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
|
||||||
|
*/
|
||||||
|
stringify: function(wordArray) {
|
||||||
|
try {
|
||||||
|
return decodeURIComponent(escape(Latin1.stringify(wordArray)));
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error('Malformed UTF-8 data');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a UTF-8 string to a word array.
|
||||||
|
*
|
||||||
|
* @param {string} utf8Str The UTF-8 string.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The word array.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
|
||||||
|
*/
|
||||||
|
parse: function(utf8Str) {
|
||||||
|
return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract buffered block algorithm template.
|
||||||
|
*
|
||||||
|
* The property blockSize must be implemented in a concrete subtype.
|
||||||
|
*
|
||||||
|
* @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
|
||||||
|
*/
|
||||||
|
var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
|
||||||
|
/**
|
||||||
|
* Resets this block algorithm's data buffer to its initial state.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* bufferedBlockAlgorithm.reset();
|
||||||
|
*/
|
||||||
|
reset: function() {
|
||||||
|
// Initial values
|
||||||
|
this._data = new WordArray.init();
|
||||||
|
this._nDataBytes = 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds new data to this block algorithm's buffer.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* bufferedBlockAlgorithm._append('data');
|
||||||
|
* bufferedBlockAlgorithm._append(wordArray);
|
||||||
|
*/
|
||||||
|
_append: function(data) {
|
||||||
|
// Convert string to WordArray, else assume WordArray already
|
||||||
|
if (typeof data == 'string') {
|
||||||
|
data = Utf8.parse(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append
|
||||||
|
this._data.concat(data);
|
||||||
|
this._nDataBytes += data.sigBytes;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes available data blocks.
|
||||||
|
*
|
||||||
|
* This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
|
||||||
|
*
|
||||||
|
* @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The processed data.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var processedData = bufferedBlockAlgorithm._process();
|
||||||
|
* var processedData = bufferedBlockAlgorithm._process(!!'flush');
|
||||||
|
*/
|
||||||
|
_process: function(doFlush) {
|
||||||
|
var processedWords;
|
||||||
|
|
||||||
|
// Shortcuts
|
||||||
|
var data = this._data;
|
||||||
|
var dataWords = data.words;
|
||||||
|
var dataSigBytes = data.sigBytes;
|
||||||
|
var blockSize = this.blockSize;
|
||||||
|
var blockSizeBytes = blockSize * 4;
|
||||||
|
|
||||||
|
// Count blocks ready
|
||||||
|
var nBlocksReady = dataSigBytes / blockSizeBytes;
|
||||||
|
if (doFlush) {
|
||||||
|
// Round up to include partial blocks
|
||||||
|
nBlocksReady = Math.ceil(nBlocksReady);
|
||||||
|
} else {
|
||||||
|
// Round down to include only full blocks,
|
||||||
|
// less the number of blocks that must remain in the buffer
|
||||||
|
nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count words ready
|
||||||
|
var nWordsReady = nBlocksReady * blockSize;
|
||||||
|
|
||||||
|
// Count bytes ready
|
||||||
|
var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
|
||||||
|
|
||||||
|
// Process blocks
|
||||||
|
if (nWordsReady) {
|
||||||
|
for (var offset = 0; offset < nWordsReady; offset += blockSize) {
|
||||||
|
// Perform concrete-algorithm logic
|
||||||
|
this._doProcessBlock(dataWords, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove processed words
|
||||||
|
processedWords = dataWords.splice(0, nWordsReady);
|
||||||
|
data.sigBytes -= nBytesReady;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return processed words
|
||||||
|
return new WordArray.init(processedWords, nBytesReady);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a copy of this object.
|
||||||
|
*
|
||||||
|
* @return {Object} The clone.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var clone = bufferedBlockAlgorithm.clone();
|
||||||
|
*/
|
||||||
|
clone: function() {
|
||||||
|
var clone = Base.clone.call(this);
|
||||||
|
clone._data = this._data.clone();
|
||||||
|
|
||||||
|
return clone;
|
||||||
|
},
|
||||||
|
|
||||||
|
_minBufferSize: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract hasher template.
|
||||||
|
*
|
||||||
|
* @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
|
||||||
|
*/
|
||||||
|
var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
|
||||||
|
/**
|
||||||
|
* Configuration options.
|
||||||
|
*/
|
||||||
|
cfg: Base.extend(),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes a newly created hasher.
|
||||||
|
*
|
||||||
|
* @param {Object} cfg (Optional) The configuration options to use for this hash computation.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hasher = CryptoJS.algo.SHA256.create();
|
||||||
|
*/
|
||||||
|
init: function(cfg) {
|
||||||
|
// Apply config defaults
|
||||||
|
this.cfg = this.cfg.extend(cfg);
|
||||||
|
|
||||||
|
// Set initial values
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets this hasher to its initial state.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* hasher.reset();
|
||||||
|
*/
|
||||||
|
reset: function() {
|
||||||
|
// Reset data buffer
|
||||||
|
BufferedBlockAlgorithm.reset.call(this);
|
||||||
|
|
||||||
|
// Perform concrete-hasher logic
|
||||||
|
this._doReset();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates this hasher with a message.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} messageUpdate The message to append.
|
||||||
|
*
|
||||||
|
* @return {Hasher} This hasher.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* hasher.update('message');
|
||||||
|
* hasher.update(wordArray);
|
||||||
|
*/
|
||||||
|
update: function(messageUpdate) {
|
||||||
|
// Append
|
||||||
|
this._append(messageUpdate);
|
||||||
|
|
||||||
|
// Update the hash
|
||||||
|
this._process();
|
||||||
|
|
||||||
|
// Chainable
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finalizes the hash computation.
|
||||||
|
* Note that the finalize operation is effectively a destructive, read-once operation.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} messageUpdate (Optional) A final message update.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The hash.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hash = hasher.finalize();
|
||||||
|
* var hash = hasher.finalize('message');
|
||||||
|
* var hash = hasher.finalize(wordArray);
|
||||||
|
*/
|
||||||
|
finalize: function(messageUpdate) {
|
||||||
|
// Final message update
|
||||||
|
if (messageUpdate) {
|
||||||
|
this._append(messageUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform concrete-hasher logic
|
||||||
|
var hash = this._doFinalize();
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
},
|
||||||
|
|
||||||
|
blockSize: 512 / 32,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a shortcut function to a hasher's object interface.
|
||||||
|
*
|
||||||
|
* @param {Hasher} hasher The hasher to create a helper for.
|
||||||
|
*
|
||||||
|
* @return {Function} The shortcut function.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
|
||||||
|
*/
|
||||||
|
_createHelper: function(hasher) {
|
||||||
|
return function(message, cfg) {
|
||||||
|
return new hasher.init(cfg).finalize(message);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a shortcut function to the HMAC's object interface.
|
||||||
|
*
|
||||||
|
* @param {Hasher} hasher The hasher to use in this HMAC helper.
|
||||||
|
*
|
||||||
|
* @return {Function} The shortcut function.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
|
||||||
|
*/
|
||||||
|
_createHmacHelper: function(hasher) {
|
||||||
|
return function(message, key) {
|
||||||
|
return new C_algo.HMAC.init(hasher, key).finalize(message);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Algorithm namespace.
|
||||||
|
*/
|
||||||
|
var C_algo = C.algo = {};
|
||||||
|
|
||||||
|
return C;
|
||||||
|
}(Math));
|
||||||
|
|
||||||
|
|
||||||
|
(function(undefined) {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var Base = C_lib.Base;
|
||||||
|
var X32WordArray = C_lib.WordArray;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* x64 namespace.
|
||||||
|
*/
|
||||||
|
var C_x64 = C.x64 = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A 64-bit word.
|
||||||
|
*/
|
||||||
|
var X64Word = C_x64.Word = Base.extend({
|
||||||
|
/**
|
||||||
|
* Initializes a newly created 64-bit word.
|
||||||
|
*
|
||||||
|
* @param {number} high The high 32 bits.
|
||||||
|
* @param {number} low The low 32 bits.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);
|
||||||
|
*/
|
||||||
|
init: function(high, low) {
|
||||||
|
this.high = high;
|
||||||
|
this.low = low;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bitwise NOTs this word.
|
||||||
|
*
|
||||||
|
* @return {X64Word} A new x64-Word object after negating.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var negated = x64Word.not();
|
||||||
|
*/
|
||||||
|
// not: function () {
|
||||||
|
// var high = ~this.high;
|
||||||
|
// var low = ~this.low;
|
||||||
|
|
||||||
|
// return X64Word.create(high, low);
|
||||||
|
// },
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bitwise ANDs this word with the passed word.
|
||||||
|
*
|
||||||
|
* @param {X64Word} word The x64-Word to AND with this word.
|
||||||
|
*
|
||||||
|
* @return {X64Word} A new x64-Word object after ANDing.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var anded = x64Word.and(anotherX64Word);
|
||||||
|
*/
|
||||||
|
// and: function (word) {
|
||||||
|
// var high = this.high & word.high;
|
||||||
|
// var low = this.low & word.low;
|
||||||
|
|
||||||
|
// return X64Word.create(high, low);
|
||||||
|
// },
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bitwise ORs this word with the passed word.
|
||||||
|
*
|
||||||
|
* @param {X64Word} word The x64-Word to OR with this word.
|
||||||
|
*
|
||||||
|
* @return {X64Word} A new x64-Word object after ORing.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var ored = x64Word.or(anotherX64Word);
|
||||||
|
*/
|
||||||
|
// or: function (word) {
|
||||||
|
// var high = this.high | word.high;
|
||||||
|
// var low = this.low | word.low;
|
||||||
|
|
||||||
|
// return X64Word.create(high, low);
|
||||||
|
// },
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bitwise XORs this word with the passed word.
|
||||||
|
*
|
||||||
|
* @param {X64Word} word The x64-Word to XOR with this word.
|
||||||
|
*
|
||||||
|
* @return {X64Word} A new x64-Word object after XORing.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var xored = x64Word.xor(anotherX64Word);
|
||||||
|
*/
|
||||||
|
// xor: function (word) {
|
||||||
|
// var high = this.high ^ word.high;
|
||||||
|
// var low = this.low ^ word.low;
|
||||||
|
|
||||||
|
// return X64Word.create(high, low);
|
||||||
|
// },
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shifts this word n bits to the left.
|
||||||
|
*
|
||||||
|
* @param {number} n The number of bits to shift.
|
||||||
|
*
|
||||||
|
* @return {X64Word} A new x64-Word object after shifting.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var shifted = x64Word.shiftL(25);
|
||||||
|
*/
|
||||||
|
// shiftL: function (n) {
|
||||||
|
// if (n < 32) {
|
||||||
|
// var high = (this.high << n) | (this.low >>> (32 - n));
|
||||||
|
// var low = this.low << n;
|
||||||
|
// } else {
|
||||||
|
// var high = this.low << (n - 32);
|
||||||
|
// var low = 0;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return X64Word.create(high, low);
|
||||||
|
// },
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shifts this word n bits to the right.
|
||||||
|
*
|
||||||
|
* @param {number} n The number of bits to shift.
|
||||||
|
*
|
||||||
|
* @return {X64Word} A new x64-Word object after shifting.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var shifted = x64Word.shiftR(7);
|
||||||
|
*/
|
||||||
|
// shiftR: function (n) {
|
||||||
|
// if (n < 32) {
|
||||||
|
// var low = (this.low >>> n) | (this.high << (32 - n));
|
||||||
|
// var high = this.high >>> n;
|
||||||
|
// } else {
|
||||||
|
// var low = this.high >>> (n - 32);
|
||||||
|
// var high = 0;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return X64Word.create(high, low);
|
||||||
|
// },
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotates this word n bits to the left.
|
||||||
|
*
|
||||||
|
* @param {number} n The number of bits to rotate.
|
||||||
|
*
|
||||||
|
* @return {X64Word} A new x64-Word object after rotating.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var rotated = x64Word.rotL(25);
|
||||||
|
*/
|
||||||
|
// rotL: function (n) {
|
||||||
|
// return this.shiftL(n).or(this.shiftR(64 - n));
|
||||||
|
// },
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotates this word n bits to the right.
|
||||||
|
*
|
||||||
|
* @param {number} n The number of bits to rotate.
|
||||||
|
*
|
||||||
|
* @return {X64Word} A new x64-Word object after rotating.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var rotated = x64Word.rotR(7);
|
||||||
|
*/
|
||||||
|
// rotR: function (n) {
|
||||||
|
// return this.shiftR(n).or(this.shiftL(64 - n));
|
||||||
|
// },
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds this word with the passed word.
|
||||||
|
*
|
||||||
|
* @param {X64Word} word The x64-Word to add with this word.
|
||||||
|
*
|
||||||
|
* @return {X64Word} A new x64-Word object after adding.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var added = x64Word.add(anotherX64Word);
|
||||||
|
*/
|
||||||
|
// add: function (word) {
|
||||||
|
// var low = (this.low + word.low) | 0;
|
||||||
|
// var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;
|
||||||
|
// var high = (this.high + word.high + carry) | 0;
|
||||||
|
|
||||||
|
// return X64Word.create(high, low);
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of 64-bit words.
|
||||||
|
*
|
||||||
|
* @property {Array} words The array of CryptoJS.x64.Word objects.
|
||||||
|
* @property {number} sigBytes The number of significant bytes in this word array.
|
||||||
|
*/
|
||||||
|
var X64WordArray = C_x64.WordArray = Base.extend({
|
||||||
|
/**
|
||||||
|
* Initializes a newly created word array.
|
||||||
|
*
|
||||||
|
* @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.
|
||||||
|
* @param {number} sigBytes (Optional) The number of significant bytes in the words.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var wordArray = CryptoJS.x64.WordArray.create();
|
||||||
|
*
|
||||||
|
* var wordArray = CryptoJS.x64.WordArray.create([
|
||||||
|
* CryptoJS.x64.Word.create(0x00010203, 0x04050607),
|
||||||
|
* CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
|
||||||
|
* ]);
|
||||||
|
*
|
||||||
|
* var wordArray = CryptoJS.x64.WordArray.create([
|
||||||
|
* CryptoJS.x64.Word.create(0x00010203, 0x04050607),
|
||||||
|
* CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
|
||||||
|
* ], 10);
|
||||||
|
*/
|
||||||
|
init: function(words, sigBytes) {
|
||||||
|
words = this.words = words || [];
|
||||||
|
|
||||||
|
if (sigBytes != undefined) {
|
||||||
|
this.sigBytes = sigBytes;
|
||||||
|
} else {
|
||||||
|
this.sigBytes = words.length * 8;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts this 64-bit word array to a 32-bit word array.
|
||||||
|
*
|
||||||
|
* @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var x32WordArray = x64WordArray.toX32();
|
||||||
|
*/
|
||||||
|
toX32: function() {
|
||||||
|
// Shortcuts
|
||||||
|
var x64Words = this.words;
|
||||||
|
var x64WordsLength = x64Words.length;
|
||||||
|
|
||||||
|
// Convert
|
||||||
|
var x32Words = [];
|
||||||
|
for (var i = 0; i < x64WordsLength; i++) {
|
||||||
|
var x64Word = x64Words[i];
|
||||||
|
x32Words.push(x64Word.high);
|
||||||
|
x32Words.push(x64Word.low);
|
||||||
|
}
|
||||||
|
|
||||||
|
return X32WordArray.create(x32Words, this.sigBytes);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a copy of this word array.
|
||||||
|
*
|
||||||
|
* @return {X64WordArray} The clone.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var clone = x64WordArray.clone();
|
||||||
|
*/
|
||||||
|
clone: function() {
|
||||||
|
var clone = Base.clone.call(this);
|
||||||
|
|
||||||
|
// Clone "words" array
|
||||||
|
var words = clone.words = this.words.slice(0);
|
||||||
|
|
||||||
|
// Clone each X64Word object
|
||||||
|
var wordsLength = words.length;
|
||||||
|
for (var i = 0; i < wordsLength; i++) {
|
||||||
|
words[i] = words[i].clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// Check if typed arrays are supported
|
||||||
|
if (typeof ArrayBuffer != 'function') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var WordArray = C_lib.WordArray;
|
||||||
|
|
||||||
|
// Reference original init
|
||||||
|
var superInit = WordArray.init;
|
||||||
|
|
||||||
|
// Augment WordArray.init to handle typed arrays
|
||||||
|
var subInit = WordArray.init = function(typedArray) {
|
||||||
|
// Convert buffers to uint8
|
||||||
|
if (typedArray instanceof ArrayBuffer) {
|
||||||
|
typedArray = new Uint8Array(typedArray);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert other array views to uint8
|
||||||
|
if (
|
||||||
|
typedArray instanceof Int8Array ||
|
||||||
|
(typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) ||
|
||||||
|
typedArray instanceof Int16Array ||
|
||||||
|
typedArray instanceof Uint16Array ||
|
||||||
|
typedArray instanceof Int32Array ||
|
||||||
|
typedArray instanceof Uint32Array ||
|
||||||
|
typedArray instanceof Float32Array ||
|
||||||
|
typedArray instanceof Float64Array
|
||||||
|
) {
|
||||||
|
typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle Uint8Array
|
||||||
|
if (typedArray instanceof Uint8Array) {
|
||||||
|
// Shortcut
|
||||||
|
var typedArrayByteLength = typedArray.byteLength;
|
||||||
|
|
||||||
|
// Extract bytes
|
||||||
|
var words = [];
|
||||||
|
for (var i = 0; i < typedArrayByteLength; i++) {
|
||||||
|
words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize this word array
|
||||||
|
superInit.call(this, words, typedArrayByteLength);
|
||||||
|
} else {
|
||||||
|
// Else call normal init
|
||||||
|
superInit.apply(this, arguments);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
subInit.prototype = WordArray;
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var WordArray = C_lib.WordArray;
|
||||||
|
var C_enc = C.enc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UTF-16 BE encoding strategy.
|
||||||
|
*/
|
||||||
|
var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = {
|
||||||
|
/**
|
||||||
|
* Converts a word array to a UTF-16 BE string.
|
||||||
|
*
|
||||||
|
* @param {WordArray} wordArray The word array.
|
||||||
|
*
|
||||||
|
* @return {string} The UTF-16 BE string.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var utf16String = CryptoJS.enc.Utf16.stringify(wordArray);
|
||||||
|
*/
|
||||||
|
stringify: function(wordArray) {
|
||||||
|
// Shortcuts
|
||||||
|
var words = wordArray.words;
|
||||||
|
var sigBytes = wordArray.sigBytes;
|
||||||
|
|
||||||
|
// Convert
|
||||||
|
var utf16Chars = [];
|
||||||
|
for (var i = 0; i < sigBytes; i += 2) {
|
||||||
|
var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff;
|
||||||
|
utf16Chars.push(String.fromCharCode(codePoint));
|
||||||
|
}
|
||||||
|
|
||||||
|
return utf16Chars.join('');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a UTF-16 BE string to a word array.
|
||||||
|
*
|
||||||
|
* @param {string} utf16Str The UTF-16 BE string.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The word array.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var wordArray = CryptoJS.enc.Utf16.parse(utf16String);
|
||||||
|
*/
|
||||||
|
parse: function(utf16Str) {
|
||||||
|
// Shortcut
|
||||||
|
var utf16StrLength = utf16Str.length;
|
||||||
|
|
||||||
|
// Convert
|
||||||
|
var words = [];
|
||||||
|
for (var i = 0; i < utf16StrLength; i++) {
|
||||||
|
words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
return WordArray.create(words, utf16StrLength * 2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UTF-16 LE encoding strategy.
|
||||||
|
*/
|
||||||
|
C_enc.Utf16LE = {
|
||||||
|
/**
|
||||||
|
* Converts a word array to a UTF-16 LE string.
|
||||||
|
*
|
||||||
|
* @param {WordArray} wordArray The word array.
|
||||||
|
*
|
||||||
|
* @return {string} The UTF-16 LE string.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray);
|
||||||
|
*/
|
||||||
|
stringify: function(wordArray) {
|
||||||
|
// Shortcuts
|
||||||
|
var words = wordArray.words;
|
||||||
|
var sigBytes = wordArray.sigBytes;
|
||||||
|
|
||||||
|
// Convert
|
||||||
|
var utf16Chars = [];
|
||||||
|
for (var i = 0; i < sigBytes; i += 2) {
|
||||||
|
var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff);
|
||||||
|
utf16Chars.push(String.fromCharCode(codePoint));
|
||||||
|
}
|
||||||
|
|
||||||
|
return utf16Chars.join('');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a UTF-16 LE string to a word array.
|
||||||
|
*
|
||||||
|
* @param {string} utf16Str The UTF-16 LE string.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The word array.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str);
|
||||||
|
*/
|
||||||
|
parse: function(utf16Str) {
|
||||||
|
// Shortcut
|
||||||
|
var utf16StrLength = utf16Str.length;
|
||||||
|
|
||||||
|
// Convert
|
||||||
|
var words = [];
|
||||||
|
for (var i = 0; i < utf16StrLength; i++) {
|
||||||
|
words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16));
|
||||||
|
}
|
||||||
|
|
||||||
|
return WordArray.create(words, utf16StrLength * 2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function swapEndian(word) {
|
||||||
|
return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff);
|
||||||
|
}
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var WordArray = C_lib.WordArray;
|
||||||
|
var C_enc = C.enc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base64 encoding strategy.
|
||||||
|
*/
|
||||||
|
var Base64 = C_enc.Base64 = {
|
||||||
|
/**
|
||||||
|
* Converts a word array to a Base64 string.
|
||||||
|
*
|
||||||
|
* @param {WordArray} wordArray The word array.
|
||||||
|
*
|
||||||
|
* @return {string} The Base64 string.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var base64String = CryptoJS.enc.Base64.stringify(wordArray);
|
||||||
|
*/
|
||||||
|
stringify: function(wordArray) {
|
||||||
|
// Shortcuts
|
||||||
|
var words = wordArray.words;
|
||||||
|
var sigBytes = wordArray.sigBytes;
|
||||||
|
var map = this._map;
|
||||||
|
|
||||||
|
// Clamp excess bits
|
||||||
|
wordArray.clamp();
|
||||||
|
|
||||||
|
// Convert
|
||||||
|
var base64Chars = [];
|
||||||
|
for (var i = 0; i < sigBytes; i += 3) {
|
||||||
|
var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
|
||||||
|
var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
|
||||||
|
var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
|
||||||
|
|
||||||
|
var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
|
||||||
|
|
||||||
|
for (var j = 0;
|
||||||
|
(j < 4) && (i + j * 0.75 < sigBytes); j++) {
|
||||||
|
base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add padding
|
||||||
|
var paddingChar = map.charAt(64);
|
||||||
|
if (paddingChar) {
|
||||||
|
while (base64Chars.length % 4) {
|
||||||
|
base64Chars.push(paddingChar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return base64Chars.join('');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a Base64 string to a word array.
|
||||||
|
*
|
||||||
|
* @param {string} base64Str The Base64 string.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The word array.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var wordArray = CryptoJS.enc.Base64.parse(base64String);
|
||||||
|
*/
|
||||||
|
parse: function(base64Str) {
|
||||||
|
// Shortcuts
|
||||||
|
var base64StrLength = base64Str.length;
|
||||||
|
var map = this._map;
|
||||||
|
var reverseMap = this._reverseMap;
|
||||||
|
|
||||||
|
if (!reverseMap) {
|
||||||
|
reverseMap = this._reverseMap = [];
|
||||||
|
for (var j = 0; j < map.length; j++) {
|
||||||
|
reverseMap[map.charCodeAt(j)] = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ignore padding
|
||||||
|
var paddingChar = map.charAt(64);
|
||||||
|
if (paddingChar) {
|
||||||
|
var paddingIndex = base64Str.indexOf(paddingChar);
|
||||||
|
if (paddingIndex !== -1) {
|
||||||
|
base64StrLength = paddingIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert
|
||||||
|
return parseLoop(base64Str, base64StrLength, reverseMap);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
|
||||||
|
};
|
||||||
|
|
||||||
|
function parseLoop(base64Str, base64StrLength, reverseMap) {
|
||||||
|
var words = [];
|
||||||
|
var nBytes = 0;
|
||||||
|
for (var i = 0; i < base64StrLength; i++) {
|
||||||
|
if (i % 4) {
|
||||||
|
var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
|
||||||
|
var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
|
||||||
|
var bitsCombined = bits1 | bits2;
|
||||||
|
words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);
|
||||||
|
nBytes++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return WordArray.create(words, nBytes);
|
||||||
|
}
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var WordArray = C_lib.WordArray;
|
||||||
|
var C_enc = C.enc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base64url encoding strategy.
|
||||||
|
*/
|
||||||
|
var Base64url = C_enc.Base64url = {
|
||||||
|
/**
|
||||||
|
* Converts a word array to a Base64url string.
|
||||||
|
*
|
||||||
|
* @param {WordArray} wordArray The word array.
|
||||||
|
*
|
||||||
|
* @param {boolean} urlSafe Whether to use url safe
|
||||||
|
*
|
||||||
|
* @return {string} The Base64url string.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var base64String = CryptoJS.enc.Base64url.stringify(wordArray);
|
||||||
|
*/
|
||||||
|
stringify: function(wordArray, urlSafe = true) {
|
||||||
|
// Shortcuts
|
||||||
|
var words = wordArray.words;
|
||||||
|
var sigBytes = wordArray.sigBytes;
|
||||||
|
var map = urlSafe ? this._safe_map : this._map;
|
||||||
|
|
||||||
|
// Clamp excess bits
|
||||||
|
wordArray.clamp();
|
||||||
|
|
||||||
|
// Convert
|
||||||
|
var base64Chars = [];
|
||||||
|
for (var i = 0; i < sigBytes; i += 3) {
|
||||||
|
var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
|
||||||
|
var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
|
||||||
|
var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
|
||||||
|
|
||||||
|
var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
|
||||||
|
|
||||||
|
for (var j = 0;
|
||||||
|
(j < 4) && (i + j * 0.75 < sigBytes); j++) {
|
||||||
|
base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add padding
|
||||||
|
var paddingChar = map.charAt(64);
|
||||||
|
if (paddingChar) {
|
||||||
|
while (base64Chars.length % 4) {
|
||||||
|
base64Chars.push(paddingChar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return base64Chars.join('');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a Base64url string to a word array.
|
||||||
|
*
|
||||||
|
* @param {string} base64Str The Base64url string.
|
||||||
|
*
|
||||||
|
* @param {boolean} urlSafe Whether to use url safe
|
||||||
|
*
|
||||||
|
* @return {WordArray} The word array.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var wordArray = CryptoJS.enc.Base64url.parse(base64String);
|
||||||
|
*/
|
||||||
|
parse: function(base64Str, urlSafe = true) {
|
||||||
|
// Shortcuts
|
||||||
|
var base64StrLength = base64Str.length;
|
||||||
|
var map = urlSafe ? this._safe_map : this._map;
|
||||||
|
var reverseMap = this._reverseMap;
|
||||||
|
|
||||||
|
if (!reverseMap) {
|
||||||
|
reverseMap = this._reverseMap = [];
|
||||||
|
for (var j = 0; j < map.length; j++) {
|
||||||
|
reverseMap[map.charCodeAt(j)] = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ignore padding
|
||||||
|
var paddingChar = map.charAt(64);
|
||||||
|
if (paddingChar) {
|
||||||
|
var paddingIndex = base64Str.indexOf(paddingChar);
|
||||||
|
if (paddingIndex !== -1) {
|
||||||
|
base64StrLength = paddingIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert
|
||||||
|
return parseLoop(base64Str, base64StrLength, reverseMap);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
|
||||||
|
_safe_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',
|
||||||
|
};
|
||||||
|
|
||||||
|
function parseLoop(base64Str, base64StrLength, reverseMap) {
|
||||||
|
var words = [];
|
||||||
|
var nBytes = 0;
|
||||||
|
for (var i = 0; i < base64StrLength; i++) {
|
||||||
|
if (i % 4) {
|
||||||
|
var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
|
||||||
|
var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
|
||||||
|
var bitsCombined = bits1 | bits2;
|
||||||
|
words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);
|
||||||
|
nBytes++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return WordArray.create(words, nBytes);
|
||||||
|
}
|
||||||
|
}());
|
||||||
|
|
||||||
|
(function(Math) {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var WordArray = C_lib.WordArray;
|
||||||
|
var Hasher = C_lib.Hasher;
|
||||||
|
var C_algo = C.algo;
|
||||||
|
|
||||||
|
// Constants table
|
||||||
|
var T = [];
|
||||||
|
|
||||||
|
// Compute constants
|
||||||
|
(function() {
|
||||||
|
for (var i = 0; i < 64; i++) {
|
||||||
|
T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;
|
||||||
|
}
|
||||||
|
}());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MD5 hash algorithm.
|
||||||
|
*/
|
||||||
|
var MD5 = C_algo.MD5 = Hasher.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
this._hash = new WordArray.init([
|
||||||
|
0x67452301, 0xefcdab89,
|
||||||
|
0x98badcfe, 0x10325476
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
|
||||||
|
_doProcessBlock: function(M, offset) {
|
||||||
|
// Swap endian
|
||||||
|
for (var i = 0; i < 16; i++) {
|
||||||
|
// Shortcuts
|
||||||
|
var offset_i = offset + i;
|
||||||
|
var M_offset_i = M[offset_i];
|
||||||
|
|
||||||
|
M[offset_i] = (
|
||||||
|
(((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
|
||||||
|
(((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shortcuts
|
||||||
|
var H = this._hash.words;
|
||||||
|
|
||||||
|
var M_offset_0 = M[offset + 0];
|
||||||
|
var M_offset_1 = M[offset + 1];
|
||||||
|
var M_offset_2 = M[offset + 2];
|
||||||
|
var M_offset_3 = M[offset + 3];
|
||||||
|
var M_offset_4 = M[offset + 4];
|
||||||
|
var M_offset_5 = M[offset + 5];
|
||||||
|
var M_offset_6 = M[offset + 6];
|
||||||
|
var M_offset_7 = M[offset + 7];
|
||||||
|
var M_offset_8 = M[offset + 8];
|
||||||
|
var M_offset_9 = M[offset + 9];
|
||||||
|
var M_offset_10 = M[offset + 10];
|
||||||
|
var M_offset_11 = M[offset + 11];
|
||||||
|
var M_offset_12 = M[offset + 12];
|
||||||
|
var M_offset_13 = M[offset + 13];
|
||||||
|
var M_offset_14 = M[offset + 14];
|
||||||
|
var M_offset_15 = M[offset + 15];
|
||||||
|
|
||||||
|
// Working varialbes
|
||||||
|
var a = H[0];
|
||||||
|
var b = H[1];
|
||||||
|
var c = H[2];
|
||||||
|
var d = H[3];
|
||||||
|
|
||||||
|
// Computation
|
||||||
|
a = FF(a, b, c, d, M_offset_0, 7, T[0]);
|
||||||
|
d = FF(d, a, b, c, M_offset_1, 12, T[1]);
|
||||||
|
c = FF(c, d, a, b, M_offset_2, 17, T[2]);
|
||||||
|
b = FF(b, c, d, a, M_offset_3, 22, T[3]);
|
||||||
|
a = FF(a, b, c, d, M_offset_4, 7, T[4]);
|
||||||
|
d = FF(d, a, b, c, M_offset_5, 12, T[5]);
|
||||||
|
c = FF(c, d, a, b, M_offset_6, 17, T[6]);
|
||||||
|
b = FF(b, c, d, a, M_offset_7, 22, T[7]);
|
||||||
|
a = FF(a, b, c, d, M_offset_8, 7, T[8]);
|
||||||
|
d = FF(d, a, b, c, M_offset_9, 12, T[9]);
|
||||||
|
c = FF(c, d, a, b, M_offset_10, 17, T[10]);
|
||||||
|
b = FF(b, c, d, a, M_offset_11, 22, T[11]);
|
||||||
|
a = FF(a, b, c, d, M_offset_12, 7, T[12]);
|
||||||
|
d = FF(d, a, b, c, M_offset_13, 12, T[13]);
|
||||||
|
c = FF(c, d, a, b, M_offset_14, 17, T[14]);
|
||||||
|
b = FF(b, c, d, a, M_offset_15, 22, T[15]);
|
||||||
|
|
||||||
|
a = GG(a, b, c, d, M_offset_1, 5, T[16]);
|
||||||
|
d = GG(d, a, b, c, M_offset_6, 9, T[17]);
|
||||||
|
c = GG(c, d, a, b, M_offset_11, 14, T[18]);
|
||||||
|
b = GG(b, c, d, a, M_offset_0, 20, T[19]);
|
||||||
|
a = GG(a, b, c, d, M_offset_5, 5, T[20]);
|
||||||
|
d = GG(d, a, b, c, M_offset_10, 9, T[21]);
|
||||||
|
c = GG(c, d, a, b, M_offset_15, 14, T[22]);
|
||||||
|
b = GG(b, c, d, a, M_offset_4, 20, T[23]);
|
||||||
|
a = GG(a, b, c, d, M_offset_9, 5, T[24]);
|
||||||
|
d = GG(d, a, b, c, M_offset_14, 9, T[25]);
|
||||||
|
c = GG(c, d, a, b, M_offset_3, 14, T[26]);
|
||||||
|
b = GG(b, c, d, a, M_offset_8, 20, T[27]);
|
||||||
|
a = GG(a, b, c, d, M_offset_13, 5, T[28]);
|
||||||
|
d = GG(d, a, b, c, M_offset_2, 9, T[29]);
|
||||||
|
c = GG(c, d, a, b, M_offset_7, 14, T[30]);
|
||||||
|
b = GG(b, c, d, a, M_offset_12, 20, T[31]);
|
||||||
|
|
||||||
|
a = HH(a, b, c, d, M_offset_5, 4, T[32]);
|
||||||
|
d = HH(d, a, b, c, M_offset_8, 11, T[33]);
|
||||||
|
c = HH(c, d, a, b, M_offset_11, 16, T[34]);
|
||||||
|
b = HH(b, c, d, a, M_offset_14, 23, T[35]);
|
||||||
|
a = HH(a, b, c, d, M_offset_1, 4, T[36]);
|
||||||
|
d = HH(d, a, b, c, M_offset_4, 11, T[37]);
|
||||||
|
c = HH(c, d, a, b, M_offset_7, 16, T[38]);
|
||||||
|
b = HH(b, c, d, a, M_offset_10, 23, T[39]);
|
||||||
|
a = HH(a, b, c, d, M_offset_13, 4, T[40]);
|
||||||
|
d = HH(d, a, b, c, M_offset_0, 11, T[41]);
|
||||||
|
c = HH(c, d, a, b, M_offset_3, 16, T[42]);
|
||||||
|
b = HH(b, c, d, a, M_offset_6, 23, T[43]);
|
||||||
|
a = HH(a, b, c, d, M_offset_9, 4, T[44]);
|
||||||
|
d = HH(d, a, b, c, M_offset_12, 11, T[45]);
|
||||||
|
c = HH(c, d, a, b, M_offset_15, 16, T[46]);
|
||||||
|
b = HH(b, c, d, a, M_offset_2, 23, T[47]);
|
||||||
|
|
||||||
|
a = II(a, b, c, d, M_offset_0, 6, T[48]);
|
||||||
|
d = II(d, a, b, c, M_offset_7, 10, T[49]);
|
||||||
|
c = II(c, d, a, b, M_offset_14, 15, T[50]);
|
||||||
|
b = II(b, c, d, a, M_offset_5, 21, T[51]);
|
||||||
|
a = II(a, b, c, d, M_offset_12, 6, T[52]);
|
||||||
|
d = II(d, a, b, c, M_offset_3, 10, T[53]);
|
||||||
|
c = II(c, d, a, b, M_offset_10, 15, T[54]);
|
||||||
|
b = II(b, c, d, a, M_offset_1, 21, T[55]);
|
||||||
|
a = II(a, b, c, d, M_offset_8, 6, T[56]);
|
||||||
|
d = II(d, a, b, c, M_offset_15, 10, T[57]);
|
||||||
|
c = II(c, d, a, b, M_offset_6, 15, T[58]);
|
||||||
|
b = II(b, c, d, a, M_offset_13, 21, T[59]);
|
||||||
|
a = II(a, b, c, d, M_offset_4, 6, T[60]);
|
||||||
|
d = II(d, a, b, c, M_offset_11, 10, T[61]);
|
||||||
|
c = II(c, d, a, b, M_offset_2, 15, T[62]);
|
||||||
|
b = II(b, c, d, a, M_offset_9, 21, T[63]);
|
||||||
|
|
||||||
|
// Intermediate hash value
|
||||||
|
H[0] = (H[0] + a) | 0;
|
||||||
|
H[1] = (H[1] + b) | 0;
|
||||||
|
H[2] = (H[2] + c) | 0;
|
||||||
|
H[3] = (H[3] + d) | 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
_doFinalize: function() {
|
||||||
|
// Shortcuts
|
||||||
|
var data = this._data;
|
||||||
|
var dataWords = data.words;
|
||||||
|
|
||||||
|
var nBitsTotal = this._nDataBytes * 8;
|
||||||
|
var nBitsLeft = data.sigBytes * 8;
|
||||||
|
|
||||||
|
// Add padding
|
||||||
|
dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
|
||||||
|
|
||||||
|
var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
|
||||||
|
var nBitsTotalL = nBitsTotal;
|
||||||
|
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (
|
||||||
|
(((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) |
|
||||||
|
(((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00)
|
||||||
|
);
|
||||||
|
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
|
||||||
|
(((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) |
|
||||||
|
(((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00)
|
||||||
|
);
|
||||||
|
|
||||||
|
data.sigBytes = (dataWords.length + 1) * 4;
|
||||||
|
|
||||||
|
// Hash final blocks
|
||||||
|
this._process();
|
||||||
|
|
||||||
|
// Shortcuts
|
||||||
|
var hash = this._hash;
|
||||||
|
var H = hash.words;
|
||||||
|
|
||||||
|
// Swap endian
|
||||||
|
for (var i = 0; i < 4; i++) {
|
||||||
|
// Shortcut
|
||||||
|
var H_i = H[i];
|
||||||
|
|
||||||
|
H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
|
||||||
|
(((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return final computed hash
|
||||||
|
return hash;
|
||||||
|
},
|
||||||
|
|
||||||
|
clone: function() {
|
||||||
|
var clone = Hasher.clone.call(this);
|
||||||
|
clone._hash = this._hash.clone();
|
||||||
|
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function FF(a, b, c, d, x, s, t) {
|
||||||
|
var n = a + ((b & c) | (~b & d)) + x + t;
|
||||||
|
return ((n << s) | (n >>> (32 - s))) + b;
|
||||||
|
}
|
||||||
|
|
||||||
|
function GG(a, b, c, d, x, s, t) {
|
||||||
|
var n = a + ((b & d) | (c & ~d)) + x + t;
|
||||||
|
return ((n << s) | (n >>> (32 - s))) + b;
|
||||||
|
}
|
||||||
|
|
||||||
|
function HH(a, b, c, d, x, s, t) {
|
||||||
|
var n = a + (b ^ c ^ d) + x + t;
|
||||||
|
return ((n << s) | (n >>> (32 - s))) + b;
|
||||||
|
}
|
||||||
|
|
||||||
|
function II(a, b, c, d, x, s, t) {
|
||||||
|
var n = a + (c ^ (b | ~d)) + x + t;
|
||||||
|
return ((n << s) | (n >>> (32 - s))) + b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut function to the hasher's object interface.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} message The message to hash.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The hash.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hash = CryptoJS.MD5('message');
|
||||||
|
* var hash = CryptoJS.MD5(wordArray);
|
||||||
|
*/
|
||||||
|
C.MD5 = Hasher._createHelper(MD5);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut function to the HMAC's object interface.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} message The message to hash.
|
||||||
|
* @param {WordArray|string} key The secret key.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The HMAC.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hmac = CryptoJS.HmacMD5(message, key);
|
||||||
|
*/
|
||||||
|
C.HmacMD5 = Hasher._createHmacHelper(MD5);
|
||||||
|
}(Math));
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var WordArray = C_lib.WordArray;
|
||||||
|
var Hasher = C_lib.Hasher;
|
||||||
|
var C_algo = C.algo;
|
||||||
|
|
||||||
|
// Reusable object
|
||||||
|
var W = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SHA-1 hash algorithm.
|
||||||
|
*/
|
||||||
|
var SHA1 = C_algo.SHA1 = Hasher.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
this._hash = new WordArray.init([
|
||||||
|
0x67452301, 0xefcdab89,
|
||||||
|
0x98badcfe, 0x10325476,
|
||||||
|
0xc3d2e1f0
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
|
||||||
|
_doProcessBlock: function(M, offset) {
|
||||||
|
// Shortcut
|
||||||
|
var H = this._hash.words;
|
||||||
|
|
||||||
|
// Working variables
|
||||||
|
var a = H[0];
|
||||||
|
var b = H[1];
|
||||||
|
var c = H[2];
|
||||||
|
var d = H[3];
|
||||||
|
var e = H[4];
|
||||||
|
|
||||||
|
// Computation
|
||||||
|
for (var i = 0; i < 80; i++) {
|
||||||
|
if (i < 16) {
|
||||||
|
W[i] = M[offset + i] | 0;
|
||||||
|
} else {
|
||||||
|
var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
|
||||||
|
W[i] = (n << 1) | (n >>> 31);
|
||||||
|
}
|
||||||
|
|
||||||
|
var t = ((a << 5) | (a >>> 27)) + e + W[i];
|
||||||
|
if (i < 20) {
|
||||||
|
t += ((b & c) | (~b & d)) + 0x5a827999;
|
||||||
|
} else if (i < 40) {
|
||||||
|
t += (b ^ c ^ d) + 0x6ed9eba1;
|
||||||
|
} else if (i < 60) {
|
||||||
|
t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;
|
||||||
|
} else /* if (i < 80) */ {
|
||||||
|
t += (b ^ c ^ d) - 0x359d3e2a;
|
||||||
|
}
|
||||||
|
|
||||||
|
e = d;
|
||||||
|
d = c;
|
||||||
|
c = (b << 30) | (b >>> 2);
|
||||||
|
b = a;
|
||||||
|
a = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Intermediate hash value
|
||||||
|
H[0] = (H[0] + a) | 0;
|
||||||
|
H[1] = (H[1] + b) | 0;
|
||||||
|
H[2] = (H[2] + c) | 0;
|
||||||
|
H[3] = (H[3] + d) | 0;
|
||||||
|
H[4] = (H[4] + e) | 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
_doFinalize: function() {
|
||||||
|
// Shortcuts
|
||||||
|
var data = this._data;
|
||||||
|
var dataWords = data.words;
|
||||||
|
|
||||||
|
var nBitsTotal = this._nDataBytes * 8;
|
||||||
|
var nBitsLeft = data.sigBytes * 8;
|
||||||
|
|
||||||
|
// Add padding
|
||||||
|
dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
|
||||||
|
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
|
||||||
|
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
|
||||||
|
data.sigBytes = dataWords.length * 4;
|
||||||
|
|
||||||
|
// Hash final blocks
|
||||||
|
this._process();
|
||||||
|
|
||||||
|
// Return final computed hash
|
||||||
|
return this._hash;
|
||||||
|
},
|
||||||
|
|
||||||
|
clone: function() {
|
||||||
|
var clone = Hasher.clone.call(this);
|
||||||
|
clone._hash = this._hash.clone();
|
||||||
|
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut function to the hasher's object interface.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} message The message to hash.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The hash.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hash = CryptoJS.SHA1('message');
|
||||||
|
* var hash = CryptoJS.SHA1(wordArray);
|
||||||
|
*/
|
||||||
|
C.SHA1 = Hasher._createHelper(SHA1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut function to the HMAC's object interface.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} message The message to hash.
|
||||||
|
* @param {WordArray|string} key The secret key.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The HMAC.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hmac = CryptoJS.HmacSHA1(message, key);
|
||||||
|
*/
|
||||||
|
C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
(function(Math) {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var WordArray = C_lib.WordArray;
|
||||||
|
var Hasher = C_lib.Hasher;
|
||||||
|
var C_algo = C.algo;
|
||||||
|
|
||||||
|
// Initialization and round constants tables
|
||||||
|
var H = [];
|
||||||
|
var K = [];
|
||||||
|
|
||||||
|
// Compute constants
|
||||||
|
(function() {
|
||||||
|
function isPrime(n) {
|
||||||
|
var sqrtN = Math.sqrt(n);
|
||||||
|
for (var factor = 2; factor <= sqrtN; factor++) {
|
||||||
|
if (!(n % factor)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFractionalBits(n) {
|
||||||
|
return ((n - (n | 0)) * 0x100000000) | 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
var n = 2;
|
||||||
|
var nPrime = 0;
|
||||||
|
while (nPrime < 64) {
|
||||||
|
if (isPrime(n)) {
|
||||||
|
if (nPrime < 8) {
|
||||||
|
H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));
|
||||||
|
}
|
||||||
|
K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));
|
||||||
|
|
||||||
|
nPrime++;
|
||||||
|
}
|
||||||
|
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}());
|
||||||
|
|
||||||
|
// Reusable object
|
||||||
|
var W = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SHA-256 hash algorithm.
|
||||||
|
*/
|
||||||
|
var SHA256 = C_algo.SHA256 = Hasher.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
this._hash = new WordArray.init(H.slice(0));
|
||||||
|
},
|
||||||
|
|
||||||
|
_doProcessBlock: function(M, offset) {
|
||||||
|
// Shortcut
|
||||||
|
var H = this._hash.words;
|
||||||
|
|
||||||
|
// Working variables
|
||||||
|
var a = H[0];
|
||||||
|
var b = H[1];
|
||||||
|
var c = H[2];
|
||||||
|
var d = H[3];
|
||||||
|
var e = H[4];
|
||||||
|
var f = H[5];
|
||||||
|
var g = H[6];
|
||||||
|
var h = H[7];
|
||||||
|
|
||||||
|
// Computation
|
||||||
|
for (var i = 0; i < 64; i++) {
|
||||||
|
if (i < 16) {
|
||||||
|
W[i] = M[offset + i] | 0;
|
||||||
|
} else {
|
||||||
|
var gamma0x = W[i - 15];
|
||||||
|
var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^
|
||||||
|
((gamma0x << 14) | (gamma0x >>> 18)) ^
|
||||||
|
(gamma0x >>> 3);
|
||||||
|
|
||||||
|
var gamma1x = W[i - 2];
|
||||||
|
var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^
|
||||||
|
((gamma1x << 13) | (gamma1x >>> 19)) ^
|
||||||
|
(gamma1x >>> 10);
|
||||||
|
|
||||||
|
W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
|
||||||
|
}
|
||||||
|
|
||||||
|
var ch = (e & f) ^ (~e & g);
|
||||||
|
var maj = (a & b) ^ (a & c) ^ (b & c);
|
||||||
|
|
||||||
|
var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));
|
||||||
|
var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));
|
||||||
|
|
||||||
|
var t1 = h + sigma1 + ch + K[i] + W[i];
|
||||||
|
var t2 = sigma0 + maj;
|
||||||
|
|
||||||
|
h = g;
|
||||||
|
g = f;
|
||||||
|
f = e;
|
||||||
|
e = (d + t1) | 0;
|
||||||
|
d = c;
|
||||||
|
c = b;
|
||||||
|
b = a;
|
||||||
|
a = (t1 + t2) | 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Intermediate hash value
|
||||||
|
H[0] = (H[0] + a) | 0;
|
||||||
|
H[1] = (H[1] + b) | 0;
|
||||||
|
H[2] = (H[2] + c) | 0;
|
||||||
|
H[3] = (H[3] + d) | 0;
|
||||||
|
H[4] = (H[4] + e) | 0;
|
||||||
|
H[5] = (H[5] + f) | 0;
|
||||||
|
H[6] = (H[6] + g) | 0;
|
||||||
|
H[7] = (H[7] + h) | 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
_doFinalize: function() {
|
||||||
|
// Shortcuts
|
||||||
|
var data = this._data;
|
||||||
|
var dataWords = data.words;
|
||||||
|
|
||||||
|
var nBitsTotal = this._nDataBytes * 8;
|
||||||
|
var nBitsLeft = data.sigBytes * 8;
|
||||||
|
|
||||||
|
// Add padding
|
||||||
|
dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
|
||||||
|
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
|
||||||
|
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
|
||||||
|
data.sigBytes = dataWords.length * 4;
|
||||||
|
|
||||||
|
// Hash final blocks
|
||||||
|
this._process();
|
||||||
|
|
||||||
|
// Return final computed hash
|
||||||
|
return this._hash;
|
||||||
|
},
|
||||||
|
|
||||||
|
clone: function() {
|
||||||
|
var clone = Hasher.clone.call(this);
|
||||||
|
clone._hash = this._hash.clone();
|
||||||
|
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut function to the hasher's object interface.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} message The message to hash.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The hash.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hash = CryptoJS.SHA256('message');
|
||||||
|
* var hash = CryptoJS.SHA256(wordArray);
|
||||||
|
*/
|
||||||
|
C.SHA256 = Hasher._createHelper(SHA256);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut function to the HMAC's object interface.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} message The message to hash.
|
||||||
|
* @param {WordArray|string} key The secret key.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The HMAC.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hmac = CryptoJS.HmacSHA256(message, key);
|
||||||
|
*/
|
||||||
|
C.HmacSHA256 = Hasher._createHmacHelper(SHA256);
|
||||||
|
}(Math));
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var WordArray = C_lib.WordArray;
|
||||||
|
var C_algo = C.algo;
|
||||||
|
var SHA256 = C_algo.SHA256;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SHA-224 hash algorithm.
|
||||||
|
*/
|
||||||
|
var SHA224 = C_algo.SHA224 = SHA256.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
this._hash = new WordArray.init([
|
||||||
|
0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
|
||||||
|
0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
|
||||||
|
_doFinalize: function() {
|
||||||
|
var hash = SHA256._doFinalize.call(this);
|
||||||
|
|
||||||
|
hash.sigBytes -= 4;
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut function to the hasher's object interface.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} message The message to hash.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The hash.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hash = CryptoJS.SHA224('message');
|
||||||
|
* var hash = CryptoJS.SHA224(wordArray);
|
||||||
|
*/
|
||||||
|
C.SHA224 = SHA256._createHelper(SHA224);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut function to the HMAC's object interface.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} message The message to hash.
|
||||||
|
* @param {WordArray|string} key The secret key.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The HMAC.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hmac = CryptoJS.HmacSHA224(message, key);
|
||||||
|
*/
|
||||||
|
C.HmacSHA224 = SHA256._createHmacHelper(SHA224);
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var Hasher = C_lib.Hasher;
|
||||||
|
var C_x64 = C.x64;
|
||||||
|
var X64Word = C_x64.Word;
|
||||||
|
var X64WordArray = C_x64.WordArray;
|
||||||
|
var C_algo = C.algo;
|
||||||
|
|
||||||
|
function X64Word_create() {
|
||||||
|
return X64Word.create.apply(X64Word, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
var K = [
|
||||||
|
X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd),
|
||||||
|
X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc),
|
||||||
|
X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019),
|
||||||
|
X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118),
|
||||||
|
X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe),
|
||||||
|
X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2),
|
||||||
|
X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1),
|
||||||
|
X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694),
|
||||||
|
X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3),
|
||||||
|
X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65),
|
||||||
|
X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483),
|
||||||
|
X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5),
|
||||||
|
X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210),
|
||||||
|
X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4),
|
||||||
|
X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725),
|
||||||
|
X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70),
|
||||||
|
X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926),
|
||||||
|
X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df),
|
||||||
|
X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8),
|
||||||
|
X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b),
|
||||||
|
X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001),
|
||||||
|
X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30),
|
||||||
|
X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910),
|
||||||
|
X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8),
|
||||||
|
X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53),
|
||||||
|
X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8),
|
||||||
|
X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb),
|
||||||
|
X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3),
|
||||||
|
X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60),
|
||||||
|
X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec),
|
||||||
|
X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9),
|
||||||
|
X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b),
|
||||||
|
X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207),
|
||||||
|
X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178),
|
||||||
|
X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6),
|
||||||
|
X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b),
|
||||||
|
X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493),
|
||||||
|
X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c),
|
||||||
|
X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a),
|
||||||
|
X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817)
|
||||||
|
];
|
||||||
|
|
||||||
|
// Reusable objects
|
||||||
|
var W = [];
|
||||||
|
(function() {
|
||||||
|
for (var i = 0; i < 80; i++) {
|
||||||
|
W[i] = X64Word_create();
|
||||||
|
}
|
||||||
|
}());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SHA-512 hash algorithm.
|
||||||
|
*/
|
||||||
|
var SHA512 = C_algo.SHA512 = Hasher.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
this._hash = new X64WordArray.init([
|
||||||
|
new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b),
|
||||||
|
new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1),
|
||||||
|
new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f),
|
||||||
|
new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179)
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
|
||||||
|
_doProcessBlock: function(M, offset) {
|
||||||
|
// Shortcuts
|
||||||
|
var H = this._hash.words;
|
||||||
|
|
||||||
|
var H0 = H[0];
|
||||||
|
var H1 = H[1];
|
||||||
|
var H2 = H[2];
|
||||||
|
var H3 = H[3];
|
||||||
|
var H4 = H[4];
|
||||||
|
var H5 = H[5];
|
||||||
|
var H6 = H[6];
|
||||||
|
var H7 = H[7];
|
||||||
|
|
||||||
|
var H0h = H0.high;
|
||||||
|
var H0l = H0.low;
|
||||||
|
var H1h = H1.high;
|
||||||
|
var H1l = H1.low;
|
||||||
|
var H2h = H2.high;
|
||||||
|
var H2l = H2.low;
|
||||||
|
var H3h = H3.high;
|
||||||
|
var H3l = H3.low;
|
||||||
|
var H4h = H4.high;
|
||||||
|
var H4l = H4.low;
|
||||||
|
var H5h = H5.high;
|
||||||
|
var H5l = H5.low;
|
||||||
|
var H6h = H6.high;
|
||||||
|
var H6l = H6.low;
|
||||||
|
var H7h = H7.high;
|
||||||
|
var H7l = H7.low;
|
||||||
|
|
||||||
|
// Working variables
|
||||||
|
var ah = H0h;
|
||||||
|
var al = H0l;
|
||||||
|
var bh = H1h;
|
||||||
|
var bl = H1l;
|
||||||
|
var ch = H2h;
|
||||||
|
var cl = H2l;
|
||||||
|
var dh = H3h;
|
||||||
|
var dl = H3l;
|
||||||
|
var eh = H4h;
|
||||||
|
var el = H4l;
|
||||||
|
var fh = H5h;
|
||||||
|
var fl = H5l;
|
||||||
|
var gh = H6h;
|
||||||
|
var gl = H6l;
|
||||||
|
var hh = H7h;
|
||||||
|
var hl = H7l;
|
||||||
|
|
||||||
|
// Rounds
|
||||||
|
for (var i = 0; i < 80; i++) {
|
||||||
|
var Wil;
|
||||||
|
var Wih;
|
||||||
|
|
||||||
|
// Shortcut
|
||||||
|
var Wi = W[i];
|
||||||
|
|
||||||
|
// Extend message
|
||||||
|
if (i < 16) {
|
||||||
|
Wih = Wi.high = M[offset + i * 2] | 0;
|
||||||
|
Wil = Wi.low = M[offset + i * 2 + 1] | 0;
|
||||||
|
} else {
|
||||||
|
// Gamma0
|
||||||
|
var gamma0x = W[i - 15];
|
||||||
|
var gamma0xh = gamma0x.high;
|
||||||
|
var gamma0xl = gamma0x.low;
|
||||||
|
var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7);
|
||||||
|
var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25));
|
||||||
|
|
||||||
|
// Gamma1
|
||||||
|
var gamma1x = W[i - 2];
|
||||||
|
var gamma1xh = gamma1x.high;
|
||||||
|
var gamma1xl = gamma1x.low;
|
||||||
|
var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6);
|
||||||
|
var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26));
|
||||||
|
|
||||||
|
// W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
|
||||||
|
var Wi7 = W[i - 7];
|
||||||
|
var Wi7h = Wi7.high;
|
||||||
|
var Wi7l = Wi7.low;
|
||||||
|
|
||||||
|
var Wi16 = W[i - 16];
|
||||||
|
var Wi16h = Wi16.high;
|
||||||
|
var Wi16l = Wi16.low;
|
||||||
|
|
||||||
|
Wil = gamma0l + Wi7l;
|
||||||
|
Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0);
|
||||||
|
Wil = Wil + gamma1l;
|
||||||
|
Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0);
|
||||||
|
Wil = Wil + Wi16l;
|
||||||
|
Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0);
|
||||||
|
|
||||||
|
Wi.high = Wih;
|
||||||
|
Wi.low = Wil;
|
||||||
|
}
|
||||||
|
|
||||||
|
var chh = (eh & fh) ^ (~eh & gh);
|
||||||
|
var chl = (el & fl) ^ (~el & gl);
|
||||||
|
var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch);
|
||||||
|
var majl = (al & bl) ^ (al & cl) ^ (bl & cl);
|
||||||
|
|
||||||
|
var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7));
|
||||||
|
var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7));
|
||||||
|
var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9));
|
||||||
|
var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9));
|
||||||
|
|
||||||
|
// t1 = h + sigma1 + ch + K[i] + W[i]
|
||||||
|
var Ki = K[i];
|
||||||
|
var Kih = Ki.high;
|
||||||
|
var Kil = Ki.low;
|
||||||
|
|
||||||
|
var t1l = hl + sigma1l;
|
||||||
|
var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0);
|
||||||
|
var t1l = t1l + chl;
|
||||||
|
var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0);
|
||||||
|
var t1l = t1l + Kil;
|
||||||
|
var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0);
|
||||||
|
var t1l = t1l + Wil;
|
||||||
|
var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0);
|
||||||
|
|
||||||
|
// t2 = sigma0 + maj
|
||||||
|
var t2l = sigma0l + majl;
|
||||||
|
var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0);
|
||||||
|
|
||||||
|
// Update working variables
|
||||||
|
hh = gh;
|
||||||
|
hl = gl;
|
||||||
|
gh = fh;
|
||||||
|
gl = fl;
|
||||||
|
fh = eh;
|
||||||
|
fl = el;
|
||||||
|
el = (dl + t1l) | 0;
|
||||||
|
eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0;
|
||||||
|
dh = ch;
|
||||||
|
dl = cl;
|
||||||
|
ch = bh;
|
||||||
|
cl = bl;
|
||||||
|
bh = ah;
|
||||||
|
bl = al;
|
||||||
|
al = (t1l + t2l) | 0;
|
||||||
|
ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Intermediate hash value
|
||||||
|
H0l = H0.low = (H0l + al);
|
||||||
|
H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0));
|
||||||
|
H1l = H1.low = (H1l + bl);
|
||||||
|
H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0));
|
||||||
|
H2l = H2.low = (H2l + cl);
|
||||||
|
H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0));
|
||||||
|
H3l = H3.low = (H3l + dl);
|
||||||
|
H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0));
|
||||||
|
H4l = H4.low = (H4l + el);
|
||||||
|
H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0));
|
||||||
|
H5l = H5.low = (H5l + fl);
|
||||||
|
H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0));
|
||||||
|
H6l = H6.low = (H6l + gl);
|
||||||
|
H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0));
|
||||||
|
H7l = H7.low = (H7l + hl);
|
||||||
|
H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0));
|
||||||
|
},
|
||||||
|
|
||||||
|
_doFinalize: function() {
|
||||||
|
// Shortcuts
|
||||||
|
var data = this._data;
|
||||||
|
var dataWords = data.words;
|
||||||
|
|
||||||
|
var nBitsTotal = this._nDataBytes * 8;
|
||||||
|
var nBitsLeft = data.sigBytes * 8;
|
||||||
|
|
||||||
|
// Add padding
|
||||||
|
dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
|
||||||
|
dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000);
|
||||||
|
dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal;
|
||||||
|
data.sigBytes = dataWords.length * 4;
|
||||||
|
|
||||||
|
// Hash final blocks
|
||||||
|
this._process();
|
||||||
|
|
||||||
|
// Convert hash to 32-bit word array before returning
|
||||||
|
var hash = this._hash.toX32();
|
||||||
|
|
||||||
|
// Return final computed hash
|
||||||
|
return hash;
|
||||||
|
},
|
||||||
|
|
||||||
|
clone: function() {
|
||||||
|
var clone = Hasher.clone.call(this);
|
||||||
|
clone._hash = this._hash.clone();
|
||||||
|
|
||||||
|
return clone;
|
||||||
|
},
|
||||||
|
|
||||||
|
blockSize: 1024 / 32
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut function to the hasher's object interface.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} message The message to hash.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The hash.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hash = CryptoJS.SHA512('message');
|
||||||
|
* var hash = CryptoJS.SHA512(wordArray);
|
||||||
|
*/
|
||||||
|
C.SHA512 = Hasher._createHelper(SHA512);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut function to the HMAC's object interface.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} message The message to hash.
|
||||||
|
* @param {WordArray|string} key The secret key.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The HMAC.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hmac = CryptoJS.HmacSHA512(message, key);
|
||||||
|
*/
|
||||||
|
C.HmacSHA512 = Hasher._createHmacHelper(SHA512);
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_x64 = C.x64;
|
||||||
|
var X64Word = C_x64.Word;
|
||||||
|
var X64WordArray = C_x64.WordArray;
|
||||||
|
var C_algo = C.algo;
|
||||||
|
var SHA512 = C_algo.SHA512;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SHA-384 hash algorithm.
|
||||||
|
*/
|
||||||
|
var SHA384 = C_algo.SHA384 = SHA512.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
this._hash = new X64WordArray.init([
|
||||||
|
new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507),
|
||||||
|
new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939),
|
||||||
|
new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511),
|
||||||
|
new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4)
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
|
||||||
|
_doFinalize: function() {
|
||||||
|
var hash = SHA512._doFinalize.call(this);
|
||||||
|
|
||||||
|
hash.sigBytes -= 16;
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut function to the hasher's object interface.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} message The message to hash.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The hash.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hash = CryptoJS.SHA384('message');
|
||||||
|
* var hash = CryptoJS.SHA384(wordArray);
|
||||||
|
*/
|
||||||
|
C.SHA384 = SHA512._createHelper(SHA384);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut function to the HMAC's object interface.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} message The message to hash.
|
||||||
|
* @param {WordArray|string} key The secret key.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The HMAC.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hmac = CryptoJS.HmacSHA384(message, key);
|
||||||
|
*/
|
||||||
|
C.HmacSHA384 = SHA512._createHmacHelper(SHA384);
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
(function(Math) {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var WordArray = C_lib.WordArray;
|
||||||
|
var Hasher = C_lib.Hasher;
|
||||||
|
var C_x64 = C.x64;
|
||||||
|
var X64Word = C_x64.Word;
|
||||||
|
var C_algo = C.algo;
|
||||||
|
|
||||||
|
// Constants tables
|
||||||
|
var RHO_OFFSETS = [];
|
||||||
|
var PI_INDEXES = [];
|
||||||
|
var ROUND_CONSTANTS = [];
|
||||||
|
|
||||||
|
// Compute Constants
|
||||||
|
(function() {
|
||||||
|
// Compute rho offset constants
|
||||||
|
var x = 1,
|
||||||
|
y = 0;
|
||||||
|
for (var t = 0; t < 24; t++) {
|
||||||
|
RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64;
|
||||||
|
|
||||||
|
var newX = y % 5;
|
||||||
|
var newY = (2 * x + 3 * y) % 5;
|
||||||
|
x = newX;
|
||||||
|
y = newY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute pi index constants
|
||||||
|
for (var x = 0; x < 5; x++) {
|
||||||
|
for (var y = 0; y < 5; y++) {
|
||||||
|
PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute round constants
|
||||||
|
var LFSR = 0x01;
|
||||||
|
for (var i = 0; i < 24; i++) {
|
||||||
|
var roundConstantMsw = 0;
|
||||||
|
var roundConstantLsw = 0;
|
||||||
|
|
||||||
|
for (var j = 0; j < 7; j++) {
|
||||||
|
if (LFSR & 0x01) {
|
||||||
|
var bitPosition = (1 << j) - 1;
|
||||||
|
if (bitPosition < 32) {
|
||||||
|
roundConstantLsw ^= 1 << bitPosition;
|
||||||
|
} else /* if (bitPosition >= 32) */ {
|
||||||
|
roundConstantMsw ^= 1 << (bitPosition - 32);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute next LFSR
|
||||||
|
if (LFSR & 0x80) {
|
||||||
|
// Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1
|
||||||
|
LFSR = (LFSR << 1) ^ 0x71;
|
||||||
|
} else {
|
||||||
|
LFSR <<= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw);
|
||||||
|
}
|
||||||
|
}());
|
||||||
|
|
||||||
|
// Reusable objects for temporary values
|
||||||
|
var T = [];
|
||||||
|
(function() {
|
||||||
|
for (var i = 0; i < 25; i++) {
|
||||||
|
T[i] = X64Word.create();
|
||||||
|
}
|
||||||
|
}());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SHA-3 hash algorithm.
|
||||||
|
*/
|
||||||
|
var SHA3 = C_algo.SHA3 = Hasher.extend({
|
||||||
|
/**
|
||||||
|
* Configuration options.
|
||||||
|
*
|
||||||
|
* @property {number} outputLength
|
||||||
|
* The desired number of bits in the output hash.
|
||||||
|
* Only values permitted are: 224, 256, 384, 512.
|
||||||
|
* Default: 512
|
||||||
|
*/
|
||||||
|
cfg: Hasher.cfg.extend({
|
||||||
|
outputLength: 512
|
||||||
|
}),
|
||||||
|
|
||||||
|
_doReset: function() {
|
||||||
|
var state = this._state = []
|
||||||
|
for (var i = 0; i < 25; i++) {
|
||||||
|
state[i] = new X64Word.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;
|
||||||
|
},
|
||||||
|
|
||||||
|
_doProcessBlock: function(M, offset) {
|
||||||
|
// Shortcuts
|
||||||
|
var state = this._state;
|
||||||
|
var nBlockSizeLanes = this.blockSize / 2;
|
||||||
|
|
||||||
|
// Absorb
|
||||||
|
for (var i = 0; i < nBlockSizeLanes; i++) {
|
||||||
|
// Shortcuts
|
||||||
|
var M2i = M[offset + 2 * i];
|
||||||
|
var M2i1 = M[offset + 2 * i + 1];
|
||||||
|
|
||||||
|
// Swap endian
|
||||||
|
M2i = (
|
||||||
|
(((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) |
|
||||||
|
(((M2i << 24) | (M2i >>> 8)) & 0xff00ff00)
|
||||||
|
);
|
||||||
|
M2i1 = (
|
||||||
|
(((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) |
|
||||||
|
(((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Absorb message into state
|
||||||
|
var lane = state[i];
|
||||||
|
lane.high ^= M2i1;
|
||||||
|
lane.low ^= M2i;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rounds
|
||||||
|
for (var round = 0; round < 24; round++) {
|
||||||
|
// Theta
|
||||||
|
for (var x = 0; x < 5; x++) {
|
||||||
|
// Mix column lanes
|
||||||
|
var tMsw = 0,
|
||||||
|
tLsw = 0;
|
||||||
|
for (var y = 0; y < 5; y++) {
|
||||||
|
var lane = state[x + 5 * y];
|
||||||
|
tMsw ^= lane.high;
|
||||||
|
tLsw ^= lane.low;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Temporary values
|
||||||
|
var Tx = T[x];
|
||||||
|
Tx.high = tMsw;
|
||||||
|
Tx.low = tLsw;
|
||||||
|
}
|
||||||
|
for (var x = 0; x < 5; x++) {
|
||||||
|
// Shortcuts
|
||||||
|
var Tx4 = T[(x + 4) % 5];
|
||||||
|
var Tx1 = T[(x + 1) % 5];
|
||||||
|
var Tx1Msw = Tx1.high;
|
||||||
|
var Tx1Lsw = Tx1.low;
|
||||||
|
|
||||||
|
// Mix surrounding columns
|
||||||
|
var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31));
|
||||||
|
var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31));
|
||||||
|
for (var y = 0; y < 5; y++) {
|
||||||
|
var lane = state[x + 5 * y];
|
||||||
|
lane.high ^= tMsw;
|
||||||
|
lane.low ^= tLsw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rho Pi
|
||||||
|
for (var laneIndex = 1; laneIndex < 25; laneIndex++) {
|
||||||
|
var tMsw;
|
||||||
|
var tLsw;
|
||||||
|
|
||||||
|
// Shortcuts
|
||||||
|
var lane = state[laneIndex];
|
||||||
|
var laneMsw = lane.high;
|
||||||
|
var laneLsw = lane.low;
|
||||||
|
var rhoOffset = RHO_OFFSETS[laneIndex];
|
||||||
|
|
||||||
|
// Rotate lanes
|
||||||
|
if (rhoOffset < 32) {
|
||||||
|
tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset));
|
||||||
|
tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset));
|
||||||
|
} else /* if (rhoOffset >= 32) */ {
|
||||||
|
tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset));
|
||||||
|
tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Transpose lanes
|
||||||
|
var TPiLane = T[PI_INDEXES[laneIndex]];
|
||||||
|
TPiLane.high = tMsw;
|
||||||
|
TPiLane.low = tLsw;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rho pi at x = y = 0
|
||||||
|
var T0 = T[0];
|
||||||
|
var state0 = state[0];
|
||||||
|
T0.high = state0.high;
|
||||||
|
T0.low = state0.low;
|
||||||
|
|
||||||
|
// Chi
|
||||||
|
for (var x = 0; x < 5; x++) {
|
||||||
|
for (var y = 0; y < 5; y++) {
|
||||||
|
// Shortcuts
|
||||||
|
var laneIndex = x + 5 * y;
|
||||||
|
var lane = state[laneIndex];
|
||||||
|
var TLane = T[laneIndex];
|
||||||
|
var Tx1Lane = T[((x + 1) % 5) + 5 * y];
|
||||||
|
var Tx2Lane = T[((x + 2) % 5) + 5 * y];
|
||||||
|
|
||||||
|
// Mix rows
|
||||||
|
lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high);
|
||||||
|
lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iota
|
||||||
|
var lane = state[0];
|
||||||
|
var roundConstant = ROUND_CONSTANTS[round];
|
||||||
|
lane.high ^= roundConstant.high;
|
||||||
|
lane.low ^= roundConstant.low;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_doFinalize: function() {
|
||||||
|
// Shortcuts
|
||||||
|
var data = this._data;
|
||||||
|
var dataWords = data.words;
|
||||||
|
var nBitsTotal = this._nDataBytes * 8;
|
||||||
|
var nBitsLeft = data.sigBytes * 8;
|
||||||
|
var blockSizeBits = this.blockSize * 32;
|
||||||
|
|
||||||
|
// Add padding
|
||||||
|
dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32);
|
||||||
|
dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80;
|
||||||
|
data.sigBytes = dataWords.length * 4;
|
||||||
|
|
||||||
|
// Hash final blocks
|
||||||
|
this._process();
|
||||||
|
|
||||||
|
// Shortcuts
|
||||||
|
var state = this._state;
|
||||||
|
var outputLengthBytes = this.cfg.outputLength / 8;
|
||||||
|
var outputLengthLanes = outputLengthBytes / 8;
|
||||||
|
|
||||||
|
// Squeeze
|
||||||
|
var hashWords = [];
|
||||||
|
for (var i = 0; i < outputLengthLanes; i++) {
|
||||||
|
// Shortcuts
|
||||||
|
var lane = state[i];
|
||||||
|
var laneMsw = lane.high;
|
||||||
|
var laneLsw = lane.low;
|
||||||
|
|
||||||
|
// Swap endian
|
||||||
|
laneMsw = (
|
||||||
|
(((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) |
|
||||||
|
(((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00)
|
||||||
|
);
|
||||||
|
laneLsw = (
|
||||||
|
(((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) |
|
||||||
|
(((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Squeeze state to retrieve hash
|
||||||
|
hashWords.push(laneLsw);
|
||||||
|
hashWords.push(laneMsw);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return final computed hash
|
||||||
|
return new WordArray.init(hashWords, outputLengthBytes);
|
||||||
|
},
|
||||||
|
|
||||||
|
clone: function() {
|
||||||
|
var clone = Hasher.clone.call(this);
|
||||||
|
|
||||||
|
var state = clone._state = this._state.slice(0);
|
||||||
|
for (var i = 0; i < 25; i++) {
|
||||||
|
state[i] = state[i].clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut function to the hasher's object interface.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} message The message to hash.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The hash.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hash = CryptoJS.SHA3('message');
|
||||||
|
* var hash = CryptoJS.SHA3(wordArray);
|
||||||
|
*/
|
||||||
|
C.SHA3 = Hasher._createHelper(SHA3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut function to the HMAC's object interface.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} message The message to hash.
|
||||||
|
* @param {WordArray|string} key The secret key.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The HMAC.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hmac = CryptoJS.HmacSHA3(message, key);
|
||||||
|
*/
|
||||||
|
C.HmacSHA3 = Hasher._createHmacHelper(SHA3);
|
||||||
|
}(Math));
|
||||||
|
|
||||||
|
|
||||||
|
/** @preserve
|
||||||
|
(c) 2012 by Cédric Mesnil. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function(Math) {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var WordArray = C_lib.WordArray;
|
||||||
|
var Hasher = C_lib.Hasher;
|
||||||
|
var C_algo = C.algo;
|
||||||
|
|
||||||
|
// Constants table
|
||||||
|
var _zl = WordArray.create([
|
||||||
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||||
|
7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
|
||||||
|
3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
|
||||||
|
1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
|
||||||
|
4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
|
||||||
|
]);
|
||||||
|
var _zr = WordArray.create([
|
||||||
|
5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
|
||||||
|
6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
|
||||||
|
15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
|
||||||
|
8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
|
||||||
|
12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
|
||||||
|
]);
|
||||||
|
var _sl = WordArray.create([
|
||||||
|
11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
|
||||||
|
7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
|
||||||
|
11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
|
||||||
|
11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
|
||||||
|
9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
|
||||||
|
]);
|
||||||
|
var _sr = WordArray.create([
|
||||||
|
8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
|
||||||
|
9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
|
||||||
|
9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
|
||||||
|
15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
|
||||||
|
8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
|
||||||
|
]);
|
||||||
|
|
||||||
|
var _hl = WordArray.create([0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]);
|
||||||
|
var _hr = WordArray.create([0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RIPEMD160 hash algorithm.
|
||||||
|
*/
|
||||||
|
var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]);
|
||||||
|
},
|
||||||
|
|
||||||
|
_doProcessBlock: function(M, offset) {
|
||||||
|
|
||||||
|
// Swap endian
|
||||||
|
for (var i = 0; i < 16; i++) {
|
||||||
|
// Shortcuts
|
||||||
|
var offset_i = offset + i;
|
||||||
|
var M_offset_i = M[offset_i];
|
||||||
|
|
||||||
|
// Swap
|
||||||
|
M[offset_i] = (
|
||||||
|
(((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
|
||||||
|
(((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// Shortcut
|
||||||
|
var H = this._hash.words;
|
||||||
|
var hl = _hl.words;
|
||||||
|
var hr = _hr.words;
|
||||||
|
var zl = _zl.words;
|
||||||
|
var zr = _zr.words;
|
||||||
|
var sl = _sl.words;
|
||||||
|
var sr = _sr.words;
|
||||||
|
|
||||||
|
// Working variables
|
||||||
|
var al, bl, cl, dl, el;
|
||||||
|
var ar, br, cr, dr, er;
|
||||||
|
|
||||||
|
ar = al = H[0];
|
||||||
|
br = bl = H[1];
|
||||||
|
cr = cl = H[2];
|
||||||
|
dr = dl = H[3];
|
||||||
|
er = el = H[4];
|
||||||
|
// Computation
|
||||||
|
var t;
|
||||||
|
for (var i = 0; i < 80; i += 1) {
|
||||||
|
t = (al + M[offset + zl[i]]) | 0;
|
||||||
|
if (i < 16) {
|
||||||
|
t += f1(bl, cl, dl) + hl[0];
|
||||||
|
} else if (i < 32) {
|
||||||
|
t += f2(bl, cl, dl) + hl[1];
|
||||||
|
} else if (i < 48) {
|
||||||
|
t += f3(bl, cl, dl) + hl[2];
|
||||||
|
} else if (i < 64) {
|
||||||
|
t += f4(bl, cl, dl) + hl[3];
|
||||||
|
} else { // if (i<80) {
|
||||||
|
t += f5(bl, cl, dl) + hl[4];
|
||||||
|
}
|
||||||
|
t = t | 0;
|
||||||
|
t = rotl(t, sl[i]);
|
||||||
|
t = (t + el) | 0;
|
||||||
|
al = el;
|
||||||
|
el = dl;
|
||||||
|
dl = rotl(cl, 10);
|
||||||
|
cl = bl;
|
||||||
|
bl = t;
|
||||||
|
|
||||||
|
t = (ar + M[offset + zr[i]]) | 0;
|
||||||
|
if (i < 16) {
|
||||||
|
t += f5(br, cr, dr) + hr[0];
|
||||||
|
} else if (i < 32) {
|
||||||
|
t += f4(br, cr, dr) + hr[1];
|
||||||
|
} else if (i < 48) {
|
||||||
|
t += f3(br, cr, dr) + hr[2];
|
||||||
|
} else if (i < 64) {
|
||||||
|
t += f2(br, cr, dr) + hr[3];
|
||||||
|
} else { // if (i<80) {
|
||||||
|
t += f1(br, cr, dr) + hr[4];
|
||||||
|
}
|
||||||
|
t = t | 0;
|
||||||
|
t = rotl(t, sr[i]);
|
||||||
|
t = (t + er) | 0;
|
||||||
|
ar = er;
|
||||||
|
er = dr;
|
||||||
|
dr = rotl(cr, 10);
|
||||||
|
cr = br;
|
||||||
|
br = t;
|
||||||
|
}
|
||||||
|
// Intermediate hash value
|
||||||
|
t = (H[1] + cl + dr) | 0;
|
||||||
|
H[1] = (H[2] + dl + er) | 0;
|
||||||
|
H[2] = (H[3] + el + ar) | 0;
|
||||||
|
H[3] = (H[4] + al + br) | 0;
|
||||||
|
H[4] = (H[0] + bl + cr) | 0;
|
||||||
|
H[0] = t;
|
||||||
|
},
|
||||||
|
|
||||||
|
_doFinalize: function() {
|
||||||
|
// Shortcuts
|
||||||
|
var data = this._data;
|
||||||
|
var dataWords = data.words;
|
||||||
|
|
||||||
|
var nBitsTotal = this._nDataBytes * 8;
|
||||||
|
var nBitsLeft = data.sigBytes * 8;
|
||||||
|
|
||||||
|
// Add padding
|
||||||
|
dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
|
||||||
|
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
|
||||||
|
(((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) |
|
||||||
|
(((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00)
|
||||||
|
);
|
||||||
|
data.sigBytes = (dataWords.length + 1) * 4;
|
||||||
|
|
||||||
|
// Hash final blocks
|
||||||
|
this._process();
|
||||||
|
|
||||||
|
// Shortcuts
|
||||||
|
var hash = this._hash;
|
||||||
|
var H = hash.words;
|
||||||
|
|
||||||
|
// Swap endian
|
||||||
|
for (var i = 0; i < 5; i++) {
|
||||||
|
// Shortcut
|
||||||
|
var H_i = H[i];
|
||||||
|
|
||||||
|
// Swap
|
||||||
|
H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
|
||||||
|
(((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return final computed hash
|
||||||
|
return hash;
|
||||||
|
},
|
||||||
|
|
||||||
|
clone: function() {
|
||||||
|
var clone = Hasher.clone.call(this);
|
||||||
|
clone._hash = this._hash.clone();
|
||||||
|
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function f1(x, y, z) {
|
||||||
|
return ((x) ^ (y) ^ (z));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function f2(x, y, z) {
|
||||||
|
return (((x) & (y)) | ((~x) & (z)));
|
||||||
|
}
|
||||||
|
|
||||||
|
function f3(x, y, z) {
|
||||||
|
return (((x) | (~(y))) ^ (z));
|
||||||
|
}
|
||||||
|
|
||||||
|
function f4(x, y, z) {
|
||||||
|
return (((x) & (z)) | ((y) & (~(z))));
|
||||||
|
}
|
||||||
|
|
||||||
|
function f5(x, y, z) {
|
||||||
|
return ((x) ^ ((y) | (~(z))));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function rotl(x, n) {
|
||||||
|
return (x << n) | (x >>> (32 - n));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut function to the hasher's object interface.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} message The message to hash.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The hash.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hash = CryptoJS.RIPEMD160('message');
|
||||||
|
* var hash = CryptoJS.RIPEMD160(wordArray);
|
||||||
|
*/
|
||||||
|
C.RIPEMD160 = Hasher._createHelper(RIPEMD160);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut function to the HMAC's object interface.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} message The message to hash.
|
||||||
|
* @param {WordArray|string} key The secret key.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The HMAC.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hmac = CryptoJS.HmacRIPEMD160(message, key);
|
||||||
|
*/
|
||||||
|
C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160);
|
||||||
|
}(Math));
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var Base = C_lib.Base;
|
||||||
|
var C_enc = C.enc;
|
||||||
|
var Utf8 = C_enc.Utf8;
|
||||||
|
var C_algo = C.algo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HMAC algorithm.
|
||||||
|
*/
|
||||||
|
var HMAC = C_algo.HMAC = Base.extend({
|
||||||
|
/**
|
||||||
|
* Initializes a newly created HMAC.
|
||||||
|
*
|
||||||
|
* @param {Hasher} hasher The hash algorithm to use.
|
||||||
|
* @param {WordArray|string} key The secret key.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
|
||||||
|
*/
|
||||||
|
init: function(hasher, key) {
|
||||||
|
// Init hasher
|
||||||
|
hasher = this._hasher = new hasher.init();
|
||||||
|
|
||||||
|
// Convert string to WordArray, else assume WordArray already
|
||||||
|
if (typeof key == 'string') {
|
||||||
|
key = Utf8.parse(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shortcuts
|
||||||
|
var hasherBlockSize = hasher.blockSize;
|
||||||
|
var hasherBlockSizeBytes = hasherBlockSize * 4;
|
||||||
|
|
||||||
|
// Allow arbitrary length keys
|
||||||
|
if (key.sigBytes > hasherBlockSizeBytes) {
|
||||||
|
key = hasher.finalize(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clamp excess bits
|
||||||
|
key.clamp();
|
||||||
|
|
||||||
|
// Clone key for inner and outer pads
|
||||||
|
var oKey = this._oKey = key.clone();
|
||||||
|
var iKey = this._iKey = key.clone();
|
||||||
|
|
||||||
|
// Shortcuts
|
||||||
|
var oKeyWords = oKey.words;
|
||||||
|
var iKeyWords = iKey.words;
|
||||||
|
|
||||||
|
// XOR keys with pad constants
|
||||||
|
for (var i = 0; i < hasherBlockSize; i++) {
|
||||||
|
oKeyWords[i] ^= 0x5c5c5c5c;
|
||||||
|
iKeyWords[i] ^= 0x36363636;
|
||||||
|
}
|
||||||
|
oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
|
||||||
|
|
||||||
|
// Set initial values
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets this HMAC to its initial state.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* hmacHasher.reset();
|
||||||
|
*/
|
||||||
|
reset: function() {
|
||||||
|
// Shortcut
|
||||||
|
var hasher = this._hasher;
|
||||||
|
|
||||||
|
// Reset
|
||||||
|
hasher.reset();
|
||||||
|
hasher.update(this._iKey);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates this HMAC with a message.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} messageUpdate The message to append.
|
||||||
|
*
|
||||||
|
* @return {HMAC} This HMAC instance.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* hmacHasher.update('message');
|
||||||
|
* hmacHasher.update(wordArray);
|
||||||
|
*/
|
||||||
|
update: function(messageUpdate) {
|
||||||
|
this._hasher.update(messageUpdate);
|
||||||
|
|
||||||
|
// Chainable
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finalizes the HMAC computation.
|
||||||
|
* Note that the finalize operation is effectively a destructive, read-once operation.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} messageUpdate (Optional) A final message update.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The HMAC.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hmac = hmacHasher.finalize();
|
||||||
|
* var hmac = hmacHasher.finalize('message');
|
||||||
|
* var hmac = hmacHasher.finalize(wordArray);
|
||||||
|
*/
|
||||||
|
finalize: function(messageUpdate) {
|
||||||
|
// Shortcut
|
||||||
|
var hasher = this._hasher;
|
||||||
|
|
||||||
|
// Compute HMAC
|
||||||
|
var innerHash = hasher.finalize(messageUpdate);
|
||||||
|
hasher.reset();
|
||||||
|
var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));
|
||||||
|
|
||||||
|
return hmac;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var Base = C_lib.Base;
|
||||||
|
var WordArray = C_lib.WordArray;
|
||||||
|
var C_algo = C.algo;
|
||||||
|
var SHA1 = C_algo.SHA1;
|
||||||
|
var HMAC = C_algo.HMAC;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Password-Based Key Derivation Function 2 algorithm.
|
||||||
|
*/
|
||||||
|
var PBKDF2 = C_algo.PBKDF2 = Base.extend({
|
||||||
|
/**
|
||||||
|
* Configuration options.
|
||||||
|
*
|
||||||
|
* @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
|
||||||
|
* @property {Hasher} hasher The hasher to use. Default: SHA1
|
||||||
|
* @property {number} iterations The number of iterations to perform. Default: 1
|
||||||
|
*/
|
||||||
|
cfg: Base.extend({
|
||||||
|
keySize: 128 / 32,
|
||||||
|
hasher: SHA1,
|
||||||
|
iterations: 1
|
||||||
|
}),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes a newly created key derivation function.
|
||||||
|
*
|
||||||
|
* @param {Object} cfg (Optional) The configuration options to use for the derivation.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var kdf = CryptoJS.algo.PBKDF2.create();
|
||||||
|
* var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 });
|
||||||
|
* var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });
|
||||||
|
*/
|
||||||
|
init: function(cfg) {
|
||||||
|
this.cfg = this.cfg.extend(cfg);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computes the Password-Based Key Derivation Function 2.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} password The password.
|
||||||
|
* @param {WordArray|string} salt A salt.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The derived key.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var key = kdf.compute(password, salt);
|
||||||
|
*/
|
||||||
|
compute: function(password, salt) {
|
||||||
|
// Shortcut
|
||||||
|
var cfg = this.cfg;
|
||||||
|
|
||||||
|
// Init HMAC
|
||||||
|
var hmac = HMAC.create(cfg.hasher, password);
|
||||||
|
|
||||||
|
// Initial values
|
||||||
|
var derivedKey = WordArray.create();
|
||||||
|
var blockIndex = WordArray.create([0x00000001]);
|
||||||
|
|
||||||
|
// Shortcuts
|
||||||
|
var derivedKeyWords = derivedKey.words;
|
||||||
|
var blockIndexWords = blockIndex.words;
|
||||||
|
var keySize = cfg.keySize;
|
||||||
|
var iterations = cfg.iterations;
|
||||||
|
|
||||||
|
// Generate key
|
||||||
|
while (derivedKeyWords.length < keySize) {
|
||||||
|
var block = hmac.update(salt).finalize(blockIndex);
|
||||||
|
hmac.reset();
|
||||||
|
|
||||||
|
// Shortcuts
|
||||||
|
var blockWords = block.words;
|
||||||
|
var blockWordsLength = blockWords.length;
|
||||||
|
|
||||||
|
// Iterations
|
||||||
|
var intermediate = block;
|
||||||
|
for (var i = 1; i < iterations; i++) {
|
||||||
|
intermediate = hmac.finalize(intermediate);
|
||||||
|
hmac.reset();
|
||||||
|
|
||||||
|
// Shortcut
|
||||||
|
var intermediateWords = intermediate.words;
|
||||||
|
|
||||||
|
// XOR intermediate with block
|
||||||
|
for (var j = 0; j < blockWordsLength; j++) {
|
||||||
|
blockWords[j] ^= intermediateWords[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
derivedKey.concat(block);
|
||||||
|
blockIndexWords[0]++;
|
||||||
|
}
|
||||||
|
derivedKey.sigBytes = keySize * 4;
|
||||||
|
|
||||||
|
return derivedKey;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computes the Password-Based Key Derivation Function 2.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} password The password.
|
||||||
|
* @param {WordArray|string} salt A salt.
|
||||||
|
* @param {Object} cfg (Optional) The configuration options to use for this computation.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The derived key.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var key = CryptoJS.PBKDF2(password, salt);
|
||||||
|
* var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 });
|
||||||
|
* var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });
|
||||||
|
*/
|
||||||
|
C.PBKDF2 = function(password, salt, cfg) {
|
||||||
|
return PBKDF2.create(cfg).compute(password, salt);
|
||||||
|
};
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var Base = C_lib.Base;
|
||||||
|
var WordArray = C_lib.WordArray;
|
||||||
|
var C_algo = C.algo;
|
||||||
|
var MD5 = C_algo.MD5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This key derivation function is meant to conform with EVP_BytesToKey.
|
||||||
|
* www.openssl.org/docs/crypto/EVP_BytesToKey.html
|
||||||
|
*/
|
||||||
|
var EvpKDF = C_algo.EvpKDF = Base.extend({
|
||||||
|
/**
|
||||||
|
* Configuration options.
|
||||||
|
*
|
||||||
|
* @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
|
||||||
|
* @property {Hasher} hasher The hash algorithm to use. Default: MD5
|
||||||
|
* @property {number} iterations The number of iterations to perform. Default: 1
|
||||||
|
*/
|
||||||
|
cfg: Base.extend({
|
||||||
|
keySize: 128 / 32,
|
||||||
|
hasher: MD5,
|
||||||
|
iterations: 1
|
||||||
|
}),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes a newly created key derivation function.
|
||||||
|
*
|
||||||
|
* @param {Object} cfg (Optional) The configuration options to use for the derivation.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var kdf = CryptoJS.algo.EvpKDF.create();
|
||||||
|
* var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
|
||||||
|
* var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
|
||||||
|
*/
|
||||||
|
init: function(cfg) {
|
||||||
|
this.cfg = this.cfg.extend(cfg);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Derives a key from a password.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} password The password.
|
||||||
|
* @param {WordArray|string} salt A salt.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The derived key.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var key = kdf.compute(password, salt);
|
||||||
|
*/
|
||||||
|
compute: function(password, salt) {
|
||||||
|
var block;
|
||||||
|
|
||||||
|
// Shortcut
|
||||||
|
var cfg = this.cfg;
|
||||||
|
|
||||||
|
// Init hasher
|
||||||
|
var hasher = cfg.hasher.create();
|
||||||
|
|
||||||
|
// Initial values
|
||||||
|
var derivedKey = WordArray.create();
|
||||||
|
|
||||||
|
// Shortcuts
|
||||||
|
var derivedKeyWords = derivedKey.words;
|
||||||
|
var keySize = cfg.keySize;
|
||||||
|
var iterations = cfg.iterations;
|
||||||
|
|
||||||
|
// Generate key
|
||||||
|
while (derivedKeyWords.length < keySize) {
|
||||||
|
if (block) {
|
||||||
|
hasher.update(block);
|
||||||
|
}
|
||||||
|
block = hasher.update(password).finalize(salt);
|
||||||
|
hasher.reset();
|
||||||
|
|
||||||
|
// Iterations
|
||||||
|
for (var i = 1; i < iterations; i++) {
|
||||||
|
block = hasher.finalize(block);
|
||||||
|
hasher.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
derivedKey.concat(block);
|
||||||
|
}
|
||||||
|
derivedKey.sigBytes = keySize * 4;
|
||||||
|
|
||||||
|
return derivedKey;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Derives a key from a password.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} password The password.
|
||||||
|
* @param {WordArray|string} salt A salt.
|
||||||
|
* @param {Object} cfg (Optional) The configuration options to use for this computation.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The derived key.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var key = CryptoJS.EvpKDF(password, salt);
|
||||||
|
* var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
|
||||||
|
* var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
|
||||||
|
*/
|
||||||
|
C.EvpKDF = function(password, salt, cfg) {
|
||||||
|
return EvpKDF.create(cfg).compute(password, salt);
|
||||||
|
};
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cipher core components.
|
||||||
|
*/
|
||||||
|
CryptoJS.lib.Cipher || (function(undefined) {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var Base = C_lib.Base;
|
||||||
|
var WordArray = C_lib.WordArray;
|
||||||
|
var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
|
||||||
|
var C_enc = C.enc;
|
||||||
|
var Utf8 = C_enc.Utf8;
|
||||||
|
var Base64 = C_enc.Base64;
|
||||||
|
var C_algo = C.algo;
|
||||||
|
var EvpKDF = C_algo.EvpKDF;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract base cipher template.
|
||||||
|
*
|
||||||
|
* @property {number} keySize This cipher's key size. Default: 4 (128 bits)
|
||||||
|
* @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
|
||||||
|
* @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
|
||||||
|
* @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
|
||||||
|
*/
|
||||||
|
var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
|
||||||
|
/**
|
||||||
|
* Configuration options.
|
||||||
|
*
|
||||||
|
* @property {WordArray} iv The IV to use for this operation.
|
||||||
|
*/
|
||||||
|
cfg: Base.extend(),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates this cipher in encryption mode.
|
||||||
|
*
|
||||||
|
* @param {WordArray} key The key.
|
||||||
|
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
||||||
|
*
|
||||||
|
* @return {Cipher} A cipher instance.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
|
||||||
|
*/
|
||||||
|
createEncryptor: function(key, cfg) {
|
||||||
|
return this.create(this._ENC_XFORM_MODE, key, cfg);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates this cipher in decryption mode.
|
||||||
|
*
|
||||||
|
* @param {WordArray} key The key.
|
||||||
|
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
||||||
|
*
|
||||||
|
* @return {Cipher} A cipher instance.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
|
||||||
|
*/
|
||||||
|
createDecryptor: function(key, cfg) {
|
||||||
|
return this.create(this._DEC_XFORM_MODE, key, cfg);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes a newly created cipher.
|
||||||
|
*
|
||||||
|
* @param {number} xformMode Either the encryption or decryption transormation mode constant.
|
||||||
|
* @param {WordArray} key The key.
|
||||||
|
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
|
||||||
|
*/
|
||||||
|
init: function(xformMode, key, cfg) {
|
||||||
|
// Apply config defaults
|
||||||
|
this.cfg = this.cfg.extend(cfg);
|
||||||
|
|
||||||
|
// Store transform mode and key
|
||||||
|
this._xformMode = xformMode;
|
||||||
|
this._key = key;
|
||||||
|
|
||||||
|
// Set initial values
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets this cipher to its initial state.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* cipher.reset();
|
||||||
|
*/
|
||||||
|
reset: function() {
|
||||||
|
// Reset data buffer
|
||||||
|
BufferedBlockAlgorithm.reset.call(this);
|
||||||
|
|
||||||
|
// Perform concrete-cipher logic
|
||||||
|
this._doReset();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds data to be encrypted or decrypted.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The data after processing.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var encrypted = cipher.process('data');
|
||||||
|
* var encrypted = cipher.process(wordArray);
|
||||||
|
*/
|
||||||
|
process: function(dataUpdate) {
|
||||||
|
// Append
|
||||||
|
this._append(dataUpdate);
|
||||||
|
|
||||||
|
// Process available blocks
|
||||||
|
return this._process();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finalizes the encryption or decryption process.
|
||||||
|
* Note that the finalize operation is effectively a destructive, read-once operation.
|
||||||
|
*
|
||||||
|
* @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The data after final processing.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var encrypted = cipher.finalize();
|
||||||
|
* var encrypted = cipher.finalize('data');
|
||||||
|
* var encrypted = cipher.finalize(wordArray);
|
||||||
|
*/
|
||||||
|
finalize: function(dataUpdate) {
|
||||||
|
// Final data update
|
||||||
|
if (dataUpdate) {
|
||||||
|
this._append(dataUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform concrete-cipher logic
|
||||||
|
var finalProcessedData = this._doFinalize();
|
||||||
|
|
||||||
|
return finalProcessedData;
|
||||||
|
},
|
||||||
|
|
||||||
|
keySize: 128 / 32,
|
||||||
|
|
||||||
|
ivSize: 128 / 32,
|
||||||
|
|
||||||
|
_ENC_XFORM_MODE: 1,
|
||||||
|
|
||||||
|
_DEC_XFORM_MODE: 2,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates shortcut functions to a cipher's object interface.
|
||||||
|
*
|
||||||
|
* @param {Cipher} cipher The cipher to create a helper for.
|
||||||
|
*
|
||||||
|
* @return {Object} An object with encrypt and decrypt shortcut functions.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
|
||||||
|
*/
|
||||||
|
_createHelper: (function() {
|
||||||
|
function selectCipherStrategy(key) {
|
||||||
|
if (typeof key == 'string') {
|
||||||
|
return PasswordBasedCipher;
|
||||||
|
} else {
|
||||||
|
return SerializableCipher;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return function(cipher) {
|
||||||
|
return {
|
||||||
|
encrypt: function(message, key, cfg) {
|
||||||
|
return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
|
||||||
|
},
|
||||||
|
|
||||||
|
decrypt: function(ciphertext, key, cfg) {
|
||||||
|
return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}())
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract base stream cipher template.
|
||||||
|
*
|
||||||
|
* @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
|
||||||
|
*/
|
||||||
|
var StreamCipher = C_lib.StreamCipher = Cipher.extend({
|
||||||
|
_doFinalize: function() {
|
||||||
|
// Process partial blocks
|
||||||
|
var finalProcessedBlocks = this._process(!!'flush');
|
||||||
|
|
||||||
|
return finalProcessedBlocks;
|
||||||
|
},
|
||||||
|
|
||||||
|
blockSize: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mode namespace.
|
||||||
|
*/
|
||||||
|
var C_mode = C.mode = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract base block cipher mode template.
|
||||||
|
*/
|
||||||
|
var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
|
||||||
|
/**
|
||||||
|
* Creates this mode for encryption.
|
||||||
|
*
|
||||||
|
* @param {Cipher} cipher A block cipher instance.
|
||||||
|
* @param {Array} iv The IV words.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
|
||||||
|
*/
|
||||||
|
createEncryptor: function(cipher, iv) {
|
||||||
|
return this.Encryptor.create(cipher, iv);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates this mode for decryption.
|
||||||
|
*
|
||||||
|
* @param {Cipher} cipher A block cipher instance.
|
||||||
|
* @param {Array} iv The IV words.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
|
||||||
|
*/
|
||||||
|
createDecryptor: function(cipher, iv) {
|
||||||
|
return this.Decryptor.create(cipher, iv);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes a newly created mode.
|
||||||
|
*
|
||||||
|
* @param {Cipher} cipher A block cipher instance.
|
||||||
|
* @param {Array} iv The IV words.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
|
||||||
|
*/
|
||||||
|
init: function(cipher, iv) {
|
||||||
|
this._cipher = cipher;
|
||||||
|
this._iv = iv;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cipher Block Chaining mode.
|
||||||
|
*/
|
||||||
|
var CBC = C_mode.CBC = (function() {
|
||||||
|
/**
|
||||||
|
* Abstract base CBC mode.
|
||||||
|
*/
|
||||||
|
var CBC = BlockCipherMode.extend();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CBC encryptor.
|
||||||
|
*/
|
||||||
|
CBC.Encryptor = CBC.extend({
|
||||||
|
/**
|
||||||
|
* Processes the data block at offset.
|
||||||
|
*
|
||||||
|
* @param {Array} words The data words to operate on.
|
||||||
|
* @param {number} offset The offset where the block starts.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* mode.processBlock(data.words, offset);
|
||||||
|
*/
|
||||||
|
processBlock: function(words, offset) {
|
||||||
|
// Shortcuts
|
||||||
|
var cipher = this._cipher;
|
||||||
|
var blockSize = cipher.blockSize;
|
||||||
|
|
||||||
|
// XOR and encrypt
|
||||||
|
xorBlock.call(this, words, offset, blockSize);
|
||||||
|
cipher.encryptBlock(words, offset);
|
||||||
|
|
||||||
|
// Remember this block to use with next block
|
||||||
|
this._prevBlock = words.slice(offset, offset + blockSize);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CBC decryptor.
|
||||||
|
*/
|
||||||
|
CBC.Decryptor = CBC.extend({
|
||||||
|
/**
|
||||||
|
* Processes the data block at offset.
|
||||||
|
*
|
||||||
|
* @param {Array} words The data words to operate on.
|
||||||
|
* @param {number} offset The offset where the block starts.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* mode.processBlock(data.words, offset);
|
||||||
|
*/
|
||||||
|
processBlock: function(words, offset) {
|
||||||
|
// Shortcuts
|
||||||
|
var cipher = this._cipher;
|
||||||
|
var blockSize = cipher.blockSize;
|
||||||
|
|
||||||
|
// Remember this block to use with next block
|
||||||
|
var thisBlock = words.slice(offset, offset + blockSize);
|
||||||
|
|
||||||
|
// Decrypt and XOR
|
||||||
|
cipher.decryptBlock(words, offset);
|
||||||
|
xorBlock.call(this, words, offset, blockSize);
|
||||||
|
|
||||||
|
// This block becomes the previous block
|
||||||
|
this._prevBlock = thisBlock;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function xorBlock(words, offset, blockSize) {
|
||||||
|
var block;
|
||||||
|
|
||||||
|
// Shortcut
|
||||||
|
var iv = this._iv;
|
||||||
|
|
||||||
|
// Choose mixing block
|
||||||
|
if (iv) {
|
||||||
|
block = iv;
|
||||||
|
|
||||||
|
// Remove IV for subsequent blocks
|
||||||
|
this._iv = undefined;
|
||||||
|
} else {
|
||||||
|
block = this._prevBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
// XOR blocks
|
||||||
|
for (var i = 0; i < blockSize; i++) {
|
||||||
|
words[offset + i] ^= block[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return CBC;
|
||||||
|
}());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Padding namespace.
|
||||||
|
*/
|
||||||
|
var C_pad = C.pad = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PKCS #5/7 padding strategy.
|
||||||
|
*/
|
||||||
|
var Pkcs7 = C_pad.Pkcs7 = {
|
||||||
|
/**
|
||||||
|
* Pads data using the algorithm defined in PKCS #5/7.
|
||||||
|
*
|
||||||
|
* @param {WordArray} data The data to pad.
|
||||||
|
* @param {number} blockSize The multiple that the data should be padded to.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* CryptoJS.pad.Pkcs7.pad(wordArray, 4);
|
||||||
|
*/
|
||||||
|
pad: function(data, blockSize) {
|
||||||
|
// Shortcut
|
||||||
|
var blockSizeBytes = blockSize * 4;
|
||||||
|
|
||||||
|
// Count padding bytes
|
||||||
|
var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
|
||||||
|
|
||||||
|
// Create padding word
|
||||||
|
var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes;
|
||||||
|
|
||||||
|
// Create padding
|
||||||
|
var paddingWords = [];
|
||||||
|
for (var i = 0; i < nPaddingBytes; i += 4) {
|
||||||
|
paddingWords.push(paddingWord);
|
||||||
|
}
|
||||||
|
var padding = WordArray.create(paddingWords, nPaddingBytes);
|
||||||
|
|
||||||
|
// Add padding
|
||||||
|
data.concat(padding);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unpads data that had been padded using the algorithm defined in PKCS #5/7.
|
||||||
|
*
|
||||||
|
* @param {WordArray} data The data to unpad.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* CryptoJS.pad.Pkcs7.unpad(wordArray);
|
||||||
|
*/
|
||||||
|
unpad: function(data) {
|
||||||
|
// Get number of padding bytes from last byte
|
||||||
|
var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
|
||||||
|
|
||||||
|
// Remove padding
|
||||||
|
data.sigBytes -= nPaddingBytes;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract base block cipher template.
|
||||||
|
*
|
||||||
|
* @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
|
||||||
|
*/
|
||||||
|
var BlockCipher = C_lib.BlockCipher = Cipher.extend({
|
||||||
|
/**
|
||||||
|
* Configuration options.
|
||||||
|
*
|
||||||
|
* @property {Mode} mode The block mode to use. Default: CBC
|
||||||
|
* @property {Padding} padding The padding strategy to use. Default: Pkcs7
|
||||||
|
*/
|
||||||
|
cfg: Cipher.cfg.extend({
|
||||||
|
mode: CBC,
|
||||||
|
padding: Pkcs7
|
||||||
|
}),
|
||||||
|
|
||||||
|
reset: function() {
|
||||||
|
var modeCreator;
|
||||||
|
|
||||||
|
// Reset cipher
|
||||||
|
Cipher.reset.call(this);
|
||||||
|
|
||||||
|
// Shortcuts
|
||||||
|
var cfg = this.cfg;
|
||||||
|
var iv = cfg.iv;
|
||||||
|
var mode = cfg.mode;
|
||||||
|
|
||||||
|
// Reset block mode
|
||||||
|
if (this._xformMode == this._ENC_XFORM_MODE) {
|
||||||
|
modeCreator = mode.createEncryptor;
|
||||||
|
} else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
|
||||||
|
modeCreator = mode.createDecryptor;
|
||||||
|
// Keep at least one block in the buffer for unpadding
|
||||||
|
this._minBufferSize = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._mode && this._mode.__creator == modeCreator) {
|
||||||
|
this._mode.init(this, iv && iv.words);
|
||||||
|
} else {
|
||||||
|
this._mode = modeCreator.call(mode, this, iv && iv.words);
|
||||||
|
this._mode.__creator = modeCreator;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_doProcessBlock: function(words, offset) {
|
||||||
|
this._mode.processBlock(words, offset);
|
||||||
|
},
|
||||||
|
|
||||||
|
_doFinalize: function() {
|
||||||
|
var finalProcessedBlocks;
|
||||||
|
|
||||||
|
// Shortcut
|
||||||
|
var padding = this.cfg.padding;
|
||||||
|
|
||||||
|
// Finalize
|
||||||
|
if (this._xformMode == this._ENC_XFORM_MODE) {
|
||||||
|
// Pad data
|
||||||
|
padding.pad(this._data, this.blockSize);
|
||||||
|
|
||||||
|
// Process final blocks
|
||||||
|
finalProcessedBlocks = this._process(!!'flush');
|
||||||
|
} else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
|
||||||
|
// Process final blocks
|
||||||
|
finalProcessedBlocks = this._process(!!'flush');
|
||||||
|
|
||||||
|
// Unpad data
|
||||||
|
padding.unpad(finalProcessedBlocks);
|
||||||
|
}
|
||||||
|
|
||||||
|
return finalProcessedBlocks;
|
||||||
|
},
|
||||||
|
|
||||||
|
blockSize: 128 / 32
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A collection of cipher parameters.
|
||||||
|
*
|
||||||
|
* @property {WordArray} ciphertext The raw ciphertext.
|
||||||
|
* @property {WordArray} key The key to this ciphertext.
|
||||||
|
* @property {WordArray} iv The IV used in the ciphering operation.
|
||||||
|
* @property {WordArray} salt The salt used with a key derivation function.
|
||||||
|
* @property {Cipher} algorithm The cipher algorithm.
|
||||||
|
* @property {Mode} mode The block mode used in the ciphering operation.
|
||||||
|
* @property {Padding} padding The padding scheme used in the ciphering operation.
|
||||||
|
* @property {number} blockSize The block size of the cipher.
|
||||||
|
* @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
|
||||||
|
*/
|
||||||
|
var CipherParams = C_lib.CipherParams = Base.extend({
|
||||||
|
/**
|
||||||
|
* Initializes a newly created cipher params object.
|
||||||
|
*
|
||||||
|
* @param {Object} cipherParams An object with any of the possible cipher parameters.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var cipherParams = CryptoJS.lib.CipherParams.create({
|
||||||
|
* ciphertext: ciphertextWordArray,
|
||||||
|
* key: keyWordArray,
|
||||||
|
* iv: ivWordArray,
|
||||||
|
* salt: saltWordArray,
|
||||||
|
* algorithm: CryptoJS.algo.AES,
|
||||||
|
* mode: CryptoJS.mode.CBC,
|
||||||
|
* padding: CryptoJS.pad.PKCS7,
|
||||||
|
* blockSize: 4,
|
||||||
|
* formatter: CryptoJS.format.OpenSSL
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
init: function(cipherParams) {
|
||||||
|
this.mixIn(cipherParams);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts this cipher params object to a string.
|
||||||
|
*
|
||||||
|
* @param {Format} formatter (Optional) The formatting strategy to use.
|
||||||
|
*
|
||||||
|
* @return {string} The stringified cipher params.
|
||||||
|
*
|
||||||
|
* @throws Error If neither the formatter nor the default formatter is set.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var string = cipherParams + '';
|
||||||
|
* var string = cipherParams.toString();
|
||||||
|
* var string = cipherParams.toString(CryptoJS.format.OpenSSL);
|
||||||
|
*/
|
||||||
|
toString: function(formatter) {
|
||||||
|
return (formatter || this.formatter).stringify(this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format namespace.
|
||||||
|
*/
|
||||||
|
var C_format = C.format = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OpenSSL formatting strategy.
|
||||||
|
*/
|
||||||
|
var OpenSSLFormatter = C_format.OpenSSL = {
|
||||||
|
/**
|
||||||
|
* Converts a cipher params object to an OpenSSL-compatible string.
|
||||||
|
*
|
||||||
|
* @param {CipherParams} cipherParams The cipher params object.
|
||||||
|
*
|
||||||
|
* @return {string} The OpenSSL-compatible string.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
|
||||||
|
*/
|
||||||
|
stringify: function(cipherParams) {
|
||||||
|
var wordArray;
|
||||||
|
|
||||||
|
// Shortcuts
|
||||||
|
var ciphertext = cipherParams.ciphertext;
|
||||||
|
var salt = cipherParams.salt;
|
||||||
|
|
||||||
|
// Format
|
||||||
|
if (salt) {
|
||||||
|
wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
|
||||||
|
} else {
|
||||||
|
wordArray = ciphertext;
|
||||||
|
}
|
||||||
|
|
||||||
|
return wordArray.toString(Base64);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts an OpenSSL-compatible string to a cipher params object.
|
||||||
|
*
|
||||||
|
* @param {string} openSSLStr The OpenSSL-compatible string.
|
||||||
|
*
|
||||||
|
* @return {CipherParams} The cipher params object.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
|
||||||
|
*/
|
||||||
|
parse: function(openSSLStr) {
|
||||||
|
var salt;
|
||||||
|
|
||||||
|
// Parse base64
|
||||||
|
var ciphertext = Base64.parse(openSSLStr);
|
||||||
|
|
||||||
|
// Shortcut
|
||||||
|
var ciphertextWords = ciphertext.words;
|
||||||
|
|
||||||
|
// Test for salt
|
||||||
|
if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
|
||||||
|
// Extract salt
|
||||||
|
salt = WordArray.create(ciphertextWords.slice(2, 4));
|
||||||
|
|
||||||
|
// Remove salt from ciphertext
|
||||||
|
ciphertextWords.splice(0, 4);
|
||||||
|
ciphertext.sigBytes -= 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CipherParams.create({
|
||||||
|
ciphertext: ciphertext,
|
||||||
|
salt: salt
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A cipher wrapper that returns ciphertext as a serializable cipher params object.
|
||||||
|
*/
|
||||||
|
var SerializableCipher = C_lib.SerializableCipher = Base.extend({
|
||||||
|
/**
|
||||||
|
* Configuration options.
|
||||||
|
*
|
||||||
|
* @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
|
||||||
|
*/
|
||||||
|
cfg: Base.extend({
|
||||||
|
format: OpenSSLFormatter
|
||||||
|
}),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encrypts a message.
|
||||||
|
*
|
||||||
|
* @param {Cipher} cipher The cipher algorithm to use.
|
||||||
|
* @param {WordArray|string} message The message to encrypt.
|
||||||
|
* @param {WordArray} key The key.
|
||||||
|
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
||||||
|
*
|
||||||
|
* @return {CipherParams} A cipher params object.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
|
||||||
|
* var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
|
||||||
|
* var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
|
||||||
|
*/
|
||||||
|
encrypt: function(cipher, message, key, cfg) {
|
||||||
|
// Apply config defaults
|
||||||
|
cfg = this.cfg.extend(cfg);
|
||||||
|
|
||||||
|
// Encrypt
|
||||||
|
var encryptor = cipher.createEncryptor(key, cfg);
|
||||||
|
var ciphertext = encryptor.finalize(message);
|
||||||
|
|
||||||
|
// Shortcut
|
||||||
|
var cipherCfg = encryptor.cfg;
|
||||||
|
|
||||||
|
// Create and return serializable cipher params
|
||||||
|
return CipherParams.create({
|
||||||
|
ciphertext: ciphertext,
|
||||||
|
key: key,
|
||||||
|
iv: cipherCfg.iv,
|
||||||
|
algorithm: cipher,
|
||||||
|
mode: cipherCfg.mode,
|
||||||
|
padding: cipherCfg.padding,
|
||||||
|
blockSize: cipher.blockSize,
|
||||||
|
formatter: cfg.format
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrypts serialized ciphertext.
|
||||||
|
*
|
||||||
|
* @param {Cipher} cipher The cipher algorithm to use.
|
||||||
|
* @param {CipherParams|string} ciphertext The ciphertext to decrypt.
|
||||||
|
* @param {WordArray} key The key.
|
||||||
|
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The plaintext.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
|
||||||
|
* var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
|
||||||
|
*/
|
||||||
|
decrypt: function(cipher, ciphertext, key, cfg) {
|
||||||
|
// Apply config defaults
|
||||||
|
cfg = this.cfg.extend(cfg);
|
||||||
|
|
||||||
|
// Convert string to CipherParams
|
||||||
|
ciphertext = this._parse(ciphertext, cfg.format);
|
||||||
|
|
||||||
|
// Decrypt
|
||||||
|
var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
|
||||||
|
|
||||||
|
return plaintext;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts serialized ciphertext to CipherParams,
|
||||||
|
* else assumed CipherParams already and returns ciphertext unchanged.
|
||||||
|
*
|
||||||
|
* @param {CipherParams|string} ciphertext The ciphertext.
|
||||||
|
* @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
|
||||||
|
*
|
||||||
|
* @return {CipherParams} The unserialized ciphertext.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
|
||||||
|
*/
|
||||||
|
_parse: function(ciphertext, format) {
|
||||||
|
if (typeof ciphertext == 'string') {
|
||||||
|
return format.parse(ciphertext, this);
|
||||||
|
} else {
|
||||||
|
return ciphertext;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Key derivation function namespace.
|
||||||
|
*/
|
||||||
|
var C_kdf = C.kdf = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OpenSSL key derivation function.
|
||||||
|
*/
|
||||||
|
var OpenSSLKdf = C_kdf.OpenSSL = {
|
||||||
|
/**
|
||||||
|
* Derives a key and IV from a password.
|
||||||
|
*
|
||||||
|
* @param {string} password The password to derive from.
|
||||||
|
* @param {number} keySize The size in words of the key to generate.
|
||||||
|
* @param {number} ivSize The size in words of the IV to generate.
|
||||||
|
* @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
|
||||||
|
*
|
||||||
|
* @return {CipherParams} A cipher params object with the key, IV, and salt.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
|
||||||
|
* var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
|
||||||
|
*/
|
||||||
|
execute: function(password, keySize, ivSize, salt) {
|
||||||
|
// Generate random salt
|
||||||
|
if (!salt) {
|
||||||
|
salt = WordArray.random(64 / 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Derive key and IV
|
||||||
|
var key = EvpKDF.create({
|
||||||
|
keySize: keySize + ivSize
|
||||||
|
}).compute(password, salt);
|
||||||
|
|
||||||
|
// Separate key and IV
|
||||||
|
var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
|
||||||
|
key.sigBytes = keySize * 4;
|
||||||
|
|
||||||
|
// Return params
|
||||||
|
return CipherParams.create({
|
||||||
|
key: key,
|
||||||
|
iv: iv,
|
||||||
|
salt: salt
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A serializable cipher wrapper that derives the key from a password,
|
||||||
|
* and returns ciphertext as a serializable cipher params object.
|
||||||
|
*/
|
||||||
|
var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
|
||||||
|
/**
|
||||||
|
* Configuration options.
|
||||||
|
*
|
||||||
|
* @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
|
||||||
|
*/
|
||||||
|
cfg: SerializableCipher.cfg.extend({
|
||||||
|
kdf: OpenSSLKdf
|
||||||
|
}),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encrypts a message using a password.
|
||||||
|
*
|
||||||
|
* @param {Cipher} cipher The cipher algorithm to use.
|
||||||
|
* @param {WordArray|string} message The message to encrypt.
|
||||||
|
* @param {string} password The password.
|
||||||
|
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
||||||
|
*
|
||||||
|
* @return {CipherParams} A cipher params object.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
|
||||||
|
* var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
|
||||||
|
*/
|
||||||
|
encrypt: function(cipher, message, password, cfg) {
|
||||||
|
// Apply config defaults
|
||||||
|
cfg = this.cfg.extend(cfg);
|
||||||
|
|
||||||
|
// Derive key and other params
|
||||||
|
var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize);
|
||||||
|
|
||||||
|
// Add IV to config
|
||||||
|
cfg.iv = derivedParams.iv;
|
||||||
|
|
||||||
|
// Encrypt
|
||||||
|
var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
|
||||||
|
|
||||||
|
// Mix in derived params
|
||||||
|
ciphertext.mixIn(derivedParams);
|
||||||
|
|
||||||
|
return ciphertext;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrypts serialized ciphertext using a password.
|
||||||
|
*
|
||||||
|
* @param {Cipher} cipher The cipher algorithm to use.
|
||||||
|
* @param {CipherParams|string} ciphertext The ciphertext to decrypt.
|
||||||
|
* @param {string} password The password.
|
||||||
|
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
||||||
|
*
|
||||||
|
* @return {WordArray} The plaintext.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
|
||||||
|
* var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
|
||||||
|
*/
|
||||||
|
decrypt: function(cipher, ciphertext, password, cfg) {
|
||||||
|
// Apply config defaults
|
||||||
|
cfg = this.cfg.extend(cfg);
|
||||||
|
|
||||||
|
// Convert string to CipherParams
|
||||||
|
ciphertext = this._parse(ciphertext, cfg.format);
|
||||||
|
|
||||||
|
// Derive key and other params
|
||||||
|
var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt);
|
||||||
|
|
||||||
|
// Add IV to config
|
||||||
|
cfg.iv = derivedParams.iv;
|
||||||
|
|
||||||
|
// Decrypt
|
||||||
|
var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
|
||||||
|
|
||||||
|
return plaintext;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cipher Feedback block mode.
|
||||||
|
*/
|
||||||
|
CryptoJS.mode.CFB = (function() {
|
||||||
|
var CFB = CryptoJS.lib.BlockCipherMode.extend();
|
||||||
|
|
||||||
|
CFB.Encryptor = CFB.extend({
|
||||||
|
processBlock: function(words, offset) {
|
||||||
|
// Shortcuts
|
||||||
|
var cipher = this._cipher;
|
||||||
|
var blockSize = cipher.blockSize;
|
||||||
|
|
||||||
|
generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
|
||||||
|
|
||||||
|
// Remember this block to use with next block
|
||||||
|
this._prevBlock = words.slice(offset, offset + blockSize);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
CFB.Decryptor = CFB.extend({
|
||||||
|
processBlock: function(words, offset) {
|
||||||
|
// Shortcuts
|
||||||
|
var cipher = this._cipher;
|
||||||
|
var blockSize = cipher.blockSize;
|
||||||
|
|
||||||
|
// Remember this block to use with next block
|
||||||
|
var thisBlock = words.slice(offset, offset + blockSize);
|
||||||
|
|
||||||
|
generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
|
||||||
|
|
||||||
|
// This block becomes the previous block
|
||||||
|
this._prevBlock = thisBlock;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) {
|
||||||
|
var keystream;
|
||||||
|
|
||||||
|
// Shortcut
|
||||||
|
var iv = this._iv;
|
||||||
|
|
||||||
|
// Generate keystream
|
||||||
|
if (iv) {
|
||||||
|
keystream = iv.slice(0);
|
||||||
|
|
||||||
|
// Remove IV for subsequent blocks
|
||||||
|
this._iv = undefined;
|
||||||
|
} else {
|
||||||
|
keystream = this._prevBlock;
|
||||||
|
}
|
||||||
|
cipher.encryptBlock(keystream, 0);
|
||||||
|
|
||||||
|
// Encrypt
|
||||||
|
for (var i = 0; i < blockSize; i++) {
|
||||||
|
words[offset + i] ^= keystream[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return CFB;
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Counter block mode.
|
||||||
|
*/
|
||||||
|
CryptoJS.mode.CTR = (function() {
|
||||||
|
var CTR = CryptoJS.lib.BlockCipherMode.extend();
|
||||||
|
|
||||||
|
var Encryptor = CTR.Encryptor = CTR.extend({
|
||||||
|
processBlock: function(words, offset) {
|
||||||
|
// Shortcuts
|
||||||
|
var cipher = this._cipher
|
||||||
|
var blockSize = cipher.blockSize;
|
||||||
|
var iv = this._iv;
|
||||||
|
var counter = this._counter;
|
||||||
|
|
||||||
|
// Generate keystream
|
||||||
|
if (iv) {
|
||||||
|
counter = this._counter = iv.slice(0);
|
||||||
|
|
||||||
|
// Remove IV for subsequent blocks
|
||||||
|
this._iv = undefined;
|
||||||
|
}
|
||||||
|
var keystream = counter.slice(0);
|
||||||
|
cipher.encryptBlock(keystream, 0);
|
||||||
|
|
||||||
|
// Increment counter
|
||||||
|
counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0
|
||||||
|
|
||||||
|
// Encrypt
|
||||||
|
for (var i = 0; i < blockSize; i++) {
|
||||||
|
words[offset + i] ^= keystream[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
CTR.Decryptor = Encryptor;
|
||||||
|
|
||||||
|
return CTR;
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
/** @preserve
|
||||||
|
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
||||||
|
* derived from CryptoJS.mode.CTR
|
||||||
|
* Jan Hruby jhruby.web@gmail.com
|
||||||
|
*/
|
||||||
|
CryptoJS.mode.CTRGladman = (function() {
|
||||||
|
var CTRGladman = CryptoJS.lib.BlockCipherMode.extend();
|
||||||
|
|
||||||
|
function incWord(word) {
|
||||||
|
if (((word >> 24) & 0xff) === 0xff) { //overflow
|
||||||
|
var b1 = (word >> 16) & 0xff;
|
||||||
|
var b2 = (word >> 8) & 0xff;
|
||||||
|
var b3 = word & 0xff;
|
||||||
|
|
||||||
|
if (b1 === 0xff) // overflow b1
|
||||||
|
{
|
||||||
|
b1 = 0;
|
||||||
|
if (b2 === 0xff) {
|
||||||
|
b2 = 0;
|
||||||
|
if (b3 === 0xff) {
|
||||||
|
b3 = 0;
|
||||||
|
} else {
|
||||||
|
++b3;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
++b2;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
++b1;
|
||||||
|
}
|
||||||
|
|
||||||
|
word = 0;
|
||||||
|
word += (b1 << 16);
|
||||||
|
word += (b2 << 8);
|
||||||
|
word += b3;
|
||||||
|
} else {
|
||||||
|
word += (0x01 << 24);
|
||||||
|
}
|
||||||
|
return word;
|
||||||
|
}
|
||||||
|
|
||||||
|
function incCounter(counter) {
|
||||||
|
if ((counter[0] = incWord(counter[0])) === 0) {
|
||||||
|
// encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8
|
||||||
|
counter[1] = incWord(counter[1]);
|
||||||
|
}
|
||||||
|
return counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({
|
||||||
|
processBlock: function(words, offset) {
|
||||||
|
// Shortcuts
|
||||||
|
var cipher = this._cipher
|
||||||
|
var blockSize = cipher.blockSize;
|
||||||
|
var iv = this._iv;
|
||||||
|
var counter = this._counter;
|
||||||
|
|
||||||
|
// Generate keystream
|
||||||
|
if (iv) {
|
||||||
|
counter = this._counter = iv.slice(0);
|
||||||
|
|
||||||
|
// Remove IV for subsequent blocks
|
||||||
|
this._iv = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
incCounter(counter);
|
||||||
|
|
||||||
|
var keystream = counter.slice(0);
|
||||||
|
cipher.encryptBlock(keystream, 0);
|
||||||
|
|
||||||
|
// Encrypt
|
||||||
|
for (var i = 0; i < blockSize; i++) {
|
||||||
|
words[offset + i] ^= keystream[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
CTRGladman.Decryptor = Encryptor;
|
||||||
|
|
||||||
|
return CTRGladman;
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output Feedback block mode.
|
||||||
|
*/
|
||||||
|
CryptoJS.mode.OFB = (function() {
|
||||||
|
var OFB = CryptoJS.lib.BlockCipherMode.extend();
|
||||||
|
|
||||||
|
var Encryptor = OFB.Encryptor = OFB.extend({
|
||||||
|
processBlock: function(words, offset) {
|
||||||
|
// Shortcuts
|
||||||
|
var cipher = this._cipher
|
||||||
|
var blockSize = cipher.blockSize;
|
||||||
|
var iv = this._iv;
|
||||||
|
var keystream = this._keystream;
|
||||||
|
|
||||||
|
// Generate keystream
|
||||||
|
if (iv) {
|
||||||
|
keystream = this._keystream = iv.slice(0);
|
||||||
|
|
||||||
|
// Remove IV for subsequent blocks
|
||||||
|
this._iv = undefined;
|
||||||
|
}
|
||||||
|
cipher.encryptBlock(keystream, 0);
|
||||||
|
|
||||||
|
// Encrypt
|
||||||
|
for (var i = 0; i < blockSize; i++) {
|
||||||
|
words[offset + i] ^= keystream[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
OFB.Decryptor = Encryptor;
|
||||||
|
|
||||||
|
return OFB;
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Electronic Codebook block mode.
|
||||||
|
*/
|
||||||
|
CryptoJS.mode.ECB = (function() {
|
||||||
|
var ECB = CryptoJS.lib.BlockCipherMode.extend();
|
||||||
|
|
||||||
|
ECB.Encryptor = ECB.extend({
|
||||||
|
processBlock: function(words, offset) {
|
||||||
|
this._cipher.encryptBlock(words, offset);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ECB.Decryptor = ECB.extend({
|
||||||
|
processBlock: function(words, offset) {
|
||||||
|
this._cipher.decryptBlock(words, offset);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return ECB;
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ANSI X.923 padding strategy.
|
||||||
|
*/
|
||||||
|
CryptoJS.pad.AnsiX923 = {
|
||||||
|
pad: function(data, blockSize) {
|
||||||
|
// Shortcuts
|
||||||
|
var dataSigBytes = data.sigBytes;
|
||||||
|
var blockSizeBytes = blockSize * 4;
|
||||||
|
|
||||||
|
// Count padding bytes
|
||||||
|
var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes;
|
||||||
|
|
||||||
|
// Compute last byte position
|
||||||
|
var lastBytePos = dataSigBytes + nPaddingBytes - 1;
|
||||||
|
|
||||||
|
// Pad
|
||||||
|
data.clamp();
|
||||||
|
data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8);
|
||||||
|
data.sigBytes += nPaddingBytes;
|
||||||
|
},
|
||||||
|
|
||||||
|
unpad: function(data) {
|
||||||
|
// Get number of padding bytes from last byte
|
||||||
|
var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
|
||||||
|
|
||||||
|
// Remove padding
|
||||||
|
data.sigBytes -= nPaddingBytes;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ISO 10126 padding strategy.
|
||||||
|
*/
|
||||||
|
CryptoJS.pad.Iso10126 = {
|
||||||
|
pad: function(data, blockSize) {
|
||||||
|
// Shortcut
|
||||||
|
var blockSizeBytes = blockSize * 4;
|
||||||
|
|
||||||
|
// Count padding bytes
|
||||||
|
var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
|
||||||
|
|
||||||
|
// Pad
|
||||||
|
data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)).
|
||||||
|
concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1));
|
||||||
|
},
|
||||||
|
|
||||||
|
unpad: function(data) {
|
||||||
|
// Get number of padding bytes from last byte
|
||||||
|
var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
|
||||||
|
|
||||||
|
// Remove padding
|
||||||
|
data.sigBytes -= nPaddingBytes;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ISO/IEC 9797-1 Padding Method 2.
|
||||||
|
*/
|
||||||
|
CryptoJS.pad.Iso97971 = {
|
||||||
|
pad: function(data, blockSize) {
|
||||||
|
// Add 0x80 byte
|
||||||
|
data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1));
|
||||||
|
|
||||||
|
// Zero pad the rest
|
||||||
|
CryptoJS.pad.ZeroPadding.pad(data, blockSize);
|
||||||
|
},
|
||||||
|
|
||||||
|
unpad: function(data) {
|
||||||
|
// Remove zero padding
|
||||||
|
CryptoJS.pad.ZeroPadding.unpad(data);
|
||||||
|
|
||||||
|
// Remove one more byte -- the 0x80 byte
|
||||||
|
data.sigBytes--;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zero padding strategy.
|
||||||
|
*/
|
||||||
|
CryptoJS.pad.ZeroPadding = {
|
||||||
|
pad: function(data, blockSize) {
|
||||||
|
// Shortcut
|
||||||
|
var blockSizeBytes = blockSize * 4;
|
||||||
|
|
||||||
|
// Pad
|
||||||
|
data.clamp();
|
||||||
|
data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes);
|
||||||
|
},
|
||||||
|
|
||||||
|
unpad: function(data) {
|
||||||
|
// Shortcut
|
||||||
|
var dataWords = data.words;
|
||||||
|
|
||||||
|
// Unpad
|
||||||
|
var i = data.sigBytes - 1;
|
||||||
|
for (var i = data.sigBytes - 1; i >= 0; i--) {
|
||||||
|
if (((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) {
|
||||||
|
data.sigBytes = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A noop padding strategy.
|
||||||
|
*/
|
||||||
|
CryptoJS.pad.NoPadding = {
|
||||||
|
pad: function() {},
|
||||||
|
|
||||||
|
unpad: function() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
(function(undefined) {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var CipherParams = C_lib.CipherParams;
|
||||||
|
var C_enc = C.enc;
|
||||||
|
var Hex = C_enc.Hex;
|
||||||
|
var C_format = C.format;
|
||||||
|
|
||||||
|
var HexFormatter = C_format.Hex = {
|
||||||
|
/**
|
||||||
|
* Converts the ciphertext of a cipher params object to a hexadecimally encoded string.
|
||||||
|
*
|
||||||
|
* @param {CipherParams} cipherParams The cipher params object.
|
||||||
|
*
|
||||||
|
* @return {string} The hexadecimally encoded string.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var hexString = CryptoJS.format.Hex.stringify(cipherParams);
|
||||||
|
*/
|
||||||
|
stringify: function(cipherParams) {
|
||||||
|
return cipherParams.ciphertext.toString(Hex);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a hexadecimally encoded ciphertext string to a cipher params object.
|
||||||
|
*
|
||||||
|
* @param {string} input The hexadecimally encoded string.
|
||||||
|
*
|
||||||
|
* @return {CipherParams} The cipher params object.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var cipherParams = CryptoJS.format.Hex.parse(hexString);
|
||||||
|
*/
|
||||||
|
parse: function(input) {
|
||||||
|
var ciphertext = Hex.parse(input);
|
||||||
|
return CipherParams.create({
|
||||||
|
ciphertext: ciphertext
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var BlockCipher = C_lib.BlockCipher;
|
||||||
|
var C_algo = C.algo;
|
||||||
|
|
||||||
|
// Lookup tables
|
||||||
|
var SBOX = [];
|
||||||
|
var INV_SBOX = [];
|
||||||
|
var SUB_MIX_0 = [];
|
||||||
|
var SUB_MIX_1 = [];
|
||||||
|
var SUB_MIX_2 = [];
|
||||||
|
var SUB_MIX_3 = [];
|
||||||
|
var INV_SUB_MIX_0 = [];
|
||||||
|
var INV_SUB_MIX_1 = [];
|
||||||
|
var INV_SUB_MIX_2 = [];
|
||||||
|
var INV_SUB_MIX_3 = [];
|
||||||
|
|
||||||
|
// Compute lookup tables
|
||||||
|
(function() {
|
||||||
|
// Compute double table
|
||||||
|
var d = [];
|
||||||
|
for (var i = 0; i < 256; i++) {
|
||||||
|
if (i < 128) {
|
||||||
|
d[i] = i << 1;
|
||||||
|
} else {
|
||||||
|
d[i] = (i << 1) ^ 0x11b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Walk GF(2^8)
|
||||||
|
var x = 0;
|
||||||
|
var xi = 0;
|
||||||
|
for (var i = 0; i < 256; i++) {
|
||||||
|
// Compute sbox
|
||||||
|
var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
|
||||||
|
sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
|
||||||
|
SBOX[x] = sx;
|
||||||
|
INV_SBOX[sx] = x;
|
||||||
|
|
||||||
|
// Compute multiplication
|
||||||
|
var x2 = d[x];
|
||||||
|
var x4 = d[x2];
|
||||||
|
var x8 = d[x4];
|
||||||
|
|
||||||
|
// Compute sub bytes, mix columns tables
|
||||||
|
var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
|
||||||
|
SUB_MIX_0[x] = (t << 24) | (t >>> 8);
|
||||||
|
SUB_MIX_1[x] = (t << 16) | (t >>> 16);
|
||||||
|
SUB_MIX_2[x] = (t << 8) | (t >>> 24);
|
||||||
|
SUB_MIX_3[x] = t;
|
||||||
|
|
||||||
|
// Compute inv sub bytes, inv mix columns tables
|
||||||
|
var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
|
||||||
|
INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
|
||||||
|
INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
|
||||||
|
INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);
|
||||||
|
INV_SUB_MIX_3[sx] = t;
|
||||||
|
|
||||||
|
// Compute next counter
|
||||||
|
if (!x) {
|
||||||
|
x = xi = 1;
|
||||||
|
} else {
|
||||||
|
x = x2 ^ d[d[d[x8 ^ x2]]];
|
||||||
|
xi ^= d[d[xi]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}());
|
||||||
|
|
||||||
|
// Precomputed Rcon lookup
|
||||||
|
var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AES block cipher algorithm.
|
||||||
|
*/
|
||||||
|
var AES = C_algo.AES = BlockCipher.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
var t;
|
||||||
|
|
||||||
|
// Skip reset of nRounds has been set before and key did not change
|
||||||
|
if (this._nRounds && this._keyPriorReset === this._key) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shortcuts
|
||||||
|
var key = this._keyPriorReset = this._key;
|
||||||
|
var keyWords = key.words;
|
||||||
|
var keySize = key.sigBytes / 4;
|
||||||
|
|
||||||
|
// Compute number of rounds
|
||||||
|
var nRounds = this._nRounds = keySize + 6;
|
||||||
|
|
||||||
|
// Compute number of key schedule rows
|
||||||
|
var ksRows = (nRounds + 1) * 4;
|
||||||
|
|
||||||
|
// Compute key schedule
|
||||||
|
var keySchedule = this._keySchedule = [];
|
||||||
|
for (var ksRow = 0; ksRow < ksRows; ksRow++) {
|
||||||
|
if (ksRow < keySize) {
|
||||||
|
keySchedule[ksRow] = keyWords[ksRow];
|
||||||
|
} else {
|
||||||
|
t = keySchedule[ksRow - 1];
|
||||||
|
|
||||||
|
if (!(ksRow % keySize)) {
|
||||||
|
// Rot word
|
||||||
|
t = (t << 8) | (t >>> 24);
|
||||||
|
|
||||||
|
// Sub word
|
||||||
|
t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
|
||||||
|
|
||||||
|
// Mix Rcon
|
||||||
|
t ^= RCON[(ksRow / keySize) | 0] << 24;
|
||||||
|
} else if (keySize > 6 && ksRow % keySize == 4) {
|
||||||
|
// Sub word
|
||||||
|
t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
|
||||||
|
}
|
||||||
|
|
||||||
|
keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute inv key schedule
|
||||||
|
var invKeySchedule = this._invKeySchedule = [];
|
||||||
|
for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
|
||||||
|
var ksRow = ksRows - invKsRow;
|
||||||
|
|
||||||
|
if (invKsRow % 4) {
|
||||||
|
var t = keySchedule[ksRow];
|
||||||
|
} else {
|
||||||
|
var t = keySchedule[ksRow - 4];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (invKsRow < 4 || ksRow <= 4) {
|
||||||
|
invKeySchedule[invKsRow] = t;
|
||||||
|
} else {
|
||||||
|
invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
|
||||||
|
INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
encryptBlock: function(M, offset) {
|
||||||
|
this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
|
||||||
|
},
|
||||||
|
|
||||||
|
decryptBlock: function(M, offset) {
|
||||||
|
// Swap 2nd and 4th rows
|
||||||
|
var t = M[offset + 1];
|
||||||
|
M[offset + 1] = M[offset + 3];
|
||||||
|
M[offset + 3] = t;
|
||||||
|
|
||||||
|
this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
|
||||||
|
|
||||||
|
// Inv swap 2nd and 4th rows
|
||||||
|
var t = M[offset + 1];
|
||||||
|
M[offset + 1] = M[offset + 3];
|
||||||
|
M[offset + 3] = t;
|
||||||
|
},
|
||||||
|
|
||||||
|
_doCryptBlock: function(M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
|
||||||
|
// Shortcut
|
||||||
|
var nRounds = this._nRounds;
|
||||||
|
|
||||||
|
// Get input, add round key
|
||||||
|
var s0 = M[offset] ^ keySchedule[0];
|
||||||
|
var s1 = M[offset + 1] ^ keySchedule[1];
|
||||||
|
var s2 = M[offset + 2] ^ keySchedule[2];
|
||||||
|
var s3 = M[offset + 3] ^ keySchedule[3];
|
||||||
|
|
||||||
|
// Key schedule row counter
|
||||||
|
var ksRow = 4;
|
||||||
|
|
||||||
|
// Rounds
|
||||||
|
for (var round = 1; round < nRounds; round++) {
|
||||||
|
// Shift rows, sub bytes, mix columns, add round key
|
||||||
|
var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
|
||||||
|
var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
|
||||||
|
var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
|
||||||
|
var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];
|
||||||
|
|
||||||
|
// Update state
|
||||||
|
s0 = t0;
|
||||||
|
s1 = t1;
|
||||||
|
s2 = t2;
|
||||||
|
s3 = t3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shift rows, sub bytes, add round key
|
||||||
|
var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
|
||||||
|
var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
|
||||||
|
var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
|
||||||
|
var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
|
||||||
|
|
||||||
|
// Set output
|
||||||
|
M[offset] = t0;
|
||||||
|
M[offset + 1] = t1;
|
||||||
|
M[offset + 2] = t2;
|
||||||
|
M[offset + 3] = t3;
|
||||||
|
},
|
||||||
|
|
||||||
|
keySize: 256 / 32
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut functions to the cipher's object interface.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
|
||||||
|
* var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);
|
||||||
|
*/
|
||||||
|
C.AES = BlockCipher._createHelper(AES);
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var WordArray = C_lib.WordArray;
|
||||||
|
var BlockCipher = C_lib.BlockCipher;
|
||||||
|
var C_algo = C.algo;
|
||||||
|
|
||||||
|
// Permuted Choice 1 constants
|
||||||
|
var PC1 = [
|
||||||
|
57, 49, 41, 33, 25, 17, 9, 1,
|
||||||
|
58, 50, 42, 34, 26, 18, 10, 2,
|
||||||
|
59, 51, 43, 35, 27, 19, 11, 3,
|
||||||
|
60, 52, 44, 36, 63, 55, 47, 39,
|
||||||
|
31, 23, 15, 7, 62, 54, 46, 38,
|
||||||
|
30, 22, 14, 6, 61, 53, 45, 37,
|
||||||
|
29, 21, 13, 5, 28, 20, 12, 4
|
||||||
|
];
|
||||||
|
|
||||||
|
// Permuted Choice 2 constants
|
||||||
|
var PC2 = [
|
||||||
|
14, 17, 11, 24, 1, 5,
|
||||||
|
3, 28, 15, 6, 21, 10,
|
||||||
|
23, 19, 12, 4, 26, 8,
|
||||||
|
16, 7, 27, 20, 13, 2,
|
||||||
|
41, 52, 31, 37, 47, 55,
|
||||||
|
30, 40, 51, 45, 33, 48,
|
||||||
|
44, 49, 39, 56, 34, 53,
|
||||||
|
46, 42, 50, 36, 29, 32
|
||||||
|
];
|
||||||
|
|
||||||
|
// Cumulative bit shift constants
|
||||||
|
var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];
|
||||||
|
|
||||||
|
// SBOXes and round permutation constants
|
||||||
|
var SBOX_P = [{
|
||||||
|
0x0: 0x808200,
|
||||||
|
0x10000000: 0x8000,
|
||||||
|
0x20000000: 0x808002,
|
||||||
|
0x30000000: 0x2,
|
||||||
|
0x40000000: 0x200,
|
||||||
|
0x50000000: 0x808202,
|
||||||
|
0x60000000: 0x800202,
|
||||||
|
0x70000000: 0x800000,
|
||||||
|
0x80000000: 0x202,
|
||||||
|
0x90000000: 0x800200,
|
||||||
|
0xa0000000: 0x8200,
|
||||||
|
0xb0000000: 0x808000,
|
||||||
|
0xc0000000: 0x8002,
|
||||||
|
0xd0000000: 0x800002,
|
||||||
|
0xe0000000: 0x0,
|
||||||
|
0xf0000000: 0x8202,
|
||||||
|
0x8000000: 0x0,
|
||||||
|
0x18000000: 0x808202,
|
||||||
|
0x28000000: 0x8202,
|
||||||
|
0x38000000: 0x8000,
|
||||||
|
0x48000000: 0x808200,
|
||||||
|
0x58000000: 0x200,
|
||||||
|
0x68000000: 0x808002,
|
||||||
|
0x78000000: 0x2,
|
||||||
|
0x88000000: 0x800200,
|
||||||
|
0x98000000: 0x8200,
|
||||||
|
0xa8000000: 0x808000,
|
||||||
|
0xb8000000: 0x800202,
|
||||||
|
0xc8000000: 0x800002,
|
||||||
|
0xd8000000: 0x8002,
|
||||||
|
0xe8000000: 0x202,
|
||||||
|
0xf8000000: 0x800000,
|
||||||
|
0x1: 0x8000,
|
||||||
|
0x10000001: 0x2,
|
||||||
|
0x20000001: 0x808200,
|
||||||
|
0x30000001: 0x800000,
|
||||||
|
0x40000001: 0x808002,
|
||||||
|
0x50000001: 0x8200,
|
||||||
|
0x60000001: 0x200,
|
||||||
|
0x70000001: 0x800202,
|
||||||
|
0x80000001: 0x808202,
|
||||||
|
0x90000001: 0x808000,
|
||||||
|
0xa0000001: 0x800002,
|
||||||
|
0xb0000001: 0x8202,
|
||||||
|
0xc0000001: 0x202,
|
||||||
|
0xd0000001: 0x800200,
|
||||||
|
0xe0000001: 0x8002,
|
||||||
|
0xf0000001: 0x0,
|
||||||
|
0x8000001: 0x808202,
|
||||||
|
0x18000001: 0x808000,
|
||||||
|
0x28000001: 0x800000,
|
||||||
|
0x38000001: 0x200,
|
||||||
|
0x48000001: 0x8000,
|
||||||
|
0x58000001: 0x800002,
|
||||||
|
0x68000001: 0x2,
|
||||||
|
0x78000001: 0x8202,
|
||||||
|
0x88000001: 0x8002,
|
||||||
|
0x98000001: 0x800202,
|
||||||
|
0xa8000001: 0x202,
|
||||||
|
0xb8000001: 0x808200,
|
||||||
|
0xc8000001: 0x800200,
|
||||||
|
0xd8000001: 0x0,
|
||||||
|
0xe8000001: 0x8200,
|
||||||
|
0xf8000001: 0x808002
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x0: 0x40084010,
|
||||||
|
0x1000000: 0x4000,
|
||||||
|
0x2000000: 0x80000,
|
||||||
|
0x3000000: 0x40080010,
|
||||||
|
0x4000000: 0x40000010,
|
||||||
|
0x5000000: 0x40084000,
|
||||||
|
0x6000000: 0x40004000,
|
||||||
|
0x7000000: 0x10,
|
||||||
|
0x8000000: 0x84000,
|
||||||
|
0x9000000: 0x40004010,
|
||||||
|
0xa000000: 0x40000000,
|
||||||
|
0xb000000: 0x84010,
|
||||||
|
0xc000000: 0x80010,
|
||||||
|
0xd000000: 0x0,
|
||||||
|
0xe000000: 0x4010,
|
||||||
|
0xf000000: 0x40080000,
|
||||||
|
0x800000: 0x40004000,
|
||||||
|
0x1800000: 0x84010,
|
||||||
|
0x2800000: 0x10,
|
||||||
|
0x3800000: 0x40004010,
|
||||||
|
0x4800000: 0x40084010,
|
||||||
|
0x5800000: 0x40000000,
|
||||||
|
0x6800000: 0x80000,
|
||||||
|
0x7800000: 0x40080010,
|
||||||
|
0x8800000: 0x80010,
|
||||||
|
0x9800000: 0x0,
|
||||||
|
0xa800000: 0x4000,
|
||||||
|
0xb800000: 0x40080000,
|
||||||
|
0xc800000: 0x40000010,
|
||||||
|
0xd800000: 0x84000,
|
||||||
|
0xe800000: 0x40084000,
|
||||||
|
0xf800000: 0x4010,
|
||||||
|
0x10000000: 0x0,
|
||||||
|
0x11000000: 0x40080010,
|
||||||
|
0x12000000: 0x40004010,
|
||||||
|
0x13000000: 0x40084000,
|
||||||
|
0x14000000: 0x40080000,
|
||||||
|
0x15000000: 0x10,
|
||||||
|
0x16000000: 0x84010,
|
||||||
|
0x17000000: 0x4000,
|
||||||
|
0x18000000: 0x4010,
|
||||||
|
0x19000000: 0x80000,
|
||||||
|
0x1a000000: 0x80010,
|
||||||
|
0x1b000000: 0x40000010,
|
||||||
|
0x1c000000: 0x84000,
|
||||||
|
0x1d000000: 0x40004000,
|
||||||
|
0x1e000000: 0x40000000,
|
||||||
|
0x1f000000: 0x40084010,
|
||||||
|
0x10800000: 0x84010,
|
||||||
|
0x11800000: 0x80000,
|
||||||
|
0x12800000: 0x40080000,
|
||||||
|
0x13800000: 0x4000,
|
||||||
|
0x14800000: 0x40004000,
|
||||||
|
0x15800000: 0x40084010,
|
||||||
|
0x16800000: 0x10,
|
||||||
|
0x17800000: 0x40000000,
|
||||||
|
0x18800000: 0x40084000,
|
||||||
|
0x19800000: 0x40000010,
|
||||||
|
0x1a800000: 0x40004010,
|
||||||
|
0x1b800000: 0x80010,
|
||||||
|
0x1c800000: 0x0,
|
||||||
|
0x1d800000: 0x4010,
|
||||||
|
0x1e800000: 0x40080010,
|
||||||
|
0x1f800000: 0x84000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x0: 0x104,
|
||||||
|
0x100000: 0x0,
|
||||||
|
0x200000: 0x4000100,
|
||||||
|
0x300000: 0x10104,
|
||||||
|
0x400000: 0x10004,
|
||||||
|
0x500000: 0x4000004,
|
||||||
|
0x600000: 0x4010104,
|
||||||
|
0x700000: 0x4010000,
|
||||||
|
0x800000: 0x4000000,
|
||||||
|
0x900000: 0x4010100,
|
||||||
|
0xa00000: 0x10100,
|
||||||
|
0xb00000: 0x4010004,
|
||||||
|
0xc00000: 0x4000104,
|
||||||
|
0xd00000: 0x10000,
|
||||||
|
0xe00000: 0x4,
|
||||||
|
0xf00000: 0x100,
|
||||||
|
0x80000: 0x4010100,
|
||||||
|
0x180000: 0x4010004,
|
||||||
|
0x280000: 0x0,
|
||||||
|
0x380000: 0x4000100,
|
||||||
|
0x480000: 0x4000004,
|
||||||
|
0x580000: 0x10000,
|
||||||
|
0x680000: 0x10004,
|
||||||
|
0x780000: 0x104,
|
||||||
|
0x880000: 0x4,
|
||||||
|
0x980000: 0x100,
|
||||||
|
0xa80000: 0x4010000,
|
||||||
|
0xb80000: 0x10104,
|
||||||
|
0xc80000: 0x10100,
|
||||||
|
0xd80000: 0x4000104,
|
||||||
|
0xe80000: 0x4010104,
|
||||||
|
0xf80000: 0x4000000,
|
||||||
|
0x1000000: 0x4010100,
|
||||||
|
0x1100000: 0x10004,
|
||||||
|
0x1200000: 0x10000,
|
||||||
|
0x1300000: 0x4000100,
|
||||||
|
0x1400000: 0x100,
|
||||||
|
0x1500000: 0x4010104,
|
||||||
|
0x1600000: 0x4000004,
|
||||||
|
0x1700000: 0x0,
|
||||||
|
0x1800000: 0x4000104,
|
||||||
|
0x1900000: 0x4000000,
|
||||||
|
0x1a00000: 0x4,
|
||||||
|
0x1b00000: 0x10100,
|
||||||
|
0x1c00000: 0x4010000,
|
||||||
|
0x1d00000: 0x104,
|
||||||
|
0x1e00000: 0x10104,
|
||||||
|
0x1f00000: 0x4010004,
|
||||||
|
0x1080000: 0x4000000,
|
||||||
|
0x1180000: 0x104,
|
||||||
|
0x1280000: 0x4010100,
|
||||||
|
0x1380000: 0x0,
|
||||||
|
0x1480000: 0x10004,
|
||||||
|
0x1580000: 0x4000100,
|
||||||
|
0x1680000: 0x100,
|
||||||
|
0x1780000: 0x4010004,
|
||||||
|
0x1880000: 0x10000,
|
||||||
|
0x1980000: 0x4010104,
|
||||||
|
0x1a80000: 0x10104,
|
||||||
|
0x1b80000: 0x4000004,
|
||||||
|
0x1c80000: 0x4000104,
|
||||||
|
0x1d80000: 0x4010000,
|
||||||
|
0x1e80000: 0x4,
|
||||||
|
0x1f80000: 0x10100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x0: 0x80401000,
|
||||||
|
0x10000: 0x80001040,
|
||||||
|
0x20000: 0x401040,
|
||||||
|
0x30000: 0x80400000,
|
||||||
|
0x40000: 0x0,
|
||||||
|
0x50000: 0x401000,
|
||||||
|
0x60000: 0x80000040,
|
||||||
|
0x70000: 0x400040,
|
||||||
|
0x80000: 0x80000000,
|
||||||
|
0x90000: 0x400000,
|
||||||
|
0xa0000: 0x40,
|
||||||
|
0xb0000: 0x80001000,
|
||||||
|
0xc0000: 0x80400040,
|
||||||
|
0xd0000: 0x1040,
|
||||||
|
0xe0000: 0x1000,
|
||||||
|
0xf0000: 0x80401040,
|
||||||
|
0x8000: 0x80001040,
|
||||||
|
0x18000: 0x40,
|
||||||
|
0x28000: 0x80400040,
|
||||||
|
0x38000: 0x80001000,
|
||||||
|
0x48000: 0x401000,
|
||||||
|
0x58000: 0x80401040,
|
||||||
|
0x68000: 0x0,
|
||||||
|
0x78000: 0x80400000,
|
||||||
|
0x88000: 0x1000,
|
||||||
|
0x98000: 0x80401000,
|
||||||
|
0xa8000: 0x400000,
|
||||||
|
0xb8000: 0x1040,
|
||||||
|
0xc8000: 0x80000000,
|
||||||
|
0xd8000: 0x400040,
|
||||||
|
0xe8000: 0x401040,
|
||||||
|
0xf8000: 0x80000040,
|
||||||
|
0x100000: 0x400040,
|
||||||
|
0x110000: 0x401000,
|
||||||
|
0x120000: 0x80000040,
|
||||||
|
0x130000: 0x0,
|
||||||
|
0x140000: 0x1040,
|
||||||
|
0x150000: 0x80400040,
|
||||||
|
0x160000: 0x80401000,
|
||||||
|
0x170000: 0x80001040,
|
||||||
|
0x180000: 0x80401040,
|
||||||
|
0x190000: 0x80000000,
|
||||||
|
0x1a0000: 0x80400000,
|
||||||
|
0x1b0000: 0x401040,
|
||||||
|
0x1c0000: 0x80001000,
|
||||||
|
0x1d0000: 0x400000,
|
||||||
|
0x1e0000: 0x40,
|
||||||
|
0x1f0000: 0x1000,
|
||||||
|
0x108000: 0x80400000,
|
||||||
|
0x118000: 0x80401040,
|
||||||
|
0x128000: 0x0,
|
||||||
|
0x138000: 0x401000,
|
||||||
|
0x148000: 0x400040,
|
||||||
|
0x158000: 0x80000000,
|
||||||
|
0x168000: 0x80001040,
|
||||||
|
0x178000: 0x40,
|
||||||
|
0x188000: 0x80000040,
|
||||||
|
0x198000: 0x1000,
|
||||||
|
0x1a8000: 0x80001000,
|
||||||
|
0x1b8000: 0x80400040,
|
||||||
|
0x1c8000: 0x1040,
|
||||||
|
0x1d8000: 0x80401000,
|
||||||
|
0x1e8000: 0x400000,
|
||||||
|
0x1f8000: 0x401040
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x0: 0x80,
|
||||||
|
0x1000: 0x1040000,
|
||||||
|
0x2000: 0x40000,
|
||||||
|
0x3000: 0x20000000,
|
||||||
|
0x4000: 0x20040080,
|
||||||
|
0x5000: 0x1000080,
|
||||||
|
0x6000: 0x21000080,
|
||||||
|
0x7000: 0x40080,
|
||||||
|
0x8000: 0x1000000,
|
||||||
|
0x9000: 0x20040000,
|
||||||
|
0xa000: 0x20000080,
|
||||||
|
0xb000: 0x21040080,
|
||||||
|
0xc000: 0x21040000,
|
||||||
|
0xd000: 0x0,
|
||||||
|
0xe000: 0x1040080,
|
||||||
|
0xf000: 0x21000000,
|
||||||
|
0x800: 0x1040080,
|
||||||
|
0x1800: 0x21000080,
|
||||||
|
0x2800: 0x80,
|
||||||
|
0x3800: 0x1040000,
|
||||||
|
0x4800: 0x40000,
|
||||||
|
0x5800: 0x20040080,
|
||||||
|
0x6800: 0x21040000,
|
||||||
|
0x7800: 0x20000000,
|
||||||
|
0x8800: 0x20040000,
|
||||||
|
0x9800: 0x0,
|
||||||
|
0xa800: 0x21040080,
|
||||||
|
0xb800: 0x1000080,
|
||||||
|
0xc800: 0x20000080,
|
||||||
|
0xd800: 0x21000000,
|
||||||
|
0xe800: 0x1000000,
|
||||||
|
0xf800: 0x40080,
|
||||||
|
0x10000: 0x40000,
|
||||||
|
0x11000: 0x80,
|
||||||
|
0x12000: 0x20000000,
|
||||||
|
0x13000: 0x21000080,
|
||||||
|
0x14000: 0x1000080,
|
||||||
|
0x15000: 0x21040000,
|
||||||
|
0x16000: 0x20040080,
|
||||||
|
0x17000: 0x1000000,
|
||||||
|
0x18000: 0x21040080,
|
||||||
|
0x19000: 0x21000000,
|
||||||
|
0x1a000: 0x1040000,
|
||||||
|
0x1b000: 0x20040000,
|
||||||
|
0x1c000: 0x40080,
|
||||||
|
0x1d000: 0x20000080,
|
||||||
|
0x1e000: 0x0,
|
||||||
|
0x1f000: 0x1040080,
|
||||||
|
0x10800: 0x21000080,
|
||||||
|
0x11800: 0x1000000,
|
||||||
|
0x12800: 0x1040000,
|
||||||
|
0x13800: 0x20040080,
|
||||||
|
0x14800: 0x20000000,
|
||||||
|
0x15800: 0x1040080,
|
||||||
|
0x16800: 0x80,
|
||||||
|
0x17800: 0x21040000,
|
||||||
|
0x18800: 0x40080,
|
||||||
|
0x19800: 0x21040080,
|
||||||
|
0x1a800: 0x0,
|
||||||
|
0x1b800: 0x21000000,
|
||||||
|
0x1c800: 0x1000080,
|
||||||
|
0x1d800: 0x40000,
|
||||||
|
0x1e800: 0x20040000,
|
||||||
|
0x1f800: 0x20000080
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x0: 0x10000008,
|
||||||
|
0x100: 0x2000,
|
||||||
|
0x200: 0x10200000,
|
||||||
|
0x300: 0x10202008,
|
||||||
|
0x400: 0x10002000,
|
||||||
|
0x500: 0x200000,
|
||||||
|
0x600: 0x200008,
|
||||||
|
0x700: 0x10000000,
|
||||||
|
0x800: 0x0,
|
||||||
|
0x900: 0x10002008,
|
||||||
|
0xa00: 0x202000,
|
||||||
|
0xb00: 0x8,
|
||||||
|
0xc00: 0x10200008,
|
||||||
|
0xd00: 0x202008,
|
||||||
|
0xe00: 0x2008,
|
||||||
|
0xf00: 0x10202000,
|
||||||
|
0x80: 0x10200000,
|
||||||
|
0x180: 0x10202008,
|
||||||
|
0x280: 0x8,
|
||||||
|
0x380: 0x200000,
|
||||||
|
0x480: 0x202008,
|
||||||
|
0x580: 0x10000008,
|
||||||
|
0x680: 0x10002000,
|
||||||
|
0x780: 0x2008,
|
||||||
|
0x880: 0x200008,
|
||||||
|
0x980: 0x2000,
|
||||||
|
0xa80: 0x10002008,
|
||||||
|
0xb80: 0x10200008,
|
||||||
|
0xc80: 0x0,
|
||||||
|
0xd80: 0x10202000,
|
||||||
|
0xe80: 0x202000,
|
||||||
|
0xf80: 0x10000000,
|
||||||
|
0x1000: 0x10002000,
|
||||||
|
0x1100: 0x10200008,
|
||||||
|
0x1200: 0x10202008,
|
||||||
|
0x1300: 0x2008,
|
||||||
|
0x1400: 0x200000,
|
||||||
|
0x1500: 0x10000000,
|
||||||
|
0x1600: 0x10000008,
|
||||||
|
0x1700: 0x202000,
|
||||||
|
0x1800: 0x202008,
|
||||||
|
0x1900: 0x0,
|
||||||
|
0x1a00: 0x8,
|
||||||
|
0x1b00: 0x10200000,
|
||||||
|
0x1c00: 0x2000,
|
||||||
|
0x1d00: 0x10002008,
|
||||||
|
0x1e00: 0x10202000,
|
||||||
|
0x1f00: 0x200008,
|
||||||
|
0x1080: 0x8,
|
||||||
|
0x1180: 0x202000,
|
||||||
|
0x1280: 0x200000,
|
||||||
|
0x1380: 0x10000008,
|
||||||
|
0x1480: 0x10002000,
|
||||||
|
0x1580: 0x2008,
|
||||||
|
0x1680: 0x10202008,
|
||||||
|
0x1780: 0x10200000,
|
||||||
|
0x1880: 0x10202000,
|
||||||
|
0x1980: 0x10200008,
|
||||||
|
0x1a80: 0x2000,
|
||||||
|
0x1b80: 0x202008,
|
||||||
|
0x1c80: 0x200008,
|
||||||
|
0x1d80: 0x0,
|
||||||
|
0x1e80: 0x10000000,
|
||||||
|
0x1f80: 0x10002008
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x0: 0x100000,
|
||||||
|
0x10: 0x2000401,
|
||||||
|
0x20: 0x400,
|
||||||
|
0x30: 0x100401,
|
||||||
|
0x40: 0x2100401,
|
||||||
|
0x50: 0x0,
|
||||||
|
0x60: 0x1,
|
||||||
|
0x70: 0x2100001,
|
||||||
|
0x80: 0x2000400,
|
||||||
|
0x90: 0x100001,
|
||||||
|
0xa0: 0x2000001,
|
||||||
|
0xb0: 0x2100400,
|
||||||
|
0xc0: 0x2100000,
|
||||||
|
0xd0: 0x401,
|
||||||
|
0xe0: 0x100400,
|
||||||
|
0xf0: 0x2000000,
|
||||||
|
0x8: 0x2100001,
|
||||||
|
0x18: 0x0,
|
||||||
|
0x28: 0x2000401,
|
||||||
|
0x38: 0x2100400,
|
||||||
|
0x48: 0x100000,
|
||||||
|
0x58: 0x2000001,
|
||||||
|
0x68: 0x2000000,
|
||||||
|
0x78: 0x401,
|
||||||
|
0x88: 0x100401,
|
||||||
|
0x98: 0x2000400,
|
||||||
|
0xa8: 0x2100000,
|
||||||
|
0xb8: 0x100001,
|
||||||
|
0xc8: 0x400,
|
||||||
|
0xd8: 0x2100401,
|
||||||
|
0xe8: 0x1,
|
||||||
|
0xf8: 0x100400,
|
||||||
|
0x100: 0x2000000,
|
||||||
|
0x110: 0x100000,
|
||||||
|
0x120: 0x2000401,
|
||||||
|
0x130: 0x2100001,
|
||||||
|
0x140: 0x100001,
|
||||||
|
0x150: 0x2000400,
|
||||||
|
0x160: 0x2100400,
|
||||||
|
0x170: 0x100401,
|
||||||
|
0x180: 0x401,
|
||||||
|
0x190: 0x2100401,
|
||||||
|
0x1a0: 0x100400,
|
||||||
|
0x1b0: 0x1,
|
||||||
|
0x1c0: 0x0,
|
||||||
|
0x1d0: 0x2100000,
|
||||||
|
0x1e0: 0x2000001,
|
||||||
|
0x1f0: 0x400,
|
||||||
|
0x108: 0x100400,
|
||||||
|
0x118: 0x2000401,
|
||||||
|
0x128: 0x2100001,
|
||||||
|
0x138: 0x1,
|
||||||
|
0x148: 0x2000000,
|
||||||
|
0x158: 0x100000,
|
||||||
|
0x168: 0x401,
|
||||||
|
0x178: 0x2100400,
|
||||||
|
0x188: 0x2000001,
|
||||||
|
0x198: 0x2100000,
|
||||||
|
0x1a8: 0x0,
|
||||||
|
0x1b8: 0x2100401,
|
||||||
|
0x1c8: 0x100401,
|
||||||
|
0x1d8: 0x400,
|
||||||
|
0x1e8: 0x2000400,
|
||||||
|
0x1f8: 0x100001
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x0: 0x8000820,
|
||||||
|
0x1: 0x20000,
|
||||||
|
0x2: 0x8000000,
|
||||||
|
0x3: 0x20,
|
||||||
|
0x4: 0x20020,
|
||||||
|
0x5: 0x8020820,
|
||||||
|
0x6: 0x8020800,
|
||||||
|
0x7: 0x800,
|
||||||
|
0x8: 0x8020000,
|
||||||
|
0x9: 0x8000800,
|
||||||
|
0xa: 0x20800,
|
||||||
|
0xb: 0x8020020,
|
||||||
|
0xc: 0x820,
|
||||||
|
0xd: 0x0,
|
||||||
|
0xe: 0x8000020,
|
||||||
|
0xf: 0x20820,
|
||||||
|
0x80000000: 0x800,
|
||||||
|
0x80000001: 0x8020820,
|
||||||
|
0x80000002: 0x8000820,
|
||||||
|
0x80000003: 0x8000000,
|
||||||
|
0x80000004: 0x8020000,
|
||||||
|
0x80000005: 0x20800,
|
||||||
|
0x80000006: 0x20820,
|
||||||
|
0x80000007: 0x20,
|
||||||
|
0x80000008: 0x8000020,
|
||||||
|
0x80000009: 0x820,
|
||||||
|
0x8000000a: 0x20020,
|
||||||
|
0x8000000b: 0x8020800,
|
||||||
|
0x8000000c: 0x0,
|
||||||
|
0x8000000d: 0x8020020,
|
||||||
|
0x8000000e: 0x8000800,
|
||||||
|
0x8000000f: 0x20000,
|
||||||
|
0x10: 0x20820,
|
||||||
|
0x11: 0x8020800,
|
||||||
|
0x12: 0x20,
|
||||||
|
0x13: 0x800,
|
||||||
|
0x14: 0x8000800,
|
||||||
|
0x15: 0x8000020,
|
||||||
|
0x16: 0x8020020,
|
||||||
|
0x17: 0x20000,
|
||||||
|
0x18: 0x0,
|
||||||
|
0x19: 0x20020,
|
||||||
|
0x1a: 0x8020000,
|
||||||
|
0x1b: 0x8000820,
|
||||||
|
0x1c: 0x8020820,
|
||||||
|
0x1d: 0x20800,
|
||||||
|
0x1e: 0x820,
|
||||||
|
0x1f: 0x8000000,
|
||||||
|
0x80000010: 0x20000,
|
||||||
|
0x80000011: 0x800,
|
||||||
|
0x80000012: 0x8020020,
|
||||||
|
0x80000013: 0x20820,
|
||||||
|
0x80000014: 0x20,
|
||||||
|
0x80000015: 0x8020000,
|
||||||
|
0x80000016: 0x8000000,
|
||||||
|
0x80000017: 0x8000820,
|
||||||
|
0x80000018: 0x8020820,
|
||||||
|
0x80000019: 0x8000020,
|
||||||
|
0x8000001a: 0x8000800,
|
||||||
|
0x8000001b: 0x0,
|
||||||
|
0x8000001c: 0x20800,
|
||||||
|
0x8000001d: 0x820,
|
||||||
|
0x8000001e: 0x20020,
|
||||||
|
0x8000001f: 0x8020800
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// Masks that select the SBOX input
|
||||||
|
var SBOX_MASK = [
|
||||||
|
0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000,
|
||||||
|
0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DES block cipher algorithm.
|
||||||
|
*/
|
||||||
|
var DES = C_algo.DES = BlockCipher.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
// Shortcuts
|
||||||
|
var key = this._key;
|
||||||
|
var keyWords = key.words;
|
||||||
|
|
||||||
|
// Select 56 bits according to PC1
|
||||||
|
var keyBits = [];
|
||||||
|
for (var i = 0; i < 56; i++) {
|
||||||
|
var keyBitPos = PC1[i] - 1;
|
||||||
|
keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assemble 16 subkeys
|
||||||
|
var subKeys = this._subKeys = [];
|
||||||
|
for (var nSubKey = 0; nSubKey < 16; nSubKey++) {
|
||||||
|
// Create subkey
|
||||||
|
var subKey = subKeys[nSubKey] = [];
|
||||||
|
|
||||||
|
// Shortcut
|
||||||
|
var bitShift = BIT_SHIFTS[nSubKey];
|
||||||
|
|
||||||
|
// Select 48 bits according to PC2
|
||||||
|
for (var i = 0; i < 24; i++) {
|
||||||
|
// Select from the left 28 key bits
|
||||||
|
subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6);
|
||||||
|
|
||||||
|
// Select from the right 28 key bits
|
||||||
|
subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Since each subkey is applied to an expanded 32-bit input,
|
||||||
|
// the subkey can be broken into 8 values scaled to 32-bits,
|
||||||
|
// which allows the key to be used without expansion
|
||||||
|
subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31);
|
||||||
|
for (var i = 1; i < 7; i++) {
|
||||||
|
subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3);
|
||||||
|
}
|
||||||
|
subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute inverse subkeys
|
||||||
|
var invSubKeys = this._invSubKeys = [];
|
||||||
|
for (var i = 0; i < 16; i++) {
|
||||||
|
invSubKeys[i] = subKeys[15 - i];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
encryptBlock: function(M, offset) {
|
||||||
|
this._doCryptBlock(M, offset, this._subKeys);
|
||||||
|
},
|
||||||
|
|
||||||
|
decryptBlock: function(M, offset) {
|
||||||
|
this._doCryptBlock(M, offset, this._invSubKeys);
|
||||||
|
},
|
||||||
|
|
||||||
|
_doCryptBlock: function(M, offset, subKeys) {
|
||||||
|
// Get input
|
||||||
|
this._lBlock = M[offset];
|
||||||
|
this._rBlock = M[offset + 1];
|
||||||
|
|
||||||
|
// Initial permutation
|
||||||
|
exchangeLR.call(this, 4, 0x0f0f0f0f);
|
||||||
|
exchangeLR.call(this, 16, 0x0000ffff);
|
||||||
|
exchangeRL.call(this, 2, 0x33333333);
|
||||||
|
exchangeRL.call(this, 8, 0x00ff00ff);
|
||||||
|
exchangeLR.call(this, 1, 0x55555555);
|
||||||
|
|
||||||
|
// Rounds
|
||||||
|
for (var round = 0; round < 16; round++) {
|
||||||
|
// Shortcuts
|
||||||
|
var subKey = subKeys[round];
|
||||||
|
var lBlock = this._lBlock;
|
||||||
|
var rBlock = this._rBlock;
|
||||||
|
|
||||||
|
// Feistel function
|
||||||
|
var f = 0;
|
||||||
|
for (var i = 0; i < 8; i++) {
|
||||||
|
f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0];
|
||||||
|
}
|
||||||
|
this._lBlock = rBlock;
|
||||||
|
this._rBlock = lBlock ^ f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Undo swap from last round
|
||||||
|
var t = this._lBlock;
|
||||||
|
this._lBlock = this._rBlock;
|
||||||
|
this._rBlock = t;
|
||||||
|
|
||||||
|
// Final permutation
|
||||||
|
exchangeLR.call(this, 1, 0x55555555);
|
||||||
|
exchangeRL.call(this, 8, 0x00ff00ff);
|
||||||
|
exchangeRL.call(this, 2, 0x33333333);
|
||||||
|
exchangeLR.call(this, 16, 0x0000ffff);
|
||||||
|
exchangeLR.call(this, 4, 0x0f0f0f0f);
|
||||||
|
|
||||||
|
// Set output
|
||||||
|
M[offset] = this._lBlock;
|
||||||
|
M[offset + 1] = this._rBlock;
|
||||||
|
},
|
||||||
|
|
||||||
|
keySize: 64 / 32,
|
||||||
|
|
||||||
|
ivSize: 64 / 32,
|
||||||
|
|
||||||
|
blockSize: 64 / 32
|
||||||
|
});
|
||||||
|
|
||||||
|
// Swap bits across the left and right words
|
||||||
|
function exchangeLR(offset, mask) {
|
||||||
|
var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask;
|
||||||
|
this._rBlock ^= t;
|
||||||
|
this._lBlock ^= t << offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
function exchangeRL(offset, mask) {
|
||||||
|
var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask;
|
||||||
|
this._lBlock ^= t;
|
||||||
|
this._rBlock ^= t << offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut functions to the cipher's object interface.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var ciphertext = CryptoJS.DES.encrypt(message, key, cfg);
|
||||||
|
* var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg);
|
||||||
|
*/
|
||||||
|
C.DES = BlockCipher._createHelper(DES);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triple-DES block cipher algorithm.
|
||||||
|
*/
|
||||||
|
var TripleDES = C_algo.TripleDES = BlockCipher.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
// Shortcuts
|
||||||
|
var key = this._key;
|
||||||
|
var keyWords = key.words;
|
||||||
|
// Make sure the key length is valid (64, 128 or >= 192 bit)
|
||||||
|
if (keyWords.length !== 2 && keyWords.length !== 4 && keyWords.length < 6) {
|
||||||
|
throw new Error('Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extend the key according to the keying options defined in 3DES standard
|
||||||
|
var key1 = keyWords.slice(0, 2);
|
||||||
|
var key2 = keyWords.length < 4 ? keyWords.slice(0, 2) : keyWords.slice(2, 4);
|
||||||
|
var key3 = keyWords.length < 6 ? keyWords.slice(0, 2) : keyWords.slice(4, 6);
|
||||||
|
|
||||||
|
// Create DES instances
|
||||||
|
this._des1 = DES.createEncryptor(WordArray.create(key1));
|
||||||
|
this._des2 = DES.createEncryptor(WordArray.create(key2));
|
||||||
|
this._des3 = DES.createEncryptor(WordArray.create(key3));
|
||||||
|
},
|
||||||
|
|
||||||
|
encryptBlock: function(M, offset) {
|
||||||
|
this._des1.encryptBlock(M, offset);
|
||||||
|
this._des2.decryptBlock(M, offset);
|
||||||
|
this._des3.encryptBlock(M, offset);
|
||||||
|
},
|
||||||
|
|
||||||
|
decryptBlock: function(M, offset) {
|
||||||
|
this._des3.decryptBlock(M, offset);
|
||||||
|
this._des2.encryptBlock(M, offset);
|
||||||
|
this._des1.decryptBlock(M, offset);
|
||||||
|
},
|
||||||
|
|
||||||
|
keySize: 192 / 32,
|
||||||
|
|
||||||
|
ivSize: 64 / 32,
|
||||||
|
|
||||||
|
blockSize: 64 / 32
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut functions to the cipher's object interface.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg);
|
||||||
|
* var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg);
|
||||||
|
*/
|
||||||
|
C.TripleDES = BlockCipher._createHelper(TripleDES);
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var StreamCipher = C_lib.StreamCipher;
|
||||||
|
var C_algo = C.algo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RC4 stream cipher algorithm.
|
||||||
|
*/
|
||||||
|
var RC4 = C_algo.RC4 = StreamCipher.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
// Shortcuts
|
||||||
|
var key = this._key;
|
||||||
|
var keyWords = key.words;
|
||||||
|
var keySigBytes = key.sigBytes;
|
||||||
|
|
||||||
|
// Init sbox
|
||||||
|
var S = this._S = [];
|
||||||
|
for (var i = 0; i < 256; i++) {
|
||||||
|
S[i] = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Key setup
|
||||||
|
for (var i = 0, j = 0; i < 256; i++) {
|
||||||
|
var keyByteIndex = i % keySigBytes;
|
||||||
|
var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff;
|
||||||
|
|
||||||
|
j = (j + S[i] + keyByte) % 256;
|
||||||
|
|
||||||
|
// Swap
|
||||||
|
var t = S[i];
|
||||||
|
S[i] = S[j];
|
||||||
|
S[j] = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Counters
|
||||||
|
this._i = this._j = 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
_doProcessBlock: function(M, offset) {
|
||||||
|
M[offset] ^= generateKeystreamWord.call(this);
|
||||||
|
},
|
||||||
|
|
||||||
|
keySize: 256 / 32,
|
||||||
|
|
||||||
|
ivSize: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
function generateKeystreamWord() {
|
||||||
|
// Shortcuts
|
||||||
|
var S = this._S;
|
||||||
|
var i = this._i;
|
||||||
|
var j = this._j;
|
||||||
|
|
||||||
|
// Generate keystream word
|
||||||
|
var keystreamWord = 0;
|
||||||
|
for (var n = 0; n < 4; n++) {
|
||||||
|
i = (i + 1) % 256;
|
||||||
|
j = (j + S[i]) % 256;
|
||||||
|
|
||||||
|
// Swap
|
||||||
|
var t = S[i];
|
||||||
|
S[i] = S[j];
|
||||||
|
S[j] = t;
|
||||||
|
|
||||||
|
keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update counters
|
||||||
|
this._i = i;
|
||||||
|
this._j = j;
|
||||||
|
|
||||||
|
return keystreamWord;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut functions to the cipher's object interface.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg);
|
||||||
|
* var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg);
|
||||||
|
*/
|
||||||
|
C.RC4 = StreamCipher._createHelper(RC4);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modified RC4 stream cipher algorithm.
|
||||||
|
*/
|
||||||
|
var RC4Drop = C_algo.RC4Drop = RC4.extend({
|
||||||
|
/**
|
||||||
|
* Configuration options.
|
||||||
|
*
|
||||||
|
* @property {number} drop The number of keystream words to drop. Default 192
|
||||||
|
*/
|
||||||
|
cfg: RC4.cfg.extend({
|
||||||
|
drop: 192
|
||||||
|
}),
|
||||||
|
|
||||||
|
_doReset: function() {
|
||||||
|
RC4._doReset.call(this);
|
||||||
|
|
||||||
|
// Drop
|
||||||
|
for (var i = this.cfg.drop; i > 0; i--) {
|
||||||
|
generateKeystreamWord.call(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut functions to the cipher's object interface.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg);
|
||||||
|
* var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);
|
||||||
|
*/
|
||||||
|
C.RC4Drop = StreamCipher._createHelper(RC4Drop);
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var StreamCipher = C_lib.StreamCipher;
|
||||||
|
var C_algo = C.algo;
|
||||||
|
|
||||||
|
// Reusable objects
|
||||||
|
var S = [];
|
||||||
|
var C_ = [];
|
||||||
|
var G = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rabbit stream cipher algorithm
|
||||||
|
*/
|
||||||
|
var Rabbit = C_algo.Rabbit = StreamCipher.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
// Shortcuts
|
||||||
|
var K = this._key.words;
|
||||||
|
var iv = this.cfg.iv;
|
||||||
|
|
||||||
|
// Swap endian
|
||||||
|
for (var i = 0; i < 4; i++) {
|
||||||
|
K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) |
|
||||||
|
(((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate initial state values
|
||||||
|
var X = this._X = [
|
||||||
|
K[0], (K[3] << 16) | (K[2] >>> 16),
|
||||||
|
K[1], (K[0] << 16) | (K[3] >>> 16),
|
||||||
|
K[2], (K[1] << 16) | (K[0] >>> 16),
|
||||||
|
K[3], (K[2] << 16) | (K[1] >>> 16)
|
||||||
|
];
|
||||||
|
|
||||||
|
// Generate initial counter values
|
||||||
|
var C = this._C = [
|
||||||
|
(K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
|
||||||
|
(K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
|
||||||
|
(K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
|
||||||
|
(K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
|
||||||
|
];
|
||||||
|
|
||||||
|
// Carry bit
|
||||||
|
this._b = 0;
|
||||||
|
|
||||||
|
// Iterate the system four times
|
||||||
|
for (var i = 0; i < 4; i++) {
|
||||||
|
nextState.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Modify the counters
|
||||||
|
for (var i = 0; i < 8; i++) {
|
||||||
|
C[i] ^= X[(i + 4) & 7];
|
||||||
|
}
|
||||||
|
|
||||||
|
// IV setup
|
||||||
|
if (iv) {
|
||||||
|
// Shortcuts
|
||||||
|
var IV = iv.words;
|
||||||
|
var IV_0 = IV[0];
|
||||||
|
var IV_1 = IV[1];
|
||||||
|
|
||||||
|
// Generate four subvectors
|
||||||
|
var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
|
||||||
|
var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
|
||||||
|
var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
|
||||||
|
var i3 = (i2 << 16) | (i0 & 0x0000ffff);
|
||||||
|
|
||||||
|
// Modify counter values
|
||||||
|
C[0] ^= i0;
|
||||||
|
C[1] ^= i1;
|
||||||
|
C[2] ^= i2;
|
||||||
|
C[3] ^= i3;
|
||||||
|
C[4] ^= i0;
|
||||||
|
C[5] ^= i1;
|
||||||
|
C[6] ^= i2;
|
||||||
|
C[7] ^= i3;
|
||||||
|
|
||||||
|
// Iterate the system four times
|
||||||
|
for (var i = 0; i < 4; i++) {
|
||||||
|
nextState.call(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_doProcessBlock: function(M, offset) {
|
||||||
|
// Shortcut
|
||||||
|
var X = this._X;
|
||||||
|
|
||||||
|
// Iterate the system
|
||||||
|
nextState.call(this);
|
||||||
|
|
||||||
|
// Generate four keystream words
|
||||||
|
S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
|
||||||
|
S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
|
||||||
|
S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
|
||||||
|
S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
|
||||||
|
|
||||||
|
for (var i = 0; i < 4; i++) {
|
||||||
|
// Swap endian
|
||||||
|
S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
|
||||||
|
(((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
|
||||||
|
|
||||||
|
// Encrypt
|
||||||
|
M[offset + i] ^= S[i];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
blockSize: 128 / 32,
|
||||||
|
|
||||||
|
ivSize: 64 / 32
|
||||||
|
});
|
||||||
|
|
||||||
|
function nextState() {
|
||||||
|
// Shortcuts
|
||||||
|
var X = this._X;
|
||||||
|
var C = this._C;
|
||||||
|
|
||||||
|
// Save old counter values
|
||||||
|
for (var i = 0; i < 8; i++) {
|
||||||
|
C_[i] = C[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate new counter values
|
||||||
|
C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
|
||||||
|
C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
|
||||||
|
C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
|
||||||
|
C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
|
||||||
|
C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
|
||||||
|
C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
|
||||||
|
C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
|
||||||
|
C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
|
||||||
|
this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
|
||||||
|
|
||||||
|
// Calculate the g-values
|
||||||
|
for (var i = 0; i < 8; i++) {
|
||||||
|
var gx = X[i] + C[i];
|
||||||
|
|
||||||
|
// Construct high and low argument for squaring
|
||||||
|
var ga = gx & 0xffff;
|
||||||
|
var gb = gx >>> 16;
|
||||||
|
|
||||||
|
// Calculate high and low result of squaring
|
||||||
|
var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
|
||||||
|
var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
|
||||||
|
|
||||||
|
// High XOR low
|
||||||
|
G[i] = gh ^ gl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate new state values
|
||||||
|
X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
|
||||||
|
X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;
|
||||||
|
X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
|
||||||
|
X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;
|
||||||
|
X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
|
||||||
|
X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;
|
||||||
|
X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
|
||||||
|
X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut functions to the cipher's object interface.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg);
|
||||||
|
* var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);
|
||||||
|
*/
|
||||||
|
C.Rabbit = StreamCipher._createHelper(Rabbit);
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// Shortcuts
|
||||||
|
var C = CryptoJS;
|
||||||
|
var C_lib = C.lib;
|
||||||
|
var StreamCipher = C_lib.StreamCipher;
|
||||||
|
var C_algo = C.algo;
|
||||||
|
|
||||||
|
// Reusable objects
|
||||||
|
var S = [];
|
||||||
|
var C_ = [];
|
||||||
|
var G = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rabbit stream cipher algorithm.
|
||||||
|
*
|
||||||
|
* This is a legacy version that neglected to convert the key to little-endian.
|
||||||
|
* This error doesn't affect the cipher's security,
|
||||||
|
* but it does affect its compatibility with other implementations.
|
||||||
|
*/
|
||||||
|
var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
// Shortcuts
|
||||||
|
var K = this._key.words;
|
||||||
|
var iv = this.cfg.iv;
|
||||||
|
|
||||||
|
// Generate initial state values
|
||||||
|
var X = this._X = [
|
||||||
|
K[0], (K[3] << 16) | (K[2] >>> 16),
|
||||||
|
K[1], (K[0] << 16) | (K[3] >>> 16),
|
||||||
|
K[2], (K[1] << 16) | (K[0] >>> 16),
|
||||||
|
K[3], (K[2] << 16) | (K[1] >>> 16)
|
||||||
|
];
|
||||||
|
|
||||||
|
// Generate initial counter values
|
||||||
|
var C = this._C = [
|
||||||
|
(K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
|
||||||
|
(K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
|
||||||
|
(K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
|
||||||
|
(K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
|
||||||
|
];
|
||||||
|
|
||||||
|
// Carry bit
|
||||||
|
this._b = 0;
|
||||||
|
|
||||||
|
// Iterate the system four times
|
||||||
|
for (var i = 0; i < 4; i++) {
|
||||||
|
nextState.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Modify the counters
|
||||||
|
for (var i = 0; i < 8; i++) {
|
||||||
|
C[i] ^= X[(i + 4) & 7];
|
||||||
|
}
|
||||||
|
|
||||||
|
// IV setup
|
||||||
|
if (iv) {
|
||||||
|
// Shortcuts
|
||||||
|
var IV = iv.words;
|
||||||
|
var IV_0 = IV[0];
|
||||||
|
var IV_1 = IV[1];
|
||||||
|
|
||||||
|
// Generate four subvectors
|
||||||
|
var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
|
||||||
|
var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
|
||||||
|
var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
|
||||||
|
var i3 = (i2 << 16) | (i0 & 0x0000ffff);
|
||||||
|
|
||||||
|
// Modify counter values
|
||||||
|
C[0] ^= i0;
|
||||||
|
C[1] ^= i1;
|
||||||
|
C[2] ^= i2;
|
||||||
|
C[3] ^= i3;
|
||||||
|
C[4] ^= i0;
|
||||||
|
C[5] ^= i1;
|
||||||
|
C[6] ^= i2;
|
||||||
|
C[7] ^= i3;
|
||||||
|
|
||||||
|
// Iterate the system four times
|
||||||
|
for (var i = 0; i < 4; i++) {
|
||||||
|
nextState.call(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_doProcessBlock: function(M, offset) {
|
||||||
|
// Shortcut
|
||||||
|
var X = this._X;
|
||||||
|
|
||||||
|
// Iterate the system
|
||||||
|
nextState.call(this);
|
||||||
|
|
||||||
|
// Generate four keystream words
|
||||||
|
S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
|
||||||
|
S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
|
||||||
|
S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
|
||||||
|
S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
|
||||||
|
|
||||||
|
for (var i = 0; i < 4; i++) {
|
||||||
|
// Swap endian
|
||||||
|
S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
|
||||||
|
(((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
|
||||||
|
|
||||||
|
// Encrypt
|
||||||
|
M[offset + i] ^= S[i];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
blockSize: 128 / 32,
|
||||||
|
|
||||||
|
ivSize: 64 / 32
|
||||||
|
});
|
||||||
|
|
||||||
|
function nextState() {
|
||||||
|
// Shortcuts
|
||||||
|
var X = this._X;
|
||||||
|
var C = this._C;
|
||||||
|
|
||||||
|
// Save old counter values
|
||||||
|
for (var i = 0; i < 8; i++) {
|
||||||
|
C_[i] = C[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate new counter values
|
||||||
|
C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
|
||||||
|
C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
|
||||||
|
C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
|
||||||
|
C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
|
||||||
|
C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
|
||||||
|
C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
|
||||||
|
C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
|
||||||
|
C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
|
||||||
|
this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
|
||||||
|
|
||||||
|
// Calculate the g-values
|
||||||
|
for (var i = 0; i < 8; i++) {
|
||||||
|
var gx = X[i] + C[i];
|
||||||
|
|
||||||
|
// Construct high and low argument for squaring
|
||||||
|
var ga = gx & 0xffff;
|
||||||
|
var gb = gx >>> 16;
|
||||||
|
|
||||||
|
// Calculate high and low result of squaring
|
||||||
|
var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
|
||||||
|
var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
|
||||||
|
|
||||||
|
// High XOR low
|
||||||
|
G[i] = gh ^ gl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate new state values
|
||||||
|
X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
|
||||||
|
X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;
|
||||||
|
X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
|
||||||
|
X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;
|
||||||
|
X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
|
||||||
|
X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;
|
||||||
|
X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
|
||||||
|
X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut functions to the cipher's object interface.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg);
|
||||||
|
* var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg);
|
||||||
|
*/
|
||||||
|
C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy);
|
||||||
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
return CryptoJS;
|
||||||
|
|
||||||
|
}));
|
||||||
File diff suppressed because one or more lines are too long
+5858
@@ -0,0 +1,5858 @@
|
|||||||
|
/*! For license information please see node-rsa.bundle.js.LICENSE.txt */ ! function(t, e) {
|
||||||
|
"object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.NODERSA = e() : t.NODERSA = e()
|
||||||
|
}(globalThis, (() => (() => {
|
||||||
|
var t = {
|
||||||
|
6395: t => {
|
||||||
|
t.exports = {
|
||||||
|
newInvalidAsn1Error: function(t) {
|
||||||
|
var e = new Error;
|
||||||
|
return e.name = "InvalidAsn1Error", e.message = t || "", e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
5670: (t, e, r) => {
|
||||||
|
var n = r(6395),
|
||||||
|
i = r(6299),
|
||||||
|
o = r(3319),
|
||||||
|
s = r(1431);
|
||||||
|
for (var a in t.exports = {
|
||||||
|
Reader: o,
|
||||||
|
Writer: s
|
||||||
|
}, i) i.hasOwnProperty(a) && (t.exports[a] = i[a]);
|
||||||
|
for (var f in n) n.hasOwnProperty(f) && (t.exports[f] = n[f])
|
||||||
|
},
|
||||||
|
3319: (t, e, r) => {
|
||||||
|
var n = r(4529),
|
||||||
|
i = r(4774).Buffer,
|
||||||
|
o = r(6299),
|
||||||
|
s = r(6395).newInvalidAsn1Error;
|
||||||
|
|
||||||
|
function a(t) {
|
||||||
|
if (!t || !i.isBuffer(t)) throw new TypeError("data must be a node Buffer");
|
||||||
|
this._buf = t, this._size = t.length, this._len = 0, this._offset = 0
|
||||||
|
}
|
||||||
|
Object.defineProperty(a.prototype, "length", {
|
||||||
|
enumerable: !0,
|
||||||
|
get: function() {
|
||||||
|
return this._len
|
||||||
|
}
|
||||||
|
}), Object.defineProperty(a.prototype, "offset", {
|
||||||
|
enumerable: !0,
|
||||||
|
get: function() {
|
||||||
|
return this._offset
|
||||||
|
}
|
||||||
|
}), Object.defineProperty(a.prototype, "remain", {
|
||||||
|
get: function() {
|
||||||
|
return this._size - this._offset
|
||||||
|
}
|
||||||
|
}), Object.defineProperty(a.prototype, "buffer", {
|
||||||
|
get: function() {
|
||||||
|
return this._buf.slice(this._offset)
|
||||||
|
}
|
||||||
|
}), a.prototype.readByte = function(t) {
|
||||||
|
if (this._size - this._offset < 1) return null;
|
||||||
|
var e = 255 & this._buf[this._offset];
|
||||||
|
return t || (this._offset += 1), e
|
||||||
|
}, a.prototype.peek = function() {
|
||||||
|
return this.readByte(!0)
|
||||||
|
}, a.prototype.readLength = function(t) {
|
||||||
|
if (void 0 === t && (t = this._offset), t >= this._size) return null;
|
||||||
|
var e = 255 & this._buf[t++];
|
||||||
|
if (null === e) return null;
|
||||||
|
if (128 & ~e) this._len = e;
|
||||||
|
else {
|
||||||
|
if (0 == (e &= 127)) throw s("Indefinite length not supported");
|
||||||
|
if (e > 4) throw s("encoding too long");
|
||||||
|
if (this._size - t < e) return null;
|
||||||
|
this._len = 0;
|
||||||
|
for (var r = 0; r < e; r++) this._len = (this._len << 8) + (255 & this._buf[t++])
|
||||||
|
}
|
||||||
|
return t
|
||||||
|
}, a.prototype.readSequence = function(t) {
|
||||||
|
var e = this.peek();
|
||||||
|
if (null === e) return null;
|
||||||
|
if (void 0 !== t && t !== e) throw s("Expected 0x" + t.toString(16) + ": got 0x" + e.toString(16));
|
||||||
|
var r = this.readLength(this._offset + 1);
|
||||||
|
return null === r ? null : (this._offset = r, e)
|
||||||
|
}, a.prototype.readInt = function() {
|
||||||
|
return this._readTag(o.Integer)
|
||||||
|
}, a.prototype.readBoolean = function() {
|
||||||
|
return 0 !== this._readTag(o.Boolean)
|
||||||
|
}, a.prototype.readEnumeration = function() {
|
||||||
|
return this._readTag(o.Enumeration)
|
||||||
|
}, a.prototype.readString = function(t, e) {
|
||||||
|
t || (t = o.OctetString);
|
||||||
|
var r = this.peek();
|
||||||
|
if (null === r) return null;
|
||||||
|
if (r !== t) throw s("Expected 0x" + t.toString(16) + ": got 0x" + r.toString(16));
|
||||||
|
var n = this.readLength(this._offset + 1);
|
||||||
|
if (null === n) return null;
|
||||||
|
if (this.length > this._size - n) return null;
|
||||||
|
if (this._offset = n, 0 === this.length) return e ? i.alloc(0) : "";
|
||||||
|
var a = this._buf.slice(this._offset, this._offset + this.length);
|
||||||
|
return this._offset += this.length, e ? a : a.toString("utf8")
|
||||||
|
}, a.prototype.readOID = function(t) {
|
||||||
|
t || (t = o.OID);
|
||||||
|
var e = this.readString(t, !0);
|
||||||
|
if (null === e) return null;
|
||||||
|
for (var r = [], n = 0, i = 0; i < e.length; i++) {
|
||||||
|
var s = 255 & e[i];
|
||||||
|
n <<= 7, n += 127 & s, 128 & s || (r.push(n), n = 0)
|
||||||
|
}
|
||||||
|
return n = r.shift(), r.unshift(n % 40), r.unshift(n / 40 | 0), r.join(".")
|
||||||
|
}, a.prototype._readTag = function(t) {
|
||||||
|
n.ok(void 0 !== t);
|
||||||
|
var e = this.peek();
|
||||||
|
if (null === e) return null;
|
||||||
|
if (e !== t) throw s("Expected 0x" + t.toString(16) + ": got 0x" + e.toString(16));
|
||||||
|
var r = this.readLength(this._offset + 1);
|
||||||
|
if (null === r) return null;
|
||||||
|
if (this.length > 4) throw s("Integer too long: " + this.length);
|
||||||
|
if (this.length > this._size - r) return null;
|
||||||
|
this._offset = r;
|
||||||
|
for (var i = this._buf[this._offset], o = 0, a = 0; a < this.length; a++) o <<= 8, o |= 255 & this._buf[this._offset++];
|
||||||
|
return 128 & ~i || 4 === a || (o -= 1 << 8 * a), 0 | o
|
||||||
|
}, t.exports = a
|
||||||
|
},
|
||||||
|
6299: t => {
|
||||||
|
t.exports = {
|
||||||
|
EOC: 0,
|
||||||
|
Boolean: 1,
|
||||||
|
Integer: 2,
|
||||||
|
BitString: 3,
|
||||||
|
OctetString: 4,
|
||||||
|
Null: 5,
|
||||||
|
OID: 6,
|
||||||
|
ObjectDescriptor: 7,
|
||||||
|
External: 8,
|
||||||
|
Real: 9,
|
||||||
|
Enumeration: 10,
|
||||||
|
PDV: 11,
|
||||||
|
Utf8String: 12,
|
||||||
|
RelativeOID: 13,
|
||||||
|
Sequence: 16,
|
||||||
|
Set: 17,
|
||||||
|
NumericString: 18,
|
||||||
|
PrintableString: 19,
|
||||||
|
T61String: 20,
|
||||||
|
VideotexString: 21,
|
||||||
|
IA5String: 22,
|
||||||
|
UTCTime: 23,
|
||||||
|
GeneralizedTime: 24,
|
||||||
|
GraphicString: 25,
|
||||||
|
VisibleString: 26,
|
||||||
|
GeneralString: 28,
|
||||||
|
UniversalString: 29,
|
||||||
|
CharacterString: 30,
|
||||||
|
BMPString: 31,
|
||||||
|
Constructor: 32,
|
||||||
|
Context: 128
|
||||||
|
}
|
||||||
|
},
|
||||||
|
1431: (t, e, r) => {
|
||||||
|
var n = r(4529),
|
||||||
|
i = r(4774).Buffer,
|
||||||
|
o = r(6299),
|
||||||
|
s = r(6395).newInvalidAsn1Error,
|
||||||
|
a = {
|
||||||
|
size: 1024,
|
||||||
|
growthFactor: 8
|
||||||
|
};
|
||||||
|
|
||||||
|
function f(t) {
|
||||||
|
var e, r;
|
||||||
|
e = a, r = t || {}, n.ok(e), n.equal(typeof e, "object"), n.ok(r), n.equal(typeof r, "object"), Object.getOwnPropertyNames(e).forEach((function(t) {
|
||||||
|
if (!r[t]) {
|
||||||
|
var n = Object.getOwnPropertyDescriptor(e, t);
|
||||||
|
Object.defineProperty(r, t, n)
|
||||||
|
}
|
||||||
|
})), t = r, this._buf = i.alloc(t.size || 1024), this._size = this._buf.length, this._offset = 0, this._options = t, this._seq = []
|
||||||
|
}
|
||||||
|
Object.defineProperty(f.prototype, "buffer", {
|
||||||
|
get: function() {
|
||||||
|
if (this._seq.length) throw s(this._seq.length + " unended sequence(s)");
|
||||||
|
return this._buf.slice(0, this._offset)
|
||||||
|
}
|
||||||
|
}), f.prototype.writeByte = function(t) {
|
||||||
|
if ("number" != typeof t) throw new TypeError("argument must be a Number");
|
||||||
|
this._ensure(1), this._buf[this._offset++] = t
|
||||||
|
}, f.prototype.writeInt = function(t, e) {
|
||||||
|
if ("number" != typeof t) throw new TypeError("argument must be a Number");
|
||||||
|
"number" != typeof e && (e = o.Integer);
|
||||||
|
for (var r = 4;
|
||||||
|
(!(4286578688 & t) || -8388608 == (4286578688 & t)) && r > 1;) r--, t <<= 8;
|
||||||
|
if (r > 4) throw s("BER ints cannot be > 0xffffffff");
|
||||||
|
for (this._ensure(2 + r), this._buf[this._offset++] = e, this._buf[this._offset++] = r; r-- > 0;) this._buf[this._offset++] = (4278190080 & t) >>> 24, t <<= 8
|
||||||
|
}, f.prototype.writeNull = function() {
|
||||||
|
this.writeByte(o.Null), this.writeByte(0)
|
||||||
|
}, f.prototype.writeEnumeration = function(t, e) {
|
||||||
|
if ("number" != typeof t) throw new TypeError("argument must be a Number");
|
||||||
|
return "number" != typeof e && (e = o.Enumeration), this.writeInt(t, e)
|
||||||
|
}, f.prototype.writeBoolean = function(t, e) {
|
||||||
|
if ("boolean" != typeof t) throw new TypeError("argument must be a Boolean");
|
||||||
|
"number" != typeof e && (e = o.Boolean), this._ensure(3), this._buf[this._offset++] = e, this._buf[this._offset++] = 1, this._buf[this._offset++] = t ? 255 : 0
|
||||||
|
}, f.prototype.writeString = function(t, e) {
|
||||||
|
if ("string" != typeof t) throw new TypeError("argument must be a string (was: " + typeof t + ")");
|
||||||
|
"number" != typeof e && (e = o.OctetString);
|
||||||
|
var r = i.byteLength(t);
|
||||||
|
this.writeByte(e), this.writeLength(r), r && (this._ensure(r), this._buf.write(t, this._offset), this._offset += r)
|
||||||
|
}, f.prototype.writeBuffer = function(t, e) {
|
||||||
|
if ("number" != typeof e) throw new TypeError("tag must be a number");
|
||||||
|
if (!i.isBuffer(t)) throw new TypeError("argument must be a buffer");
|
||||||
|
this.writeByte(e), this.writeLength(t.length), this._ensure(t.length), t.copy(this._buf, this._offset, 0, t.length), this._offset += t.length
|
||||||
|
}, f.prototype.writeStringArray = function(t) {
|
||||||
|
if (!t instanceof Array) throw new TypeError("argument must be an Array[String]");
|
||||||
|
var e = this;
|
||||||
|
t.forEach((function(t) {
|
||||||
|
e.writeString(t)
|
||||||
|
}))
|
||||||
|
}, f.prototype.writeOID = function(t, e) {
|
||||||
|
if ("string" != typeof t) throw new TypeError("argument must be a string");
|
||||||
|
if ("number" != typeof e && (e = o.OID), !/^([0-9]+\.){3,}[0-9]+$/.test(t)) throw new Error("argument is not a valid OID string");
|
||||||
|
var r = t.split("."),
|
||||||
|
n = [];
|
||||||
|
n.push(40 * parseInt(r[0], 10) + parseInt(r[1], 10)), r.slice(2).forEach((function(t) {
|
||||||
|
! function(t, e) {
|
||||||
|
e < 128 ? t.push(e) : e < 16384 ? (t.push(e >>> 7 | 128), t.push(127 & e)) : e < 2097152 ? (t.push(e >>> 14 | 128), t.push(e >>> 7 & 255 | 128), t.push(127 & e)) : e < 268435456 ? (t.push(e >>> 21 | 128), t.push(e >>> 14 & 255 | 128), t.push(e >>> 7 & 255 | 128), t.push(127 & e)) : (t.push(e >>> 28 & 255 | 128), t.push(e >>> 21 & 255 | 128), t.push(e >>> 14 & 255 | 128), t.push(e >>> 7 & 255 | 128), t.push(127 & e))
|
||||||
|
}(n, parseInt(t, 10))
|
||||||
|
}));
|
||||||
|
var i = this;
|
||||||
|
this._ensure(2 + n.length), this.writeByte(e), this.writeLength(n.length), n.forEach((function(t) {
|
||||||
|
i.writeByte(t)
|
||||||
|
}))
|
||||||
|
}, f.prototype.writeLength = function(t) {
|
||||||
|
if ("number" != typeof t) throw new TypeError("argument must be a Number");
|
||||||
|
if (this._ensure(4), t <= 127) this._buf[this._offset++] = t;
|
||||||
|
else if (t <= 255) this._buf[this._offset++] = 129, this._buf[this._offset++] = t;
|
||||||
|
else if (t <= 65535) this._buf[this._offset++] = 130, this._buf[this._offset++] = t >> 8, this._buf[this._offset++] = t;
|
||||||
|
else {
|
||||||
|
if (!(t <= 16777215)) throw s("Length too long (> 4 bytes)");
|
||||||
|
this._buf[this._offset++] = 131, this._buf[this._offset++] = t >> 16, this._buf[this._offset++] = t >> 8, this._buf[this._offset++] = t
|
||||||
|
}
|
||||||
|
}, f.prototype.startSequence = function(t) {
|
||||||
|
"number" != typeof t && (t = o.Sequence | o.Constructor), this.writeByte(t), this._seq.push(this._offset), this._ensure(3), this._offset += 3
|
||||||
|
}, f.prototype.endSequence = function() {
|
||||||
|
var t = this._seq.pop(),
|
||||||
|
e = t + 3,
|
||||||
|
r = this._offset - e;
|
||||||
|
if (r <= 127) this._shift(e, r, -2), this._buf[t] = r;
|
||||||
|
else if (r <= 255) this._shift(e, r, -1), this._buf[t] = 129, this._buf[t + 1] = r;
|
||||||
|
else if (r <= 65535) this._buf[t] = 130, this._buf[t + 1] = r >> 8, this._buf[t + 2] = r;
|
||||||
|
else {
|
||||||
|
if (!(r <= 16777215)) throw s("Sequence too long");
|
||||||
|
this._shift(e, r, 1), this._buf[t] = 131, this._buf[t + 1] = r >> 16, this._buf[t + 2] = r >> 8, this._buf[t + 3] = r
|
||||||
|
}
|
||||||
|
}, f.prototype._shift = function(t, e, r) {
|
||||||
|
n.ok(void 0 !== t), n.ok(void 0 !== e), n.ok(r), this._buf.copy(this._buf, t + r, t, t + e), this._offset += r
|
||||||
|
}, f.prototype._ensure = function(t) {
|
||||||
|
if (n.ok(t), this._size - this._offset < t) {
|
||||||
|
var e = this._size * this._options.growthFactor;
|
||||||
|
e - this._offset < t && (e += t);
|
||||||
|
var r = i.alloc(e);
|
||||||
|
this._buf.copy(r, 0, 0, this._offset), this._buf = r, this._size = e
|
||||||
|
}
|
||||||
|
}, t.exports = f
|
||||||
|
},
|
||||||
|
3100: (t, e, r) => {
|
||||||
|
var n = r(5670);
|
||||||
|
t.exports = {
|
||||||
|
Ber: n,
|
||||||
|
BerReader: n.Reader,
|
||||||
|
BerWriter: n.Writer
|
||||||
|
}
|
||||||
|
},
|
||||||
|
4529: (t, e, r) => {
|
||||||
|
"use strict";
|
||||||
|
var n = r(1514)();
|
||||||
|
|
||||||
|
function i(t, e) {
|
||||||
|
if (t === e) return 0;
|
||||||
|
for (var r = t.length, n = e.length, i = 0, o = Math.min(r, n); i < o; ++i)
|
||||||
|
if (t[i] !== e[i]) {
|
||||||
|
r = t[i], n = e[i];
|
||||||
|
break
|
||||||
|
} return r < n ? -1 : n < r ? 1 : 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function o(t) {
|
||||||
|
return r.g.Buffer && "function" == typeof r.g.Buffer.isBuffer ? r.g.Buffer.isBuffer(t) : !(null == t || !t._isBuffer)
|
||||||
|
}
|
||||||
|
var s = r(4591),
|
||||||
|
a = Object.prototype.hasOwnProperty,
|
||||||
|
f = Array.prototype.slice,
|
||||||
|
u = "foo" === function() {}.name;
|
||||||
|
|
||||||
|
function c(t) {
|
||||||
|
return Object.prototype.toString.call(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
function h(t) {
|
||||||
|
return !o(t) && "function" == typeof r.g.ArrayBuffer && ("function" == typeof ArrayBuffer.isView ? ArrayBuffer.isView(t) : !!t && (t instanceof DataView || !!(t.buffer && t.buffer instanceof ArrayBuffer)))
|
||||||
|
}
|
||||||
|
var p = t.exports = m,
|
||||||
|
l = /\s*function\s+([^\(\s]*)\s*/;
|
||||||
|
|
||||||
|
function y(t) {
|
||||||
|
if (s.isFunction(t)) {
|
||||||
|
if (u) return t.name;
|
||||||
|
var e = t.toString().match(l);
|
||||||
|
return e && e[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function g(t, e) {
|
||||||
|
return "string" == typeof t ? t.length < e ? t : t.slice(0, e) : t
|
||||||
|
}
|
||||||
|
|
||||||
|
function d(t) {
|
||||||
|
if (u || !s.isFunction(t)) return s.inspect(t);
|
||||||
|
var e = y(t);
|
||||||
|
return "[Function" + (e ? ": " + e : "") + "]"
|
||||||
|
}
|
||||||
|
|
||||||
|
function v(t, e, r, n, i) {
|
||||||
|
throw new p.AssertionError({
|
||||||
|
message: r,
|
||||||
|
actual: t,
|
||||||
|
expected: e,
|
||||||
|
operator: n,
|
||||||
|
stackStartFunction: i
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function m(t, e) {
|
||||||
|
t || v(t, !0, e, "==", p.ok)
|
||||||
|
}
|
||||||
|
|
||||||
|
function S(t, e, r, n) {
|
||||||
|
if (t === e) return !0;
|
||||||
|
if (o(t) && o(e)) return 0 === i(t, e);
|
||||||
|
if (s.isDate(t) && s.isDate(e)) return t.getTime() === e.getTime();
|
||||||
|
if (s.isRegExp(t) && s.isRegExp(e)) return t.source === e.source && t.global === e.global && t.multiline === e.multiline && t.lastIndex === e.lastIndex && t.ignoreCase === e.ignoreCase;
|
||||||
|
if (null !== t && "object" == typeof t || null !== e && "object" == typeof e) {
|
||||||
|
if (h(t) && h(e) && c(t) === c(e) && !(t instanceof Float32Array || t instanceof Float64Array)) return 0 === i(new Uint8Array(t.buffer), new Uint8Array(e.buffer));
|
||||||
|
if (o(t) !== o(e)) return !1;
|
||||||
|
var a = (n = n || {
|
||||||
|
actual: [],
|
||||||
|
expected: []
|
||||||
|
}).actual.indexOf(t);
|
||||||
|
return -1 !== a && a === n.expected.indexOf(e) || (n.actual.push(t), n.expected.push(e), function(t, e, r, n) {
|
||||||
|
if (null == t || null == e) return !1;
|
||||||
|
if (s.isPrimitive(t) || s.isPrimitive(e)) return t === e;
|
||||||
|
if (r && Object.getPrototypeOf(t) !== Object.getPrototypeOf(e)) return !1;
|
||||||
|
var i = _(t),
|
||||||
|
o = _(e);
|
||||||
|
if (i && !o || !i && o) return !1;
|
||||||
|
if (i) return S(t = f.call(t), e = f.call(e), r);
|
||||||
|
var a, u, c = w(t),
|
||||||
|
h = w(e);
|
||||||
|
if (c.length !== h.length) return !1;
|
||||||
|
for (c.sort(), h.sort(), u = c.length - 1; u >= 0; u--)
|
||||||
|
if (c[u] !== h[u]) return !1;
|
||||||
|
for (u = c.length - 1; u >= 0; u--)
|
||||||
|
if (!S(t[a = c[u]], e[a], r, n)) return !1;
|
||||||
|
return !0
|
||||||
|
}(t, e, r, n))
|
||||||
|
}
|
||||||
|
return r ? t === e : t == e
|
||||||
|
}
|
||||||
|
|
||||||
|
function _(t) {
|
||||||
|
return "[object Arguments]" == Object.prototype.toString.call(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
function b(t, e) {
|
||||||
|
if (!t || !e) return !1;
|
||||||
|
if ("[object RegExp]" == Object.prototype.toString.call(e)) return e.test(t);
|
||||||
|
try {
|
||||||
|
if (t instanceof e) return !0
|
||||||
|
} catch (t) {}
|
||||||
|
return !Error.isPrototypeOf(e) && !0 === e.call({}, t)
|
||||||
|
}
|
||||||
|
|
||||||
|
function E(t, e, r, n) {
|
||||||
|
var i;
|
||||||
|
if ("function" != typeof e) throw new TypeError('"block" argument must be a function');
|
||||||
|
"string" == typeof r && (n = r, r = null), i = function(t) {
|
||||||
|
var e;
|
||||||
|
try {
|
||||||
|
t()
|
||||||
|
} catch (t) {
|
||||||
|
e = t
|
||||||
|
}
|
||||||
|
return e
|
||||||
|
}(e), n = (r && r.name ? " (" + r.name + ")." : ".") + (n ? " " + n : "."), t && !i && v(i, r, "Missing expected exception" + n);
|
||||||
|
var o = "string" == typeof n,
|
||||||
|
a = !t && i && !r;
|
||||||
|
if ((!t && s.isError(i) && o && b(i, r) || a) && v(i, r, "Got unwanted exception" + n), t && i && r && !b(i, r) || !t && i) throw i
|
||||||
|
}
|
||||||
|
p.AssertionError = function(t) {
|
||||||
|
this.name = "AssertionError", this.actual = t.actual, this.expected = t.expected, this.operator = t.operator, t.message ? (this.message = t.message, this.generatedMessage = !1) : (this.message = g(d(this.actual), 128) + " " + this.operator + " " + g(d(this.expected), 128), this.generatedMessage = !0);
|
||||||
|
var e = t.stackStartFunction || v;
|
||||||
|
if (Error.captureStackTrace) Error.captureStackTrace(this, e);
|
||||||
|
else {
|
||||||
|
var r = new Error;
|
||||||
|
if (r.stack) {
|
||||||
|
var n = r.stack,
|
||||||
|
i = y(e),
|
||||||
|
o = n.indexOf("\n" + i);
|
||||||
|
if (o >= 0) {
|
||||||
|
var s = n.indexOf("\n", o + 1);
|
||||||
|
n = n.substring(s + 1)
|
||||||
|
}
|
||||||
|
this.stack = n
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, s.inherits(p.AssertionError, Error), p.fail = v, p.ok = m, p.equal = function(t, e, r) {
|
||||||
|
t != e && v(t, e, r, "==", p.equal)
|
||||||
|
}, p.notEqual = function(t, e, r) {
|
||||||
|
t == e && v(t, e, r, "!=", p.notEqual)
|
||||||
|
}, p.deepEqual = function(t, e, r) {
|
||||||
|
S(t, e, !1) || v(t, e, r, "deepEqual", p.deepEqual)
|
||||||
|
}, p.deepStrictEqual = function(t, e, r) {
|
||||||
|
S(t, e, !0) || v(t, e, r, "deepStrictEqual", p.deepStrictEqual)
|
||||||
|
}, p.notDeepEqual = function(t, e, r) {
|
||||||
|
S(t, e, !1) && v(t, e, r, "notDeepEqual", p.notDeepEqual)
|
||||||
|
}, p.notDeepStrictEqual = function t(e, r, n) {
|
||||||
|
S(e, r, !0) && v(e, r, n, "notDeepStrictEqual", t)
|
||||||
|
}, p.strictEqual = function(t, e, r) {
|
||||||
|
t !== e && v(t, e, r, "===", p.strictEqual)
|
||||||
|
}, p.notStrictEqual = function(t, e, r) {
|
||||||
|
t === e && v(t, e, r, "!==", p.notStrictEqual)
|
||||||
|
}, p.throws = function(t, e, r) {
|
||||||
|
E(!0, t, e, r)
|
||||||
|
}, p.doesNotThrow = function(t, e, r) {
|
||||||
|
E(!1, t, e, r)
|
||||||
|
}, p.ifError = function(t) {
|
||||||
|
if (t) throw t
|
||||||
|
}, p.strict = n((function t(e, r) {
|
||||||
|
e || v(e, !0, r, "==", t)
|
||||||
|
}), p, {
|
||||||
|
equal: p.strictEqual,
|
||||||
|
deepEqual: p.deepStrictEqual,
|
||||||
|
notEqual: p.notStrictEqual,
|
||||||
|
notDeepEqual: p.notDeepStrictEqual
|
||||||
|
}), p.strict.strict = p.strict;
|
||||||
|
var w = Object.keys || function(t) {
|
||||||
|
var e = [];
|
||||||
|
for (var r in t) a.call(t, r) && e.push(r);
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
},
|
||||||
|
6100: t => {
|
||||||
|
"function" == typeof Object.create ? t.exports = function(t, e) {
|
||||||
|
t.super_ = e, t.prototype = Object.create(e.prototype, {
|
||||||
|
constructor: {
|
||||||
|
value: t,
|
||||||
|
enumerable: !1,
|
||||||
|
writable: !0,
|
||||||
|
configurable: !0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} : t.exports = function(t, e) {
|
||||||
|
t.super_ = e;
|
||||||
|
var r = function() {};
|
||||||
|
r.prototype = e.prototype, t.prototype = new r, t.prototype.constructor = t
|
||||||
|
}
|
||||||
|
},
|
||||||
|
3845: t => {
|
||||||
|
t.exports = function(t) {
|
||||||
|
return t && "object" == typeof t && "function" == typeof t.copy && "function" == typeof t.fill && "function" == typeof t.readUInt8
|
||||||
|
}
|
||||||
|
},
|
||||||
|
4591: (t, e, r) => {
|
||||||
|
var n = r(5606),
|
||||||
|
i = /%[sdj%]/g;
|
||||||
|
e.format = function(t) {
|
||||||
|
if (!v(t)) {
|
||||||
|
for (var e = [], r = 0; r < arguments.length; r++) e.push(a(arguments[r]));
|
||||||
|
return e.join(" ")
|
||||||
|
}
|
||||||
|
r = 1;
|
||||||
|
for (var n = arguments, o = n.length, s = String(t).replace(i, (function(t) {
|
||||||
|
if ("%%" === t) return "%";
|
||||||
|
if (r >= o) return t;
|
||||||
|
switch (t) {
|
||||||
|
case "%s":
|
||||||
|
return String(n[r++]);
|
||||||
|
case "%d":
|
||||||
|
return Number(n[r++]);
|
||||||
|
case "%j":
|
||||||
|
try {
|
||||||
|
return JSON.stringify(n[r++])
|
||||||
|
} catch (t) {
|
||||||
|
return "[Circular]"
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
})), f = n[r]; r < o; f = n[++r]) g(f) || !_(f) ? s += " " + f : s += " " + a(f);
|
||||||
|
return s
|
||||||
|
}, e.deprecate = function(t, i) {
|
||||||
|
if (m(r.g.process)) return function() {
|
||||||
|
return e.deprecate(t, i).apply(this, arguments)
|
||||||
|
};
|
||||||
|
if (!0 === n.noDeprecation) return t;
|
||||||
|
var o = !1;
|
||||||
|
return function() {
|
||||||
|
if (!o) {
|
||||||
|
if (n.throwDeprecation) throw new Error(i);
|
||||||
|
n.traceDeprecation ? console.trace(i) : console.error(i), o = !0
|
||||||
|
}
|
||||||
|
return t.apply(this, arguments)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var o, s = {};
|
||||||
|
|
||||||
|
function a(t, r) {
|
||||||
|
var n = {
|
||||||
|
seen: [],
|
||||||
|
stylize: u
|
||||||
|
};
|
||||||
|
return arguments.length >= 3 && (n.depth = arguments[2]), arguments.length >= 4 && (n.colors = arguments[3]), y(r) ? n.showHidden = r : r && e._extend(n, r), m(n.showHidden) && (n.showHidden = !1), m(n.depth) && (n.depth = 2), m(n.colors) && (n.colors = !1), m(n.customInspect) && (n.customInspect = !0), n.colors && (n.stylize = f), c(n, t, n.depth)
|
||||||
|
}
|
||||||
|
|
||||||
|
function f(t, e) {
|
||||||
|
var r = a.styles[e];
|
||||||
|
return r ? "[" + a.colors[r][0] + "m" + t + "[" + a.colors[r][1] + "m" : t
|
||||||
|
}
|
||||||
|
|
||||||
|
function u(t, e) {
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
|
||||||
|
function c(t, r, n) {
|
||||||
|
if (t.customInspect && r && w(r.inspect) && r.inspect !== e.inspect && (!r.constructor || r.constructor.prototype !== r)) {
|
||||||
|
var i = r.inspect(n, t);
|
||||||
|
return v(i) || (i = c(t, i, n)), i
|
||||||
|
}
|
||||||
|
var o = function(t, e) {
|
||||||
|
if (m(e)) return t.stylize("undefined", "undefined");
|
||||||
|
if (v(e)) {
|
||||||
|
var r = "'" + JSON.stringify(e).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'";
|
||||||
|
return t.stylize(r, "string")
|
||||||
|
}
|
||||||
|
return d(e) ? t.stylize("" + e, "number") : y(e) ? t.stylize("" + e, "boolean") : g(e) ? t.stylize("null", "null") : void 0
|
||||||
|
}(t, r);
|
||||||
|
if (o) return o;
|
||||||
|
var s = Object.keys(r),
|
||||||
|
a = function(t) {
|
||||||
|
var e = {};
|
||||||
|
return t.forEach((function(t, r) {
|
||||||
|
e[t] = !0
|
||||||
|
})), e
|
||||||
|
}(s);
|
||||||
|
if (t.showHidden && (s = Object.getOwnPropertyNames(r)), E(r) && (s.indexOf("message") >= 0 || s.indexOf("description") >= 0)) return h(r);
|
||||||
|
if (0 === s.length) {
|
||||||
|
if (w(r)) {
|
||||||
|
var f = r.name ? ": " + r.name : "";
|
||||||
|
return t.stylize("[Function" + f + "]", "special")
|
||||||
|
}
|
||||||
|
if (S(r)) return t.stylize(RegExp.prototype.toString.call(r), "regexp");
|
||||||
|
if (b(r)) return t.stylize(Date.prototype.toString.call(r), "date");
|
||||||
|
if (E(r)) return h(r)
|
||||||
|
}
|
||||||
|
var u, _ = "",
|
||||||
|
O = !1,
|
||||||
|
B = ["{", "}"];
|
||||||
|
return l(r) && (O = !0, B = ["[", "]"]), w(r) && (_ = " [Function" + (r.name ? ": " + r.name : "") + "]"), S(r) && (_ = " " + RegExp.prototype.toString.call(r)), b(r) && (_ = " " + Date.prototype.toUTCString.call(r)), E(r) && (_ = " " + h(r)), 0 !== s.length || O && 0 != r.length ? n < 0 ? S(r) ? t.stylize(RegExp.prototype.toString.call(r), "regexp") : t.stylize("[Object]", "special") : (t.seen.push(r), u = O ? function(t, e, r, n, i) {
|
||||||
|
for (var o = [], s = 0, a = e.length; s < a; ++s) x(e, String(s)) ? o.push(p(t, e, r, n, String(s), !0)) : o.push("");
|
||||||
|
return i.forEach((function(i) {
|
||||||
|
i.match(/^\d+$/) || o.push(p(t, e, r, n, i, !0))
|
||||||
|
})), o
|
||||||
|
}(t, r, n, a, s) : s.map((function(e) {
|
||||||
|
return p(t, r, n, a, e, O)
|
||||||
|
})), t.seen.pop(), function(t, e, r) {
|
||||||
|
return t.reduce((function(t, e) {
|
||||||
|
return e.indexOf("\n"), t + e.replace(/\u001b\[\d\d?m/g, "").length + 1
|
||||||
|
}), 0) > 60 ? r[0] + ("" === e ? "" : e + "\n ") + " " + t.join(",\n ") + " " + r[1] : r[0] + e + " " + t.join(", ") + " " + r[1]
|
||||||
|
}(u, _, B)) : B[0] + _ + B[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
function h(t) {
|
||||||
|
return "[" + Error.prototype.toString.call(t) + "]"
|
||||||
|
}
|
||||||
|
|
||||||
|
function p(t, e, r, n, i, o) {
|
||||||
|
var s, a, f;
|
||||||
|
if ((f = Object.getOwnPropertyDescriptor(e, i) || {
|
||||||
|
value: e[i]
|
||||||
|
}).get ? a = f.set ? t.stylize("[Getter/Setter]", "special") : t.stylize("[Getter]", "special") : f.set && (a = t.stylize("[Setter]", "special")), x(n, i) || (s = "[" + i + "]"), a || (t.seen.indexOf(f.value) < 0 ? (a = g(r) ? c(t, f.value, null) : c(t, f.value, r - 1)).indexOf("\n") > -1 && (a = o ? a.split("\n").map((function(t) {
|
||||||
|
return " " + t
|
||||||
|
})).join("\n").substr(2) : "\n" + a.split("\n").map((function(t) {
|
||||||
|
return " " + t
|
||||||
|
})).join("\n")) : a = t.stylize("[Circular]", "special")), m(s)) {
|
||||||
|
if (o && i.match(/^\d+$/)) return a;
|
||||||
|
(s = JSON.stringify("" + i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/) ? (s = s.substr(1, s.length - 2), s = t.stylize(s, "name")) : (s = s.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"), s = t.stylize(s, "string"))
|
||||||
|
}
|
||||||
|
return s + ": " + a
|
||||||
|
}
|
||||||
|
|
||||||
|
function l(t) {
|
||||||
|
return Array.isArray(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
function y(t) {
|
||||||
|
return "boolean" == typeof t
|
||||||
|
}
|
||||||
|
|
||||||
|
function g(t) {
|
||||||
|
return null === t
|
||||||
|
}
|
||||||
|
|
||||||
|
function d(t) {
|
||||||
|
return "number" == typeof t
|
||||||
|
}
|
||||||
|
|
||||||
|
function v(t) {
|
||||||
|
return "string" == typeof t
|
||||||
|
}
|
||||||
|
|
||||||
|
function m(t) {
|
||||||
|
return void 0 === t
|
||||||
|
}
|
||||||
|
|
||||||
|
function S(t) {
|
||||||
|
return _(t) && "[object RegExp]" === O(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
function _(t) {
|
||||||
|
return "object" == typeof t && null !== t
|
||||||
|
}
|
||||||
|
|
||||||
|
function b(t) {
|
||||||
|
return _(t) && "[object Date]" === O(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
function E(t) {
|
||||||
|
return _(t) && ("[object Error]" === O(t) || t instanceof Error)
|
||||||
|
}
|
||||||
|
|
||||||
|
function w(t) {
|
||||||
|
return "function" == typeof t
|
||||||
|
}
|
||||||
|
|
||||||
|
function O(t) {
|
||||||
|
return Object.prototype.toString.call(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
function B(t) {
|
||||||
|
return t < 10 ? "0" + t.toString(10) : t.toString(10)
|
||||||
|
}
|
||||||
|
e.debuglog = function(t) {
|
||||||
|
if (m(o) && (o = n.env.NODE_DEBUG || ""), t = t.toUpperCase(), !s[t])
|
||||||
|
if (new RegExp("\\b" + t + "\\b", "i").test(o)) {
|
||||||
|
var r = n.pid;
|
||||||
|
s[t] = function() {
|
||||||
|
var n = e.format.apply(e, arguments);
|
||||||
|
console.error("%s %d: %s", t, r, n)
|
||||||
|
}
|
||||||
|
} else s[t] = function() {};
|
||||||
|
return s[t]
|
||||||
|
}, e.inspect = a, a.colors = {
|
||||||
|
bold: [1, 22],
|
||||||
|
italic: [3, 23],
|
||||||
|
underline: [4, 24],
|
||||||
|
inverse: [7, 27],
|
||||||
|
white: [37, 39],
|
||||||
|
grey: [90, 39],
|
||||||
|
black: [30, 39],
|
||||||
|
blue: [34, 39],
|
||||||
|
cyan: [36, 39],
|
||||||
|
green: [32, 39],
|
||||||
|
magenta: [35, 39],
|
||||||
|
red: [31, 39],
|
||||||
|
yellow: [33, 39]
|
||||||
|
}, a.styles = {
|
||||||
|
special: "cyan",
|
||||||
|
number: "yellow",
|
||||||
|
boolean: "yellow",
|
||||||
|
undefined: "grey",
|
||||||
|
null: "bold",
|
||||||
|
string: "green",
|
||||||
|
date: "magenta",
|
||||||
|
regexp: "red"
|
||||||
|
}, e.isArray = l, e.isBoolean = y, e.isNull = g, e.isNullOrUndefined = function(t) {
|
||||||
|
return null == t
|
||||||
|
}, e.isNumber = d, e.isString = v, e.isSymbol = function(t) {
|
||||||
|
return "symbol" == typeof t
|
||||||
|
}, e.isUndefined = m, e.isRegExp = S, e.isObject = _, e.isDate = b, e.isError = E, e.isFunction = w, e.isPrimitive = function(t) {
|
||||||
|
return null === t || "boolean" == typeof t || "number" == typeof t || "string" == typeof t || "symbol" == typeof t || void 0 === t
|
||||||
|
}, e.isBuffer = r(3845);
|
||||||
|
var A = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
||||||
|
|
||||||
|
function x(t, e) {
|
||||||
|
return Object.prototype.hasOwnProperty.call(t, e)
|
||||||
|
}
|
||||||
|
e.log = function() {
|
||||||
|
var t, r;
|
||||||
|
console.log("%s - %s", (r = [B((t = new Date).getHours()), B(t.getMinutes()), B(t.getSeconds())].join(":"), [t.getDate(), A[t.getMonth()], r].join(" ")), e.format.apply(e, arguments))
|
||||||
|
}, e.inherits = r(6100), e._extend = function(t, e) {
|
||||||
|
if (!e || !_(e)) return t;
|
||||||
|
for (var r = Object.keys(e), n = r.length; n--;) t[r[n]] = e[r[n]];
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
},
|
||||||
|
7526: (t, e) => {
|
||||||
|
"use strict";
|
||||||
|
e.byteLength = function(t) {
|
||||||
|
var e = a(t),
|
||||||
|
r = e[0],
|
||||||
|
n = e[1];
|
||||||
|
return 3 * (r + n) / 4 - n
|
||||||
|
}, e.toByteArray = function(t) {
|
||||||
|
var e, r, o = a(t),
|
||||||
|
s = o[0],
|
||||||
|
f = o[1],
|
||||||
|
u = new i(function(t, e, r) {
|
||||||
|
return 3 * (e + r) / 4 - r
|
||||||
|
}(0, s, f)),
|
||||||
|
c = 0,
|
||||||
|
h = f > 0 ? s - 4 : s;
|
||||||
|
for (r = 0; r < h; r += 4) e = n[t.charCodeAt(r)] << 18 | n[t.charCodeAt(r + 1)] << 12 | n[t.charCodeAt(r + 2)] << 6 | n[t.charCodeAt(r + 3)], u[c++] = e >> 16 & 255, u[c++] = e >> 8 & 255, u[c++] = 255 & e;
|
||||||
|
return 2 === f && (e = n[t.charCodeAt(r)] << 2 | n[t.charCodeAt(r + 1)] >> 4, u[c++] = 255 & e), 1 === f && (e = n[t.charCodeAt(r)] << 10 | n[t.charCodeAt(r + 1)] << 4 | n[t.charCodeAt(r + 2)] >> 2, u[c++] = e >> 8 & 255, u[c++] = 255 & e), u
|
||||||
|
}, e.fromByteArray = function(t) {
|
||||||
|
for (var e, n = t.length, i = n % 3, o = [], s = 16383, a = 0, u = n - i; a < u; a += s) o.push(f(t, a, a + s > u ? u : a + s));
|
||||||
|
return 1 === i ? (e = t[n - 1], o.push(r[e >> 2] + r[e << 4 & 63] + "==")) : 2 === i && (e = (t[n - 2] << 8) + t[n - 1], o.push(r[e >> 10] + r[e >> 4 & 63] + r[e << 2 & 63] + "=")), o.join("")
|
||||||
|
};
|
||||||
|
for (var r = [], n = [], i = "undefined" != typeof Uint8Array ? Uint8Array : Array, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", s = 0; s < 64; ++s) r[s] = o[s], n[o.charCodeAt(s)] = s;
|
||||||
|
|
||||||
|
function a(t) {
|
||||||
|
var e = t.length;
|
||||||
|
if (e % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4");
|
||||||
|
var r = t.indexOf("=");
|
||||||
|
return -1 === r && (r = e), [r, r === e ? 0 : 4 - r % 4]
|
||||||
|
}
|
||||||
|
|
||||||
|
function f(t, e, n) {
|
||||||
|
for (var i, o, s = [], a = e; a < n; a += 3) i = (t[a] << 16 & 16711680) + (t[a + 1] << 8 & 65280) + (255 & t[a + 2]), s.push(r[(o = i) >> 18 & 63] + r[o >> 12 & 63] + r[o >> 6 & 63] + r[63 & o]);
|
||||||
|
return s.join("")
|
||||||
|
}
|
||||||
|
n["-".charCodeAt(0)] = 62, n["_".charCodeAt(0)] = 63
|
||||||
|
},
|
||||||
|
8287: (t, e, r) => {
|
||||||
|
"use strict";
|
||||||
|
var n = r(7526),
|
||||||
|
i = r(251);
|
||||||
|
e.Buffer = a, e.SlowBuffer = function(t) {
|
||||||
|
return +t != t && (t = 0), a.alloc(+t)
|
||||||
|
}, e.INSPECT_MAX_BYTES = 50;
|
||||||
|
var o = 2147483647;
|
||||||
|
|
||||||
|
function s(t) {
|
||||||
|
if (t > o) throw new RangeError('The value "' + t + '" is invalid for option "size"');
|
||||||
|
var e = new Uint8Array(t);
|
||||||
|
return e.__proto__ = a.prototype, e
|
||||||
|
}
|
||||||
|
|
||||||
|
function a(t, e, r) {
|
||||||
|
if ("number" == typeof t) {
|
||||||
|
if ("string" == typeof e) throw new TypeError('The "string" argument must be of type string. Received type number');
|
||||||
|
return c(t)
|
||||||
|
}
|
||||||
|
return f(t, e, r)
|
||||||
|
}
|
||||||
|
|
||||||
|
function f(t, e, r) {
|
||||||
|
if ("string" == typeof t) return function(t, e) {
|
||||||
|
if ("string" == typeof e && "" !== e || (e = "utf8"), !a.isEncoding(e)) throw new TypeError("Unknown encoding: " + e);
|
||||||
|
var r = 0 | l(t, e),
|
||||||
|
n = s(r),
|
||||||
|
i = n.write(t, e);
|
||||||
|
return i !== r && (n = n.slice(0, i)), n
|
||||||
|
}(t, e);
|
||||||
|
if (ArrayBuffer.isView(t)) return h(t);
|
||||||
|
if (null == t) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof t);
|
||||||
|
if (H(t, ArrayBuffer) || t && H(t.buffer, ArrayBuffer)) return function(t, e, r) {
|
||||||
|
if (e < 0 || t.byteLength < e) throw new RangeError('"offset" is outside of buffer bounds');
|
||||||
|
if (t.byteLength < e + (r || 0)) throw new RangeError('"length" is outside of buffer bounds');
|
||||||
|
var n;
|
||||||
|
return (n = void 0 === e && void 0 === r ? new Uint8Array(t) : void 0 === r ? new Uint8Array(t, e) : new Uint8Array(t, e, r)).__proto__ = a.prototype, n
|
||||||
|
}(t, e, r);
|
||||||
|
if ("number" == typeof t) throw new TypeError('The "value" argument must not be of type number. Received type number');
|
||||||
|
var n = t.valueOf && t.valueOf();
|
||||||
|
if (null != n && n !== t) return a.from(n, e, r);
|
||||||
|
var i = function(t) {
|
||||||
|
if (a.isBuffer(t)) {
|
||||||
|
var e = 0 | p(t.length),
|
||||||
|
r = s(e);
|
||||||
|
return 0 === r.length || t.copy(r, 0, 0, e), r
|
||||||
|
}
|
||||||
|
return void 0 !== t.length ? "number" != typeof t.length || F(t.length) ? s(0) : h(t) : "Buffer" === t.type && Array.isArray(t.data) ? h(t.data) : void 0
|
||||||
|
}(t);
|
||||||
|
if (i) return i;
|
||||||
|
if ("undefined" != typeof Symbol && null != Symbol.toPrimitive && "function" == typeof t[Symbol.toPrimitive]) return a.from(t[Symbol.toPrimitive]("string"), e, r);
|
||||||
|
throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof t)
|
||||||
|
}
|
||||||
|
|
||||||
|
function u(t) {
|
||||||
|
if ("number" != typeof t) throw new TypeError('"size" argument must be of type number');
|
||||||
|
if (t < 0) throw new RangeError('The value "' + t + '" is invalid for option "size"')
|
||||||
|
}
|
||||||
|
|
||||||
|
function c(t) {
|
||||||
|
return u(t), s(t < 0 ? 0 : 0 | p(t))
|
||||||
|
}
|
||||||
|
|
||||||
|
function h(t) {
|
||||||
|
for (var e = t.length < 0 ? 0 : 0 | p(t.length), r = s(e), n = 0; n < e; n += 1) r[n] = 255 & t[n];
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
function p(t) {
|
||||||
|
if (t >= o) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + o.toString(16) + " bytes");
|
||||||
|
return 0 | t
|
||||||
|
}
|
||||||
|
|
||||||
|
function l(t, e) {
|
||||||
|
if (a.isBuffer(t)) return t.length;
|
||||||
|
if (ArrayBuffer.isView(t) || H(t, ArrayBuffer)) return t.byteLength;
|
||||||
|
if ("string" != typeof t) throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof t);
|
||||||
|
var r = t.length,
|
||||||
|
n = arguments.length > 2 && !0 === arguments[2];
|
||||||
|
if (!n && 0 === r) return 0;
|
||||||
|
for (var i = !1;;) switch (e) {
|
||||||
|
case "ascii":
|
||||||
|
case "latin1":
|
||||||
|
case "binary":
|
||||||
|
return r;
|
||||||
|
case "utf8":
|
||||||
|
case "utf-8":
|
||||||
|
return U(t).length;
|
||||||
|
case "ucs2":
|
||||||
|
case "ucs-2":
|
||||||
|
case "utf16le":
|
||||||
|
case "utf-16le":
|
||||||
|
return 2 * r;
|
||||||
|
case "hex":
|
||||||
|
return r >>> 1;
|
||||||
|
case "base64":
|
||||||
|
return M(t).length;
|
||||||
|
default:
|
||||||
|
if (i) return n ? -1 : U(t).length;
|
||||||
|
e = ("" + e).toLowerCase(), i = !0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function y(t, e, r) {
|
||||||
|
var n = !1;
|
||||||
|
if ((void 0 === e || e < 0) && (e = 0), e > this.length) return "";
|
||||||
|
if ((void 0 === r || r > this.length) && (r = this.length), r <= 0) return "";
|
||||||
|
if ((r >>>= 0) <= (e >>>= 0)) return "";
|
||||||
|
for (t || (t = "utf8");;) switch (t) {
|
||||||
|
case "hex":
|
||||||
|
return T(this, e, r);
|
||||||
|
case "utf8":
|
||||||
|
case "utf-8":
|
||||||
|
return B(this, e, r);
|
||||||
|
case "ascii":
|
||||||
|
return x(this, e, r);
|
||||||
|
case "latin1":
|
||||||
|
case "binary":
|
||||||
|
return P(this, e, r);
|
||||||
|
case "base64":
|
||||||
|
return O(this, e, r);
|
||||||
|
case "ucs2":
|
||||||
|
case "ucs-2":
|
||||||
|
case "utf16le":
|
||||||
|
case "utf-16le":
|
||||||
|
return I(this, e, r);
|
||||||
|
default:
|
||||||
|
if (n) throw new TypeError("Unknown encoding: " + t);
|
||||||
|
t = (t + "").toLowerCase(), n = !0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function g(t, e, r) {
|
||||||
|
var n = t[e];
|
||||||
|
t[e] = t[r], t[r] = n
|
||||||
|
}
|
||||||
|
|
||||||
|
function d(t, e, r, n, i) {
|
||||||
|
if (0 === t.length) return -1;
|
||||||
|
if ("string" == typeof r ? (n = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), F(r = +r) && (r = i ? 0 : t.length - 1), r < 0 && (r = t.length + r), r >= t.length) {
|
||||||
|
if (i) return -1;
|
||||||
|
r = t.length - 1
|
||||||
|
} else if (r < 0) {
|
||||||
|
if (!i) return -1;
|
||||||
|
r = 0
|
||||||
|
}
|
||||||
|
if ("string" == typeof e && (e = a.from(e, n)), a.isBuffer(e)) return 0 === e.length ? -1 : v(t, e, r, n, i);
|
||||||
|
if ("number" == typeof e) return e &= 255, "function" == typeof Uint8Array.prototype.indexOf ? i ? Uint8Array.prototype.indexOf.call(t, e, r) : Uint8Array.prototype.lastIndexOf.call(t, e, r) : v(t, [e], r, n, i);
|
||||||
|
throw new TypeError("val must be string, number or Buffer")
|
||||||
|
}
|
||||||
|
|
||||||
|
function v(t, e, r, n, i) {
|
||||||
|
var o, s = 1,
|
||||||
|
a = t.length,
|
||||||
|
f = e.length;
|
||||||
|
if (void 0 !== n && ("ucs2" === (n = String(n).toLowerCase()) || "ucs-2" === n || "utf16le" === n || "utf-16le" === n)) {
|
||||||
|
if (t.length < 2 || e.length < 2) return -1;
|
||||||
|
s = 2, a /= 2, f /= 2, r /= 2
|
||||||
|
}
|
||||||
|
|
||||||
|
function u(t, e) {
|
||||||
|
return 1 === s ? t[e] : t.readUInt16BE(e * s)
|
||||||
|
}
|
||||||
|
if (i) {
|
||||||
|
var c = -1;
|
||||||
|
for (o = r; o < a; o++)
|
||||||
|
if (u(t, o) === u(e, -1 === c ? 0 : o - c)) {
|
||||||
|
if (-1 === c && (c = o), o - c + 1 === f) return c * s
|
||||||
|
} else - 1 !== c && (o -= o - c), c = -1
|
||||||
|
} else
|
||||||
|
for (r + f > a && (r = a - f), o = r; o >= 0; o--) {
|
||||||
|
for (var h = !0, p = 0; p < f; p++)
|
||||||
|
if (u(t, o + p) !== u(e, p)) {
|
||||||
|
h = !1;
|
||||||
|
break
|
||||||
|
} if (h) return o
|
||||||
|
}
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
function m(t, e, r, n) {
|
||||||
|
r = Number(r) || 0;
|
||||||
|
var i = t.length - r;
|
||||||
|
n ? (n = Number(n)) > i && (n = i) : n = i;
|
||||||
|
var o = e.length;
|
||||||
|
n > o / 2 && (n = o / 2);
|
||||||
|
for (var s = 0; s < n; ++s) {
|
||||||
|
var a = parseInt(e.substr(2 * s, 2), 16);
|
||||||
|
if (F(a)) return s;
|
||||||
|
t[r + s] = a
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
function S(t, e, r, n) {
|
||||||
|
return j(U(e, t.length - r), t, r, n)
|
||||||
|
}
|
||||||
|
|
||||||
|
function _(t, e, r, n) {
|
||||||
|
return j(function(t) {
|
||||||
|
for (var e = [], r = 0; r < t.length; ++r) e.push(255 & t.charCodeAt(r));
|
||||||
|
return e
|
||||||
|
}(e), t, r, n)
|
||||||
|
}
|
||||||
|
|
||||||
|
function b(t, e, r, n) {
|
||||||
|
return _(t, e, r, n)
|
||||||
|
}
|
||||||
|
|
||||||
|
function E(t, e, r, n) {
|
||||||
|
return j(M(e), t, r, n)
|
||||||
|
}
|
||||||
|
|
||||||
|
function w(t, e, r, n) {
|
||||||
|
return j(function(t, e) {
|
||||||
|
for (var r, n, i, o = [], s = 0; s < t.length && !((e -= 2) < 0); ++s) n = (r = t.charCodeAt(s)) >> 8, i = r % 256, o.push(i), o.push(n);
|
||||||
|
return o
|
||||||
|
}(e, t.length - r), t, r, n)
|
||||||
|
}
|
||||||
|
|
||||||
|
function O(t, e, r) {
|
||||||
|
return 0 === e && r === t.length ? n.fromByteArray(t) : n.fromByteArray(t.slice(e, r))
|
||||||
|
}
|
||||||
|
|
||||||
|
function B(t, e, r) {
|
||||||
|
r = Math.min(t.length, r);
|
||||||
|
for (var n = [], i = e; i < r;) {
|
||||||
|
var o, s, a, f, u = t[i],
|
||||||
|
c = null,
|
||||||
|
h = u > 239 ? 4 : u > 223 ? 3 : u > 191 ? 2 : 1;
|
||||||
|
if (i + h <= r) switch (h) {
|
||||||
|
case 1:
|
||||||
|
u < 128 && (c = u);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
128 == (192 & (o = t[i + 1])) && (f = (31 & u) << 6 | 63 & o) > 127 && (c = f);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
o = t[i + 1], s = t[i + 2], 128 == (192 & o) && 128 == (192 & s) && (f = (15 & u) << 12 | (63 & o) << 6 | 63 & s) > 2047 && (f < 55296 || f > 57343) && (c = f);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
o = t[i + 1], s = t[i + 2], a = t[i + 3], 128 == (192 & o) && 128 == (192 & s) && 128 == (192 & a) && (f = (15 & u) << 18 | (63 & o) << 12 | (63 & s) << 6 | 63 & a) > 65535 && f < 1114112 && (c = f)
|
||||||
|
}
|
||||||
|
null === c ? (c = 65533, h = 1) : c > 65535 && (c -= 65536, n.push(c >>> 10 & 1023 | 55296), c = 56320 | 1023 & c), n.push(c), i += h
|
||||||
|
}
|
||||||
|
return function(t) {
|
||||||
|
var e = t.length;
|
||||||
|
if (e <= A) return String.fromCharCode.apply(String, t);
|
||||||
|
for (var r = "", n = 0; n < e;) r += String.fromCharCode.apply(String, t.slice(n, n += A));
|
||||||
|
return r
|
||||||
|
}(n)
|
||||||
|
}
|
||||||
|
e.kMaxLength = o, a.TYPED_ARRAY_SUPPORT = function() {
|
||||||
|
try {
|
||||||
|
var t = new Uint8Array(1);
|
||||||
|
return t.__proto__ = {
|
||||||
|
__proto__: Uint8Array.prototype,
|
||||||
|
foo: function() {
|
||||||
|
return 42
|
||||||
|
}
|
||||||
|
}, 42 === t.foo()
|
||||||
|
} catch (t) {
|
||||||
|
return !1
|
||||||
|
}
|
||||||
|
}(), a.TYPED_ARRAY_SUPPORT || "undefined" == typeof console || "function" != typeof console.error || console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."), Object.defineProperty(a.prototype, "parent", {
|
||||||
|
enumerable: !0,
|
||||||
|
get: function() {
|
||||||
|
if (a.isBuffer(this)) return this.buffer
|
||||||
|
}
|
||||||
|
}), Object.defineProperty(a.prototype, "offset", {
|
||||||
|
enumerable: !0,
|
||||||
|
get: function() {
|
||||||
|
if (a.isBuffer(this)) return this.byteOffset
|
||||||
|
}
|
||||||
|
}), "undefined" != typeof Symbol && null != Symbol.species && a[Symbol.species] === a && Object.defineProperty(a, Symbol.species, {
|
||||||
|
value: null,
|
||||||
|
configurable: !0,
|
||||||
|
enumerable: !1,
|
||||||
|
writable: !1
|
||||||
|
}), a.poolSize = 8192, a.from = function(t, e, r) {
|
||||||
|
return f(t, e, r)
|
||||||
|
}, a.prototype.__proto__ = Uint8Array.prototype, a.__proto__ = Uint8Array, a.alloc = function(t, e, r) {
|
||||||
|
return function(t, e, r) {
|
||||||
|
return u(t), t <= 0 ? s(t) : void 0 !== e ? "string" == typeof r ? s(t).fill(e, r) : s(t).fill(e) : s(t)
|
||||||
|
}(t, e, r)
|
||||||
|
}, a.allocUnsafe = function(t) {
|
||||||
|
return c(t)
|
||||||
|
}, a.allocUnsafeSlow = function(t) {
|
||||||
|
return c(t)
|
||||||
|
}, a.isBuffer = function(t) {
|
||||||
|
return null != t && !0 === t._isBuffer && t !== a.prototype
|
||||||
|
}, a.compare = function(t, e) {
|
||||||
|
if (H(t, Uint8Array) && (t = a.from(t, t.offset, t.byteLength)), H(e, Uint8Array) && (e = a.from(e, e.offset, e.byteLength)), !a.isBuffer(t) || !a.isBuffer(e)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');
|
||||||
|
if (t === e) return 0;
|
||||||
|
for (var r = t.length, n = e.length, i = 0, o = Math.min(r, n); i < o; ++i)
|
||||||
|
if (t[i] !== e[i]) {
|
||||||
|
r = t[i], n = e[i];
|
||||||
|
break
|
||||||
|
} return r < n ? -1 : n < r ? 1 : 0
|
||||||
|
}, a.isEncoding = function(t) {
|
||||||
|
switch (String(t).toLowerCase()) {
|
||||||
|
case "hex":
|
||||||
|
case "utf8":
|
||||||
|
case "utf-8":
|
||||||
|
case "ascii":
|
||||||
|
case "latin1":
|
||||||
|
case "binary":
|
||||||
|
case "base64":
|
||||||
|
case "ucs2":
|
||||||
|
case "ucs-2":
|
||||||
|
case "utf16le":
|
||||||
|
case "utf-16le":
|
||||||
|
return !0;
|
||||||
|
default:
|
||||||
|
return !1
|
||||||
|
}
|
||||||
|
}, a.concat = function(t, e) {
|
||||||
|
if (!Array.isArray(t)) throw new TypeError('"list" argument must be an Array of Buffers');
|
||||||
|
if (0 === t.length) return a.alloc(0);
|
||||||
|
var r;
|
||||||
|
if (void 0 === e)
|
||||||
|
for (e = 0, r = 0; r < t.length; ++r) e += t[r].length;
|
||||||
|
var n = a.allocUnsafe(e),
|
||||||
|
i = 0;
|
||||||
|
for (r = 0; r < t.length; ++r) {
|
||||||
|
var o = t[r];
|
||||||
|
if (H(o, Uint8Array) && (o = a.from(o)), !a.isBuffer(o)) throw new TypeError('"list" argument must be an Array of Buffers');
|
||||||
|
o.copy(n, i), i += o.length
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}, a.byteLength = l, a.prototype._isBuffer = !0, a.prototype.swap16 = function() {
|
||||||
|
var t = this.length;
|
||||||
|
if (t % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits");
|
||||||
|
for (var e = 0; e < t; e += 2) g(this, e, e + 1);
|
||||||
|
return this
|
||||||
|
}, a.prototype.swap32 = function() {
|
||||||
|
var t = this.length;
|
||||||
|
if (t % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits");
|
||||||
|
for (var e = 0; e < t; e += 4) g(this, e, e + 3), g(this, e + 1, e + 2);
|
||||||
|
return this
|
||||||
|
}, a.prototype.swap64 = function() {
|
||||||
|
var t = this.length;
|
||||||
|
if (t % 8 != 0) throw new RangeError("Buffer size must be a multiple of 64-bits");
|
||||||
|
for (var e = 0; e < t; e += 8) g(this, e, e + 7), g(this, e + 1, e + 6), g(this, e + 2, e + 5), g(this, e + 3, e + 4);
|
||||||
|
return this
|
||||||
|
}, a.prototype.toString = function() {
|
||||||
|
var t = this.length;
|
||||||
|
return 0 === t ? "" : 0 === arguments.length ? B(this, 0, t) : y.apply(this, arguments)
|
||||||
|
}, a.prototype.toLocaleString = a.prototype.toString, a.prototype.equals = function(t) {
|
||||||
|
if (!a.isBuffer(t)) throw new TypeError("Argument must be a Buffer");
|
||||||
|
return this === t || 0 === a.compare(this, t)
|
||||||
|
}, a.prototype.inspect = function() {
|
||||||
|
var t = "",
|
||||||
|
r = e.INSPECT_MAX_BYTES;
|
||||||
|
return t = this.toString("hex", 0, r).replace(/(.{2})/g, "$1 ").trim(), this.length > r && (t += " ... "), "<Buffer " + t + ">"
|
||||||
|
}, a.prototype.compare = function(t, e, r, n, i) {
|
||||||
|
if (H(t, Uint8Array) && (t = a.from(t, t.offset, t.byteLength)), !a.isBuffer(t)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof t);
|
||||||
|
if (void 0 === e && (e = 0), void 0 === r && (r = t ? t.length : 0), void 0 === n && (n = 0), void 0 === i && (i = this.length), e < 0 || r > t.length || n < 0 || i > this.length) throw new RangeError("out of range index");
|
||||||
|
if (n >= i && e >= r) return 0;
|
||||||
|
if (n >= i) return -1;
|
||||||
|
if (e >= r) return 1;
|
||||||
|
if (this === t) return 0;
|
||||||
|
for (var o = (i >>>= 0) - (n >>>= 0), s = (r >>>= 0) - (e >>>= 0), f = Math.min(o, s), u = this.slice(n, i), c = t.slice(e, r), h = 0; h < f; ++h)
|
||||||
|
if (u[h] !== c[h]) {
|
||||||
|
o = u[h], s = c[h];
|
||||||
|
break
|
||||||
|
} return o < s ? -1 : s < o ? 1 : 0
|
||||||
|
}, a.prototype.includes = function(t, e, r) {
|
||||||
|
return -1 !== this.indexOf(t, e, r)
|
||||||
|
}, a.prototype.indexOf = function(t, e, r) {
|
||||||
|
return d(this, t, e, r, !0)
|
||||||
|
}, a.prototype.lastIndexOf = function(t, e, r) {
|
||||||
|
return d(this, t, e, r, !1)
|
||||||
|
}, a.prototype.write = function(t, e, r, n) {
|
||||||
|
if (void 0 === e) n = "utf8", r = this.length, e = 0;
|
||||||
|
else if (void 0 === r && "string" == typeof e) n = e, r = this.length, e = 0;
|
||||||
|
else {
|
||||||
|
if (!isFinite(e)) throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
|
||||||
|
e >>>= 0, isFinite(r) ? (r >>>= 0, void 0 === n && (n = "utf8")) : (n = r, r = void 0)
|
||||||
|
}
|
||||||
|
var i = this.length - e;
|
||||||
|
if ((void 0 === r || r > i) && (r = i), t.length > 0 && (r < 0 || e < 0) || e > this.length) throw new RangeError("Attempt to write outside buffer bounds");
|
||||||
|
n || (n = "utf8");
|
||||||
|
for (var o = !1;;) switch (n) {
|
||||||
|
case "hex":
|
||||||
|
return m(this, t, e, r);
|
||||||
|
case "utf8":
|
||||||
|
case "utf-8":
|
||||||
|
return S(this, t, e, r);
|
||||||
|
case "ascii":
|
||||||
|
return _(this, t, e, r);
|
||||||
|
case "latin1":
|
||||||
|
case "binary":
|
||||||
|
return b(this, t, e, r);
|
||||||
|
case "base64":
|
||||||
|
return E(this, t, e, r);
|
||||||
|
case "ucs2":
|
||||||
|
case "ucs-2":
|
||||||
|
case "utf16le":
|
||||||
|
case "utf-16le":
|
||||||
|
return w(this, t, e, r);
|
||||||
|
default:
|
||||||
|
if (o) throw new TypeError("Unknown encoding: " + n);
|
||||||
|
n = ("" + n).toLowerCase(), o = !0
|
||||||
|
}
|
||||||
|
}, a.prototype.toJSON = function() {
|
||||||
|
return {
|
||||||
|
type: "Buffer",
|
||||||
|
data: Array.prototype.slice.call(this._arr || this, 0)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var A = 4096;
|
||||||
|
|
||||||
|
function x(t, e, r) {
|
||||||
|
var n = "";
|
||||||
|
r = Math.min(t.length, r);
|
||||||
|
for (var i = e; i < r; ++i) n += String.fromCharCode(127 & t[i]);
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
function P(t, e, r) {
|
||||||
|
var n = "";
|
||||||
|
r = Math.min(t.length, r);
|
||||||
|
for (var i = e; i < r; ++i) n += String.fromCharCode(t[i]);
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
function T(t, e, r) {
|
||||||
|
var n, i = t.length;
|
||||||
|
(!e || e < 0) && (e = 0), (!r || r < 0 || r > i) && (r = i);
|
||||||
|
for (var o = "", s = e; s < r; ++s) o += (n = t[s]) < 16 ? "0" + n.toString(16) : n.toString(16);
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
function I(t, e, r) {
|
||||||
|
for (var n = t.slice(e, r), i = "", o = 0; o < n.length; o += 2) i += String.fromCharCode(n[o] + 256 * n[o + 1]);
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
|
function k(t, e, r) {
|
||||||
|
if (t % 1 != 0 || t < 0) throw new RangeError("offset is not uint");
|
||||||
|
if (t + e > r) throw new RangeError("Trying to access beyond buffer length")
|
||||||
|
}
|
||||||
|
|
||||||
|
function D(t, e, r, n, i, o) {
|
||||||
|
if (!a.isBuffer(t)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
||||||
|
if (e > i || e < o) throw new RangeError('"value" argument is out of bounds');
|
||||||
|
if (r + n > t.length) throw new RangeError("Index out of range")
|
||||||
|
}
|
||||||
|
|
||||||
|
function R(t, e, r, n, i, o) {
|
||||||
|
if (r + n > t.length) throw new RangeError("Index out of range");
|
||||||
|
if (r < 0) throw new RangeError("Index out of range")
|
||||||
|
}
|
||||||
|
|
||||||
|
function N(t, e, r, n, o) {
|
||||||
|
return e = +e, r >>>= 0, o || R(t, 0, r, 4), i.write(t, e, r, n, 23, 4), r + 4
|
||||||
|
}
|
||||||
|
|
||||||
|
function L(t, e, r, n, o) {
|
||||||
|
return e = +e, r >>>= 0, o || R(t, 0, r, 8), i.write(t, e, r, n, 52, 8), r + 8
|
||||||
|
}
|
||||||
|
a.prototype.slice = function(t, e) {
|
||||||
|
var r = this.length;
|
||||||
|
(t = ~~t) < 0 ? (t += r) < 0 && (t = 0) : t > r && (t = r), (e = void 0 === e ? r : ~~e) < 0 ? (e += r) < 0 && (e = 0) : e > r && (e = r), e < t && (e = t);
|
||||||
|
var n = this.subarray(t, e);
|
||||||
|
return n.__proto__ = a.prototype, n
|
||||||
|
}, a.prototype.readUIntLE = function(t, e, r) {
|
||||||
|
t >>>= 0, e >>>= 0, r || k(t, e, this.length);
|
||||||
|
for (var n = this[t], i = 1, o = 0; ++o < e && (i *= 256);) n += this[t + o] * i;
|
||||||
|
return n
|
||||||
|
}, a.prototype.readUIntBE = function(t, e, r) {
|
||||||
|
t >>>= 0, e >>>= 0, r || k(t, e, this.length);
|
||||||
|
for (var n = this[t + --e], i = 1; e > 0 && (i *= 256);) n += this[t + --e] * i;
|
||||||
|
return n
|
||||||
|
}, a.prototype.readUInt8 = function(t, e) {
|
||||||
|
return t >>>= 0, e || k(t, 1, this.length), this[t]
|
||||||
|
}, a.prototype.readUInt16LE = function(t, e) {
|
||||||
|
return t >>>= 0, e || k(t, 2, this.length), this[t] | this[t + 1] << 8
|
||||||
|
}, a.prototype.readUInt16BE = function(t, e) {
|
||||||
|
return t >>>= 0, e || k(t, 2, this.length), this[t] << 8 | this[t + 1]
|
||||||
|
}, a.prototype.readUInt32LE = function(t, e) {
|
||||||
|
return t >>>= 0, e || k(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + 16777216 * this[t + 3]
|
||||||
|
}, a.prototype.readUInt32BE = function(t, e) {
|
||||||
|
return t >>>= 0, e || k(t, 4, this.length), 16777216 * this[t] + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3])
|
||||||
|
}, a.prototype.readIntLE = function(t, e, r) {
|
||||||
|
t >>>= 0, e >>>= 0, r || k(t, e, this.length);
|
||||||
|
for (var n = this[t], i = 1, o = 0; ++o < e && (i *= 256);) n += this[t + o] * i;
|
||||||
|
return n >= (i *= 128) && (n -= Math.pow(2, 8 * e)), n
|
||||||
|
}, a.prototype.readIntBE = function(t, e, r) {
|
||||||
|
t >>>= 0, e >>>= 0, r || k(t, e, this.length);
|
||||||
|
for (var n = e, i = 1, o = this[t + --n]; n > 0 && (i *= 256);) o += this[t + --n] * i;
|
||||||
|
return o >= (i *= 128) && (o -= Math.pow(2, 8 * e)), o
|
||||||
|
}, a.prototype.readInt8 = function(t, e) {
|
||||||
|
return t >>>= 0, e || k(t, 1, this.length), 128 & this[t] ? -1 * (255 - this[t] + 1) : this[t]
|
||||||
|
}, a.prototype.readInt16LE = function(t, e) {
|
||||||
|
t >>>= 0, e || k(t, 2, this.length);
|
||||||
|
var r = this[t] | this[t + 1] << 8;
|
||||||
|
return 32768 & r ? 4294901760 | r : r
|
||||||
|
}, a.prototype.readInt16BE = function(t, e) {
|
||||||
|
t >>>= 0, e || k(t, 2, this.length);
|
||||||
|
var r = this[t + 1] | this[t] << 8;
|
||||||
|
return 32768 & r ? 4294901760 | r : r
|
||||||
|
}, a.prototype.readInt32LE = function(t, e) {
|
||||||
|
return t >>>= 0, e || k(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24
|
||||||
|
}, a.prototype.readInt32BE = function(t, e) {
|
||||||
|
return t >>>= 0, e || k(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]
|
||||||
|
}, a.prototype.readFloatLE = function(t, e) {
|
||||||
|
return t >>>= 0, e || k(t, 4, this.length), i.read(this, t, !0, 23, 4)
|
||||||
|
}, a.prototype.readFloatBE = function(t, e) {
|
||||||
|
return t >>>= 0, e || k(t, 4, this.length), i.read(this, t, !1, 23, 4)
|
||||||
|
}, a.prototype.readDoubleLE = function(t, e) {
|
||||||
|
return t >>>= 0, e || k(t, 8, this.length), i.read(this, t, !0, 52, 8)
|
||||||
|
}, a.prototype.readDoubleBE = function(t, e) {
|
||||||
|
return t >>>= 0, e || k(t, 8, this.length), i.read(this, t, !1, 52, 8)
|
||||||
|
}, a.prototype.writeUIntLE = function(t, e, r, n) {
|
||||||
|
t = +t, e >>>= 0, r >>>= 0, n || D(this, t, e, r, Math.pow(2, 8 * r) - 1, 0);
|
||||||
|
var i = 1,
|
||||||
|
o = 0;
|
||||||
|
for (this[e] = 255 & t; ++o < r && (i *= 256);) this[e + o] = t / i & 255;
|
||||||
|
return e + r
|
||||||
|
}, a.prototype.writeUIntBE = function(t, e, r, n) {
|
||||||
|
t = +t, e >>>= 0, r >>>= 0, n || D(this, t, e, r, Math.pow(2, 8 * r) - 1, 0);
|
||||||
|
var i = r - 1,
|
||||||
|
o = 1;
|
||||||
|
for (this[e + i] = 255 & t; --i >= 0 && (o *= 256);) this[e + i] = t / o & 255;
|
||||||
|
return e + r
|
||||||
|
}, a.prototype.writeUInt8 = function(t, e, r) {
|
||||||
|
return t = +t, e >>>= 0, r || D(this, t, e, 1, 255, 0), this[e] = 255 & t, e + 1
|
||||||
|
}, a.prototype.writeUInt16LE = function(t, e, r) {
|
||||||
|
return t = +t, e >>>= 0, r || D(this, t, e, 2, 65535, 0), this[e] = 255 & t, this[e + 1] = t >>> 8, e + 2
|
||||||
|
}, a.prototype.writeUInt16BE = function(t, e, r) {
|
||||||
|
return t = +t, e >>>= 0, r || D(this, t, e, 2, 65535, 0), this[e] = t >>> 8, this[e + 1] = 255 & t, e + 2
|
||||||
|
}, a.prototype.writeUInt32LE = function(t, e, r) {
|
||||||
|
return t = +t, e >>>= 0, r || D(this, t, e, 4, 4294967295, 0), this[e + 3] = t >>> 24, this[e + 2] = t >>> 16, this[e + 1] = t >>> 8, this[e] = 255 & t, e + 4
|
||||||
|
}, a.prototype.writeUInt32BE = function(t, e, r) {
|
||||||
|
return t = +t, e >>>= 0, r || D(this, t, e, 4, 4294967295, 0), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = 255 & t, e + 4
|
||||||
|
}, a.prototype.writeIntLE = function(t, e, r, n) {
|
||||||
|
if (t = +t, e >>>= 0, !n) {
|
||||||
|
var i = Math.pow(2, 8 * r - 1);
|
||||||
|
D(this, t, e, r, i - 1, -i)
|
||||||
|
}
|
||||||
|
var o = 0,
|
||||||
|
s = 1,
|
||||||
|
a = 0;
|
||||||
|
for (this[e] = 255 & t; ++o < r && (s *= 256);) t < 0 && 0 === a && 0 !== this[e + o - 1] && (a = 1), this[e + o] = (t / s | 0) - a & 255;
|
||||||
|
return e + r
|
||||||
|
}, a.prototype.writeIntBE = function(t, e, r, n) {
|
||||||
|
if (t = +t, e >>>= 0, !n) {
|
||||||
|
var i = Math.pow(2, 8 * r - 1);
|
||||||
|
D(this, t, e, r, i - 1, -i)
|
||||||
|
}
|
||||||
|
var o = r - 1,
|
||||||
|
s = 1,
|
||||||
|
a = 0;
|
||||||
|
for (this[e + o] = 255 & t; --o >= 0 && (s *= 256);) t < 0 && 0 === a && 0 !== this[e + o + 1] && (a = 1), this[e + o] = (t / s | 0) - a & 255;
|
||||||
|
return e + r
|
||||||
|
}, a.prototype.writeInt8 = function(t, e, r) {
|
||||||
|
return t = +t, e >>>= 0, r || D(this, t, e, 1, 127, -128), t < 0 && (t = 255 + t + 1), this[e] = 255 & t, e + 1
|
||||||
|
}, a.prototype.writeInt16LE = function(t, e, r) {
|
||||||
|
return t = +t, e >>>= 0, r || D(this, t, e, 2, 32767, -32768), this[e] = 255 & t, this[e + 1] = t >>> 8, e + 2
|
||||||
|
}, a.prototype.writeInt16BE = function(t, e, r) {
|
||||||
|
return t = +t, e >>>= 0, r || D(this, t, e, 2, 32767, -32768), this[e] = t >>> 8, this[e + 1] = 255 & t, e + 2
|
||||||
|
}, a.prototype.writeInt32LE = function(t, e, r) {
|
||||||
|
return t = +t, e >>>= 0, r || D(this, t, e, 4, 2147483647, -2147483648), this[e] = 255 & t, this[e + 1] = t >>> 8, this[e + 2] = t >>> 16, this[e + 3] = t >>> 24, e + 4
|
||||||
|
}, a.prototype.writeInt32BE = function(t, e, r) {
|
||||||
|
return t = +t, e >>>= 0, r || D(this, t, e, 4, 2147483647, -2147483648), t < 0 && (t = 4294967295 + t + 1), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = 255 & t, e + 4
|
||||||
|
}, a.prototype.writeFloatLE = function(t, e, r) {
|
||||||
|
return N(this, t, e, !0, r)
|
||||||
|
}, a.prototype.writeFloatBE = function(t, e, r) {
|
||||||
|
return N(this, t, e, !1, r)
|
||||||
|
}, a.prototype.writeDoubleLE = function(t, e, r) {
|
||||||
|
return L(this, t, e, !0, r)
|
||||||
|
}, a.prototype.writeDoubleBE = function(t, e, r) {
|
||||||
|
return L(this, t, e, !1, r)
|
||||||
|
}, a.prototype.copy = function(t, e, r, n) {
|
||||||
|
if (!a.isBuffer(t)) throw new TypeError("argument should be a Buffer");
|
||||||
|
if (r || (r = 0), n || 0 === n || (n = this.length), e >= t.length && (e = t.length), e || (e = 0), n > 0 && n < r && (n = r), n === r) return 0;
|
||||||
|
if (0 === t.length || 0 === this.length) return 0;
|
||||||
|
if (e < 0) throw new RangeError("targetStart out of bounds");
|
||||||
|
if (r < 0 || r >= this.length) throw new RangeError("Index out of range");
|
||||||
|
if (n < 0) throw new RangeError("sourceEnd out of bounds");
|
||||||
|
n > this.length && (n = this.length), t.length - e < n - r && (n = t.length - e + r);
|
||||||
|
var i = n - r;
|
||||||
|
if (this === t && "function" == typeof Uint8Array.prototype.copyWithin) this.copyWithin(e, r, n);
|
||||||
|
else if (this === t && r < e && e < n)
|
||||||
|
for (var o = i - 1; o >= 0; --o) t[o + e] = this[o + r];
|
||||||
|
else Uint8Array.prototype.set.call(t, this.subarray(r, n), e);
|
||||||
|
return i
|
||||||
|
}, a.prototype.fill = function(t, e, r, n) {
|
||||||
|
if ("string" == typeof t) {
|
||||||
|
if ("string" == typeof e ? (n = e, e = 0, r = this.length) : "string" == typeof r && (n = r, r = this.length), void 0 !== n && "string" != typeof n) throw new TypeError("encoding must be a string");
|
||||||
|
if ("string" == typeof n && !a.isEncoding(n)) throw new TypeError("Unknown encoding: " + n);
|
||||||
|
if (1 === t.length) {
|
||||||
|
var i = t.charCodeAt(0);
|
||||||
|
("utf8" === n && i < 128 || "latin1" === n) && (t = i)
|
||||||
|
}
|
||||||
|
} else "number" == typeof t && (t &= 255);
|
||||||
|
if (e < 0 || this.length < e || this.length < r) throw new RangeError("Out of range index");
|
||||||
|
if (r <= e) return this;
|
||||||
|
var o;
|
||||||
|
if (e >>>= 0, r = void 0 === r ? this.length : r >>> 0, t || (t = 0), "number" == typeof t)
|
||||||
|
for (o = e; o < r; ++o) this[o] = t;
|
||||||
|
else {
|
||||||
|
var s = a.isBuffer(t) ? t : a.from(t, n),
|
||||||
|
f = s.length;
|
||||||
|
if (0 === f) throw new TypeError('The value "' + t + '" is invalid for argument "value"');
|
||||||
|
for (o = 0; o < r - e; ++o) this[o + e] = s[o % f]
|
||||||
|
}
|
||||||
|
return this
|
||||||
|
};
|
||||||
|
var C = /[^+/0-9A-Za-z-_]/g;
|
||||||
|
|
||||||
|
function U(t, e) {
|
||||||
|
var r;
|
||||||
|
e = e || 1 / 0;
|
||||||
|
for (var n = t.length, i = null, o = [], s = 0; s < n; ++s) {
|
||||||
|
if ((r = t.charCodeAt(s)) > 55295 && r < 57344) {
|
||||||
|
if (!i) {
|
||||||
|
if (r > 56319) {
|
||||||
|
(e -= 3) > -1 && o.push(239, 191, 189);
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (s + 1 === n) {
|
||||||
|
(e -= 3) > -1 && o.push(239, 191, 189);
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
i = r;
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (r < 56320) {
|
||||||
|
(e -= 3) > -1 && o.push(239, 191, 189), i = r;
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
r = 65536 + (i - 55296 << 10 | r - 56320)
|
||||||
|
} else i && (e -= 3) > -1 && o.push(239, 191, 189);
|
||||||
|
if (i = null, r < 128) {
|
||||||
|
if ((e -= 1) < 0) break;
|
||||||
|
o.push(r)
|
||||||
|
} else if (r < 2048) {
|
||||||
|
if ((e -= 2) < 0) break;
|
||||||
|
o.push(r >> 6 | 192, 63 & r | 128)
|
||||||
|
} else if (r < 65536) {
|
||||||
|
if ((e -= 3) < 0) break;
|
||||||
|
o.push(r >> 12 | 224, r >> 6 & 63 | 128, 63 & r | 128)
|
||||||
|
} else {
|
||||||
|
if (!(r < 1114112)) throw new Error("Invalid code point");
|
||||||
|
if ((e -= 4) < 0) break;
|
||||||
|
o.push(r >> 18 | 240, r >> 12 & 63 | 128, r >> 6 & 63 | 128, 63 & r | 128)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
function M(t) {
|
||||||
|
return n.toByteArray(function(t) {
|
||||||
|
if ((t = (t = t.split("=")[0]).trim().replace(C, "")).length < 2) return "";
|
||||||
|
for (; t.length % 4 != 0;) t += "=";
|
||||||
|
return t
|
||||||
|
}(t))
|
||||||
|
}
|
||||||
|
|
||||||
|
function j(t, e, r, n) {
|
||||||
|
for (var i = 0; i < n && !(i + r >= e.length || i >= t.length); ++i) e[i + r] = t[i];
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
|
function H(t, e) {
|
||||||
|
return t instanceof e || null != t && null != t.constructor && null != t.constructor.name && t.constructor.name === e.name
|
||||||
|
}
|
||||||
|
|
||||||
|
function F(t) {
|
||||||
|
return t != t
|
||||||
|
}
|
||||||
|
},
|
||||||
|
8075: (t, e, r) => {
|
||||||
|
"use strict";
|
||||||
|
var n = r(453),
|
||||||
|
i = r(487),
|
||||||
|
o = i(n("String.prototype.indexOf"));
|
||||||
|
t.exports = function(t, e) {
|
||||||
|
var r = n(t, !!e);
|
||||||
|
return "function" == typeof r && o(t, ".prototype.") > -1 ? i(r) : r
|
||||||
|
}
|
||||||
|
},
|
||||||
|
487: (t, e, r) => {
|
||||||
|
"use strict";
|
||||||
|
var n = r(6743),
|
||||||
|
i = r(453),
|
||||||
|
o = r(6897),
|
||||||
|
s = r(9675),
|
||||||
|
a = i("%Function.prototype.apply%"),
|
||||||
|
f = i("%Function.prototype.call%"),
|
||||||
|
u = i("%Reflect.apply%", !0) || n.call(f, a),
|
||||||
|
c = r(655),
|
||||||
|
h = i("%Math.max%");
|
||||||
|
t.exports = function(t) {
|
||||||
|
if ("function" != typeof t) throw new s("a function is required");
|
||||||
|
var e = u(n, f, arguments);
|
||||||
|
return o(e, 1 + h(0, t.length - (arguments.length - 1)), !0)
|
||||||
|
};
|
||||||
|
var p = function() {
|
||||||
|
return u(n, a, arguments)
|
||||||
|
};
|
||||||
|
c ? c(t.exports, "apply", {
|
||||||
|
value: p
|
||||||
|
}) : t.exports.apply = p
|
||||||
|
},
|
||||||
|
955: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), r(754), r(4636), r(9506), r(7165), function() {
|
||||||
|
var t = n,
|
||||||
|
e = t.lib.BlockCipher,
|
||||||
|
r = t.algo,
|
||||||
|
i = [],
|
||||||
|
o = [],
|
||||||
|
s = [],
|
||||||
|
a = [],
|
||||||
|
f = [],
|
||||||
|
u = [],
|
||||||
|
c = [],
|
||||||
|
h = [],
|
||||||
|
p = [],
|
||||||
|
l = [];
|
||||||
|
! function() {
|
||||||
|
for (var t = [], e = 0; e < 256; e++) t[e] = e < 128 ? e << 1 : e << 1 ^ 283;
|
||||||
|
var r = 0,
|
||||||
|
n = 0;
|
||||||
|
for (e = 0; e < 256; e++) {
|
||||||
|
var y = n ^ n << 1 ^ n << 2 ^ n << 3 ^ n << 4;
|
||||||
|
y = y >>> 8 ^ 255 & y ^ 99, i[r] = y, o[y] = r;
|
||||||
|
var g = t[r],
|
||||||
|
d = t[g],
|
||||||
|
v = t[d],
|
||||||
|
m = 257 * t[y] ^ 16843008 * y;
|
||||||
|
s[r] = m << 24 | m >>> 8, a[r] = m << 16 | m >>> 16, f[r] = m << 8 | m >>> 24, u[r] = m, m = 16843009 * v ^ 65537 * d ^ 257 * g ^ 16843008 * r, c[y] = m << 24 | m >>> 8, h[y] = m << 16 | m >>> 16, p[y] = m << 8 | m >>> 24, l[y] = m, r ? (r = g ^ t[t[t[v ^ g]]], n ^= t[t[n]]) : r = n = 1
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
var y = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54],
|
||||||
|
g = r.AES = e.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
if (!this._nRounds || this._keyPriorReset !== this._key) {
|
||||||
|
for (var t = this._keyPriorReset = this._key, e = t.words, r = t.sigBytes / 4, n = 4 * ((this._nRounds = r + 6) + 1), o = this._keySchedule = [], s = 0; s < n; s++)
|
||||||
|
if (s < r) o[s] = e[s];
|
||||||
|
else {
|
||||||
|
var a = o[s - 1];
|
||||||
|
s % r ? r > 6 && s % r == 4 && (a = i[a >>> 24] << 24 | i[a >>> 16 & 255] << 16 | i[a >>> 8 & 255] << 8 | i[255 & a]) : (a = i[(a = a << 8 | a >>> 24) >>> 24] << 24 | i[a >>> 16 & 255] << 16 | i[a >>> 8 & 255] << 8 | i[255 & a], a ^= y[s / r | 0] << 24), o[s] = o[s - r] ^ a
|
||||||
|
} for (var f = this._invKeySchedule = [], u = 0; u < n; u++) s = n - u, a = u % 4 ? o[s] : o[s - 4], f[u] = u < 4 || s <= 4 ? a : c[i[a >>> 24]] ^ h[i[a >>> 16 & 255]] ^ p[i[a >>> 8 & 255]] ^ l[i[255 & a]]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
encryptBlock: function(t, e) {
|
||||||
|
this._doCryptBlock(t, e, this._keySchedule, s, a, f, u, i)
|
||||||
|
},
|
||||||
|
decryptBlock: function(t, e) {
|
||||||
|
var r = t[e + 1];
|
||||||
|
t[e + 1] = t[e + 3], t[e + 3] = r, this._doCryptBlock(t, e, this._invKeySchedule, c, h, p, l, o), r = t[e + 1], t[e + 1] = t[e + 3], t[e + 3] = r
|
||||||
|
},
|
||||||
|
_doCryptBlock: function(t, e, r, n, i, o, s, a) {
|
||||||
|
for (var f = this._nRounds, u = t[e] ^ r[0], c = t[e + 1] ^ r[1], h = t[e + 2] ^ r[2], p = t[e + 3] ^ r[3], l = 4, y = 1; y < f; y++) {
|
||||||
|
var g = n[u >>> 24] ^ i[c >>> 16 & 255] ^ o[h >>> 8 & 255] ^ s[255 & p] ^ r[l++],
|
||||||
|
d = n[c >>> 24] ^ i[h >>> 16 & 255] ^ o[p >>> 8 & 255] ^ s[255 & u] ^ r[l++],
|
||||||
|
v = n[h >>> 24] ^ i[p >>> 16 & 255] ^ o[u >>> 8 & 255] ^ s[255 & c] ^ r[l++],
|
||||||
|
m = n[p >>> 24] ^ i[u >>> 16 & 255] ^ o[c >>> 8 & 255] ^ s[255 & h] ^ r[l++];
|
||||||
|
u = g, c = d, h = v, p = m
|
||||||
|
}
|
||||||
|
g = (a[u >>> 24] << 24 | a[c >>> 16 & 255] << 16 | a[h >>> 8 & 255] << 8 | a[255 & p]) ^ r[l++], d = (a[c >>> 24] << 24 | a[h >>> 16 & 255] << 16 | a[p >>> 8 & 255] << 8 | a[255 & u]) ^ r[l++], v = (a[h >>> 24] << 24 | a[p >>> 16 & 255] << 16 | a[u >>> 8 & 255] << 8 | a[255 & c]) ^ r[l++], m = (a[p >>> 24] << 24 | a[u >>> 16 & 255] << 16 | a[c >>> 8 & 255] << 8 | a[255 & h]) ^ r[l++], t[e] = g, t[e + 1] = d, t[e + 2] = v, t[e + 3] = m
|
||||||
|
},
|
||||||
|
keySize: 8
|
||||||
|
});
|
||||||
|
t.AES = e._createHelper(g)
|
||||||
|
}(), n.AES)
|
||||||
|
},
|
||||||
|
7165: function(t, e, r) {
|
||||||
|
var n, i, o, s, a, f, u, c, h, p, l, y, g, d, v, m, S, _, b;
|
||||||
|
t.exports = (n = r(9021), r(9506), void(n.lib.Cipher || (i = n, o = i.lib, s = o.Base, a = o.WordArray, f = o.BufferedBlockAlgorithm, u = i.enc, u.Utf8, c = u.Base64, h = i.algo.EvpKDF, p = o.Cipher = f.extend({
|
||||||
|
cfg: s.extend(),
|
||||||
|
createEncryptor: function(t, e) {
|
||||||
|
return this.create(this._ENC_XFORM_MODE, t, e)
|
||||||
|
},
|
||||||
|
createDecryptor: function(t, e) {
|
||||||
|
return this.create(this._DEC_XFORM_MODE, t, e)
|
||||||
|
},
|
||||||
|
init: function(t, e, r) {
|
||||||
|
this.cfg = this.cfg.extend(r), this._xformMode = t, this._key = e, this.reset()
|
||||||
|
},
|
||||||
|
reset: function() {
|
||||||
|
f.reset.call(this), this._doReset()
|
||||||
|
},
|
||||||
|
process: function(t) {
|
||||||
|
return this._append(t), this._process()
|
||||||
|
},
|
||||||
|
finalize: function(t) {
|
||||||
|
return t && this._append(t), this._doFinalize()
|
||||||
|
},
|
||||||
|
keySize: 4,
|
||||||
|
ivSize: 4,
|
||||||
|
_ENC_XFORM_MODE: 1,
|
||||||
|
_DEC_XFORM_MODE: 2,
|
||||||
|
_createHelper: function() {
|
||||||
|
function t(t) {
|
||||||
|
return "string" == typeof t ? b : S
|
||||||
|
}
|
||||||
|
return function(e) {
|
||||||
|
return {
|
||||||
|
encrypt: function(r, n, i) {
|
||||||
|
return t(n).encrypt(e, r, n, i)
|
||||||
|
},
|
||||||
|
decrypt: function(r, n, i) {
|
||||||
|
return t(n).decrypt(e, r, n, i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}), o.StreamCipher = p.extend({
|
||||||
|
_doFinalize: function() {
|
||||||
|
return this._process(!0)
|
||||||
|
},
|
||||||
|
blockSize: 1
|
||||||
|
}), l = i.mode = {}, y = o.BlockCipherMode = s.extend({
|
||||||
|
createEncryptor: function(t, e) {
|
||||||
|
return this.Encryptor.create(t, e)
|
||||||
|
},
|
||||||
|
createDecryptor: function(t, e) {
|
||||||
|
return this.Decryptor.create(t, e)
|
||||||
|
},
|
||||||
|
init: function(t, e) {
|
||||||
|
this._cipher = t, this._iv = e
|
||||||
|
}
|
||||||
|
}), g = l.CBC = function() {
|
||||||
|
var t = y.extend();
|
||||||
|
|
||||||
|
function e(t, e, r) {
|
||||||
|
var n = this._iv;
|
||||||
|
if (n) {
|
||||||
|
var i = n;
|
||||||
|
this._iv = void 0
|
||||||
|
} else i = this._prevBlock;
|
||||||
|
for (var o = 0; o < r; o++) t[e + o] ^= i[o]
|
||||||
|
}
|
||||||
|
return t.Encryptor = t.extend({
|
||||||
|
processBlock: function(t, r) {
|
||||||
|
var n = this._cipher,
|
||||||
|
i = n.blockSize;
|
||||||
|
e.call(this, t, r, i), n.encryptBlock(t, r), this._prevBlock = t.slice(r, r + i)
|
||||||
|
}
|
||||||
|
}), t.Decryptor = t.extend({
|
||||||
|
processBlock: function(t, r) {
|
||||||
|
var n = this._cipher,
|
||||||
|
i = n.blockSize,
|
||||||
|
o = t.slice(r, r + i);
|
||||||
|
n.decryptBlock(t, r), e.call(this, t, r, i), this._prevBlock = o
|
||||||
|
}
|
||||||
|
}), t
|
||||||
|
}(), d = (i.pad = {}).Pkcs7 = {
|
||||||
|
pad: function(t, e) {
|
||||||
|
for (var r = 4 * e, n = r - t.sigBytes % r, i = n << 24 | n << 16 | n << 8 | n, o = [], s = 0; s < n; s += 4) o.push(i);
|
||||||
|
var f = a.create(o, n);
|
||||||
|
t.concat(f)
|
||||||
|
},
|
||||||
|
unpad: function(t) {
|
||||||
|
var e = 255 & t.words[t.sigBytes - 1 >>> 2];
|
||||||
|
t.sigBytes -= e
|
||||||
|
}
|
||||||
|
}, o.BlockCipher = p.extend({
|
||||||
|
cfg: p.cfg.extend({
|
||||||
|
mode: g,
|
||||||
|
padding: d
|
||||||
|
}),
|
||||||
|
reset: function() {
|
||||||
|
p.reset.call(this);
|
||||||
|
var t = this.cfg,
|
||||||
|
e = t.iv,
|
||||||
|
r = t.mode;
|
||||||
|
if (this._xformMode == this._ENC_XFORM_MODE) var n = r.createEncryptor;
|
||||||
|
else n = r.createDecryptor, this._minBufferSize = 1;
|
||||||
|
this._mode && this._mode.__creator == n ? this._mode.init(this, e && e.words) : (this._mode = n.call(r, this, e && e.words), this._mode.__creator = n)
|
||||||
|
},
|
||||||
|
_doProcessBlock: function(t, e) {
|
||||||
|
this._mode.processBlock(t, e)
|
||||||
|
},
|
||||||
|
_doFinalize: function() {
|
||||||
|
var t = this.cfg.padding;
|
||||||
|
if (this._xformMode == this._ENC_XFORM_MODE) {
|
||||||
|
t.pad(this._data, this.blockSize);
|
||||||
|
var e = this._process(!0)
|
||||||
|
} else e = this._process(!0), t.unpad(e);
|
||||||
|
return e
|
||||||
|
},
|
||||||
|
blockSize: 4
|
||||||
|
}), v = o.CipherParams = s.extend({
|
||||||
|
init: function(t) {
|
||||||
|
this.mixIn(t)
|
||||||
|
},
|
||||||
|
toString: function(t) {
|
||||||
|
return (t || this.formatter).stringify(this)
|
||||||
|
}
|
||||||
|
}), m = (i.format = {}).OpenSSL = {
|
||||||
|
stringify: function(t) {
|
||||||
|
var e = t.ciphertext,
|
||||||
|
r = t.salt;
|
||||||
|
if (r) var n = a.create([1398893684, 1701076831]).concat(r).concat(e);
|
||||||
|
else n = e;
|
||||||
|
return n.toString(c)
|
||||||
|
},
|
||||||
|
parse: function(t) {
|
||||||
|
var e = c.parse(t),
|
||||||
|
r = e.words;
|
||||||
|
if (1398893684 == r[0] && 1701076831 == r[1]) {
|
||||||
|
var n = a.create(r.slice(2, 4));
|
||||||
|
r.splice(0, 4), e.sigBytes -= 16
|
||||||
|
}
|
||||||
|
return v.create({
|
||||||
|
ciphertext: e,
|
||||||
|
salt: n
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, S = o.SerializableCipher = s.extend({
|
||||||
|
cfg: s.extend({
|
||||||
|
format: m
|
||||||
|
}),
|
||||||
|
encrypt: function(t, e, r, n) {
|
||||||
|
n = this.cfg.extend(n);
|
||||||
|
var i = t.createEncryptor(r, n),
|
||||||
|
o = i.finalize(e),
|
||||||
|
s = i.cfg;
|
||||||
|
return v.create({
|
||||||
|
ciphertext: o,
|
||||||
|
key: r,
|
||||||
|
iv: s.iv,
|
||||||
|
algorithm: t,
|
||||||
|
mode: s.mode,
|
||||||
|
padding: s.padding,
|
||||||
|
blockSize: t.blockSize,
|
||||||
|
formatter: n.format
|
||||||
|
})
|
||||||
|
},
|
||||||
|
decrypt: function(t, e, r, n) {
|
||||||
|
return n = this.cfg.extend(n), e = this._parse(e, n.format), t.createDecryptor(r, n).finalize(e.ciphertext)
|
||||||
|
},
|
||||||
|
_parse: function(t, e) {
|
||||||
|
return "string" == typeof t ? e.parse(t, this) : t
|
||||||
|
}
|
||||||
|
}), _ = (i.kdf = {}).OpenSSL = {
|
||||||
|
execute: function(t, e, r, n) {
|
||||||
|
n || (n = a.random(8));
|
||||||
|
var i = h.create({
|
||||||
|
keySize: e + r
|
||||||
|
}).compute(t, n),
|
||||||
|
o = a.create(i.words.slice(e), 4 * r);
|
||||||
|
return i.sigBytes = 4 * e, v.create({
|
||||||
|
key: i,
|
||||||
|
iv: o,
|
||||||
|
salt: n
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, b = o.PasswordBasedCipher = S.extend({
|
||||||
|
cfg: S.cfg.extend({
|
||||||
|
kdf: _
|
||||||
|
}),
|
||||||
|
encrypt: function(t, e, r, n) {
|
||||||
|
var i = (n = this.cfg.extend(n)).kdf.execute(r, t.keySize, t.ivSize);
|
||||||
|
n.iv = i.iv;
|
||||||
|
var o = S.encrypt.call(this, t, e, i.key, n);
|
||||||
|
return o.mixIn(i), o
|
||||||
|
},
|
||||||
|
decrypt: function(t, e, r, n) {
|
||||||
|
n = this.cfg.extend(n), e = this._parse(e, n.format);
|
||||||
|
var i = n.kdf.execute(r, t.keySize, t.ivSize, e.salt);
|
||||||
|
return n.iv = i.iv, S.decrypt.call(this, t, e, i.key, n)
|
||||||
|
}
|
||||||
|
}))))
|
||||||
|
},
|
||||||
|
9021: function(t, e) {
|
||||||
|
var r;
|
||||||
|
t.exports = (r = r || function(t, e) {
|
||||||
|
var r = Object.create || function() {
|
||||||
|
function t() {}
|
||||||
|
return function(e) {
|
||||||
|
var r;
|
||||||
|
return t.prototype = e, r = new t, t.prototype = null, r
|
||||||
|
}
|
||||||
|
}(),
|
||||||
|
n = {},
|
||||||
|
i = n.lib = {},
|
||||||
|
o = i.Base = {
|
||||||
|
extend: function(t) {
|
||||||
|
var e = r(this);
|
||||||
|
return t && e.mixIn(t), e.hasOwnProperty("init") && this.init !== e.init || (e.init = function() {
|
||||||
|
e.$super.init.apply(this, arguments)
|
||||||
|
}), e.init.prototype = e, e.$super = this, e
|
||||||
|
},
|
||||||
|
create: function() {
|
||||||
|
var t = this.extend();
|
||||||
|
return t.init.apply(t, arguments), t
|
||||||
|
},
|
||||||
|
init: function() {},
|
||||||
|
mixIn: function(t) {
|
||||||
|
for (var e in t) t.hasOwnProperty(e) && (this[e] = t[e]);
|
||||||
|
t.hasOwnProperty("toString") && (this.toString = t.toString)
|
||||||
|
},
|
||||||
|
clone: function() {
|
||||||
|
return this.init.prototype.extend(this)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
s = i.WordArray = o.extend({
|
||||||
|
init: function(t, e) {
|
||||||
|
t = this.words = t || [], this.sigBytes = null != e ? e : 4 * t.length
|
||||||
|
},
|
||||||
|
toString: function(t) {
|
||||||
|
return (t || f).stringify(this)
|
||||||
|
},
|
||||||
|
concat: function(t) {
|
||||||
|
var e = this.words,
|
||||||
|
r = t.words,
|
||||||
|
n = this.sigBytes,
|
||||||
|
i = t.sigBytes;
|
||||||
|
if (this.clamp(), n % 4)
|
||||||
|
for (var o = 0; o < i; o++) {
|
||||||
|
var s = r[o >>> 2] >>> 24 - o % 4 * 8 & 255;
|
||||||
|
e[n + o >>> 2] |= s << 24 - (n + o) % 4 * 8
|
||||||
|
} else
|
||||||
|
for (o = 0; o < i; o += 4) e[n + o >>> 2] = r[o >>> 2];
|
||||||
|
return this.sigBytes += i, this
|
||||||
|
},
|
||||||
|
clamp: function() {
|
||||||
|
var e = this.words,
|
||||||
|
r = this.sigBytes;
|
||||||
|
e[r >>> 2] &= 4294967295 << 32 - r % 4 * 8, e.length = t.ceil(r / 4)
|
||||||
|
},
|
||||||
|
clone: function() {
|
||||||
|
var t = o.clone.call(this);
|
||||||
|
return t.words = this.words.slice(0), t
|
||||||
|
},
|
||||||
|
random: function(e) {
|
||||||
|
for (var r, n = [], i = function(e) {
|
||||||
|
var r = 987654321,
|
||||||
|
n = 4294967295;
|
||||||
|
return function() {
|
||||||
|
var i = ((r = 36969 * (65535 & r) + (r >> 16) & n) << 16) + (e = 18e3 * (65535 & e) + (e >> 16) & n) & n;
|
||||||
|
return i /= 4294967296, (i += .5) * (t.random() > .5 ? 1 : -1)
|
||||||
|
}
|
||||||
|
}, o = 0; o < e; o += 4) {
|
||||||
|
var a = i(4294967296 * (r || t.random()));
|
||||||
|
r = 987654071 * a(), n.push(4294967296 * a() | 0)
|
||||||
|
}
|
||||||
|
return new s.init(n, e)
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
a = n.enc = {},
|
||||||
|
f = a.Hex = {
|
||||||
|
stringify: function(t) {
|
||||||
|
for (var e = t.words, r = t.sigBytes, n = [], i = 0; i < r; i++) {
|
||||||
|
var o = e[i >>> 2] >>> 24 - i % 4 * 8 & 255;
|
||||||
|
n.push((o >>> 4).toString(16)), n.push((15 & o).toString(16))
|
||||||
|
}
|
||||||
|
return n.join("")
|
||||||
|
},
|
||||||
|
parse: function(t) {
|
||||||
|
for (var e = t.length, r = [], n = 0; n < e; n += 2) r[n >>> 3] |= parseInt(t.substr(n, 2), 16) << 24 - n % 8 * 4;
|
||||||
|
return new s.init(r, e / 2)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
u = a.Latin1 = {
|
||||||
|
stringify: function(t) {
|
||||||
|
for (var e = t.words, r = t.sigBytes, n = [], i = 0; i < r; i++) {
|
||||||
|
var o = e[i >>> 2] >>> 24 - i % 4 * 8 & 255;
|
||||||
|
n.push(String.fromCharCode(o))
|
||||||
|
}
|
||||||
|
return n.join("")
|
||||||
|
},
|
||||||
|
parse: function(t) {
|
||||||
|
for (var e = t.length, r = [], n = 0; n < e; n++) r[n >>> 2] |= (255 & t.charCodeAt(n)) << 24 - n % 4 * 8;
|
||||||
|
return new s.init(r, e)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
c = a.Utf8 = {
|
||||||
|
stringify: function(t) {
|
||||||
|
try {
|
||||||
|
return decodeURIComponent(escape(u.stringify(t)))
|
||||||
|
} catch (t) {
|
||||||
|
throw new Error("Malformed UTF-8 data")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
parse: function(t) {
|
||||||
|
return u.parse(unescape(encodeURIComponent(t)))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
h = i.BufferedBlockAlgorithm = o.extend({
|
||||||
|
reset: function() {
|
||||||
|
this._data = new s.init, this._nDataBytes = 0
|
||||||
|
},
|
||||||
|
_append: function(t) {
|
||||||
|
"string" == typeof t && (t = c.parse(t)), this._data.concat(t), this._nDataBytes += t.sigBytes
|
||||||
|
},
|
||||||
|
_process: function(e) {
|
||||||
|
var r = this._data,
|
||||||
|
n = r.words,
|
||||||
|
i = r.sigBytes,
|
||||||
|
o = this.blockSize,
|
||||||
|
a = i / (4 * o),
|
||||||
|
f = (a = e ? t.ceil(a) : t.max((0 | a) - this._minBufferSize, 0)) * o,
|
||||||
|
u = t.min(4 * f, i);
|
||||||
|
if (f) {
|
||||||
|
for (var c = 0; c < f; c += o) this._doProcessBlock(n, c);
|
||||||
|
var h = n.splice(0, f);
|
||||||
|
r.sigBytes -= u
|
||||||
|
}
|
||||||
|
return new s.init(h, u)
|
||||||
|
},
|
||||||
|
clone: function() {
|
||||||
|
var t = o.clone.call(this);
|
||||||
|
return t._data = this._data.clone(), t
|
||||||
|
},
|
||||||
|
_minBufferSize: 0
|
||||||
|
}),
|
||||||
|
p = (i.Hasher = h.extend({
|
||||||
|
cfg: o.extend(),
|
||||||
|
init: function(t) {
|
||||||
|
this.cfg = this.cfg.extend(t), this.reset()
|
||||||
|
},
|
||||||
|
reset: function() {
|
||||||
|
h.reset.call(this), this._doReset()
|
||||||
|
},
|
||||||
|
update: function(t) {
|
||||||
|
return this._append(t), this._process(), this
|
||||||
|
},
|
||||||
|
finalize: function(t) {
|
||||||
|
return t && this._append(t), this._doFinalize()
|
||||||
|
},
|
||||||
|
blockSize: 16,
|
||||||
|
_createHelper: function(t) {
|
||||||
|
return function(e, r) {
|
||||||
|
return new t.init(r).finalize(e)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_createHmacHelper: function(t) {
|
||||||
|
return function(e, r) {
|
||||||
|
return new p.HMAC.init(t, r).finalize(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}), n.algo = {});
|
||||||
|
return n
|
||||||
|
}(Math), r)
|
||||||
|
},
|
||||||
|
754: function(t, e, r) {
|
||||||
|
var n, i, o;
|
||||||
|
t.exports = (n = r(9021), o = (i = n).lib.WordArray, i.enc.Base64 = {
|
||||||
|
stringify: function(t) {
|
||||||
|
var e = t.words,
|
||||||
|
r = t.sigBytes,
|
||||||
|
n = this._map;
|
||||||
|
t.clamp();
|
||||||
|
for (var i = [], o = 0; o < r; o += 3)
|
||||||
|
for (var s = (e[o >>> 2] >>> 24 - o % 4 * 8 & 255) << 16 | (e[o + 1 >>> 2] >>> 24 - (o + 1) % 4 * 8 & 255) << 8 | e[o + 2 >>> 2] >>> 24 - (o + 2) % 4 * 8 & 255, a = 0; a < 4 && o + .75 * a < r; a++) i.push(n.charAt(s >>> 6 * (3 - a) & 63));
|
||||||
|
var f = n.charAt(64);
|
||||||
|
if (f)
|
||||||
|
for (; i.length % 4;) i.push(f);
|
||||||
|
return i.join("")
|
||||||
|
},
|
||||||
|
parse: function(t) {
|
||||||
|
var e = t.length,
|
||||||
|
r = this._map,
|
||||||
|
n = this._reverseMap;
|
||||||
|
if (!n) {
|
||||||
|
n = this._reverseMap = [];
|
||||||
|
for (var i = 0; i < r.length; i++) n[r.charCodeAt(i)] = i
|
||||||
|
}
|
||||||
|
var s = r.charAt(64);
|
||||||
|
if (s) {
|
||||||
|
var a = t.indexOf(s); - 1 !== a && (e = a)
|
||||||
|
}
|
||||||
|
return function(t, e, r) {
|
||||||
|
for (var n = [], i = 0, s = 0; s < e; s++)
|
||||||
|
if (s % 4) {
|
||||||
|
var a = r[t.charCodeAt(s - 1)] << s % 4 * 2,
|
||||||
|
f = r[t.charCodeAt(s)] >>> 6 - s % 4 * 2;
|
||||||
|
n[i >>> 2] |= (a | f) << 24 - i % 4 * 8, i++
|
||||||
|
} return o.create(n, i)
|
||||||
|
}(t, e, n)
|
||||||
|
},
|
||||||
|
_map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
|
||||||
|
}, n.enc.Base64)
|
||||||
|
},
|
||||||
|
5503: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), function() {
|
||||||
|
var t = n,
|
||||||
|
e = t.lib.WordArray,
|
||||||
|
r = t.enc;
|
||||||
|
|
||||||
|
function i(t) {
|
||||||
|
return t << 8 & 4278255360 | t >>> 8 & 16711935
|
||||||
|
}
|
||||||
|
r.Utf16 = r.Utf16BE = {
|
||||||
|
stringify: function(t) {
|
||||||
|
for (var e = t.words, r = t.sigBytes, n = [], i = 0; i < r; i += 2) {
|
||||||
|
var o = e[i >>> 2] >>> 16 - i % 4 * 8 & 65535;
|
||||||
|
n.push(String.fromCharCode(o))
|
||||||
|
}
|
||||||
|
return n.join("")
|
||||||
|
},
|
||||||
|
parse: function(t) {
|
||||||
|
for (var r = t.length, n = [], i = 0; i < r; i++) n[i >>> 1] |= t.charCodeAt(i) << 16 - i % 2 * 16;
|
||||||
|
return e.create(n, 2 * r)
|
||||||
|
}
|
||||||
|
}, r.Utf16LE = {
|
||||||
|
stringify: function(t) {
|
||||||
|
for (var e = t.words, r = t.sigBytes, n = [], o = 0; o < r; o += 2) {
|
||||||
|
var s = i(e[o >>> 2] >>> 16 - o % 4 * 8 & 65535);
|
||||||
|
n.push(String.fromCharCode(s))
|
||||||
|
}
|
||||||
|
return n.join("")
|
||||||
|
},
|
||||||
|
parse: function(t) {
|
||||||
|
for (var r = t.length, n = [], o = 0; o < r; o++) n[o >>> 1] |= i(t.charCodeAt(o) << 16 - o % 2 * 16);
|
||||||
|
return e.create(n, 2 * r)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}(), n.enc.Utf16)
|
||||||
|
},
|
||||||
|
9506: function(t, e, r) {
|
||||||
|
var n, i, o, s, a, f, u, c;
|
||||||
|
t.exports = (c = r(9021), r(5471), r(1025), o = (i = (n = c).lib).Base, s = i.WordArray, f = (a = n.algo).MD5, u = a.EvpKDF = o.extend({
|
||||||
|
cfg: o.extend({
|
||||||
|
keySize: 4,
|
||||||
|
hasher: f,
|
||||||
|
iterations: 1
|
||||||
|
}),
|
||||||
|
init: function(t) {
|
||||||
|
this.cfg = this.cfg.extend(t)
|
||||||
|
},
|
||||||
|
compute: function(t, e) {
|
||||||
|
for (var r = this.cfg, n = r.hasher.create(), i = s.create(), o = i.words, a = r.keySize, f = r.iterations; o.length < a;) {
|
||||||
|
u && n.update(u);
|
||||||
|
var u = n.update(t).finalize(e);
|
||||||
|
n.reset();
|
||||||
|
for (var c = 1; c < f; c++) u = n.finalize(u), n.reset();
|
||||||
|
i.concat(u)
|
||||||
|
}
|
||||||
|
return i.sigBytes = 4 * a, i
|
||||||
|
}
|
||||||
|
}), n.EvpKDF = function(t, e, r) {
|
||||||
|
return u.create(r).compute(t, e)
|
||||||
|
}, c.EvpKDF)
|
||||||
|
},
|
||||||
|
25: function(t, e, r) {
|
||||||
|
var n, i, o, s;
|
||||||
|
t.exports = (s = r(9021), r(7165), i = (n = s).lib.CipherParams, o = n.enc.Hex, n.format.Hex = {
|
||||||
|
stringify: function(t) {
|
||||||
|
return t.ciphertext.toString(o)
|
||||||
|
},
|
||||||
|
parse: function(t) {
|
||||||
|
var e = o.parse(t);
|
||||||
|
return i.create({
|
||||||
|
ciphertext: e
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, s.format.Hex)
|
||||||
|
},
|
||||||
|
1025: function(t, e, r) {
|
||||||
|
var n, i, o;
|
||||||
|
t.exports = (i = (n = r(9021)).lib.Base, o = n.enc.Utf8, void(n.algo.HMAC = i.extend({
|
||||||
|
init: function(t, e) {
|
||||||
|
t = this._hasher = new t.init, "string" == typeof e && (e = o.parse(e));
|
||||||
|
var r = t.blockSize,
|
||||||
|
n = 4 * r;
|
||||||
|
e.sigBytes > n && (e = t.finalize(e)), e.clamp();
|
||||||
|
for (var i = this._oKey = e.clone(), s = this._iKey = e.clone(), a = i.words, f = s.words, u = 0; u < r; u++) a[u] ^= 1549556828, f[u] ^= 909522486;
|
||||||
|
i.sigBytes = s.sigBytes = n, this.reset()
|
||||||
|
},
|
||||||
|
reset: function() {
|
||||||
|
var t = this._hasher;
|
||||||
|
t.reset(), t.update(this._iKey)
|
||||||
|
},
|
||||||
|
update: function(t) {
|
||||||
|
return this._hasher.update(t), this
|
||||||
|
},
|
||||||
|
finalize: function(t) {
|
||||||
|
var e = this._hasher,
|
||||||
|
r = e.finalize(t);
|
||||||
|
return e.reset(), e.finalize(this._oKey.clone().concat(r))
|
||||||
|
}
|
||||||
|
})))
|
||||||
|
},
|
||||||
|
1396: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), r(3240), r(6440), r(5503), r(754), r(4636), r(5471), r(3009), r(6308), r(1380), r(9557), r(5953), r(8056), r(1025), r(19), r(9506), r(7165), r(2169), r(6939), r(6372), r(3797), r(8454), r(2073), r(4905), r(482), r(2155), r(8124), r(25), r(955), r(7628), r(7193), r(6298), r(2696), n)
|
||||||
|
},
|
||||||
|
6440: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), function() {
|
||||||
|
if ("function" == typeof ArrayBuffer) {
|
||||||
|
var t = n.lib.WordArray,
|
||||||
|
e = t.init,
|
||||||
|
r = t.init = function(t) {
|
||||||
|
if (t instanceof ArrayBuffer && (t = new Uint8Array(t)), (t instanceof Int8Array || "undefined" != typeof Uint8ClampedArray && t instanceof Uint8ClampedArray || t instanceof Int16Array || t instanceof Uint16Array || t instanceof Int32Array || t instanceof Uint32Array || t instanceof Float32Array || t instanceof Float64Array) && (t = new Uint8Array(t.buffer, t.byteOffset, t.byteLength)), t instanceof Uint8Array) {
|
||||||
|
for (var r = t.byteLength, n = [], i = 0; i < r; i++) n[i >>> 2] |= t[i] << 24 - i % 4 * 8;
|
||||||
|
e.call(this, n, r)
|
||||||
|
} else e.apply(this, arguments)
|
||||||
|
};
|
||||||
|
r.prototype = t
|
||||||
|
}
|
||||||
|
}(), n.lib.WordArray)
|
||||||
|
},
|
||||||
|
4636: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), function(t) {
|
||||||
|
var e = n,
|
||||||
|
r = e.lib,
|
||||||
|
i = r.WordArray,
|
||||||
|
o = r.Hasher,
|
||||||
|
s = e.algo,
|
||||||
|
a = [];
|
||||||
|
! function() {
|
||||||
|
for (var e = 0; e < 64; e++) a[e] = 4294967296 * t.abs(t.sin(e + 1)) | 0
|
||||||
|
}();
|
||||||
|
var f = s.MD5 = o.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
this._hash = new i.init([1732584193, 4023233417, 2562383102, 271733878])
|
||||||
|
},
|
||||||
|
_doProcessBlock: function(t, e) {
|
||||||
|
for (var r = 0; r < 16; r++) {
|
||||||
|
var n = e + r,
|
||||||
|
i = t[n];
|
||||||
|
t[n] = 16711935 & (i << 8 | i >>> 24) | 4278255360 & (i << 24 | i >>> 8)
|
||||||
|
}
|
||||||
|
var o = this._hash.words,
|
||||||
|
s = t[e + 0],
|
||||||
|
f = t[e + 1],
|
||||||
|
l = t[e + 2],
|
||||||
|
y = t[e + 3],
|
||||||
|
g = t[e + 4],
|
||||||
|
d = t[e + 5],
|
||||||
|
v = t[e + 6],
|
||||||
|
m = t[e + 7],
|
||||||
|
S = t[e + 8],
|
||||||
|
_ = t[e + 9],
|
||||||
|
b = t[e + 10],
|
||||||
|
E = t[e + 11],
|
||||||
|
w = t[e + 12],
|
||||||
|
O = t[e + 13],
|
||||||
|
B = t[e + 14],
|
||||||
|
A = t[e + 15],
|
||||||
|
x = o[0],
|
||||||
|
P = o[1],
|
||||||
|
T = o[2],
|
||||||
|
I = o[3];
|
||||||
|
x = u(x, P, T, I, s, 7, a[0]), I = u(I, x, P, T, f, 12, a[1]), T = u(T, I, x, P, l, 17, a[2]), P = u(P, T, I, x, y, 22, a[3]), x = u(x, P, T, I, g, 7, a[4]), I = u(I, x, P, T, d, 12, a[5]), T = u(T, I, x, P, v, 17, a[6]), P = u(P, T, I, x, m, 22, a[7]), x = u(x, P, T, I, S, 7, a[8]), I = u(I, x, P, T, _, 12, a[9]), T = u(T, I, x, P, b, 17, a[10]), P = u(P, T, I, x, E, 22, a[11]), x = u(x, P, T, I, w, 7, a[12]), I = u(I, x, P, T, O, 12, a[13]), T = u(T, I, x, P, B, 17, a[14]), x = c(x, P = u(P, T, I, x, A, 22, a[15]), T, I, f, 5, a[16]), I = c(I, x, P, T, v, 9, a[17]), T = c(T, I, x, P, E, 14, a[18]), P = c(P, T, I, x, s, 20, a[19]), x = c(x, P, T, I, d, 5, a[20]), I = c(I, x, P, T, b, 9, a[21]), T = c(T, I, x, P, A, 14, a[22]), P = c(P, T, I, x, g, 20, a[23]), x = c(x, P, T, I, _, 5, a[24]), I = c(I, x, P, T, B, 9, a[25]), T = c(T, I, x, P, y, 14, a[26]), P = c(P, T, I, x, S, 20, a[27]), x = c(x, P, T, I, O, 5, a[28]), I = c(I, x, P, T, l, 9, a[29]), T = c(T, I, x, P, m, 14, a[30]), x = h(x, P = c(P, T, I, x, w, 20, a[31]), T, I, d, 4, a[32]), I = h(I, x, P, T, S, 11, a[33]), T = h(T, I, x, P, E, 16, a[34]), P = h(P, T, I, x, B, 23, a[35]), x = h(x, P, T, I, f, 4, a[36]), I = h(I, x, P, T, g, 11, a[37]), T = h(T, I, x, P, m, 16, a[38]), P = h(P, T, I, x, b, 23, a[39]), x = h(x, P, T, I, O, 4, a[40]), I = h(I, x, P, T, s, 11, a[41]), T = h(T, I, x, P, y, 16, a[42]), P = h(P, T, I, x, v, 23, a[43]), x = h(x, P, T, I, _, 4, a[44]), I = h(I, x, P, T, w, 11, a[45]), T = h(T, I, x, P, A, 16, a[46]), x = p(x, P = h(P, T, I, x, l, 23, a[47]), T, I, s, 6, a[48]), I = p(I, x, P, T, m, 10, a[49]), T = p(T, I, x, P, B, 15, a[50]), P = p(P, T, I, x, d, 21, a[51]), x = p(x, P, T, I, w, 6, a[52]), I = p(I, x, P, T, y, 10, a[53]), T = p(T, I, x, P, b, 15, a[54]), P = p(P, T, I, x, f, 21, a[55]), x = p(x, P, T, I, S, 6, a[56]), I = p(I, x, P, T, A, 10, a[57]), T = p(T, I, x, P, v, 15, a[58]), P = p(P, T, I, x, O, 21, a[59]), x = p(x, P, T, I, g, 6, a[60]), I = p(I, x, P, T, E, 10, a[61]), T = p(T, I, x, P, l, 15, a[62]), P = p(P, T, I, x, _, 21, a[63]), o[0] = o[0] + x | 0, o[1] = o[1] + P | 0, o[2] = o[2] + T | 0, o[3] = o[3] + I | 0
|
||||||
|
},
|
||||||
|
_doFinalize: function() {
|
||||||
|
var e = this._data,
|
||||||
|
r = e.words,
|
||||||
|
n = 8 * this._nDataBytes,
|
||||||
|
i = 8 * e.sigBytes;
|
||||||
|
r[i >>> 5] |= 128 << 24 - i % 32;
|
||||||
|
var o = t.floor(n / 4294967296),
|
||||||
|
s = n;
|
||||||
|
r[15 + (i + 64 >>> 9 << 4)] = 16711935 & (o << 8 | o >>> 24) | 4278255360 & (o << 24 | o >>> 8), r[14 + (i + 64 >>> 9 << 4)] = 16711935 & (s << 8 | s >>> 24) | 4278255360 & (s << 24 | s >>> 8), e.sigBytes = 4 * (r.length + 1), this._process();
|
||||||
|
for (var a = this._hash, f = a.words, u = 0; u < 4; u++) {
|
||||||
|
var c = f[u];
|
||||||
|
f[u] = 16711935 & (c << 8 | c >>> 24) | 4278255360 & (c << 24 | c >>> 8)
|
||||||
|
}
|
||||||
|
return a
|
||||||
|
},
|
||||||
|
clone: function() {
|
||||||
|
var t = o.clone.call(this);
|
||||||
|
return t._hash = this._hash.clone(), t
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function u(t, e, r, n, i, o, s) {
|
||||||
|
var a = t + (e & r | ~e & n) + i + s;
|
||||||
|
return (a << o | a >>> 32 - o) + e
|
||||||
|
}
|
||||||
|
|
||||||
|
function c(t, e, r, n, i, o, s) {
|
||||||
|
var a = t + (e & n | r & ~n) + i + s;
|
||||||
|
return (a << o | a >>> 32 - o) + e
|
||||||
|
}
|
||||||
|
|
||||||
|
function h(t, e, r, n, i, o, s) {
|
||||||
|
var a = t + (e ^ r ^ n) + i + s;
|
||||||
|
return (a << o | a >>> 32 - o) + e
|
||||||
|
}
|
||||||
|
|
||||||
|
function p(t, e, r, n, i, o, s) {
|
||||||
|
var a = t + (r ^ (e | ~n)) + i + s;
|
||||||
|
return (a << o | a >>> 32 - o) + e
|
||||||
|
}
|
||||||
|
e.MD5 = o._createHelper(f), e.HmacMD5 = o._createHmacHelper(f)
|
||||||
|
}(Math), n.MD5)
|
||||||
|
},
|
||||||
|
2169: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), r(7165), n.mode.CFB = function() {
|
||||||
|
var t = n.lib.BlockCipherMode.extend();
|
||||||
|
|
||||||
|
function e(t, e, r, n) {
|
||||||
|
var i = this._iv;
|
||||||
|
if (i) {
|
||||||
|
var o = i.slice(0);
|
||||||
|
this._iv = void 0
|
||||||
|
} else o = this._prevBlock;
|
||||||
|
n.encryptBlock(o, 0);
|
||||||
|
for (var s = 0; s < r; s++) t[e + s] ^= o[s]
|
||||||
|
}
|
||||||
|
return t.Encryptor = t.extend({
|
||||||
|
processBlock: function(t, r) {
|
||||||
|
var n = this._cipher,
|
||||||
|
i = n.blockSize;
|
||||||
|
e.call(this, t, r, i, n), this._prevBlock = t.slice(r, r + i)
|
||||||
|
}
|
||||||
|
}), t.Decryptor = t.extend({
|
||||||
|
processBlock: function(t, r) {
|
||||||
|
var n = this._cipher,
|
||||||
|
i = n.blockSize,
|
||||||
|
o = t.slice(r, r + i);
|
||||||
|
e.call(this, t, r, i, n), this._prevBlock = o
|
||||||
|
}
|
||||||
|
}), t
|
||||||
|
}(), n.mode.CFB)
|
||||||
|
},
|
||||||
|
6372: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), r(7165), n.mode.CTRGladman = function() {
|
||||||
|
var t = n.lib.BlockCipherMode.extend();
|
||||||
|
|
||||||
|
function e(t) {
|
||||||
|
if (255 & ~(t >> 24)) t += 1 << 24;
|
||||||
|
else {
|
||||||
|
var e = t >> 16 & 255,
|
||||||
|
r = t >> 8 & 255,
|
||||||
|
n = 255 & t;
|
||||||
|
255 === e ? (e = 0, 255 === r ? (r = 0, 255 === n ? n = 0 : ++n) : ++r) : ++e, t = 0, t += e << 16, t += r << 8, t += n
|
||||||
|
}
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
var r = t.Encryptor = t.extend({
|
||||||
|
processBlock: function(t, r) {
|
||||||
|
var n = this._cipher,
|
||||||
|
i = n.blockSize,
|
||||||
|
o = this._iv,
|
||||||
|
s = this._counter;
|
||||||
|
o && (s = this._counter = o.slice(0), this._iv = void 0),
|
||||||
|
function(t) {
|
||||||
|
0 === (t[0] = e(t[0])) && (t[1] = e(t[1]))
|
||||||
|
}(s);
|
||||||
|
var a = s.slice(0);
|
||||||
|
n.encryptBlock(a, 0);
|
||||||
|
for (var f = 0; f < i; f++) t[r + f] ^= a[f]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return t.Decryptor = r, t
|
||||||
|
}(), n.mode.CTRGladman)
|
||||||
|
},
|
||||||
|
6939: function(t, e, r) {
|
||||||
|
var n, i, o;
|
||||||
|
t.exports = (o = r(9021), r(7165), o.mode.CTR = (i = (n = o.lib.BlockCipherMode.extend()).Encryptor = n.extend({
|
||||||
|
processBlock: function(t, e) {
|
||||||
|
var r = this._cipher,
|
||||||
|
n = r.blockSize,
|
||||||
|
i = this._iv,
|
||||||
|
o = this._counter;
|
||||||
|
i && (o = this._counter = i.slice(0), this._iv = void 0);
|
||||||
|
var s = o.slice(0);
|
||||||
|
r.encryptBlock(s, 0), o[n - 1] = o[n - 1] + 1 | 0;
|
||||||
|
for (var a = 0; a < n; a++) t[e + a] ^= s[a]
|
||||||
|
}
|
||||||
|
}), n.Decryptor = i, n), o.mode.CTR)
|
||||||
|
},
|
||||||
|
8454: function(t, e, r) {
|
||||||
|
var n, i;
|
||||||
|
t.exports = (i = r(9021), r(7165), i.mode.ECB = ((n = i.lib.BlockCipherMode.extend()).Encryptor = n.extend({
|
||||||
|
processBlock: function(t, e) {
|
||||||
|
this._cipher.encryptBlock(t, e)
|
||||||
|
}
|
||||||
|
}), n.Decryptor = n.extend({
|
||||||
|
processBlock: function(t, e) {
|
||||||
|
this._cipher.decryptBlock(t, e)
|
||||||
|
}
|
||||||
|
}), n), i.mode.ECB)
|
||||||
|
},
|
||||||
|
3797: function(t, e, r) {
|
||||||
|
var n, i, o;
|
||||||
|
t.exports = (o = r(9021), r(7165), o.mode.OFB = (i = (n = o.lib.BlockCipherMode.extend()).Encryptor = n.extend({
|
||||||
|
processBlock: function(t, e) {
|
||||||
|
var r = this._cipher,
|
||||||
|
n = r.blockSize,
|
||||||
|
i = this._iv,
|
||||||
|
o = this._keystream;
|
||||||
|
i && (o = this._keystream = i.slice(0), this._iv = void 0), r.encryptBlock(o, 0);
|
||||||
|
for (var s = 0; s < n; s++) t[e + s] ^= o[s]
|
||||||
|
}
|
||||||
|
}), n.Decryptor = i, n), o.mode.OFB)
|
||||||
|
},
|
||||||
|
2073: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), r(7165), n.pad.AnsiX923 = {
|
||||||
|
pad: function(t, e) {
|
||||||
|
var r = t.sigBytes,
|
||||||
|
n = 4 * e,
|
||||||
|
i = n - r % n,
|
||||||
|
o = r + i - 1;
|
||||||
|
t.clamp(), t.words[o >>> 2] |= i << 24 - o % 4 * 8, t.sigBytes += i
|
||||||
|
},
|
||||||
|
unpad: function(t) {
|
||||||
|
var e = 255 & t.words[t.sigBytes - 1 >>> 2];
|
||||||
|
t.sigBytes -= e
|
||||||
|
}
|
||||||
|
}, n.pad.Ansix923)
|
||||||
|
},
|
||||||
|
4905: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), r(7165), n.pad.Iso10126 = {
|
||||||
|
pad: function(t, e) {
|
||||||
|
var r = 4 * e,
|
||||||
|
i = r - t.sigBytes % r;
|
||||||
|
t.concat(n.lib.WordArray.random(i - 1)).concat(n.lib.WordArray.create([i << 24], 1))
|
||||||
|
},
|
||||||
|
unpad: function(t) {
|
||||||
|
var e = 255 & t.words[t.sigBytes - 1 >>> 2];
|
||||||
|
t.sigBytes -= e
|
||||||
|
}
|
||||||
|
}, n.pad.Iso10126)
|
||||||
|
},
|
||||||
|
482: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), r(7165), n.pad.Iso97971 = {
|
||||||
|
pad: function(t, e) {
|
||||||
|
t.concat(n.lib.WordArray.create([2147483648], 1)), n.pad.ZeroPadding.pad(t, e)
|
||||||
|
},
|
||||||
|
unpad: function(t) {
|
||||||
|
n.pad.ZeroPadding.unpad(t), t.sigBytes--
|
||||||
|
}
|
||||||
|
}, n.pad.Iso97971)
|
||||||
|
},
|
||||||
|
8124: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), r(7165), n.pad.NoPadding = {
|
||||||
|
pad: function() {},
|
||||||
|
unpad: function() {}
|
||||||
|
}, n.pad.NoPadding)
|
||||||
|
},
|
||||||
|
2155: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), r(7165), n.pad.ZeroPadding = {
|
||||||
|
pad: function(t, e) {
|
||||||
|
var r = 4 * e;
|
||||||
|
t.clamp(), t.sigBytes += r - (t.sigBytes % r || r)
|
||||||
|
},
|
||||||
|
unpad: function(t) {
|
||||||
|
for (var e = t.words, r = t.sigBytes - 1; !(e[r >>> 2] >>> 24 - r % 4 * 8 & 255);) r--;
|
||||||
|
t.sigBytes = r + 1
|
||||||
|
}
|
||||||
|
}, n.pad.ZeroPadding)
|
||||||
|
},
|
||||||
|
19: function(t, e, r) {
|
||||||
|
var n, i, o, s, a, f, u, c, h;
|
||||||
|
t.exports = (h = r(9021), r(5471), r(1025), o = (i = (n = h).lib).Base, s = i.WordArray, f = (a = n.algo).SHA1, u = a.HMAC, c = a.PBKDF2 = o.extend({
|
||||||
|
cfg: o.extend({
|
||||||
|
keySize: 4,
|
||||||
|
hasher: f,
|
||||||
|
iterations: 1
|
||||||
|
}),
|
||||||
|
init: function(t) {
|
||||||
|
this.cfg = this.cfg.extend(t)
|
||||||
|
},
|
||||||
|
compute: function(t, e) {
|
||||||
|
for (var r = this.cfg, n = u.create(r.hasher, t), i = s.create(), o = s.create([1]), a = i.words, f = o.words, c = r.keySize, h = r.iterations; a.length < c;) {
|
||||||
|
var p = n.update(e).finalize(o);
|
||||||
|
n.reset();
|
||||||
|
for (var l = p.words, y = l.length, g = p, d = 1; d < h; d++) {
|
||||||
|
g = n.finalize(g), n.reset();
|
||||||
|
for (var v = g.words, m = 0; m < y; m++) l[m] ^= v[m]
|
||||||
|
}
|
||||||
|
i.concat(p), f[0]++
|
||||||
|
}
|
||||||
|
return i.sigBytes = 4 * c, i
|
||||||
|
}
|
||||||
|
}), n.PBKDF2 = function(t, e, r) {
|
||||||
|
return c.create(r).compute(t, e)
|
||||||
|
}, h.PBKDF2)
|
||||||
|
},
|
||||||
|
2696: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), r(754), r(4636), r(9506), r(7165), function() {
|
||||||
|
var t = n,
|
||||||
|
e = t.lib.StreamCipher,
|
||||||
|
r = t.algo,
|
||||||
|
i = [],
|
||||||
|
o = [],
|
||||||
|
s = [],
|
||||||
|
a = r.RabbitLegacy = e.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
var t = this._key.words,
|
||||||
|
e = this.cfg.iv,
|
||||||
|
r = this._X = [t[0], t[3] << 16 | t[2] >>> 16, t[1], t[0] << 16 | t[3] >>> 16, t[2], t[1] << 16 | t[0] >>> 16, t[3], t[2] << 16 | t[1] >>> 16],
|
||||||
|
n = this._C = [t[2] << 16 | t[2] >>> 16, 4294901760 & t[0] | 65535 & t[1], t[3] << 16 | t[3] >>> 16, 4294901760 & t[1] | 65535 & t[2], t[0] << 16 | t[0] >>> 16, 4294901760 & t[2] | 65535 & t[3], t[1] << 16 | t[1] >>> 16, 4294901760 & t[3] | 65535 & t[0]];
|
||||||
|
this._b = 0;
|
||||||
|
for (var i = 0; i < 4; i++) f.call(this);
|
||||||
|
for (i = 0; i < 8; i++) n[i] ^= r[i + 4 & 7];
|
||||||
|
if (e) {
|
||||||
|
var o = e.words,
|
||||||
|
s = o[0],
|
||||||
|
a = o[1],
|
||||||
|
u = 16711935 & (s << 8 | s >>> 24) | 4278255360 & (s << 24 | s >>> 8),
|
||||||
|
c = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8),
|
||||||
|
h = u >>> 16 | 4294901760 & c,
|
||||||
|
p = c << 16 | 65535 & u;
|
||||||
|
for (n[0] ^= u, n[1] ^= h, n[2] ^= c, n[3] ^= p, n[4] ^= u, n[5] ^= h, n[6] ^= c, n[7] ^= p, i = 0; i < 4; i++) f.call(this)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_doProcessBlock: function(t, e) {
|
||||||
|
var r = this._X;
|
||||||
|
f.call(this), i[0] = r[0] ^ r[5] >>> 16 ^ r[3] << 16, i[1] = r[2] ^ r[7] >>> 16 ^ r[5] << 16, i[2] = r[4] ^ r[1] >>> 16 ^ r[7] << 16, i[3] = r[6] ^ r[3] >>> 16 ^ r[1] << 16;
|
||||||
|
for (var n = 0; n < 4; n++) i[n] = 16711935 & (i[n] << 8 | i[n] >>> 24) | 4278255360 & (i[n] << 24 | i[n] >>> 8), t[e + n] ^= i[n]
|
||||||
|
},
|
||||||
|
blockSize: 4,
|
||||||
|
ivSize: 2
|
||||||
|
});
|
||||||
|
|
||||||
|
function f() {
|
||||||
|
for (var t = this._X, e = this._C, r = 0; r < 8; r++) o[r] = e[r];
|
||||||
|
for (e[0] = e[0] + 1295307597 + this._b | 0, e[1] = e[1] + 3545052371 + (e[0] >>> 0 < o[0] >>> 0 ? 1 : 0) | 0, e[2] = e[2] + 886263092 + (e[1] >>> 0 < o[1] >>> 0 ? 1 : 0) | 0, e[3] = e[3] + 1295307597 + (e[2] >>> 0 < o[2] >>> 0 ? 1 : 0) | 0, e[4] = e[4] + 3545052371 + (e[3] >>> 0 < o[3] >>> 0 ? 1 : 0) | 0, e[5] = e[5] + 886263092 + (e[4] >>> 0 < o[4] >>> 0 ? 1 : 0) | 0, e[6] = e[6] + 1295307597 + (e[5] >>> 0 < o[5] >>> 0 ? 1 : 0) | 0, e[7] = e[7] + 3545052371 + (e[6] >>> 0 < o[6] >>> 0 ? 1 : 0) | 0, this._b = e[7] >>> 0 < o[7] >>> 0 ? 1 : 0, r = 0; r < 8; r++) {
|
||||||
|
var n = t[r] + e[r],
|
||||||
|
i = 65535 & n,
|
||||||
|
a = n >>> 16,
|
||||||
|
f = ((i * i >>> 17) + i * a >>> 15) + a * a,
|
||||||
|
u = ((4294901760 & n) * n | 0) + ((65535 & n) * n | 0);
|
||||||
|
s[r] = f ^ u
|
||||||
|
}
|
||||||
|
t[0] = s[0] + (s[7] << 16 | s[7] >>> 16) + (s[6] << 16 | s[6] >>> 16) | 0, t[1] = s[1] + (s[0] << 8 | s[0] >>> 24) + s[7] | 0, t[2] = s[2] + (s[1] << 16 | s[1] >>> 16) + (s[0] << 16 | s[0] >>> 16) | 0, t[3] = s[3] + (s[2] << 8 | s[2] >>> 24) + s[1] | 0, t[4] = s[4] + (s[3] << 16 | s[3] >>> 16) + (s[2] << 16 | s[2] >>> 16) | 0, t[5] = s[5] + (s[4] << 8 | s[4] >>> 24) + s[3] | 0, t[6] = s[6] + (s[5] << 16 | s[5] >>> 16) + (s[4] << 16 | s[4] >>> 16) | 0, t[7] = s[7] + (s[6] << 8 | s[6] >>> 24) + s[5] | 0
|
||||||
|
}
|
||||||
|
t.RabbitLegacy = e._createHelper(a)
|
||||||
|
}(), n.RabbitLegacy)
|
||||||
|
},
|
||||||
|
6298: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), r(754), r(4636), r(9506), r(7165), function() {
|
||||||
|
var t = n,
|
||||||
|
e = t.lib.StreamCipher,
|
||||||
|
r = t.algo,
|
||||||
|
i = [],
|
||||||
|
o = [],
|
||||||
|
s = [],
|
||||||
|
a = r.Rabbit = e.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
for (var t = this._key.words, e = this.cfg.iv, r = 0; r < 4; r++) t[r] = 16711935 & (t[r] << 8 | t[r] >>> 24) | 4278255360 & (t[r] << 24 | t[r] >>> 8);
|
||||||
|
var n = this._X = [t[0], t[3] << 16 | t[2] >>> 16, t[1], t[0] << 16 | t[3] >>> 16, t[2], t[1] << 16 | t[0] >>> 16, t[3], t[2] << 16 | t[1] >>> 16],
|
||||||
|
i = this._C = [t[2] << 16 | t[2] >>> 16, 4294901760 & t[0] | 65535 & t[1], t[3] << 16 | t[3] >>> 16, 4294901760 & t[1] | 65535 & t[2], t[0] << 16 | t[0] >>> 16, 4294901760 & t[2] | 65535 & t[3], t[1] << 16 | t[1] >>> 16, 4294901760 & t[3] | 65535 & t[0]];
|
||||||
|
for (this._b = 0, r = 0; r < 4; r++) f.call(this);
|
||||||
|
for (r = 0; r < 8; r++) i[r] ^= n[r + 4 & 7];
|
||||||
|
if (e) {
|
||||||
|
var o = e.words,
|
||||||
|
s = o[0],
|
||||||
|
a = o[1],
|
||||||
|
u = 16711935 & (s << 8 | s >>> 24) | 4278255360 & (s << 24 | s >>> 8),
|
||||||
|
c = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8),
|
||||||
|
h = u >>> 16 | 4294901760 & c,
|
||||||
|
p = c << 16 | 65535 & u;
|
||||||
|
for (i[0] ^= u, i[1] ^= h, i[2] ^= c, i[3] ^= p, i[4] ^= u, i[5] ^= h, i[6] ^= c, i[7] ^= p, r = 0; r < 4; r++) f.call(this)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_doProcessBlock: function(t, e) {
|
||||||
|
var r = this._X;
|
||||||
|
f.call(this), i[0] = r[0] ^ r[5] >>> 16 ^ r[3] << 16, i[1] = r[2] ^ r[7] >>> 16 ^ r[5] << 16, i[2] = r[4] ^ r[1] >>> 16 ^ r[7] << 16, i[3] = r[6] ^ r[3] >>> 16 ^ r[1] << 16;
|
||||||
|
for (var n = 0; n < 4; n++) i[n] = 16711935 & (i[n] << 8 | i[n] >>> 24) | 4278255360 & (i[n] << 24 | i[n] >>> 8), t[e + n] ^= i[n]
|
||||||
|
},
|
||||||
|
blockSize: 4,
|
||||||
|
ivSize: 2
|
||||||
|
});
|
||||||
|
|
||||||
|
function f() {
|
||||||
|
for (var t = this._X, e = this._C, r = 0; r < 8; r++) o[r] = e[r];
|
||||||
|
for (e[0] = e[0] + 1295307597 + this._b | 0, e[1] = e[1] + 3545052371 + (e[0] >>> 0 < o[0] >>> 0 ? 1 : 0) | 0, e[2] = e[2] + 886263092 + (e[1] >>> 0 < o[1] >>> 0 ? 1 : 0) | 0, e[3] = e[3] + 1295307597 + (e[2] >>> 0 < o[2] >>> 0 ? 1 : 0) | 0, e[4] = e[4] + 3545052371 + (e[3] >>> 0 < o[3] >>> 0 ? 1 : 0) | 0, e[5] = e[5] + 886263092 + (e[4] >>> 0 < o[4] >>> 0 ? 1 : 0) | 0, e[6] = e[6] + 1295307597 + (e[5] >>> 0 < o[5] >>> 0 ? 1 : 0) | 0, e[7] = e[7] + 3545052371 + (e[6] >>> 0 < o[6] >>> 0 ? 1 : 0) | 0, this._b = e[7] >>> 0 < o[7] >>> 0 ? 1 : 0, r = 0; r < 8; r++) {
|
||||||
|
var n = t[r] + e[r],
|
||||||
|
i = 65535 & n,
|
||||||
|
a = n >>> 16,
|
||||||
|
f = ((i * i >>> 17) + i * a >>> 15) + a * a,
|
||||||
|
u = ((4294901760 & n) * n | 0) + ((65535 & n) * n | 0);
|
||||||
|
s[r] = f ^ u
|
||||||
|
}
|
||||||
|
t[0] = s[0] + (s[7] << 16 | s[7] >>> 16) + (s[6] << 16 | s[6] >>> 16) | 0, t[1] = s[1] + (s[0] << 8 | s[0] >>> 24) + s[7] | 0, t[2] = s[2] + (s[1] << 16 | s[1] >>> 16) + (s[0] << 16 | s[0] >>> 16) | 0, t[3] = s[3] + (s[2] << 8 | s[2] >>> 24) + s[1] | 0, t[4] = s[4] + (s[3] << 16 | s[3] >>> 16) + (s[2] << 16 | s[2] >>> 16) | 0, t[5] = s[5] + (s[4] << 8 | s[4] >>> 24) + s[3] | 0, t[6] = s[6] + (s[5] << 16 | s[5] >>> 16) + (s[4] << 16 | s[4] >>> 16) | 0, t[7] = s[7] + (s[6] << 8 | s[6] >>> 24) + s[5] | 0
|
||||||
|
}
|
||||||
|
t.Rabbit = e._createHelper(a)
|
||||||
|
}(), n.Rabbit)
|
||||||
|
},
|
||||||
|
7193: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), r(754), r(4636), r(9506), r(7165), function() {
|
||||||
|
var t = n,
|
||||||
|
e = t.lib.StreamCipher,
|
||||||
|
r = t.algo,
|
||||||
|
i = r.RC4 = e.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
for (var t = this._key, e = t.words, r = t.sigBytes, n = this._S = [], i = 0; i < 256; i++) n[i] = i;
|
||||||
|
i = 0;
|
||||||
|
for (var o = 0; i < 256; i++) {
|
||||||
|
var s = i % r,
|
||||||
|
a = e[s >>> 2] >>> 24 - s % 4 * 8 & 255;
|
||||||
|
o = (o + n[i] + a) % 256;
|
||||||
|
var f = n[i];
|
||||||
|
n[i] = n[o], n[o] = f
|
||||||
|
}
|
||||||
|
this._i = this._j = 0
|
||||||
|
},
|
||||||
|
_doProcessBlock: function(t, e) {
|
||||||
|
t[e] ^= o.call(this)
|
||||||
|
},
|
||||||
|
keySize: 8,
|
||||||
|
ivSize: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
function o() {
|
||||||
|
for (var t = this._S, e = this._i, r = this._j, n = 0, i = 0; i < 4; i++) {
|
||||||
|
r = (r + t[e = (e + 1) % 256]) % 256;
|
||||||
|
var o = t[e];
|
||||||
|
t[e] = t[r], t[r] = o, n |= t[(t[e] + t[r]) % 256] << 24 - 8 * i
|
||||||
|
}
|
||||||
|
return this._i = e, this._j = r, n
|
||||||
|
}
|
||||||
|
t.RC4 = e._createHelper(i);
|
||||||
|
var s = r.RC4Drop = i.extend({
|
||||||
|
cfg: i.cfg.extend({
|
||||||
|
drop: 192
|
||||||
|
}),
|
||||||
|
_doReset: function() {
|
||||||
|
i._doReset.call(this);
|
||||||
|
for (var t = this.cfg.drop; t > 0; t--) o.call(this)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
t.RC4Drop = e._createHelper(s)
|
||||||
|
}(), n.RC4)
|
||||||
|
},
|
||||||
|
8056: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), function(t) {
|
||||||
|
var e = n,
|
||||||
|
r = e.lib,
|
||||||
|
i = r.WordArray,
|
||||||
|
o = r.Hasher,
|
||||||
|
s = e.algo,
|
||||||
|
a = i.create([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]),
|
||||||
|
f = i.create([5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]),
|
||||||
|
u = i.create([11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6]),
|
||||||
|
c = i.create([8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11]),
|
||||||
|
h = i.create([0, 1518500249, 1859775393, 2400959708, 2840853838]),
|
||||||
|
p = i.create([1352829926, 1548603684, 1836072691, 2053994217, 0]),
|
||||||
|
l = s.RIPEMD160 = o.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
this._hash = i.create([1732584193, 4023233417, 2562383102, 271733878, 3285377520])
|
||||||
|
},
|
||||||
|
_doProcessBlock: function(t, e) {
|
||||||
|
for (var r = 0; r < 16; r++) {
|
||||||
|
var n = e + r,
|
||||||
|
i = t[n];
|
||||||
|
t[n] = 16711935 & (i << 8 | i >>> 24) | 4278255360 & (i << 24 | i >>> 8)
|
||||||
|
}
|
||||||
|
var o, s, l, _, b, E, w, O, B, A, x, P = this._hash.words,
|
||||||
|
T = h.words,
|
||||||
|
I = p.words,
|
||||||
|
k = a.words,
|
||||||
|
D = f.words,
|
||||||
|
R = u.words,
|
||||||
|
N = c.words;
|
||||||
|
for (E = o = P[0], w = s = P[1], O = l = P[2], B = _ = P[3], A = b = P[4], r = 0; r < 80; r += 1) x = o + t[e + k[r]] | 0, x += r < 16 ? y(s, l, _) + T[0] : r < 32 ? g(s, l, _) + T[1] : r < 48 ? d(s, l, _) + T[2] : r < 64 ? v(s, l, _) + T[3] : m(s, l, _) + T[4], x = (x = S(x |= 0, R[r])) + b | 0, o = b, b = _, _ = S(l, 10), l = s, s = x, x = E + t[e + D[r]] | 0, x += r < 16 ? m(w, O, B) + I[0] : r < 32 ? v(w, O, B) + I[1] : r < 48 ? d(w, O, B) + I[2] : r < 64 ? g(w, O, B) + I[3] : y(w, O, B) + I[4], x = (x = S(x |= 0, N[r])) + A | 0, E = A, A = B, B = S(O, 10), O = w, w = x;
|
||||||
|
x = P[1] + l + B | 0, P[1] = P[2] + _ + A | 0, P[2] = P[3] + b + E | 0, P[3] = P[4] + o + w | 0, P[4] = P[0] + s + O | 0, P[0] = x
|
||||||
|
},
|
||||||
|
_doFinalize: function() {
|
||||||
|
var t = this._data,
|
||||||
|
e = t.words,
|
||||||
|
r = 8 * this._nDataBytes,
|
||||||
|
n = 8 * t.sigBytes;
|
||||||
|
e[n >>> 5] |= 128 << 24 - n % 32, e[14 + (n + 64 >>> 9 << 4)] = 16711935 & (r << 8 | r >>> 24) | 4278255360 & (r << 24 | r >>> 8), t.sigBytes = 4 * (e.length + 1), this._process();
|
||||||
|
for (var i = this._hash, o = i.words, s = 0; s < 5; s++) {
|
||||||
|
var a = o[s];
|
||||||
|
o[s] = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8)
|
||||||
|
}
|
||||||
|
return i
|
||||||
|
},
|
||||||
|
clone: function() {
|
||||||
|
var t = o.clone.call(this);
|
||||||
|
return t._hash = this._hash.clone(), t
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function y(t, e, r) {
|
||||||
|
return t ^ e ^ r
|
||||||
|
}
|
||||||
|
|
||||||
|
function g(t, e, r) {
|
||||||
|
return t & e | ~t & r
|
||||||
|
}
|
||||||
|
|
||||||
|
function d(t, e, r) {
|
||||||
|
return (t | ~e) ^ r
|
||||||
|
}
|
||||||
|
|
||||||
|
function v(t, e, r) {
|
||||||
|
return t & r | e & ~r
|
||||||
|
}
|
||||||
|
|
||||||
|
function m(t, e, r) {
|
||||||
|
return t ^ (e | ~r)
|
||||||
|
}
|
||||||
|
|
||||||
|
function S(t, e) {
|
||||||
|
return t << e | t >>> 32 - e
|
||||||
|
}
|
||||||
|
e.RIPEMD160 = o._createHelper(l), e.HmacRIPEMD160 = o._createHmacHelper(l)
|
||||||
|
}(Math), n.RIPEMD160)
|
||||||
|
},
|
||||||
|
5471: function(t, e, r) {
|
||||||
|
var n, i, o, s, a, f, u, c;
|
||||||
|
t.exports = (i = (n = c = r(9021)).lib, o = i.WordArray, s = i.Hasher, a = n.algo, f = [], u = a.SHA1 = s.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
this._hash = new o.init([1732584193, 4023233417, 2562383102, 271733878, 3285377520])
|
||||||
|
},
|
||||||
|
_doProcessBlock: function(t, e) {
|
||||||
|
for (var r = this._hash.words, n = r[0], i = r[1], o = r[2], s = r[3], a = r[4], u = 0; u < 80; u++) {
|
||||||
|
if (u < 16) f[u] = 0 | t[e + u];
|
||||||
|
else {
|
||||||
|
var c = f[u - 3] ^ f[u - 8] ^ f[u - 14] ^ f[u - 16];
|
||||||
|
f[u] = c << 1 | c >>> 31
|
||||||
|
}
|
||||||
|
var h = (n << 5 | n >>> 27) + a + f[u];
|
||||||
|
h += u < 20 ? 1518500249 + (i & o | ~i & s) : u < 40 ? 1859775393 + (i ^ o ^ s) : u < 60 ? (i & o | i & s | o & s) - 1894007588 : (i ^ o ^ s) - 899497514, a = s, s = o, o = i << 30 | i >>> 2, i = n, n = h
|
||||||
|
}
|
||||||
|
r[0] = r[0] + n | 0, r[1] = r[1] + i | 0, r[2] = r[2] + o | 0, r[3] = r[3] + s | 0, r[4] = r[4] + a | 0
|
||||||
|
},
|
||||||
|
_doFinalize: function() {
|
||||||
|
var t = this._data,
|
||||||
|
e = t.words,
|
||||||
|
r = 8 * this._nDataBytes,
|
||||||
|
n = 8 * t.sigBytes;
|
||||||
|
return e[n >>> 5] |= 128 << 24 - n % 32, e[14 + (n + 64 >>> 9 << 4)] = Math.floor(r / 4294967296), e[15 + (n + 64 >>> 9 << 4)] = r, t.sigBytes = 4 * e.length, this._process(), this._hash
|
||||||
|
},
|
||||||
|
clone: function() {
|
||||||
|
var t = s.clone.call(this);
|
||||||
|
return t._hash = this._hash.clone(), t
|
||||||
|
}
|
||||||
|
}), n.SHA1 = s._createHelper(u), n.HmacSHA1 = s._createHmacHelper(u), c.SHA1)
|
||||||
|
},
|
||||||
|
6308: function(t, e, r) {
|
||||||
|
var n, i, o, s, a, f;
|
||||||
|
t.exports = (f = r(9021), r(3009), i = (n = f).lib.WordArray, o = n.algo, s = o.SHA256, a = o.SHA224 = s.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
this._hash = new i.init([3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428])
|
||||||
|
},
|
||||||
|
_doFinalize: function() {
|
||||||
|
var t = s._doFinalize.call(this);
|
||||||
|
return t.sigBytes -= 4, t
|
||||||
|
}
|
||||||
|
}), n.SHA224 = s._createHelper(a), n.HmacSHA224 = s._createHmacHelper(a), f.SHA224)
|
||||||
|
},
|
||||||
|
3009: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), function(t) {
|
||||||
|
var e = n,
|
||||||
|
r = e.lib,
|
||||||
|
i = r.WordArray,
|
||||||
|
o = r.Hasher,
|
||||||
|
s = e.algo,
|
||||||
|
a = [],
|
||||||
|
f = [];
|
||||||
|
! function() {
|
||||||
|
function e(e) {
|
||||||
|
for (var r = t.sqrt(e), n = 2; n <= r; n++)
|
||||||
|
if (!(e % n)) return !1;
|
||||||
|
return !0
|
||||||
|
}
|
||||||
|
|
||||||
|
function r(t) {
|
||||||
|
return 4294967296 * (t - (0 | t)) | 0
|
||||||
|
}
|
||||||
|
for (var n = 2, i = 0; i < 64;) e(n) && (i < 8 && (a[i] = r(t.pow(n, .5))), f[i] = r(t.pow(n, 1 / 3)), i++), n++
|
||||||
|
}();
|
||||||
|
var u = [],
|
||||||
|
c = s.SHA256 = o.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
this._hash = new i.init(a.slice(0))
|
||||||
|
},
|
||||||
|
_doProcessBlock: function(t, e) {
|
||||||
|
for (var r = this._hash.words, n = r[0], i = r[1], o = r[2], s = r[3], a = r[4], c = r[5], h = r[6], p = r[7], l = 0; l < 64; l++) {
|
||||||
|
if (l < 16) u[l] = 0 | t[e + l];
|
||||||
|
else {
|
||||||
|
var y = u[l - 15],
|
||||||
|
g = (y << 25 | y >>> 7) ^ (y << 14 | y >>> 18) ^ y >>> 3,
|
||||||
|
d = u[l - 2],
|
||||||
|
v = (d << 15 | d >>> 17) ^ (d << 13 | d >>> 19) ^ d >>> 10;
|
||||||
|
u[l] = g + u[l - 7] + v + u[l - 16]
|
||||||
|
}
|
||||||
|
var m = n & i ^ n & o ^ i & o,
|
||||||
|
S = (n << 30 | n >>> 2) ^ (n << 19 | n >>> 13) ^ (n << 10 | n >>> 22),
|
||||||
|
_ = p + ((a << 26 | a >>> 6) ^ (a << 21 | a >>> 11) ^ (a << 7 | a >>> 25)) + (a & c ^ ~a & h) + f[l] + u[l];
|
||||||
|
p = h, h = c, c = a, a = s + _ | 0, s = o, o = i, i = n, n = _ + (S + m) | 0
|
||||||
|
}
|
||||||
|
r[0] = r[0] + n | 0, r[1] = r[1] + i | 0, r[2] = r[2] + o | 0, r[3] = r[3] + s | 0, r[4] = r[4] + a | 0, r[5] = r[5] + c | 0, r[6] = r[6] + h | 0, r[7] = r[7] + p | 0
|
||||||
|
},
|
||||||
|
_doFinalize: function() {
|
||||||
|
var e = this._data,
|
||||||
|
r = e.words,
|
||||||
|
n = 8 * this._nDataBytes,
|
||||||
|
i = 8 * e.sigBytes;
|
||||||
|
return r[i >>> 5] |= 128 << 24 - i % 32, r[14 + (i + 64 >>> 9 << 4)] = t.floor(n / 4294967296), r[15 + (i + 64 >>> 9 << 4)] = n, e.sigBytes = 4 * r.length, this._process(), this._hash
|
||||||
|
},
|
||||||
|
clone: function() {
|
||||||
|
var t = o.clone.call(this);
|
||||||
|
return t._hash = this._hash.clone(), t
|
||||||
|
}
|
||||||
|
});
|
||||||
|
e.SHA256 = o._createHelper(c), e.HmacSHA256 = o._createHmacHelper(c)
|
||||||
|
}(Math), n.SHA256)
|
||||||
|
},
|
||||||
|
5953: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), r(3240), function(t) {
|
||||||
|
var e = n,
|
||||||
|
r = e.lib,
|
||||||
|
i = r.WordArray,
|
||||||
|
o = r.Hasher,
|
||||||
|
s = e.x64.Word,
|
||||||
|
a = e.algo,
|
||||||
|
f = [],
|
||||||
|
u = [],
|
||||||
|
c = [];
|
||||||
|
! function() {
|
||||||
|
for (var t = 1, e = 0, r = 0; r < 24; r++) {
|
||||||
|
f[t + 5 * e] = (r + 1) * (r + 2) / 2 % 64;
|
||||||
|
var n = (2 * t + 3 * e) % 5;
|
||||||
|
t = e % 5, e = n
|
||||||
|
}
|
||||||
|
for (t = 0; t < 5; t++)
|
||||||
|
for (e = 0; e < 5; e++) u[t + 5 * e] = e + (2 * t + 3 * e) % 5 * 5;
|
||||||
|
for (var i = 1, o = 0; o < 24; o++) {
|
||||||
|
for (var a = 0, h = 0, p = 0; p < 7; p++) {
|
||||||
|
if (1 & i) {
|
||||||
|
var l = (1 << p) - 1;
|
||||||
|
l < 32 ? h ^= 1 << l : a ^= 1 << l - 32
|
||||||
|
}
|
||||||
|
128 & i ? i = i << 1 ^ 113 : i <<= 1
|
||||||
|
}
|
||||||
|
c[o] = s.create(a, h)
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
var h = [];
|
||||||
|
! function() {
|
||||||
|
for (var t = 0; t < 25; t++) h[t] = s.create()
|
||||||
|
}();
|
||||||
|
var p = a.SHA3 = o.extend({
|
||||||
|
cfg: o.cfg.extend({
|
||||||
|
outputLength: 512
|
||||||
|
}),
|
||||||
|
_doReset: function() {
|
||||||
|
for (var t = this._state = [], e = 0; e < 25; e++) t[e] = new s.init;
|
||||||
|
this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32
|
||||||
|
},
|
||||||
|
_doProcessBlock: function(t, e) {
|
||||||
|
for (var r = this._state, n = this.blockSize / 2, i = 0; i < n; i++) {
|
||||||
|
var o = t[e + 2 * i],
|
||||||
|
s = t[e + 2 * i + 1];
|
||||||
|
o = 16711935 & (o << 8 | o >>> 24) | 4278255360 & (o << 24 | o >>> 8), s = 16711935 & (s << 8 | s >>> 24) | 4278255360 & (s << 24 | s >>> 8), (P = r[i]).high ^= s, P.low ^= o
|
||||||
|
}
|
||||||
|
for (var a = 0; a < 24; a++) {
|
||||||
|
for (var p = 0; p < 5; p++) {
|
||||||
|
for (var l = 0, y = 0, g = 0; g < 5; g++) l ^= (P = r[p + 5 * g]).high, y ^= P.low;
|
||||||
|
var d = h[p];
|
||||||
|
d.high = l, d.low = y
|
||||||
|
}
|
||||||
|
for (p = 0; p < 5; p++) {
|
||||||
|
var v = h[(p + 4) % 5],
|
||||||
|
m = h[(p + 1) % 5],
|
||||||
|
S = m.high,
|
||||||
|
_ = m.low;
|
||||||
|
for (l = v.high ^ (S << 1 | _ >>> 31), y = v.low ^ (_ << 1 | S >>> 31), g = 0; g < 5; g++)(P = r[p + 5 * g]).high ^= l, P.low ^= y
|
||||||
|
}
|
||||||
|
for (var b = 1; b < 25; b++) {
|
||||||
|
var E = (P = r[b]).high,
|
||||||
|
w = P.low,
|
||||||
|
O = f[b];
|
||||||
|
O < 32 ? (l = E << O | w >>> 32 - O, y = w << O | E >>> 32 - O) : (l = w << O - 32 | E >>> 64 - O, y = E << O - 32 | w >>> 64 - O);
|
||||||
|
var B = h[u[b]];
|
||||||
|
B.high = l, B.low = y
|
||||||
|
}
|
||||||
|
var A = h[0],
|
||||||
|
x = r[0];
|
||||||
|
for (A.high = x.high, A.low = x.low, p = 0; p < 5; p++)
|
||||||
|
for (g = 0; g < 5; g++) {
|
||||||
|
var P = r[b = p + 5 * g],
|
||||||
|
T = h[b],
|
||||||
|
I = h[(p + 1) % 5 + 5 * g],
|
||||||
|
k = h[(p + 2) % 5 + 5 * g];
|
||||||
|
P.high = T.high ^ ~I.high & k.high, P.low = T.low ^ ~I.low & k.low
|
||||||
|
}
|
||||||
|
P = r[0];
|
||||||
|
var D = c[a];
|
||||||
|
P.high ^= D.high, P.low ^= D.low
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_doFinalize: function() {
|
||||||
|
var e = this._data,
|
||||||
|
r = e.words,
|
||||||
|
n = (this._nDataBytes, 8 * e.sigBytes),
|
||||||
|
o = 32 * this.blockSize;
|
||||||
|
r[n >>> 5] |= 1 << 24 - n % 32, r[(t.ceil((n + 1) / o) * o >>> 5) - 1] |= 128, e.sigBytes = 4 * r.length, this._process();
|
||||||
|
for (var s = this._state, a = this.cfg.outputLength / 8, f = a / 8, u = [], c = 0; c < f; c++) {
|
||||||
|
var h = s[c],
|
||||||
|
p = h.high,
|
||||||
|
l = h.low;
|
||||||
|
p = 16711935 & (p << 8 | p >>> 24) | 4278255360 & (p << 24 | p >>> 8), l = 16711935 & (l << 8 | l >>> 24) | 4278255360 & (l << 24 | l >>> 8), u.push(l), u.push(p)
|
||||||
|
}
|
||||||
|
return new i.init(u, a)
|
||||||
|
},
|
||||||
|
clone: function() {
|
||||||
|
for (var t = o.clone.call(this), e = t._state = this._state.slice(0), r = 0; r < 25; r++) e[r] = e[r].clone();
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
});
|
||||||
|
e.SHA3 = o._createHelper(p), e.HmacSHA3 = o._createHmacHelper(p)
|
||||||
|
}(Math), n.SHA3)
|
||||||
|
},
|
||||||
|
9557: function(t, e, r) {
|
||||||
|
var n, i, o, s, a, f, u, c;
|
||||||
|
t.exports = (c = r(9021), r(3240), r(1380), i = (n = c).x64, o = i.Word, s = i.WordArray, a = n.algo, f = a.SHA512, u = a.SHA384 = f.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
this._hash = new s.init([new o.init(3418070365, 3238371032), new o.init(1654270250, 914150663), new o.init(2438529370, 812702999), new o.init(355462360, 4144912697), new o.init(1731405415, 4290775857), new o.init(2394180231, 1750603025), new o.init(3675008525, 1694076839), new o.init(1203062813, 3204075428)])
|
||||||
|
},
|
||||||
|
_doFinalize: function() {
|
||||||
|
var t = f._doFinalize.call(this);
|
||||||
|
return t.sigBytes -= 16, t
|
||||||
|
}
|
||||||
|
}), n.SHA384 = f._createHelper(u), n.HmacSHA384 = f._createHmacHelper(u), c.SHA384)
|
||||||
|
},
|
||||||
|
1380: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), r(3240), function() {
|
||||||
|
var t = n,
|
||||||
|
e = t.lib.Hasher,
|
||||||
|
r = t.x64,
|
||||||
|
i = r.Word,
|
||||||
|
o = r.WordArray,
|
||||||
|
s = t.algo;
|
||||||
|
|
||||||
|
function a() {
|
||||||
|
return i.create.apply(i, arguments)
|
||||||
|
}
|
||||||
|
var f = [a(1116352408, 3609767458), a(1899447441, 602891725), a(3049323471, 3964484399), a(3921009573, 2173295548), a(961987163, 4081628472), a(1508970993, 3053834265), a(2453635748, 2937671579), a(2870763221, 3664609560), a(3624381080, 2734883394), a(310598401, 1164996542), a(607225278, 1323610764), a(1426881987, 3590304994), a(1925078388, 4068182383), a(2162078206, 991336113), a(2614888103, 633803317), a(3248222580, 3479774868), a(3835390401, 2666613458), a(4022224774, 944711139), a(264347078, 2341262773), a(604807628, 2007800933), a(770255983, 1495990901), a(1249150122, 1856431235), a(1555081692, 3175218132), a(1996064986, 2198950837), a(2554220882, 3999719339), a(2821834349, 766784016), a(2952996808, 2566594879), a(3210313671, 3203337956), a(3336571891, 1034457026), a(3584528711, 2466948901), a(113926993, 3758326383), a(338241895, 168717936), a(666307205, 1188179964), a(773529912, 1546045734), a(1294757372, 1522805485), a(1396182291, 2643833823), a(1695183700, 2343527390), a(1986661051, 1014477480), a(2177026350, 1206759142), a(2456956037, 344077627), a(2730485921, 1290863460), a(2820302411, 3158454273), a(3259730800, 3505952657), a(3345764771, 106217008), a(3516065817, 3606008344), a(3600352804, 1432725776), a(4094571909, 1467031594), a(275423344, 851169720), a(430227734, 3100823752), a(506948616, 1363258195), a(659060556, 3750685593), a(883997877, 3785050280), a(958139571, 3318307427), a(1322822218, 3812723403), a(1537002063, 2003034995), a(1747873779, 3602036899), a(1955562222, 1575990012), a(2024104815, 1125592928), a(2227730452, 2716904306), a(2361852424, 442776044), a(2428436474, 593698344), a(2756734187, 3733110249), a(3204031479, 2999351573), a(3329325298, 3815920427), a(3391569614, 3928383900), a(3515267271, 566280711), a(3940187606, 3454069534), a(4118630271, 4000239992), a(116418474, 1914138554), a(174292421, 2731055270), a(289380356, 3203993006), a(460393269, 320620315), a(685471733, 587496836), a(852142971, 1086792851), a(1017036298, 365543100), a(1126000580, 2618297676), a(1288033470, 3409855158), a(1501505948, 4234509866), a(1607167915, 987167468), a(1816402316, 1246189591)],
|
||||||
|
u = [];
|
||||||
|
! function() {
|
||||||
|
for (var t = 0; t < 80; t++) u[t] = a()
|
||||||
|
}();
|
||||||
|
var c = s.SHA512 = e.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
this._hash = new o.init([new i.init(1779033703, 4089235720), new i.init(3144134277, 2227873595), new i.init(1013904242, 4271175723), new i.init(2773480762, 1595750129), new i.init(1359893119, 2917565137), new i.init(2600822924, 725511199), new i.init(528734635, 4215389547), new i.init(1541459225, 327033209)])
|
||||||
|
},
|
||||||
|
_doProcessBlock: function(t, e) {
|
||||||
|
for (var r = this._hash.words, n = r[0], i = r[1], o = r[2], s = r[3], a = r[4], c = r[5], h = r[6], p = r[7], l = n.high, y = n.low, g = i.high, d = i.low, v = o.high, m = o.low, S = s.high, _ = s.low, b = a.high, E = a.low, w = c.high, O = c.low, B = h.high, A = h.low, x = p.high, P = p.low, T = l, I = y, k = g, D = d, R = v, N = m, L = S, C = _, U = b, M = E, j = w, H = O, F = B, z = A, G = x, q = P, $ = 0; $ < 80; $++) {
|
||||||
|
var K = u[$];
|
||||||
|
if ($ < 16) var W = K.high = 0 | t[e + 2 * $],
|
||||||
|
V = K.low = 0 | t[e + 2 * $ + 1];
|
||||||
|
else {
|
||||||
|
var Y = u[$ - 15],
|
||||||
|
X = Y.high,
|
||||||
|
Z = Y.low,
|
||||||
|
J = (X >>> 1 | Z << 31) ^ (X >>> 8 | Z << 24) ^ X >>> 7,
|
||||||
|
Q = (Z >>> 1 | X << 31) ^ (Z >>> 8 | X << 24) ^ (Z >>> 7 | X << 25),
|
||||||
|
tt = u[$ - 2],
|
||||||
|
et = tt.high,
|
||||||
|
rt = tt.low,
|
||||||
|
nt = (et >>> 19 | rt << 13) ^ (et << 3 | rt >>> 29) ^ et >>> 6,
|
||||||
|
it = (rt >>> 19 | et << 13) ^ (rt << 3 | et >>> 29) ^ (rt >>> 6 | et << 26),
|
||||||
|
ot = u[$ - 7],
|
||||||
|
st = ot.high,
|
||||||
|
at = ot.low,
|
||||||
|
ft = u[$ - 16],
|
||||||
|
ut = ft.high,
|
||||||
|
ct = ft.low;
|
||||||
|
W = (W = (W = J + st + ((V = Q + at) >>> 0 < Q >>> 0 ? 1 : 0)) + nt + ((V += it) >>> 0 < it >>> 0 ? 1 : 0)) + ut + ((V += ct) >>> 0 < ct >>> 0 ? 1 : 0), K.high = W, K.low = V
|
||||||
|
}
|
||||||
|
var ht, pt = U & j ^ ~U & F,
|
||||||
|
lt = M & H ^ ~M & z,
|
||||||
|
yt = T & k ^ T & R ^ k & R,
|
||||||
|
gt = I & D ^ I & N ^ D & N,
|
||||||
|
dt = (T >>> 28 | I << 4) ^ (T << 30 | I >>> 2) ^ (T << 25 | I >>> 7),
|
||||||
|
vt = (I >>> 28 | T << 4) ^ (I << 30 | T >>> 2) ^ (I << 25 | T >>> 7),
|
||||||
|
mt = (U >>> 14 | M << 18) ^ (U >>> 18 | M << 14) ^ (U << 23 | M >>> 9),
|
||||||
|
St = (M >>> 14 | U << 18) ^ (M >>> 18 | U << 14) ^ (M << 23 | U >>> 9),
|
||||||
|
_t = f[$],
|
||||||
|
bt = _t.high,
|
||||||
|
Et = _t.low,
|
||||||
|
wt = G + mt + ((ht = q + St) >>> 0 < q >>> 0 ? 1 : 0),
|
||||||
|
Ot = vt + gt;
|
||||||
|
G = F, q = z, F = j, z = H, j = U, H = M, U = L + (wt = (wt = (wt = wt + pt + ((ht += lt) >>> 0 < lt >>> 0 ? 1 : 0)) + bt + ((ht += Et) >>> 0 < Et >>> 0 ? 1 : 0)) + W + ((ht += V) >>> 0 < V >>> 0 ? 1 : 0)) + ((M = C + ht | 0) >>> 0 < C >>> 0 ? 1 : 0) | 0, L = R, C = N, R = k, N = D, k = T, D = I, T = wt + (dt + yt + (Ot >>> 0 < vt >>> 0 ? 1 : 0)) + ((I = ht + Ot | 0) >>> 0 < ht >>> 0 ? 1 : 0) | 0
|
||||||
|
}
|
||||||
|
y = n.low = y + I, n.high = l + T + (y >>> 0 < I >>> 0 ? 1 : 0), d = i.low = d + D, i.high = g + k + (d >>> 0 < D >>> 0 ? 1 : 0), m = o.low = m + N, o.high = v + R + (m >>> 0 < N >>> 0 ? 1 : 0), _ = s.low = _ + C, s.high = S + L + (_ >>> 0 < C >>> 0 ? 1 : 0), E = a.low = E + M, a.high = b + U + (E >>> 0 < M >>> 0 ? 1 : 0), O = c.low = O + H, c.high = w + j + (O >>> 0 < H >>> 0 ? 1 : 0), A = h.low = A + z, h.high = B + F + (A >>> 0 < z >>> 0 ? 1 : 0), P = p.low = P + q, p.high = x + G + (P >>> 0 < q >>> 0 ? 1 : 0)
|
||||||
|
},
|
||||||
|
_doFinalize: function() {
|
||||||
|
var t = this._data,
|
||||||
|
e = t.words,
|
||||||
|
r = 8 * this._nDataBytes,
|
||||||
|
n = 8 * t.sigBytes;
|
||||||
|
return e[n >>> 5] |= 128 << 24 - n % 32, e[30 + (n + 128 >>> 10 << 5)] = Math.floor(r / 4294967296), e[31 + (n + 128 >>> 10 << 5)] = r, t.sigBytes = 4 * e.length, this._process(), this._hash.toX32()
|
||||||
|
},
|
||||||
|
clone: function() {
|
||||||
|
var t = e.clone.call(this);
|
||||||
|
return t._hash = this._hash.clone(), t
|
||||||
|
},
|
||||||
|
blockSize: 32
|
||||||
|
});
|
||||||
|
t.SHA512 = e._createHelper(c), t.HmacSHA512 = e._createHmacHelper(c)
|
||||||
|
}(), n.SHA512)
|
||||||
|
},
|
||||||
|
7628: function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
t.exports = (n = r(9021), r(754), r(4636), r(9506), r(7165), function() {
|
||||||
|
var t = n,
|
||||||
|
e = t.lib,
|
||||||
|
r = e.WordArray,
|
||||||
|
i = e.BlockCipher,
|
||||||
|
o = t.algo,
|
||||||
|
s = [57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4],
|
||||||
|
a = [14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32],
|
||||||
|
f = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28],
|
||||||
|
u = [{
|
||||||
|
0: 8421888,
|
||||||
|
268435456: 32768,
|
||||||
|
536870912: 8421378,
|
||||||
|
805306368: 2,
|
||||||
|
1073741824: 512,
|
||||||
|
1342177280: 8421890,
|
||||||
|
1610612736: 8389122,
|
||||||
|
1879048192: 8388608,
|
||||||
|
2147483648: 514,
|
||||||
|
2415919104: 8389120,
|
||||||
|
2684354560: 33280,
|
||||||
|
2952790016: 8421376,
|
||||||
|
3221225472: 32770,
|
||||||
|
3489660928: 8388610,
|
||||||
|
3758096384: 0,
|
||||||
|
4026531840: 33282,
|
||||||
|
134217728: 0,
|
||||||
|
402653184: 8421890,
|
||||||
|
671088640: 33282,
|
||||||
|
939524096: 32768,
|
||||||
|
1207959552: 8421888,
|
||||||
|
1476395008: 512,
|
||||||
|
1744830464: 8421378,
|
||||||
|
2013265920: 2,
|
||||||
|
2281701376: 8389120,
|
||||||
|
2550136832: 33280,
|
||||||
|
2818572288: 8421376,
|
||||||
|
3087007744: 8389122,
|
||||||
|
3355443200: 8388610,
|
||||||
|
3623878656: 32770,
|
||||||
|
3892314112: 514,
|
||||||
|
4160749568: 8388608,
|
||||||
|
1: 32768,
|
||||||
|
268435457: 2,
|
||||||
|
536870913: 8421888,
|
||||||
|
805306369: 8388608,
|
||||||
|
1073741825: 8421378,
|
||||||
|
1342177281: 33280,
|
||||||
|
1610612737: 512,
|
||||||
|
1879048193: 8389122,
|
||||||
|
2147483649: 8421890,
|
||||||
|
2415919105: 8421376,
|
||||||
|
2684354561: 8388610,
|
||||||
|
2952790017: 33282,
|
||||||
|
3221225473: 514,
|
||||||
|
3489660929: 8389120,
|
||||||
|
3758096385: 32770,
|
||||||
|
4026531841: 0,
|
||||||
|
134217729: 8421890,
|
||||||
|
402653185: 8421376,
|
||||||
|
671088641: 8388608,
|
||||||
|
939524097: 512,
|
||||||
|
1207959553: 32768,
|
||||||
|
1476395009: 8388610,
|
||||||
|
1744830465: 2,
|
||||||
|
2013265921: 33282,
|
||||||
|
2281701377: 32770,
|
||||||
|
2550136833: 8389122,
|
||||||
|
2818572289: 514,
|
||||||
|
3087007745: 8421888,
|
||||||
|
3355443201: 8389120,
|
||||||
|
3623878657: 0,
|
||||||
|
3892314113: 33280,
|
||||||
|
4160749569: 8421378
|
||||||
|
}, {
|
||||||
|
0: 1074282512,
|
||||||
|
16777216: 16384,
|
||||||
|
33554432: 524288,
|
||||||
|
50331648: 1074266128,
|
||||||
|
67108864: 1073741840,
|
||||||
|
83886080: 1074282496,
|
||||||
|
100663296: 1073758208,
|
||||||
|
117440512: 16,
|
||||||
|
134217728: 540672,
|
||||||
|
150994944: 1073758224,
|
||||||
|
167772160: 1073741824,
|
||||||
|
184549376: 540688,
|
||||||
|
201326592: 524304,
|
||||||
|
218103808: 0,
|
||||||
|
234881024: 16400,
|
||||||
|
251658240: 1074266112,
|
||||||
|
8388608: 1073758208,
|
||||||
|
25165824: 540688,
|
||||||
|
41943040: 16,
|
||||||
|
58720256: 1073758224,
|
||||||
|
75497472: 1074282512,
|
||||||
|
92274688: 1073741824,
|
||||||
|
109051904: 524288,
|
||||||
|
125829120: 1074266128,
|
||||||
|
142606336: 524304,
|
||||||
|
159383552: 0,
|
||||||
|
176160768: 16384,
|
||||||
|
192937984: 1074266112,
|
||||||
|
209715200: 1073741840,
|
||||||
|
226492416: 540672,
|
||||||
|
243269632: 1074282496,
|
||||||
|
260046848: 16400,
|
||||||
|
268435456: 0,
|
||||||
|
285212672: 1074266128,
|
||||||
|
301989888: 1073758224,
|
||||||
|
318767104: 1074282496,
|
||||||
|
335544320: 1074266112,
|
||||||
|
352321536: 16,
|
||||||
|
369098752: 540688,
|
||||||
|
385875968: 16384,
|
||||||
|
402653184: 16400,
|
||||||
|
419430400: 524288,
|
||||||
|
436207616: 524304,
|
||||||
|
452984832: 1073741840,
|
||||||
|
469762048: 540672,
|
||||||
|
486539264: 1073758208,
|
||||||
|
503316480: 1073741824,
|
||||||
|
520093696: 1074282512,
|
||||||
|
276824064: 540688,
|
||||||
|
293601280: 524288,
|
||||||
|
310378496: 1074266112,
|
||||||
|
327155712: 16384,
|
||||||
|
343932928: 1073758208,
|
||||||
|
360710144: 1074282512,
|
||||||
|
377487360: 16,
|
||||||
|
394264576: 1073741824,
|
||||||
|
411041792: 1074282496,
|
||||||
|
427819008: 1073741840,
|
||||||
|
444596224: 1073758224,
|
||||||
|
461373440: 524304,
|
||||||
|
478150656: 0,
|
||||||
|
494927872: 16400,
|
||||||
|
511705088: 1074266128,
|
||||||
|
528482304: 540672
|
||||||
|
}, {
|
||||||
|
0: 260,
|
||||||
|
1048576: 0,
|
||||||
|
2097152: 67109120,
|
||||||
|
3145728: 65796,
|
||||||
|
4194304: 65540,
|
||||||
|
5242880: 67108868,
|
||||||
|
6291456: 67174660,
|
||||||
|
7340032: 67174400,
|
||||||
|
8388608: 67108864,
|
||||||
|
9437184: 67174656,
|
||||||
|
10485760: 65792,
|
||||||
|
11534336: 67174404,
|
||||||
|
12582912: 67109124,
|
||||||
|
13631488: 65536,
|
||||||
|
14680064: 4,
|
||||||
|
15728640: 256,
|
||||||
|
524288: 67174656,
|
||||||
|
1572864: 67174404,
|
||||||
|
2621440: 0,
|
||||||
|
3670016: 67109120,
|
||||||
|
4718592: 67108868,
|
||||||
|
5767168: 65536,
|
||||||
|
6815744: 65540,
|
||||||
|
7864320: 260,
|
||||||
|
8912896: 4,
|
||||||
|
9961472: 256,
|
||||||
|
11010048: 67174400,
|
||||||
|
12058624: 65796,
|
||||||
|
13107200: 65792,
|
||||||
|
14155776: 67109124,
|
||||||
|
15204352: 67174660,
|
||||||
|
16252928: 67108864,
|
||||||
|
16777216: 67174656,
|
||||||
|
17825792: 65540,
|
||||||
|
18874368: 65536,
|
||||||
|
19922944: 67109120,
|
||||||
|
20971520: 256,
|
||||||
|
22020096: 67174660,
|
||||||
|
23068672: 67108868,
|
||||||
|
24117248: 0,
|
||||||
|
25165824: 67109124,
|
||||||
|
26214400: 67108864,
|
||||||
|
27262976: 4,
|
||||||
|
28311552: 65792,
|
||||||
|
29360128: 67174400,
|
||||||
|
30408704: 260,
|
||||||
|
31457280: 65796,
|
||||||
|
32505856: 67174404,
|
||||||
|
17301504: 67108864,
|
||||||
|
18350080: 260,
|
||||||
|
19398656: 67174656,
|
||||||
|
20447232: 0,
|
||||||
|
21495808: 65540,
|
||||||
|
22544384: 67109120,
|
||||||
|
23592960: 256,
|
||||||
|
24641536: 67174404,
|
||||||
|
25690112: 65536,
|
||||||
|
26738688: 67174660,
|
||||||
|
27787264: 65796,
|
||||||
|
28835840: 67108868,
|
||||||
|
29884416: 67109124,
|
||||||
|
30932992: 67174400,
|
||||||
|
31981568: 4,
|
||||||
|
33030144: 65792
|
||||||
|
}, {
|
||||||
|
0: 2151682048,
|
||||||
|
65536: 2147487808,
|
||||||
|
131072: 4198464,
|
||||||
|
196608: 2151677952,
|
||||||
|
262144: 0,
|
||||||
|
327680: 4198400,
|
||||||
|
393216: 2147483712,
|
||||||
|
458752: 4194368,
|
||||||
|
524288: 2147483648,
|
||||||
|
589824: 4194304,
|
||||||
|
655360: 64,
|
||||||
|
720896: 2147487744,
|
||||||
|
786432: 2151678016,
|
||||||
|
851968: 4160,
|
||||||
|
917504: 4096,
|
||||||
|
983040: 2151682112,
|
||||||
|
32768: 2147487808,
|
||||||
|
98304: 64,
|
||||||
|
163840: 2151678016,
|
||||||
|
229376: 2147487744,
|
||||||
|
294912: 4198400,
|
||||||
|
360448: 2151682112,
|
||||||
|
425984: 0,
|
||||||
|
491520: 2151677952,
|
||||||
|
557056: 4096,
|
||||||
|
622592: 2151682048,
|
||||||
|
688128: 4194304,
|
||||||
|
753664: 4160,
|
||||||
|
819200: 2147483648,
|
||||||
|
884736: 4194368,
|
||||||
|
950272: 4198464,
|
||||||
|
1015808: 2147483712,
|
||||||
|
1048576: 4194368,
|
||||||
|
1114112: 4198400,
|
||||||
|
1179648: 2147483712,
|
||||||
|
1245184: 0,
|
||||||
|
1310720: 4160,
|
||||||
|
1376256: 2151678016,
|
||||||
|
1441792: 2151682048,
|
||||||
|
1507328: 2147487808,
|
||||||
|
1572864: 2151682112,
|
||||||
|
1638400: 2147483648,
|
||||||
|
1703936: 2151677952,
|
||||||
|
1769472: 4198464,
|
||||||
|
1835008: 2147487744,
|
||||||
|
1900544: 4194304,
|
||||||
|
1966080: 64,
|
||||||
|
2031616: 4096,
|
||||||
|
1081344: 2151677952,
|
||||||
|
1146880: 2151682112,
|
||||||
|
1212416: 0,
|
||||||
|
1277952: 4198400,
|
||||||
|
1343488: 4194368,
|
||||||
|
1409024: 2147483648,
|
||||||
|
1474560: 2147487808,
|
||||||
|
1540096: 64,
|
||||||
|
1605632: 2147483712,
|
||||||
|
1671168: 4096,
|
||||||
|
1736704: 2147487744,
|
||||||
|
1802240: 2151678016,
|
||||||
|
1867776: 4160,
|
||||||
|
1933312: 2151682048,
|
||||||
|
1998848: 4194304,
|
||||||
|
2064384: 4198464
|
||||||
|
}, {
|
||||||
|
0: 128,
|
||||||
|
4096: 17039360,
|
||||||
|
8192: 262144,
|
||||||
|
12288: 536870912,
|
||||||
|
16384: 537133184,
|
||||||
|
20480: 16777344,
|
||||||
|
24576: 553648256,
|
||||||
|
28672: 262272,
|
||||||
|
32768: 16777216,
|
||||||
|
36864: 537133056,
|
||||||
|
40960: 536871040,
|
||||||
|
45056: 553910400,
|
||||||
|
49152: 553910272,
|
||||||
|
53248: 0,
|
||||||
|
57344: 17039488,
|
||||||
|
61440: 553648128,
|
||||||
|
2048: 17039488,
|
||||||
|
6144: 553648256,
|
||||||
|
10240: 128,
|
||||||
|
14336: 17039360,
|
||||||
|
18432: 262144,
|
||||||
|
22528: 537133184,
|
||||||
|
26624: 553910272,
|
||||||
|
30720: 536870912,
|
||||||
|
34816: 537133056,
|
||||||
|
38912: 0,
|
||||||
|
43008: 553910400,
|
||||||
|
47104: 16777344,
|
||||||
|
51200: 536871040,
|
||||||
|
55296: 553648128,
|
||||||
|
59392: 16777216,
|
||||||
|
63488: 262272,
|
||||||
|
65536: 262144,
|
||||||
|
69632: 128,
|
||||||
|
73728: 536870912,
|
||||||
|
77824: 553648256,
|
||||||
|
81920: 16777344,
|
||||||
|
86016: 553910272,
|
||||||
|
90112: 537133184,
|
||||||
|
94208: 16777216,
|
||||||
|
98304: 553910400,
|
||||||
|
102400: 553648128,
|
||||||
|
106496: 17039360,
|
||||||
|
110592: 537133056,
|
||||||
|
114688: 262272,
|
||||||
|
118784: 536871040,
|
||||||
|
122880: 0,
|
||||||
|
126976: 17039488,
|
||||||
|
67584: 553648256,
|
||||||
|
71680: 16777216,
|
||||||
|
75776: 17039360,
|
||||||
|
79872: 537133184,
|
||||||
|
83968: 536870912,
|
||||||
|
88064: 17039488,
|
||||||
|
92160: 128,
|
||||||
|
96256: 553910272,
|
||||||
|
100352: 262272,
|
||||||
|
104448: 553910400,
|
||||||
|
108544: 0,
|
||||||
|
112640: 553648128,
|
||||||
|
116736: 16777344,
|
||||||
|
120832: 262144,
|
||||||
|
124928: 537133056,
|
||||||
|
129024: 536871040
|
||||||
|
}, {
|
||||||
|
0: 268435464,
|
||||||
|
256: 8192,
|
||||||
|
512: 270532608,
|
||||||
|
768: 270540808,
|
||||||
|
1024: 268443648,
|
||||||
|
1280: 2097152,
|
||||||
|
1536: 2097160,
|
||||||
|
1792: 268435456,
|
||||||
|
2048: 0,
|
||||||
|
2304: 268443656,
|
||||||
|
2560: 2105344,
|
||||||
|
2816: 8,
|
||||||
|
3072: 270532616,
|
||||||
|
3328: 2105352,
|
||||||
|
3584: 8200,
|
||||||
|
3840: 270540800,
|
||||||
|
128: 270532608,
|
||||||
|
384: 270540808,
|
||||||
|
640: 8,
|
||||||
|
896: 2097152,
|
||||||
|
1152: 2105352,
|
||||||
|
1408: 268435464,
|
||||||
|
1664: 268443648,
|
||||||
|
1920: 8200,
|
||||||
|
2176: 2097160,
|
||||||
|
2432: 8192,
|
||||||
|
2688: 268443656,
|
||||||
|
2944: 270532616,
|
||||||
|
3200: 0,
|
||||||
|
3456: 270540800,
|
||||||
|
3712: 2105344,
|
||||||
|
3968: 268435456,
|
||||||
|
4096: 268443648,
|
||||||
|
4352: 270532616,
|
||||||
|
4608: 270540808,
|
||||||
|
4864: 8200,
|
||||||
|
5120: 2097152,
|
||||||
|
5376: 268435456,
|
||||||
|
5632: 268435464,
|
||||||
|
5888: 2105344,
|
||||||
|
6144: 2105352,
|
||||||
|
6400: 0,
|
||||||
|
6656: 8,
|
||||||
|
6912: 270532608,
|
||||||
|
7168: 8192,
|
||||||
|
7424: 268443656,
|
||||||
|
7680: 270540800,
|
||||||
|
7936: 2097160,
|
||||||
|
4224: 8,
|
||||||
|
4480: 2105344,
|
||||||
|
4736: 2097152,
|
||||||
|
4992: 268435464,
|
||||||
|
5248: 268443648,
|
||||||
|
5504: 8200,
|
||||||
|
5760: 270540808,
|
||||||
|
6016: 270532608,
|
||||||
|
6272: 270540800,
|
||||||
|
6528: 270532616,
|
||||||
|
6784: 8192,
|
||||||
|
7040: 2105352,
|
||||||
|
7296: 2097160,
|
||||||
|
7552: 0,
|
||||||
|
7808: 268435456,
|
||||||
|
8064: 268443656
|
||||||
|
}, {
|
||||||
|
0: 1048576,
|
||||||
|
16: 33555457,
|
||||||
|
32: 1024,
|
||||||
|
48: 1049601,
|
||||||
|
64: 34604033,
|
||||||
|
80: 0,
|
||||||
|
96: 1,
|
||||||
|
112: 34603009,
|
||||||
|
128: 33555456,
|
||||||
|
144: 1048577,
|
||||||
|
160: 33554433,
|
||||||
|
176: 34604032,
|
||||||
|
192: 34603008,
|
||||||
|
208: 1025,
|
||||||
|
224: 1049600,
|
||||||
|
240: 33554432,
|
||||||
|
8: 34603009,
|
||||||
|
24: 0,
|
||||||
|
40: 33555457,
|
||||||
|
56: 34604032,
|
||||||
|
72: 1048576,
|
||||||
|
88: 33554433,
|
||||||
|
104: 33554432,
|
||||||
|
120: 1025,
|
||||||
|
136: 1049601,
|
||||||
|
152: 33555456,
|
||||||
|
168: 34603008,
|
||||||
|
184: 1048577,
|
||||||
|
200: 1024,
|
||||||
|
216: 34604033,
|
||||||
|
232: 1,
|
||||||
|
248: 1049600,
|
||||||
|
256: 33554432,
|
||||||
|
272: 1048576,
|
||||||
|
288: 33555457,
|
||||||
|
304: 34603009,
|
||||||
|
320: 1048577,
|
||||||
|
336: 33555456,
|
||||||
|
352: 34604032,
|
||||||
|
368: 1049601,
|
||||||
|
384: 1025,
|
||||||
|
400: 34604033,
|
||||||
|
416: 1049600,
|
||||||
|
432: 1,
|
||||||
|
448: 0,
|
||||||
|
464: 34603008,
|
||||||
|
480: 33554433,
|
||||||
|
496: 1024,
|
||||||
|
264: 1049600,
|
||||||
|
280: 33555457,
|
||||||
|
296: 34603009,
|
||||||
|
312: 1,
|
||||||
|
328: 33554432,
|
||||||
|
344: 1048576,
|
||||||
|
360: 1025,
|
||||||
|
376: 34604032,
|
||||||
|
392: 33554433,
|
||||||
|
408: 34603008,
|
||||||
|
424: 0,
|
||||||
|
440: 34604033,
|
||||||
|
456: 1049601,
|
||||||
|
472: 1024,
|
||||||
|
488: 33555456,
|
||||||
|
504: 1048577
|
||||||
|
}, {
|
||||||
|
0: 134219808,
|
||||||
|
1: 131072,
|
||||||
|
2: 134217728,
|
||||||
|
3: 32,
|
||||||
|
4: 131104,
|
||||||
|
5: 134350880,
|
||||||
|
6: 134350848,
|
||||||
|
7: 2048,
|
||||||
|
8: 134348800,
|
||||||
|
9: 134219776,
|
||||||
|
10: 133120,
|
||||||
|
11: 134348832,
|
||||||
|
12: 2080,
|
||||||
|
13: 0,
|
||||||
|
14: 134217760,
|
||||||
|
15: 133152,
|
||||||
|
2147483648: 2048,
|
||||||
|
2147483649: 134350880,
|
||||||
|
2147483650: 134219808,
|
||||||
|
2147483651: 134217728,
|
||||||
|
2147483652: 134348800,
|
||||||
|
2147483653: 133120,
|
||||||
|
2147483654: 133152,
|
||||||
|
2147483655: 32,
|
||||||
|
2147483656: 134217760,
|
||||||
|
2147483657: 2080,
|
||||||
|
2147483658: 131104,
|
||||||
|
2147483659: 134350848,
|
||||||
|
2147483660: 0,
|
||||||
|
2147483661: 134348832,
|
||||||
|
2147483662: 134219776,
|
||||||
|
2147483663: 131072,
|
||||||
|
16: 133152,
|
||||||
|
17: 134350848,
|
||||||
|
18: 32,
|
||||||
|
19: 2048,
|
||||||
|
20: 134219776,
|
||||||
|
21: 134217760,
|
||||||
|
22: 134348832,
|
||||||
|
23: 131072,
|
||||||
|
24: 0,
|
||||||
|
25: 131104,
|
||||||
|
26: 134348800,
|
||||||
|
27: 134219808,
|
||||||
|
28: 134350880,
|
||||||
|
29: 133120,
|
||||||
|
30: 2080,
|
||||||
|
31: 134217728,
|
||||||
|
2147483664: 131072,
|
||||||
|
2147483665: 2048,
|
||||||
|
2147483666: 134348832,
|
||||||
|
2147483667: 133152,
|
||||||
|
2147483668: 32,
|
||||||
|
2147483669: 134348800,
|
||||||
|
2147483670: 134217728,
|
||||||
|
2147483671: 134219808,
|
||||||
|
2147483672: 134350880,
|
||||||
|
2147483673: 134217760,
|
||||||
|
2147483674: 134219776,
|
||||||
|
2147483675: 0,
|
||||||
|
2147483676: 133120,
|
||||||
|
2147483677: 2080,
|
||||||
|
2147483678: 131104,
|
||||||
|
2147483679: 134350848
|
||||||
|
}],
|
||||||
|
c = [4160749569, 528482304, 33030144, 2064384, 129024, 8064, 504, 2147483679],
|
||||||
|
h = o.DES = i.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
for (var t = this._key.words, e = [], r = 0; r < 56; r++) {
|
||||||
|
var n = s[r] - 1;
|
||||||
|
e[r] = t[n >>> 5] >>> 31 - n % 32 & 1
|
||||||
|
}
|
||||||
|
for (var i = this._subKeys = [], o = 0; o < 16; o++) {
|
||||||
|
var u = i[o] = [],
|
||||||
|
c = f[o];
|
||||||
|
for (r = 0; r < 24; r++) u[r / 6 | 0] |= e[(a[r] - 1 + c) % 28] << 31 - r % 6, u[4 + (r / 6 | 0)] |= e[28 + (a[r + 24] - 1 + c) % 28] << 31 - r % 6;
|
||||||
|
for (u[0] = u[0] << 1 | u[0] >>> 31, r = 1; r < 7; r++) u[r] = u[r] >>> 4 * (r - 1) + 3;
|
||||||
|
u[7] = u[7] << 5 | u[7] >>> 27
|
||||||
|
}
|
||||||
|
var h = this._invSubKeys = [];
|
||||||
|
for (r = 0; r < 16; r++) h[r] = i[15 - r]
|
||||||
|
},
|
||||||
|
encryptBlock: function(t, e) {
|
||||||
|
this._doCryptBlock(t, e, this._subKeys)
|
||||||
|
},
|
||||||
|
decryptBlock: function(t, e) {
|
||||||
|
this._doCryptBlock(t, e, this._invSubKeys)
|
||||||
|
},
|
||||||
|
_doCryptBlock: function(t, e, r) {
|
||||||
|
this._lBlock = t[e], this._rBlock = t[e + 1], p.call(this, 4, 252645135), p.call(this, 16, 65535), l.call(this, 2, 858993459), l.call(this, 8, 16711935), p.call(this, 1, 1431655765);
|
||||||
|
for (var n = 0; n < 16; n++) {
|
||||||
|
for (var i = r[n], o = this._lBlock, s = this._rBlock, a = 0, f = 0; f < 8; f++) a |= u[f][((s ^ i[f]) & c[f]) >>> 0];
|
||||||
|
this._lBlock = s, this._rBlock = o ^ a
|
||||||
|
}
|
||||||
|
var h = this._lBlock;
|
||||||
|
this._lBlock = this._rBlock, this._rBlock = h, p.call(this, 1, 1431655765), l.call(this, 8, 16711935), l.call(this, 2, 858993459), p.call(this, 16, 65535), p.call(this, 4, 252645135), t[e] = this._lBlock, t[e + 1] = this._rBlock
|
||||||
|
},
|
||||||
|
keySize: 2,
|
||||||
|
ivSize: 2,
|
||||||
|
blockSize: 2
|
||||||
|
});
|
||||||
|
|
||||||
|
function p(t, e) {
|
||||||
|
var r = (this._lBlock >>> t ^ this._rBlock) & e;
|
||||||
|
this._rBlock ^= r, this._lBlock ^= r << t
|
||||||
|
}
|
||||||
|
|
||||||
|
function l(t, e) {
|
||||||
|
var r = (this._rBlock >>> t ^ this._lBlock) & e;
|
||||||
|
this._lBlock ^= r, this._rBlock ^= r << t
|
||||||
|
}
|
||||||
|
t.DES = i._createHelper(h);
|
||||||
|
var y = o.TripleDES = i.extend({
|
||||||
|
_doReset: function() {
|
||||||
|
var t = this._key.words;
|
||||||
|
this._des1 = h.createEncryptor(r.create(t.slice(0, 2))), this._des2 = h.createEncryptor(r.create(t.slice(2, 4))), this._des3 = h.createEncryptor(r.create(t.slice(4, 6)))
|
||||||
|
},
|
||||||
|
encryptBlock: function(t, e) {
|
||||||
|
this._des1.encryptBlock(t, e), this._des2.decryptBlock(t, e), this._des3.encryptBlock(t, e)
|
||||||
|
},
|
||||||
|
decryptBlock: function(t, e) {
|
||||||
|
this._des3.decryptBlock(t, e), this._des2.encryptBlock(t, e), this._des1.decryptBlock(t, e)
|
||||||
|
},
|
||||||
|
keySize: 6,
|
||||||
|
ivSize: 2,
|
||||||
|
blockSize: 2
|
||||||
|
});
|
||||||
|
t.TripleDES = i._createHelper(y)
|
||||||
|
}(), n.TripleDES)
|
||||||
|
},
|
||||||
|
3240: function(t, e, r) {
|
||||||
|
var n, i, o, s, a, f;
|
||||||
|
t.exports = (n = r(9021), o = (i = n).lib, s = o.Base, a = o.WordArray, (f = i.x64 = {}).Word = s.extend({
|
||||||
|
init: function(t, e) {
|
||||||
|
this.high = t, this.low = e
|
||||||
|
}
|
||||||
|
}), f.WordArray = s.extend({
|
||||||
|
init: function(t, e) {
|
||||||
|
t = this.words = t || [], this.sigBytes = null != e ? e : 8 * t.length
|
||||||
|
},
|
||||||
|
toX32: function() {
|
||||||
|
for (var t = this.words, e = t.length, r = [], n = 0; n < e; n++) {
|
||||||
|
var i = t[n];
|
||||||
|
r.push(i.high), r.push(i.low)
|
||||||
|
}
|
||||||
|
return a.create(r, this.sigBytes)
|
||||||
|
},
|
||||||
|
clone: function() {
|
||||||
|
for (var t = s.clone.call(this), e = t.words = this.words.slice(0), r = e.length, n = 0; n < r; n++) e[n] = e[n].clone();
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
}), n)
|
||||||
|
},
|
||||||
|
41: (t, e, r) => {
|
||||||
|
"use strict";
|
||||||
|
var n = r(655),
|
||||||
|
i = r(8068),
|
||||||
|
o = r(9675),
|
||||||
|
s = r(5795);
|
||||||
|
t.exports = function(t, e, r) {
|
||||||
|
if (!t || "object" != typeof t && "function" != typeof t) throw new o("`obj` must be an object or a function`");
|
||||||
|
if ("string" != typeof e && "symbol" != typeof e) throw new o("`property` must be a string or a symbol`");
|
||||||
|
if (arguments.length > 3 && "boolean" != typeof arguments[3] && null !== arguments[3]) throw new o("`nonEnumerable`, if provided, must be a boolean or null");
|
||||||
|
if (arguments.length > 4 && "boolean" != typeof arguments[4] && null !== arguments[4]) throw new o("`nonWritable`, if provided, must be a boolean or null");
|
||||||
|
if (arguments.length > 5 && "boolean" != typeof arguments[5] && null !== arguments[5]) throw new o("`nonConfigurable`, if provided, must be a boolean or null");
|
||||||
|
if (arguments.length > 6 && "boolean" != typeof arguments[6]) throw new o("`loose`, if provided, must be a boolean");
|
||||||
|
var a = arguments.length > 3 ? arguments[3] : null,
|
||||||
|
f = arguments.length > 4 ? arguments[4] : null,
|
||||||
|
u = arguments.length > 5 ? arguments[5] : null,
|
||||||
|
c = arguments.length > 6 && arguments[6],
|
||||||
|
h = !!s && s(t, e);
|
||||||
|
if (n) n(t, e, {
|
||||||
|
configurable: null === u && h ? h.configurable : !u,
|
||||||
|
enumerable: null === a && h ? h.enumerable : !a,
|
||||||
|
value: r,
|
||||||
|
writable: null === f && h ? h.writable : !f
|
||||||
|
});
|
||||||
|
else {
|
||||||
|
if (!c && (a || f || u)) throw new i("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
|
||||||
|
t[e] = r
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
655: (t, e, r) => {
|
||||||
|
"use strict";
|
||||||
|
var n = r(453)("%Object.defineProperty%", !0) || !1;
|
||||||
|
if (n) try {
|
||||||
|
n({}, "a", {
|
||||||
|
value: 1
|
||||||
|
})
|
||||||
|
} catch (t) {
|
||||||
|
n = !1
|
||||||
|
}
|
||||||
|
t.exports = n
|
||||||
|
},
|
||||||
|
1237: t => {
|
||||||
|
"use strict";
|
||||||
|
t.exports = EvalError
|
||||||
|
},
|
||||||
|
9383: t => {
|
||||||
|
"use strict";
|
||||||
|
t.exports = Error
|
||||||
|
},
|
||||||
|
9290: t => {
|
||||||
|
"use strict";
|
||||||
|
t.exports = RangeError
|
||||||
|
},
|
||||||
|
9538: t => {
|
||||||
|
"use strict";
|
||||||
|
t.exports = ReferenceError
|
||||||
|
},
|
||||||
|
8068: t => {
|
||||||
|
"use strict";
|
||||||
|
t.exports = SyntaxError
|
||||||
|
},
|
||||||
|
9675: t => {
|
||||||
|
"use strict";
|
||||||
|
t.exports = TypeError
|
||||||
|
},
|
||||||
|
5345: t => {
|
||||||
|
"use strict";
|
||||||
|
t.exports = URIError
|
||||||
|
},
|
||||||
|
9353: t => {
|
||||||
|
"use strict";
|
||||||
|
var e = Object.prototype.toString,
|
||||||
|
r = Math.max,
|
||||||
|
n = function(t, e) {
|
||||||
|
for (var r = [], n = 0; n < t.length; n += 1) r[n] = t[n];
|
||||||
|
for (var i = 0; i < e.length; i += 1) r[i + t.length] = e[i];
|
||||||
|
return r
|
||||||
|
};
|
||||||
|
t.exports = function(t) {
|
||||||
|
var i = this;
|
||||||
|
if ("function" != typeof i || "[object Function]" !== e.apply(i)) throw new TypeError("Function.prototype.bind called on incompatible " + i);
|
||||||
|
for (var o, s = function(t, e) {
|
||||||
|
for (var r = [], n = 1, i = 0; n < t.length; n += 1, i += 1) r[i] = t[n];
|
||||||
|
return r
|
||||||
|
}(arguments), a = r(0, i.length - s.length), f = [], u = 0; u < a; u++) f[u] = "$" + u;
|
||||||
|
if (o = Function("binder", "return function (" + function(t, e) {
|
||||||
|
for (var r = "", n = 0; n < t.length; n += 1) r += t[n], n + 1 < t.length && (r += ",");
|
||||||
|
return r
|
||||||
|
}(f) + "){ return binder.apply(this,arguments); }")((function() {
|
||||||
|
if (this instanceof o) {
|
||||||
|
var e = i.apply(this, n(s, arguments));
|
||||||
|
return Object(e) === e ? e : this
|
||||||
|
}
|
||||||
|
return i.apply(t, n(s, arguments))
|
||||||
|
})), i.prototype) {
|
||||||
|
var c = function() {};
|
||||||
|
c.prototype = i.prototype, o.prototype = new c, c.prototype = null
|
||||||
|
}
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
},
|
||||||
|
6743: (t, e, r) => {
|
||||||
|
"use strict";
|
||||||
|
var n = r(9353);
|
||||||
|
t.exports = Function.prototype.bind || n
|
||||||
|
},
|
||||||
|
453: (t, e, r) => {
|
||||||
|
"use strict";
|
||||||
|
var n, i = r(9383),
|
||||||
|
o = r(1237),
|
||||||
|
s = r(9290),
|
||||||
|
a = r(9538),
|
||||||
|
f = r(8068),
|
||||||
|
u = r(9675),
|
||||||
|
c = r(5345),
|
||||||
|
h = Function,
|
||||||
|
p = function(t) {
|
||||||
|
try {
|
||||||
|
return h('"use strict"; return (' + t + ").constructor;")()
|
||||||
|
} catch (t) {}
|
||||||
|
},
|
||||||
|
l = Object.getOwnPropertyDescriptor;
|
||||||
|
if (l) try {
|
||||||
|
l({}, "")
|
||||||
|
} catch (t) {
|
||||||
|
l = null
|
||||||
|
}
|
||||||
|
var y = function() {
|
||||||
|
throw new u
|
||||||
|
},
|
||||||
|
g = l ? function() {
|
||||||
|
try {
|
||||||
|
return y
|
||||||
|
} catch (t) {
|
||||||
|
try {
|
||||||
|
return l(arguments, "callee").get
|
||||||
|
} catch (t) {
|
||||||
|
return y
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}() : y,
|
||||||
|
d = r(4039)(),
|
||||||
|
v = r(24)(),
|
||||||
|
m = Object.getPrototypeOf || (v ? function(t) {
|
||||||
|
return t.__proto__
|
||||||
|
} : null),
|
||||||
|
S = {},
|
||||||
|
_ = "undefined" != typeof Uint8Array && m ? m(Uint8Array) : n,
|
||||||
|
b = {
|
||||||
|
__proto__: null,
|
||||||
|
"%AggregateError%": "undefined" == typeof AggregateError ? n : AggregateError,
|
||||||
|
"%Array%": Array,
|
||||||
|
"%ArrayBuffer%": "undefined" == typeof ArrayBuffer ? n : ArrayBuffer,
|
||||||
|
"%ArrayIteratorPrototype%": d && m ? m([][Symbol.iterator]()) : n,
|
||||||
|
"%AsyncFromSyncIteratorPrototype%": n,
|
||||||
|
"%AsyncFunction%": S,
|
||||||
|
"%AsyncGenerator%": S,
|
||||||
|
"%AsyncGeneratorFunction%": S,
|
||||||
|
"%AsyncIteratorPrototype%": S,
|
||||||
|
"%Atomics%": "undefined" == typeof Atomics ? n : Atomics,
|
||||||
|
"%BigInt%": "undefined" == typeof BigInt ? n : BigInt,
|
||||||
|
"%BigInt64Array%": "undefined" == typeof BigInt64Array ? n : BigInt64Array,
|
||||||
|
"%BigUint64Array%": "undefined" == typeof BigUint64Array ? n : BigUint64Array,
|
||||||
|
"%Boolean%": Boolean,
|
||||||
|
"%DataView%": "undefined" == typeof DataView ? n : DataView,
|
||||||
|
"%Date%": Date,
|
||||||
|
"%decodeURI%": decodeURI,
|
||||||
|
"%decodeURIComponent%": decodeURIComponent,
|
||||||
|
"%encodeURI%": encodeURI,
|
||||||
|
"%encodeURIComponent%": encodeURIComponent,
|
||||||
|
"%Error%": i,
|
||||||
|
"%eval%": eval,
|
||||||
|
"%EvalError%": o,
|
||||||
|
"%Float32Array%": "undefined" == typeof Float32Array ? n : Float32Array,
|
||||||
|
"%Float64Array%": "undefined" == typeof Float64Array ? n : Float64Array,
|
||||||
|
"%FinalizationRegistry%": "undefined" == typeof FinalizationRegistry ? n : FinalizationRegistry,
|
||||||
|
"%Function%": h,
|
||||||
|
"%GeneratorFunction%": S,
|
||||||
|
"%Int8Array%": "undefined" == typeof Int8Array ? n : Int8Array,
|
||||||
|
"%Int16Array%": "undefined" == typeof Int16Array ? n : Int16Array,
|
||||||
|
"%Int32Array%": "undefined" == typeof Int32Array ? n : Int32Array,
|
||||||
|
"%isFinite%": isFinite,
|
||||||
|
"%isNaN%": isNaN,
|
||||||
|
"%IteratorPrototype%": d && m ? m(m([][Symbol.iterator]())) : n,
|
||||||
|
"%JSON%": "object" == typeof JSON ? JSON : n,
|
||||||
|
"%Map%": "undefined" == typeof Map ? n : Map,
|
||||||
|
"%MapIteratorPrototype%": "undefined" != typeof Map && d && m ? m((new Map)[Symbol.iterator]()) : n,
|
||||||
|
"%Math%": Math,
|
||||||
|
"%Number%": Number,
|
||||||
|
"%Object%": Object,
|
||||||
|
"%parseFloat%": parseFloat,
|
||||||
|
"%parseInt%": parseInt,
|
||||||
|
"%Promise%": "undefined" == typeof Promise ? n : Promise,
|
||||||
|
"%Proxy%": "undefined" == typeof Proxy ? n : Proxy,
|
||||||
|
"%RangeError%": s,
|
||||||
|
"%ReferenceError%": a,
|
||||||
|
"%Reflect%": "undefined" == typeof Reflect ? n : Reflect,
|
||||||
|
"%RegExp%": RegExp,
|
||||||
|
"%Set%": "undefined" == typeof Set ? n : Set,
|
||||||
|
"%SetIteratorPrototype%": "undefined" != typeof Set && d && m ? m((new Set)[Symbol.iterator]()) : n,
|
||||||
|
"%SharedArrayBuffer%": "undefined" == typeof SharedArrayBuffer ? n : SharedArrayBuffer,
|
||||||
|
"%String%": String,
|
||||||
|
"%StringIteratorPrototype%": d && m ? m("" [Symbol.iterator]()) : n,
|
||||||
|
"%Symbol%": d ? Symbol : n,
|
||||||
|
"%SyntaxError%": f,
|
||||||
|
"%ThrowTypeError%": g,
|
||||||
|
"%TypedArray%": _,
|
||||||
|
"%TypeError%": u,
|
||||||
|
"%Uint8Array%": "undefined" == typeof Uint8Array ? n : Uint8Array,
|
||||||
|
"%Uint8ClampedArray%": "undefined" == typeof Uint8ClampedArray ? n : Uint8ClampedArray,
|
||||||
|
"%Uint16Array%": "undefined" == typeof Uint16Array ? n : Uint16Array,
|
||||||
|
"%Uint32Array%": "undefined" == typeof Uint32Array ? n : Uint32Array,
|
||||||
|
"%URIError%": c,
|
||||||
|
"%WeakMap%": "undefined" == typeof WeakMap ? n : WeakMap,
|
||||||
|
"%WeakRef%": "undefined" == typeof WeakRef ? n : WeakRef,
|
||||||
|
"%WeakSet%": "undefined" == typeof WeakSet ? n : WeakSet
|
||||||
|
};
|
||||||
|
if (m) try {
|
||||||
|
null.error
|
||||||
|
} catch (t) {
|
||||||
|
var E = m(m(t));
|
||||||
|
b["%Error.prototype%"] = E
|
||||||
|
}
|
||||||
|
var w = function t(e) {
|
||||||
|
var r;
|
||||||
|
if ("%AsyncFunction%" === e) r = p("async function () {}");
|
||||||
|
else if ("%GeneratorFunction%" === e) r = p("function* () {}");
|
||||||
|
else if ("%AsyncGeneratorFunction%" === e) r = p("async function* () {}");
|
||||||
|
else if ("%AsyncGenerator%" === e) {
|
||||||
|
var n = t("%AsyncGeneratorFunction%");
|
||||||
|
n && (r = n.prototype)
|
||||||
|
} else if ("%AsyncIteratorPrototype%" === e) {
|
||||||
|
var i = t("%AsyncGenerator%");
|
||||||
|
i && m && (r = m(i.prototype))
|
||||||
|
}
|
||||||
|
return b[e] = r, r
|
||||||
|
},
|
||||||
|
O = {
|
||||||
|
__proto__: null,
|
||||||
|
"%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
|
||||||
|
"%ArrayPrototype%": ["Array", "prototype"],
|
||||||
|
"%ArrayProto_entries%": ["Array", "prototype", "entries"],
|
||||||
|
"%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
|
||||||
|
"%ArrayProto_keys%": ["Array", "prototype", "keys"],
|
||||||
|
"%ArrayProto_values%": ["Array", "prototype", "values"],
|
||||||
|
"%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
|
||||||
|
"%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
|
||||||
|
"%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
|
||||||
|
"%BooleanPrototype%": ["Boolean", "prototype"],
|
||||||
|
"%DataViewPrototype%": ["DataView", "prototype"],
|
||||||
|
"%DatePrototype%": ["Date", "prototype"],
|
||||||
|
"%ErrorPrototype%": ["Error", "prototype"],
|
||||||
|
"%EvalErrorPrototype%": ["EvalError", "prototype"],
|
||||||
|
"%Float32ArrayPrototype%": ["Float32Array", "prototype"],
|
||||||
|
"%Float64ArrayPrototype%": ["Float64Array", "prototype"],
|
||||||
|
"%FunctionPrototype%": ["Function", "prototype"],
|
||||||
|
"%Generator%": ["GeneratorFunction", "prototype"],
|
||||||
|
"%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
|
||||||
|
"%Int8ArrayPrototype%": ["Int8Array", "prototype"],
|
||||||
|
"%Int16ArrayPrototype%": ["Int16Array", "prototype"],
|
||||||
|
"%Int32ArrayPrototype%": ["Int32Array", "prototype"],
|
||||||
|
"%JSONParse%": ["JSON", "parse"],
|
||||||
|
"%JSONStringify%": ["JSON", "stringify"],
|
||||||
|
"%MapPrototype%": ["Map", "prototype"],
|
||||||
|
"%NumberPrototype%": ["Number", "prototype"],
|
||||||
|
"%ObjectPrototype%": ["Object", "prototype"],
|
||||||
|
"%ObjProto_toString%": ["Object", "prototype", "toString"],
|
||||||
|
"%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
|
||||||
|
"%PromisePrototype%": ["Promise", "prototype"],
|
||||||
|
"%PromiseProto_then%": ["Promise", "prototype", "then"],
|
||||||
|
"%Promise_all%": ["Promise", "all"],
|
||||||
|
"%Promise_reject%": ["Promise", "reject"],
|
||||||
|
"%Promise_resolve%": ["Promise", "resolve"],
|
||||||
|
"%RangeErrorPrototype%": ["RangeError", "prototype"],
|
||||||
|
"%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
|
||||||
|
"%RegExpPrototype%": ["RegExp", "prototype"],
|
||||||
|
"%SetPrototype%": ["Set", "prototype"],
|
||||||
|
"%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
|
||||||
|
"%StringPrototype%": ["String", "prototype"],
|
||||||
|
"%SymbolPrototype%": ["Symbol", "prototype"],
|
||||||
|
"%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
|
||||||
|
"%TypedArrayPrototype%": ["TypedArray", "prototype"],
|
||||||
|
"%TypeErrorPrototype%": ["TypeError", "prototype"],
|
||||||
|
"%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
|
||||||
|
"%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
|
||||||
|
"%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
|
||||||
|
"%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
|
||||||
|
"%URIErrorPrototype%": ["URIError", "prototype"],
|
||||||
|
"%WeakMapPrototype%": ["WeakMap", "prototype"],
|
||||||
|
"%WeakSetPrototype%": ["WeakSet", "prototype"]
|
||||||
|
},
|
||||||
|
B = r(6743),
|
||||||
|
A = r(9957),
|
||||||
|
x = B.call(Function.call, Array.prototype.concat),
|
||||||
|
P = B.call(Function.apply, Array.prototype.splice),
|
||||||
|
T = B.call(Function.call, String.prototype.replace),
|
||||||
|
I = B.call(Function.call, String.prototype.slice),
|
||||||
|
k = B.call(Function.call, RegExp.prototype.exec),
|
||||||
|
D = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,
|
||||||
|
R = /\\(\\)?/g,
|
||||||
|
N = function(t, e) {
|
||||||
|
var r, n = t;
|
||||||
|
if (A(O, n) && (n = "%" + (r = O[n])[0] + "%"), A(b, n)) {
|
||||||
|
var i = b[n];
|
||||||
|
if (i === S && (i = w(n)), void 0 === i && !e) throw new u("intrinsic " + t + " exists, but is not available. Please file an issue!");
|
||||||
|
return {
|
||||||
|
alias: r,
|
||||||
|
name: n,
|
||||||
|
value: i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new f("intrinsic " + t + " does not exist!")
|
||||||
|
};
|
||||||
|
t.exports = function(t, e) {
|
||||||
|
if ("string" != typeof t || 0 === t.length) throw new u("intrinsic name must be a non-empty string");
|
||||||
|
if (arguments.length > 1 && "boolean" != typeof e) throw new u('"allowMissing" argument must be a boolean');
|
||||||
|
if (null === k(/^%?[^%]*%?$/, t)) throw new f("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
|
||||||
|
var r = function(t) {
|
||||||
|
var e = I(t, 0, 1),
|
||||||
|
r = I(t, -1);
|
||||||
|
if ("%" === e && "%" !== r) throw new f("invalid intrinsic syntax, expected closing `%`");
|
||||||
|
if ("%" === r && "%" !== e) throw new f("invalid intrinsic syntax, expected opening `%`");
|
||||||
|
var n = [];
|
||||||
|
return T(t, D, (function(t, e, r, i) {
|
||||||
|
n[n.length] = r ? T(i, R, "$1") : e || t
|
||||||
|
})), n
|
||||||
|
}(t),
|
||||||
|
n = r.length > 0 ? r[0] : "",
|
||||||
|
i = N("%" + n + "%", e),
|
||||||
|
o = i.name,
|
||||||
|
s = i.value,
|
||||||
|
a = !1,
|
||||||
|
c = i.alias;
|
||||||
|
c && (n = c[0], P(r, x([0, 1], c)));
|
||||||
|
for (var h = 1, p = !0; h < r.length; h += 1) {
|
||||||
|
var y = r[h],
|
||||||
|
g = I(y, 0, 1),
|
||||||
|
d = I(y, -1);
|
||||||
|
if (('"' === g || "'" === g || "`" === g || '"' === d || "'" === d || "`" === d) && g !== d) throw new f("property names with quotes must have matching quotes");
|
||||||
|
if ("constructor" !== y && p || (a = !0), A(b, o = "%" + (n += "." + y) + "%")) s = b[o];
|
||||||
|
else if (null != s) {
|
||||||
|
if (!(y in s)) {
|
||||||
|
if (!e) throw new u("base intrinsic for " + t + " exists, but the property is not available.");
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (l && h + 1 >= r.length) {
|
||||||
|
var v = l(s, y);
|
||||||
|
s = (p = !!v) && "get" in v && !("originalValue" in v.get) ? v.get : s[y]
|
||||||
|
} else p = A(s, y), s = s[y];
|
||||||
|
p && !a && (b[o] = s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
},
|
||||||
|
5795: (t, e, r) => {
|
||||||
|
"use strict";
|
||||||
|
var n = r(453)("%Object.getOwnPropertyDescriptor%", !0);
|
||||||
|
if (n) try {
|
||||||
|
n([], "length")
|
||||||
|
} catch (t) {
|
||||||
|
n = null
|
||||||
|
}
|
||||||
|
t.exports = n
|
||||||
|
},
|
||||||
|
592: (t, e, r) => {
|
||||||
|
"use strict";
|
||||||
|
var n = r(655),
|
||||||
|
i = function() {
|
||||||
|
return !!n
|
||||||
|
};
|
||||||
|
i.hasArrayLengthDefineBug = function() {
|
||||||
|
if (!n) return null;
|
||||||
|
try {
|
||||||
|
return 1 !== n([], "length", {
|
||||||
|
value: 1
|
||||||
|
}).length
|
||||||
|
} catch (t) {
|
||||||
|
return !0
|
||||||
|
}
|
||||||
|
}, t.exports = i
|
||||||
|
},
|
||||||
|
24: t => {
|
||||||
|
"use strict";
|
||||||
|
var e = {
|
||||||
|
__proto__: null,
|
||||||
|
foo: {}
|
||||||
|
},
|
||||||
|
r = Object;
|
||||||
|
t.exports = function() {
|
||||||
|
return {
|
||||||
|
__proto__: e
|
||||||
|
}.foo === e.foo && !(e instanceof r)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
4039: (t, e, r) => {
|
||||||
|
"use strict";
|
||||||
|
var n = "undefined" != typeof Symbol && Symbol,
|
||||||
|
i = r(1333);
|
||||||
|
t.exports = function() {
|
||||||
|
return "function" == typeof n && "function" == typeof Symbol && "symbol" == typeof n("foo") && "symbol" == typeof Symbol("bar") && i()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
1333: t => {
|
||||||
|
"use strict";
|
||||||
|
t.exports = function() {
|
||||||
|
if ("function" != typeof Symbol || "function" != typeof Object.getOwnPropertySymbols) return !1;
|
||||||
|
if ("symbol" == typeof Symbol.iterator) return !0;
|
||||||
|
var t = {},
|
||||||
|
e = Symbol("test"),
|
||||||
|
r = Object(e);
|
||||||
|
if ("string" == typeof e) return !1;
|
||||||
|
if ("[object Symbol]" !== Object.prototype.toString.call(e)) return !1;
|
||||||
|
if ("[object Symbol]" !== Object.prototype.toString.call(r)) return !1;
|
||||||
|
for (e in t[e] = 42, t) return !1;
|
||||||
|
if ("function" == typeof Object.keys && 0 !== Object.keys(t).length) return !1;
|
||||||
|
if ("function" == typeof Object.getOwnPropertyNames && 0 !== Object.getOwnPropertyNames(t).length) return !1;
|
||||||
|
var n = Object.getOwnPropertySymbols(t);
|
||||||
|
if (1 !== n.length || n[0] !== e) return !1;
|
||||||
|
if (!Object.prototype.propertyIsEnumerable.call(t, e)) return !1;
|
||||||
|
if ("function" == typeof Object.getOwnPropertyDescriptor) {
|
||||||
|
var i = Object.getOwnPropertyDescriptor(t, e);
|
||||||
|
if (42 !== i.value || !0 !== i.enumerable) return !1
|
||||||
|
}
|
||||||
|
return !0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
9957: (t, e, r) => {
|
||||||
|
"use strict";
|
||||||
|
var n = Function.prototype.call,
|
||||||
|
i = Object.prototype.hasOwnProperty,
|
||||||
|
o = r(6743);
|
||||||
|
t.exports = o.call(n, i)
|
||||||
|
},
|
||||||
|
251: (t, e) => {
|
||||||
|
e.read = function(t, e, r, n, i) {
|
||||||
|
var o, s, a = 8 * i - n - 1,
|
||||||
|
f = (1 << a) - 1,
|
||||||
|
u = f >> 1,
|
||||||
|
c = -7,
|
||||||
|
h = r ? i - 1 : 0,
|
||||||
|
p = r ? -1 : 1,
|
||||||
|
l = t[e + h];
|
||||||
|
for (h += p, o = l & (1 << -c) - 1, l >>= -c, c += a; c > 0; o = 256 * o + t[e + h], h += p, c -= 8);
|
||||||
|
for (s = o & (1 << -c) - 1, o >>= -c, c += n; c > 0; s = 256 * s + t[e + h], h += p, c -= 8);
|
||||||
|
if (0 === o) o = 1 - u;
|
||||||
|
else {
|
||||||
|
if (o === f) return s ? NaN : 1 / 0 * (l ? -1 : 1);
|
||||||
|
s += Math.pow(2, n), o -= u
|
||||||
|
}
|
||||||
|
return (l ? -1 : 1) * s * Math.pow(2, o - n)
|
||||||
|
}, e.write = function(t, e, r, n, i, o) {
|
||||||
|
var s, a, f, u = 8 * o - i - 1,
|
||||||
|
c = (1 << u) - 1,
|
||||||
|
h = c >> 1,
|
||||||
|
p = 23 === i ? Math.pow(2, -24) - Math.pow(2, -77) : 0,
|
||||||
|
l = n ? 0 : o - 1,
|
||||||
|
y = n ? 1 : -1,
|
||||||
|
g = e < 0 || 0 === e && 1 / e < 0 ? 1 : 0;
|
||||||
|
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (a = isNaN(e) ? 1 : 0, s = c) : (s = Math.floor(Math.log(e) / Math.LN2), e * (f = Math.pow(2, -s)) < 1 && (s--, f *= 2), (e += s + h >= 1 ? p / f : p * Math.pow(2, 1 - h)) * f >= 2 && (s++, f /= 2), s + h >= c ? (a = 0, s = c) : s + h >= 1 ? (a = (e * f - 1) * Math.pow(2, i), s += h) : (a = e * Math.pow(2, h - 1) * Math.pow(2, i), s = 0)); i >= 8; t[r + l] = 255 & a, l += y, a /= 256, i -= 8);
|
||||||
|
for (s = s << i | a, u += i; u > 0; t[r + l] = 255 & s, l += y, s /= 256, u -= 8);
|
||||||
|
t[r + l - y] |= 128 * g
|
||||||
|
}
|
||||||
|
},
|
||||||
|
3229: (t, e, r) => {
|
||||||
|
var n = r(8287).Buffer,
|
||||||
|
i = r(7449),
|
||||||
|
o = r(5682),
|
||||||
|
s = (r(3200), r(3100).Ber, r(8226)._),
|
||||||
|
a = r(8226),
|
||||||
|
f = r(1768),
|
||||||
|
u = r(7460);
|
||||||
|
void 0 === i.RSA_NO_PADDING && (i.RSA_NO_PADDING = 3), t.exports = function() {
|
||||||
|
var t = {
|
||||||
|
node10: ["md4", "md5", "ripemd160", "sha1", "sha224", "sha256", "sha384", "sha512"],
|
||||||
|
node: ["md4", "md5", "ripemd160", "sha1", "sha224", "sha256", "sha384", "sha512"],
|
||||||
|
iojs: ["md4", "md5", "ripemd160", "sha1", "sha224", "sha256", "sha384", "sha512"],
|
||||||
|
browser: ["md5", "ripemd160", "sha1", "sha256", "sha512"]
|
||||||
|
},
|
||||||
|
e = "pkcs1_oaep",
|
||||||
|
r = "pkcs1",
|
||||||
|
i = {
|
||||||
|
private: "pkcs1-private-pem",
|
||||||
|
"private-der": "pkcs1-private-der",
|
||||||
|
public: "pkcs8-public-pem",
|
||||||
|
"public-der": "pkcs8-public-der"
|
||||||
|
};
|
||||||
|
|
||||||
|
function c(t, i, f) {
|
||||||
|
if (!(this instanceof c)) return new c(t, i, f);
|
||||||
|
s.isObject(i) && (f = i, i = void 0), this.$options = {
|
||||||
|
signingScheme: r,
|
||||||
|
signingSchemeOptions: {
|
||||||
|
hash: "sha256",
|
||||||
|
saltLength: null
|
||||||
|
},
|
||||||
|
encryptionScheme: e,
|
||||||
|
encryptionSchemeOptions: {
|
||||||
|
hash: "sha1",
|
||||||
|
label: null
|
||||||
|
},
|
||||||
|
environment: a.detectEnvironment(),
|
||||||
|
rsaUtils: this
|
||||||
|
}, this.keyPair = new o.Key, this.$cache = {}, n.isBuffer(t) || s.isString(t) ? this.importKey(t, i) : s.isObject(t) && this.generateKeyPair(t.b, t.e), this.setOptions(f)
|
||||||
|
}
|
||||||
|
return c.prototype.setOptions = function(n) {
|
||||||
|
if ((n = n || {}).environment && (this.$options.environment = n.environment), n.signingScheme) {
|
||||||
|
if (s.isString(n.signingScheme)) {
|
||||||
|
var i = n.signingScheme.toLowerCase().split("-");
|
||||||
|
1 == i.length ? t.node.indexOf(i[0]) > -1 ? (this.$options.signingSchemeOptions = {
|
||||||
|
hash: i[0]
|
||||||
|
}, this.$options.signingScheme = r) : (this.$options.signingScheme = i[0], this.$options.signingSchemeOptions = {
|
||||||
|
hash: null
|
||||||
|
}) : (this.$options.signingSchemeOptions = {
|
||||||
|
hash: i[1]
|
||||||
|
}, this.$options.signingScheme = i[0])
|
||||||
|
} else s.isObject(n.signingScheme) && (this.$options.signingScheme = n.signingScheme.scheme || r, this.$options.signingSchemeOptions = s.omit(n.signingScheme, "scheme"));
|
||||||
|
if (!f.isSignature(this.$options.signingScheme)) throw Error("Unsupported signing scheme");
|
||||||
|
if (this.$options.signingSchemeOptions.hash && -1 === t[this.$options.environment].indexOf(this.$options.signingSchemeOptions.hash)) throw Error("Unsupported hashing algorithm for " + this.$options.environment + " environment")
|
||||||
|
}
|
||||||
|
if (n.encryptionScheme) {
|
||||||
|
if (s.isString(n.encryptionScheme) ? (this.$options.encryptionScheme = n.encryptionScheme.toLowerCase(), this.$options.encryptionSchemeOptions = {}) : s.isObject(n.encryptionScheme) && (this.$options.encryptionScheme = n.encryptionScheme.scheme || e, this.$options.encryptionSchemeOptions = s.omit(n.encryptionScheme, "scheme")), !f.isEncryption(this.$options.encryptionScheme)) throw Error("Unsupported encryption scheme");
|
||||||
|
if (this.$options.encryptionSchemeOptions.hash && -1 === t[this.$options.environment].indexOf(this.$options.encryptionSchemeOptions.hash)) throw Error("Unsupported hashing algorithm for " + this.$options.environment + " environment")
|
||||||
|
}
|
||||||
|
this.keyPair.setOptions(this.$options)
|
||||||
|
}, c.prototype.generateKeyPair = function(t, e) {
|
||||||
|
if (e = e || 65537, (t = t || 2048) % 8 != 0) throw Error("Key size must be a multiple of 8.");
|
||||||
|
return this.keyPair.generate(t, e.toString(16)), this.$cache = {}, this
|
||||||
|
}, c.prototype.importKey = function(t, e) {
|
||||||
|
if (!t) throw Error("Empty key given");
|
||||||
|
if (e && (e = i[e] || e), !u.detectAndImport(this.keyPair, t, e) && void 0 === e) throw Error("Key format must be specified");
|
||||||
|
return this.$cache = {}, this
|
||||||
|
}, c.prototype.exportKey = function(t) {
|
||||||
|
return t = i[t = t || "private"] || t, this.$cache[t] || (this.$cache[t] = u.detectAndExport(this.keyPair, t)), this.$cache[t]
|
||||||
|
}, c.prototype.isPrivate = function() {
|
||||||
|
return this.keyPair.isPrivate()
|
||||||
|
}, c.prototype.isPublic = function(t) {
|
||||||
|
return this.keyPair.isPublic(t)
|
||||||
|
}, c.prototype.isEmpty = function(t) {
|
||||||
|
return !(this.keyPair.n || this.keyPair.e || this.keyPair.d)
|
||||||
|
}, c.prototype.encrypt = function(t, e, r) {
|
||||||
|
return this.$$encryptKey(!1, t, e, r)
|
||||||
|
}, c.prototype.decrypt = function(t, e) {
|
||||||
|
return this.$$decryptKey(!1, t, e)
|
||||||
|
}, c.prototype.encryptPrivate = function(t, e, r) {
|
||||||
|
return this.$$encryptKey(!0, t, e, r)
|
||||||
|
}, c.prototype.decryptPublic = function(t, e) {
|
||||||
|
return this.$$decryptKey(!0, t, e)
|
||||||
|
}, c.prototype.$$encryptKey = function(t, e, r, n) {
|
||||||
|
try {
|
||||||
|
var i = this.keyPair.encrypt(this.$getDataForEncrypt(e, n), t);
|
||||||
|
return "buffer" != r && r ? i.toString(r) : i
|
||||||
|
} catch (t) {
|
||||||
|
throw Error("Error during encryption. Original error: " + t)
|
||||||
|
}
|
||||||
|
}, c.prototype.$$decryptKey = function(t, e, r) {
|
||||||
|
try {
|
||||||
|
e = s.isString(e) ? n.from(e, "base64") : e;
|
||||||
|
var i = this.keyPair.decrypt(e, t);
|
||||||
|
if (null === i) throw Error("Key decrypt method returns null.");
|
||||||
|
return this.$getDecryptedData(i, r)
|
||||||
|
} catch (t) {
|
||||||
|
throw Error("Error during decryption (probably incorrect key). Original error: " + t)
|
||||||
|
}
|
||||||
|
}, c.prototype.sign = function(t, e, r) {
|
||||||
|
if (!this.isPrivate()) throw Error("This is not private key");
|
||||||
|
var n = this.keyPair.sign(this.$getDataForEncrypt(t, r));
|
||||||
|
return e && "buffer" != e && (n = n.toString(e)), n
|
||||||
|
}, c.prototype.verify = function(t, e, r, n) {
|
||||||
|
if (!this.isPublic()) throw Error("This is not public key");
|
||||||
|
return n = n && "buffer" != n ? n : null, this.keyPair.verify(this.$getDataForEncrypt(t, r), e, n)
|
||||||
|
}, c.prototype.getKeySize = function() {
|
||||||
|
return this.keyPair.keySize
|
||||||
|
}, c.prototype.getMaxMessageSize = function() {
|
||||||
|
return this.keyPair.maxMessageLength
|
||||||
|
}, c.prototype.$getDataForEncrypt = function(t, e) {
|
||||||
|
if (s.isString(t) || s.isNumber(t)) return n.from("" + t, e || "utf8");
|
||||||
|
if (n.isBuffer(t)) return t;
|
||||||
|
if (s.isObject(t)) return n.from(JSON.stringify(t));
|
||||||
|
throw Error("Unexpected data type")
|
||||||
|
}, c.prototype.$getDecryptedData = function(t, e) {
|
||||||
|
return "buffer" == (e = e || "buffer") ? t : "json" == e ? JSON.parse(t.toString()) : t.toString(e)
|
||||||
|
}, c
|
||||||
|
}()
|
||||||
|
},
|
||||||
|
4538: (t, e, r) => {
|
||||||
|
var n = r(3200);
|
||||||
|
t.exports = {
|
||||||
|
getEngine: function(t, e) {
|
||||||
|
var i = r(7469);
|
||||||
|
return "node" === e.environment && "function" == typeof n.publicEncrypt && "function" == typeof n.privateDecrypt && (i = "function" == typeof n.privateEncrypt && "function" == typeof n.publicDecrypt ? r(2418) : r(1957)), i(t, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
2418: (t, e, r) => {
|
||||||
|
var n = r(3200),
|
||||||
|
i = r(7449),
|
||||||
|
o = r(1768);
|
||||||
|
t.exports = function(t, e) {
|
||||||
|
var r = o.pkcs1.makeScheme(t, e);
|
||||||
|
return {
|
||||||
|
encrypt: function(t, o) {
|
||||||
|
var s;
|
||||||
|
if (o) return s = i.RSA_PKCS1_PADDING, e.encryptionSchemeOptions && e.encryptionSchemeOptions.padding && (s = e.encryptionSchemeOptions.padding), n.privateEncrypt({
|
||||||
|
key: e.rsaUtils.exportKey("private"),
|
||||||
|
padding: s
|
||||||
|
}, t);
|
||||||
|
s = i.RSA_PKCS1_OAEP_PADDING, "pkcs1" === e.encryptionScheme && (s = i.RSA_PKCS1_PADDING), e.encryptionSchemeOptions && e.encryptionSchemeOptions.padding && (s = e.encryptionSchemeOptions.padding);
|
||||||
|
var a = t;
|
||||||
|
return s === i.RSA_NO_PADDING && (a = r.pkcs0pad(t)), n.publicEncrypt({
|
||||||
|
key: e.rsaUtils.exportKey("public"),
|
||||||
|
padding: s
|
||||||
|
}, a)
|
||||||
|
},
|
||||||
|
decrypt: function(t, o) {
|
||||||
|
var s;
|
||||||
|
if (o) return s = i.RSA_PKCS1_PADDING, e.encryptionSchemeOptions && e.encryptionSchemeOptions.padding && (s = e.encryptionSchemeOptions.padding), n.publicDecrypt({
|
||||||
|
key: e.rsaUtils.exportKey("public"),
|
||||||
|
padding: s
|
||||||
|
}, t);
|
||||||
|
s = i.RSA_PKCS1_OAEP_PADDING, "pkcs1" === e.encryptionScheme && (s = i.RSA_PKCS1_PADDING), e.encryptionSchemeOptions && e.encryptionSchemeOptions.padding && (s = e.encryptionSchemeOptions.padding);
|
||||||
|
var a = n.privateDecrypt({
|
||||||
|
key: e.rsaUtils.exportKey("private"),
|
||||||
|
padding: s
|
||||||
|
}, t);
|
||||||
|
return s === i.RSA_NO_PADDING ? r.pkcs0unpad(a) : a
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
7469: (t, e, r) => {
|
||||||
|
var n = r(1973),
|
||||||
|
i = r(1768);
|
||||||
|
t.exports = function(t, e) {
|
||||||
|
var r = i.pkcs1.makeScheme(t, e);
|
||||||
|
return {
|
||||||
|
encrypt: function(e, i) {
|
||||||
|
var o, s;
|
||||||
|
return i ? (o = new n(r.encPad(e, {
|
||||||
|
type: 1
|
||||||
|
})), s = t.$doPrivate(o)) : (o = new n(t.encryptionScheme.encPad(e)), s = t.$doPublic(o)), s.toBuffer(t.encryptedDataLength)
|
||||||
|
},
|
||||||
|
decrypt: function(e, i) {
|
||||||
|
var o, s = new n(e);
|
||||||
|
return i ? (o = t.$doPublic(s), r.encUnPad(o.toBuffer(t.encryptedDataLength), {
|
||||||
|
type: 1
|
||||||
|
})) : (o = t.$doPrivate(s), t.encryptionScheme.encUnPad(o.toBuffer(t.encryptedDataLength)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
1957: (t, e, r) => {
|
||||||
|
var n = r(3200),
|
||||||
|
i = r(7449),
|
||||||
|
o = r(1768);
|
||||||
|
t.exports = function(t, e) {
|
||||||
|
var s = r(7469)(t, e),
|
||||||
|
a = o.pkcs1.makeScheme(t, e);
|
||||||
|
return {
|
||||||
|
encrypt: function(t, r) {
|
||||||
|
if (r) return s.encrypt(t, r);
|
||||||
|
var o = i.RSA_PKCS1_OAEP_PADDING;
|
||||||
|
"pkcs1" === e.encryptionScheme && (o = i.RSA_PKCS1_PADDING), e.encryptionSchemeOptions && e.encryptionSchemeOptions.padding && (o = e.encryptionSchemeOptions.padding);
|
||||||
|
var f = t;
|
||||||
|
return o === i.RSA_NO_PADDING && (f = a.pkcs0pad(t)), n.publicEncrypt({
|
||||||
|
key: e.rsaUtils.exportKey("public"),
|
||||||
|
padding: o
|
||||||
|
}, f)
|
||||||
|
},
|
||||||
|
decrypt: function(t, r) {
|
||||||
|
if (r) return s.decrypt(t, r);
|
||||||
|
var o = i.RSA_PKCS1_OAEP_PADDING;
|
||||||
|
"pkcs1" === e.encryptionScheme && (o = i.RSA_PKCS1_PADDING), e.encryptionSchemeOptions && e.encryptionSchemeOptions.padding && (o = e.encryptionSchemeOptions.padding);
|
||||||
|
var f = n.privateDecrypt({
|
||||||
|
key: e.rsaUtils.exportKey("private"),
|
||||||
|
padding: o
|
||||||
|
}, t);
|
||||||
|
return o === i.RSA_NO_PADDING ? a.pkcs0unpad(f) : f
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
3374: (t, e, r) => {
|
||||||
|
r(8226)._, r(8226), t.exports = {
|
||||||
|
privateExport: function(t, e) {
|
||||||
|
return {
|
||||||
|
n: t.n.toBuffer(),
|
||||||
|
e: t.e,
|
||||||
|
d: t.d.toBuffer(),
|
||||||
|
p: t.p.toBuffer(),
|
||||||
|
q: t.q.toBuffer(),
|
||||||
|
dmp1: t.dmp1.toBuffer(),
|
||||||
|
dmq1: t.dmq1.toBuffer(),
|
||||||
|
coeff: t.coeff.toBuffer()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
privateImport: function(t, e, r) {
|
||||||
|
if (!(e.n && e.e && e.d && e.p && e.q && e.dmp1 && e.dmq1 && e.coeff)) throw Error("Invalid key data");
|
||||||
|
t.setPrivate(e.n, e.e, e.d, e.p, e.q, e.dmp1, e.dmq1, e.coeff)
|
||||||
|
},
|
||||||
|
publicExport: function(t, e) {
|
||||||
|
return {
|
||||||
|
n: t.n.toBuffer(),
|
||||||
|
e: t.e
|
||||||
|
}
|
||||||
|
},
|
||||||
|
publicImport: function(t, e, r) {
|
||||||
|
if (!e.n || !e.e) throw Error("Invalid key data");
|
||||||
|
t.setPublic(e.n, e.e)
|
||||||
|
},
|
||||||
|
autoImport: function(e, r) {
|
||||||
|
return !(!r.n || !r.e || (r.d && r.p && r.q && r.dmp1 && r.dmq1 && r.coeff ? (t.exports.privateImport(e, r), 0) : (t.exports.publicImport(e, r), 0)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
7460: (t, e, r) => {
|
||||||
|
function n(t) {
|
||||||
|
t = t.split("-");
|
||||||
|
for (var e = "private", r = {
|
||||||
|
type: "default"
|
||||||
|
}, n = 1; n < t.length; n++)
|
||||||
|
if (t[n]) switch (t[n]) {
|
||||||
|
case "public":
|
||||||
|
case "private":
|
||||||
|
e = t[n];
|
||||||
|
break;
|
||||||
|
case "pem":
|
||||||
|
case "der":
|
||||||
|
r.type = t[n]
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
scheme: t[0],
|
||||||
|
keyType: e,
|
||||||
|
keyOpt: r
|
||||||
|
}
|
||||||
|
}
|
||||||
|
r(8226)._, t.exports = {
|
||||||
|
pkcs1: r(6566),
|
||||||
|
pkcs8: r(8573),
|
||||||
|
components: r(3374),
|
||||||
|
openssh: r(3194),
|
||||||
|
isPrivateExport: function(e) {
|
||||||
|
return t.exports[e] && "function" == typeof t.exports[e].privateExport
|
||||||
|
},
|
||||||
|
isPrivateImport: function(e) {
|
||||||
|
return t.exports[e] && "function" == typeof t.exports[e].privateImport
|
||||||
|
},
|
||||||
|
isPublicExport: function(e) {
|
||||||
|
return t.exports[e] && "function" == typeof t.exports[e].publicExport
|
||||||
|
},
|
||||||
|
isPublicImport: function(e) {
|
||||||
|
return t.exports[e] && "function" == typeof t.exports[e].publicImport
|
||||||
|
},
|
||||||
|
detectAndImport: function(e, r, i) {
|
||||||
|
if (void 0 === i) {
|
||||||
|
for (var o in t.exports)
|
||||||
|
if ("function" == typeof t.exports[o].autoImport && t.exports[o].autoImport(e, r)) return !0
|
||||||
|
} else if (i) {
|
||||||
|
var s = n(i);
|
||||||
|
if (!t.exports[s.scheme]) throw Error("Unsupported key format");
|
||||||
|
"private" === s.keyType ? t.exports[s.scheme].privateImport(e, r, s.keyOpt) : t.exports[s.scheme].publicImport(e, r, s.keyOpt)
|
||||||
|
}
|
||||||
|
return !1
|
||||||
|
},
|
||||||
|
detectAndExport: function(e, r) {
|
||||||
|
if (r) {
|
||||||
|
var i = n(r);
|
||||||
|
if (t.exports[i.scheme]) {
|
||||||
|
if ("private" === i.keyType) {
|
||||||
|
if (!e.isPrivate()) throw Error("This is not private key");
|
||||||
|
return t.exports[i.scheme].privateExport(e, i.keyOpt)
|
||||||
|
}
|
||||||
|
if (!e.isPublic()) throw Error("This is not public key");
|
||||||
|
return t.exports[i.scheme].publicExport(e, i.keyOpt)
|
||||||
|
}
|
||||||
|
throw Error("Unsupported key format")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
3194: (t, e, r) => {
|
||||||
|
var n = r(8287).Buffer,
|
||||||
|
i = r(8226)._,
|
||||||
|
o = r(8226),
|
||||||
|
s = r(1973);
|
||||||
|
const a = "-----BEGIN OPENSSH PRIVATE KEY-----",
|
||||||
|
f = "-----END OPENSSH PRIVATE KEY-----";
|
||||||
|
|
||||||
|
function u(t) {
|
||||||
|
const e = t.buf.readInt32BE(t.off);
|
||||||
|
t.off += 4;
|
||||||
|
const r = t.buf.slice(t.off, t.off + e);
|
||||||
|
return t.off += e, r
|
||||||
|
}
|
||||||
|
|
||||||
|
function c(t, e) {
|
||||||
|
t.buf.writeInt32BE(e.byteLength, t.off), t.off += 4, t.off += e.copy(t.buf, t.off)
|
||||||
|
}
|
||||||
|
t.exports = {
|
||||||
|
privateExport: function(t, e) {
|
||||||
|
const r = t.n.toBuffer();
|
||||||
|
let i = n.alloc(4);
|
||||||
|
for (i.writeUInt32BE(t.e, 0); 0 === i[0];) i = i.slice(1);
|
||||||
|
const s = t.d.toBuffer(),
|
||||||
|
u = t.coeff.toBuffer(),
|
||||||
|
h = t.p.toBuffer(),
|
||||||
|
p = t.q.toBuffer();
|
||||||
|
let l;
|
||||||
|
l = void 0 !== t.sshcomment ? n.from(t.sshcomment) : n.from([]);
|
||||||
|
const y = 15 + i.byteLength + 4 + r.byteLength,
|
||||||
|
g = 23 + r.byteLength + 4 + i.byteLength + 4 + s.byteLength + 4 + u.byteLength + 4 + h.byteLength + 4 + p.byteLength + 4 + l.byteLength;
|
||||||
|
let d = 43 + y + 4 + g;
|
||||||
|
d += 8 * Math.ceil(g / 8) - g;
|
||||||
|
const v = n.alloc(d),
|
||||||
|
m = {
|
||||||
|
buf: v,
|
||||||
|
off: 0
|
||||||
|
};
|
||||||
|
v.write("openssh-key-v1", "utf8"), v.writeUInt8(0, 14), m.off += 15, c(m, n.from("none")), c(m, n.from("none")), c(m, n.from("")), m.off = m.buf.writeUInt32BE(1, m.off), m.off = m.buf.writeUInt32BE(y, m.off), c(m, n.from("ssh-rsa")), c(m, i), c(m, r), m.off = m.buf.writeUInt32BE(d - 47 - y, m.off), m.off += 8, c(m, n.from("ssh-rsa")), c(m, r), c(m, i), c(m, s), c(m, u), c(m, h), c(m, p), c(m, l);
|
||||||
|
let S = 1;
|
||||||
|
for (; m.off < d;) m.off = m.buf.writeUInt8(S++, m.off);
|
||||||
|
return "der" === e.type ? m.buf : a + "\n" + o.linebrk(v.toString("base64"), 70) + "\n" + f + "\n"
|
||||||
|
},
|
||||||
|
privateImport: function(t, e, r) {
|
||||||
|
var c;
|
||||||
|
if ("der" !== (r = r || {}).type) {
|
||||||
|
if (n.isBuffer(e) && (e = e.toString("utf8")), !i.isString(e)) throw Error("Unsupported key format");
|
||||||
|
var h = o.trimSurroundingText(e, a, f).replace(/\s+|\n\r|\n|\r$/gm, "");
|
||||||
|
c = n.from(h, "base64")
|
||||||
|
} else {
|
||||||
|
if (!n.isBuffer(e)) throw Error("Unsupported key format");
|
||||||
|
c = e
|
||||||
|
}
|
||||||
|
const p = {
|
||||||
|
buf: c,
|
||||||
|
off: 0
|
||||||
|
};
|
||||||
|
if ("openssh-key-v1" !== c.slice(0, 14).toString("ascii")) throw "Invalid file format.";
|
||||||
|
if (p.off += 15, "none" !== u(p).toString("ascii")) throw Error("Unsupported key type");
|
||||||
|
if ("none" !== u(p).toString("ascii")) throw Error("Unsupported key type");
|
||||||
|
if ("" !== u(p).toString("ascii")) throw Error("Unsupported key type");
|
||||||
|
if (p.off += 4, p.off += 4, "ssh-rsa" !== u(p).toString("ascii")) throw Error("Unsupported key type");
|
||||||
|
if (u(p), u(p), p.off += 12, "ssh-rsa" !== u(p).toString("ascii")) throw Error("Unsupported key type");
|
||||||
|
const l = u(p),
|
||||||
|
y = u(p),
|
||||||
|
g = u(p),
|
||||||
|
d = u(p),
|
||||||
|
v = u(p),
|
||||||
|
m = u(p),
|
||||||
|
S = new s(g),
|
||||||
|
_ = new s(m),
|
||||||
|
b = new s(v),
|
||||||
|
E = S.mod(b.subtract(s.ONE)),
|
||||||
|
w = S.mod(_.subtract(s.ONE));
|
||||||
|
t.setPrivate(l, y, g, v, m, E.toBuffer(), w.toBuffer(), d), t.sshcomment = u(p).toString("ascii")
|
||||||
|
},
|
||||||
|
publicExport: function(t, e) {
|
||||||
|
let r = n.alloc(4);
|
||||||
|
for (r.writeUInt32BE(t.e, 0); 0 === r[0];) r = r.slice(1);
|
||||||
|
const i = t.n.toBuffer(),
|
||||||
|
o = n.alloc(r.byteLength + 4 + i.byteLength + 4 + 7 + 4),
|
||||||
|
s = {
|
||||||
|
buf: o,
|
||||||
|
off: 0
|
||||||
|
};
|
||||||
|
c(s, n.from("ssh-rsa")), c(s, r), c(s, i);
|
||||||
|
let a = t.sshcomment || "";
|
||||||
|
return "der" === e.type ? s.buf : "ssh-rsa " + o.toString("base64") + " " + a + "\n"
|
||||||
|
},
|
||||||
|
publicImport: function(t, e, r) {
|
||||||
|
var o;
|
||||||
|
if ("der" !== (r = r || {}).type) {
|
||||||
|
if (n.isBuffer(e) && (e = e.toString("utf8")), !i.isString(e)) throw Error("Unsupported key format");
|
||||||
|
{
|
||||||
|
if ("ssh-rsa " !== e.substring(0, 8)) throw Error("Unsupported key format");
|
||||||
|
let r = e.indexOf(" ", 8); - 1 === r ? r = e.length : t.sshcomment = e.substring(r + 1).replace(/\s+|\n\r|\n|\r$/gm, "");
|
||||||
|
const i = e.substring(8, r).replace(/\s+|\n\r|\n|\r$/gm, "");
|
||||||
|
o = n.from(i, "base64")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!n.isBuffer(e)) throw Error("Unsupported key format");
|
||||||
|
o = e
|
||||||
|
}
|
||||||
|
const s = {
|
||||||
|
buf: o,
|
||||||
|
off: 0
|
||||||
|
},
|
||||||
|
a = u(s).toString("ascii");
|
||||||
|
if ("ssh-rsa" !== a) throw Error("Invalid key type: " + a);
|
||||||
|
const f = u(s),
|
||||||
|
c = u(s);
|
||||||
|
t.setPublic(c, f)
|
||||||
|
},
|
||||||
|
autoImport: function(e, r) {
|
||||||
|
return /^[\S\s]*-----BEGIN OPENSSH PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END OPENSSH PRIVATE KEY-----[\S\s]*$/g.test(r) ? (t.exports.privateImport(e, r), !0) : !!/^[\S\s]*ssh-rsa \s*(?=(([A-Za-z0-9+/=]+\s*)+))\1[\S\s]*$/g.test(r) && (t.exports.publicImport(e, r), !0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
6566: (t, e, r) => {
|
||||||
|
var n = r(8287).Buffer,
|
||||||
|
i = r(3100).Ber,
|
||||||
|
o = r(8226)._,
|
||||||
|
s = r(8226);
|
||||||
|
const a = "-----BEGIN RSA PRIVATE KEY-----",
|
||||||
|
f = "-----END RSA PRIVATE KEY-----",
|
||||||
|
u = "-----BEGIN RSA PUBLIC KEY-----",
|
||||||
|
c = "-----END RSA PUBLIC KEY-----";
|
||||||
|
t.exports = {
|
||||||
|
privateExport: function(t, e) {
|
||||||
|
e = e || {};
|
||||||
|
var r = t.n.toBuffer(),
|
||||||
|
n = t.d.toBuffer(),
|
||||||
|
o = t.p.toBuffer(),
|
||||||
|
u = t.q.toBuffer(),
|
||||||
|
c = t.dmp1.toBuffer(),
|
||||||
|
h = t.dmq1.toBuffer(),
|
||||||
|
p = t.coeff.toBuffer(),
|
||||||
|
l = r.length + n.length + o.length + u.length + c.length + h.length + p.length + 512,
|
||||||
|
y = new i.Writer({
|
||||||
|
size: l
|
||||||
|
});
|
||||||
|
return y.startSequence(), y.writeInt(0), y.writeBuffer(r, 2), y.writeInt(t.e), y.writeBuffer(n, 2), y.writeBuffer(o, 2), y.writeBuffer(u, 2), y.writeBuffer(c, 2), y.writeBuffer(h, 2), y.writeBuffer(p, 2), y.endSequence(), "der" === e.type ? y.buffer : a + "\n" + s.linebrk(y.buffer.toString("base64"), 64) + "\n" + f
|
||||||
|
},
|
||||||
|
privateImport: function(t, e, r) {
|
||||||
|
var u;
|
||||||
|
if ("der" !== (r = r || {}).type) {
|
||||||
|
if (n.isBuffer(e) && (e = e.toString("utf8")), !o.isString(e)) throw Error("Unsupported key format");
|
||||||
|
var c = s.trimSurroundingText(e, a, f).replace(/\s+|\n\r|\n|\r$/gm, "");
|
||||||
|
u = n.from(c, "base64")
|
||||||
|
} else {
|
||||||
|
if (!n.isBuffer(e)) throw Error("Unsupported key format");
|
||||||
|
u = e
|
||||||
|
}
|
||||||
|
var h = new i.Reader(u);
|
||||||
|
h.readSequence(), h.readString(2, !0), t.setPrivate(h.readString(2, !0), h.readString(2, !0), h.readString(2, !0), h.readString(2, !0), h.readString(2, !0), h.readString(2, !0), h.readString(2, !0), h.readString(2, !0))
|
||||||
|
},
|
||||||
|
publicExport: function(t, e) {
|
||||||
|
e = e || {};
|
||||||
|
var r = t.n.toBuffer(),
|
||||||
|
n = r.length + 512,
|
||||||
|
o = new i.Writer({
|
||||||
|
size: n
|
||||||
|
});
|
||||||
|
return o.startSequence(), o.writeBuffer(r, 2), o.writeInt(t.e), o.endSequence(), "der" === e.type ? o.buffer : u + "\n" + s.linebrk(o.buffer.toString("base64"), 64) + "\n" + c
|
||||||
|
},
|
||||||
|
publicImport: function(t, e, r) {
|
||||||
|
var a;
|
||||||
|
if ("der" !== (r = r || {}).type) {
|
||||||
|
if (n.isBuffer(e) && (e = e.toString("utf8")), o.isString(e)) {
|
||||||
|
var f = s.trimSurroundingText(e, u, c).replace(/\s+|\n\r|\n|\r$/gm, "");
|
||||||
|
a = n.from(f, "base64")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!n.isBuffer(e)) throw Error("Unsupported key format");
|
||||||
|
a = e
|
||||||
|
}
|
||||||
|
var h = new i.Reader(a);
|
||||||
|
h.readSequence(), t.setPublic(h.readString(2, !0), h.readString(2, !0))
|
||||||
|
},
|
||||||
|
autoImport: function(e, r) {
|
||||||
|
return /^[\S\s]*-----BEGIN RSA PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END RSA PRIVATE KEY-----[\S\s]*$/g.test(r) ? (t.exports.privateImport(e, r), !0) : !!/^[\S\s]*-----BEGIN RSA PUBLIC KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END RSA PUBLIC KEY-----[\S\s]*$/g.test(r) && (t.exports.publicImport(e, r), !0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
8573: (t, e, r) => {
|
||||||
|
var n = r(8287).Buffer,
|
||||||
|
i = r(3100).Ber,
|
||||||
|
o = r(8226)._,
|
||||||
|
s = "1.2.840.113549.1.1.1",
|
||||||
|
a = r(8226);
|
||||||
|
const f = "-----BEGIN PRIVATE KEY-----",
|
||||||
|
u = "-----END PRIVATE KEY-----",
|
||||||
|
c = "-----BEGIN PUBLIC KEY-----",
|
||||||
|
h = "-----END PUBLIC KEY-----";
|
||||||
|
t.exports = {
|
||||||
|
privateExport: function(t, e) {
|
||||||
|
e = e || {};
|
||||||
|
var r = t.n.toBuffer(),
|
||||||
|
n = t.d.toBuffer(),
|
||||||
|
o = t.p.toBuffer(),
|
||||||
|
c = t.q.toBuffer(),
|
||||||
|
h = t.dmp1.toBuffer(),
|
||||||
|
p = t.dmq1.toBuffer(),
|
||||||
|
l = t.coeff.toBuffer(),
|
||||||
|
y = r.length + n.length + o.length + c.length + h.length + p.length + l.length + 512,
|
||||||
|
g = new i.Writer({
|
||||||
|
size: y
|
||||||
|
});
|
||||||
|
g.startSequence(), g.writeInt(0), g.writeBuffer(r, 2), g.writeInt(t.e), g.writeBuffer(n, 2), g.writeBuffer(o, 2), g.writeBuffer(c, 2), g.writeBuffer(h, 2), g.writeBuffer(p, 2), g.writeBuffer(l, 2), g.endSequence();
|
||||||
|
var d = new i.Writer({
|
||||||
|
size: y
|
||||||
|
});
|
||||||
|
return d.startSequence(), d.writeInt(0), d.startSequence(), d.writeOID(s), d.writeNull(), d.endSequence(), d.writeBuffer(g.buffer, 4), d.endSequence(), "der" === e.type ? d.buffer : f + "\n" + a.linebrk(d.buffer.toString("base64"), 64) + "\n" + u
|
||||||
|
},
|
||||||
|
privateImport: function(t, e, r) {
|
||||||
|
var c;
|
||||||
|
if ("der" !== (r = r || {}).type) {
|
||||||
|
if (n.isBuffer(e) && (e = e.toString("utf8")), !o.isString(e)) throw Error("Unsupported key format");
|
||||||
|
var h = a.trimSurroundingText(e, f, u).replace("-----END PRIVATE KEY-----", "").replace(/\s+|\n\r|\n|\r$/gm, "");
|
||||||
|
c = n.from(h, "base64")
|
||||||
|
} else {
|
||||||
|
if (!n.isBuffer(e)) throw Error("Unsupported key format");
|
||||||
|
c = e
|
||||||
|
}
|
||||||
|
var p = new i.Reader(c);
|
||||||
|
if (p.readSequence(), p.readInt(0), new i.Reader(p.readString(48, !0)).readOID(6, !0) !== s) throw Error("Invalid Public key format");
|
||||||
|
var l = new i.Reader(p.readString(4, !0));
|
||||||
|
l.readSequence(), l.readString(2, !0), t.setPrivate(l.readString(2, !0), l.readString(2, !0), l.readString(2, !0), l.readString(2, !0), l.readString(2, !0), l.readString(2, !0), l.readString(2, !0), l.readString(2, !0))
|
||||||
|
},
|
||||||
|
publicExport: function(t, e) {
|
||||||
|
e = e || {};
|
||||||
|
var r = t.n.toBuffer(),
|
||||||
|
n = r.length + 512,
|
||||||
|
o = new i.Writer({
|
||||||
|
size: n
|
||||||
|
});
|
||||||
|
o.writeByte(0), o.startSequence(), o.writeBuffer(r, 2), o.writeInt(t.e), o.endSequence();
|
||||||
|
var f = new i.Writer({
|
||||||
|
size: n
|
||||||
|
});
|
||||||
|
return f.startSequence(), f.startSequence(), f.writeOID(s), f.writeNull(), f.endSequence(), f.writeBuffer(o.buffer, 3), f.endSequence(), "der" === e.type ? f.buffer : c + "\n" + a.linebrk(f.buffer.toString("base64"), 64) + "\n" + h
|
||||||
|
},
|
||||||
|
publicImport: function(t, e, r) {
|
||||||
|
var f;
|
||||||
|
if ("der" !== (r = r || {}).type) {
|
||||||
|
if (n.isBuffer(e) && (e = e.toString("utf8")), o.isString(e)) {
|
||||||
|
var u = a.trimSurroundingText(e, c, h).replace(/\s+|\n\r|\n|\r$/gm, "");
|
||||||
|
f = n.from(u, "base64")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!n.isBuffer(e)) throw Error("Unsupported key format");
|
||||||
|
f = e
|
||||||
|
}
|
||||||
|
var p = new i.Reader(f);
|
||||||
|
if (p.readSequence(), new i.Reader(p.readString(48, !0)).readOID(6, !0) !== s) throw Error("Invalid Public key format");
|
||||||
|
var l = new i.Reader(p.readString(3, !0));
|
||||||
|
l.readByte(), l.readSequence(), t.setPublic(l.readString(2, !0), l.readString(2, !0))
|
||||||
|
},
|
||||||
|
autoImport: function(e, r) {
|
||||||
|
return /^[\S\s]*-----BEGIN PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END PRIVATE KEY-----[\S\s]*$/g.test(r) ? (t.exports.privateImport(e, r), !0) : !!/^[\S\s]*-----BEGIN PUBLIC KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END PUBLIC KEY-----[\S\s]*$/g.test(r) && (t.exports.publicImport(e, r), !0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
1973: (t, e, r) => {
|
||||||
|
var n = r(8287).Buffer,
|
||||||
|
i = r(3200),
|
||||||
|
o = r(8226)._;
|
||||||
|
|
||||||
|
function s(t, e) {
|
||||||
|
null != t && ("number" == typeof t ? this.fromNumber(t, e) : n.isBuffer(t) ? this.fromBuffer(t) : null == e && "string" != typeof t ? this.fromByteArray(t) : this.fromString(t, e))
|
||||||
|
}
|
||||||
|
|
||||||
|
function a() {
|
||||||
|
return new s(null)
|
||||||
|
}
|
||||||
|
s.prototype.am = function(t, e, r, n, i, o) {
|
||||||
|
for (var s = 16383 & e, a = e >> 14; --o >= 0;) {
|
||||||
|
var f = 16383 & this[t],
|
||||||
|
u = this[t++] >> 14,
|
||||||
|
c = a * f + u * s;
|
||||||
|
i = ((f = s * f + ((16383 & c) << 14) + r[n] + i) >> 28) + (c >> 14) + a * u, r[n++] = 268435455 & f
|
||||||
|
}
|
||||||
|
return i
|
||||||
|
}, s.prototype.DB = 28, s.prototype.DM = 268435455, s.prototype.DV = 1 << 28, s.prototype.FV = Math.pow(2, 52), s.prototype.F1 = 24, s.prototype.F2 = 4;
|
||||||
|
var f, u, c = new Array;
|
||||||
|
for (f = "0".charCodeAt(0), u = 0; u <= 9; ++u) c[f++] = u;
|
||||||
|
for (f = "a".charCodeAt(0), u = 10; u < 36; ++u) c[f++] = u;
|
||||||
|
for (f = "A".charCodeAt(0), u = 10; u < 36; ++u) c[f++] = u;
|
||||||
|
|
||||||
|
function h(t) {
|
||||||
|
return "0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
function p(t, e) {
|
||||||
|
var r = c[t.charCodeAt(e)];
|
||||||
|
return null == r ? -1 : r
|
||||||
|
}
|
||||||
|
|
||||||
|
function l(t) {
|
||||||
|
var e = a();
|
||||||
|
return e.fromInt(t), e
|
||||||
|
}
|
||||||
|
|
||||||
|
function y(t) {
|
||||||
|
var e, r = 1;
|
||||||
|
return 0 != (e = t >>> 16) && (t = e, r += 16), 0 != (e = t >> 8) && (t = e, r += 8), 0 != (e = t >> 4) && (t = e, r += 4), 0 != (e = t >> 2) && (t = e, r += 2), 0 != (e = t >> 1) && (t = e, r += 1), r
|
||||||
|
}
|
||||||
|
|
||||||
|
function g(t) {
|
||||||
|
this.m = t
|
||||||
|
}
|
||||||
|
|
||||||
|
function d(t) {
|
||||||
|
this.m = t, this.mp = t.invDigit(), this.mpl = 32767 & this.mp, this.mph = this.mp >> 15, this.um = (1 << t.DB - 15) - 1, this.mt2 = 2 * t.t
|
||||||
|
}
|
||||||
|
|
||||||
|
function v(t, e) {
|
||||||
|
return t & e
|
||||||
|
}
|
||||||
|
|
||||||
|
function m(t, e) {
|
||||||
|
return t | e
|
||||||
|
}
|
||||||
|
|
||||||
|
function S(t, e) {
|
||||||
|
return t ^ e
|
||||||
|
}
|
||||||
|
|
||||||
|
function _(t, e) {
|
||||||
|
return t & ~e
|
||||||
|
}
|
||||||
|
|
||||||
|
function b(t) {
|
||||||
|
if (0 === t) return -1;
|
||||||
|
var e = 0;
|
||||||
|
return 65535 & t || (t >>= 16, e += 16), 255 & t || (t >>= 8, e += 8), 15 & t || (t >>= 4, e += 4), 3 & t || (t >>= 2, e += 2), 1 & t || ++e, e
|
||||||
|
}
|
||||||
|
|
||||||
|
function E(t) {
|
||||||
|
for (var e = 0; 0 != t;) t &= t - 1, ++e;
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
|
||||||
|
function w() {}
|
||||||
|
|
||||||
|
function O(t) {
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
|
||||||
|
function B(t) {
|
||||||
|
this.r2 = a(), this.q3 = a(), s.ONE.dlShiftTo(2 * t.t, this.r2), this.mu = this.r2.divide(t), this.m = t
|
||||||
|
}
|
||||||
|
g.prototype.convert = function(t) {
|
||||||
|
return t.s < 0 || t.compareTo(this.m) >= 0 ? t.mod(this.m) : t
|
||||||
|
}, g.prototype.revert = function(t) {
|
||||||
|
return t
|
||||||
|
}, g.prototype.reduce = function(t) {
|
||||||
|
t.divRemTo(this.m, null, t)
|
||||||
|
}, g.prototype.mulTo = function(t, e, r) {
|
||||||
|
t.multiplyTo(e, r), this.reduce(r)
|
||||||
|
}, g.prototype.sqrTo = function(t, e) {
|
||||||
|
t.squareTo(e), this.reduce(e)
|
||||||
|
}, d.prototype.convert = function(t) {
|
||||||
|
var e = a();
|
||||||
|
return t.abs().dlShiftTo(this.m.t, e), e.divRemTo(this.m, null, e), t.s < 0 && e.compareTo(s.ZERO) > 0 && this.m.subTo(e, e), e
|
||||||
|
}, d.prototype.revert = function(t) {
|
||||||
|
var e = a();
|
||||||
|
return t.copyTo(e), this.reduce(e), e
|
||||||
|
}, d.prototype.reduce = function(t) {
|
||||||
|
for (; t.t <= this.mt2;) t[t.t++] = 0;
|
||||||
|
for (var e = 0; e < this.m.t; ++e) {
|
||||||
|
var r = 32767 & t[e],
|
||||||
|
n = r * this.mpl + ((r * this.mph + (t[e] >> 15) * this.mpl & this.um) << 15) & t.DM;
|
||||||
|
for (t[r = e + this.m.t] += this.m.am(0, n, t, e, 0, this.m.t); t[r] >= t.DV;) t[r] -= t.DV, t[++r]++
|
||||||
|
}
|
||||||
|
t.clamp(), t.drShiftTo(this.m.t, t), t.compareTo(this.m) >= 0 && t.subTo(this.m, t)
|
||||||
|
}, d.prototype.mulTo = function(t, e, r) {
|
||||||
|
t.multiplyTo(e, r), this.reduce(r)
|
||||||
|
}, d.prototype.sqrTo = function(t, e) {
|
||||||
|
t.squareTo(e), this.reduce(e)
|
||||||
|
}, w.prototype.convert = O, w.prototype.revert = O, w.prototype.mulTo = function(t, e, r) {
|
||||||
|
t.multiplyTo(e, r)
|
||||||
|
}, w.prototype.sqrTo = function(t, e) {
|
||||||
|
t.squareTo(e)
|
||||||
|
}, B.prototype.convert = function(t) {
|
||||||
|
if (t.s < 0 || t.t > 2 * this.m.t) return t.mod(this.m);
|
||||||
|
if (t.compareTo(this.m) < 0) return t;
|
||||||
|
var e = a();
|
||||||
|
return t.copyTo(e), this.reduce(e), e
|
||||||
|
}, B.prototype.revert = function(t) {
|
||||||
|
return t
|
||||||
|
}, B.prototype.reduce = function(t) {
|
||||||
|
for (t.drShiftTo(this.m.t - 1, this.r2), t.t > this.m.t + 1 && (t.t = this.m.t + 1, t.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); t.compareTo(this.r2) < 0;) t.dAddOffset(1, this.m.t + 1);
|
||||||
|
for (t.subTo(this.r2, t); t.compareTo(this.m) >= 0;) t.subTo(this.m, t)
|
||||||
|
}, B.prototype.mulTo = function(t, e, r) {
|
||||||
|
t.multiplyTo(e, r), this.reduce(r)
|
||||||
|
}, B.prototype.sqrTo = function(t, e) {
|
||||||
|
t.squareTo(e), this.reduce(e)
|
||||||
|
};
|
||||||
|
var A = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997],
|
||||||
|
x = (1 << 26) / A[A.length - 1];
|
||||||
|
s.prototype.copyTo = function(t) {
|
||||||
|
for (var e = this.t - 1; e >= 0; --e) t[e] = this[e];
|
||||||
|
t.t = this.t, t.s = this.s
|
||||||
|
}, s.prototype.fromInt = function(t) {
|
||||||
|
this.t = 1, this.s = t < 0 ? -1 : 0, t > 0 ? this[0] = t : t < -1 ? this[0] = t + DV : this.t = 0
|
||||||
|
}, s.prototype.fromString = function(t, e, r) {
|
||||||
|
var n;
|
||||||
|
switch (e) {
|
||||||
|
case 2:
|
||||||
|
n = 1;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
n = 2;
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
n = 3;
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
n = 4;
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
n = 5;
|
||||||
|
break;
|
||||||
|
case 256:
|
||||||
|
n = 8;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return void this.fromRadix(t, e)
|
||||||
|
}
|
||||||
|
this.t = 0, this.s = 0;
|
||||||
|
for (var i = t.length, o = !1, a = 0; --i >= 0;) {
|
||||||
|
var f = 8 == n ? 255 & t[i] : p(t, i);
|
||||||
|
f < 0 ? "-" == t.charAt(i) && (o = !0) : (o = !1, 0 === a ? this[this.t++] = f : a + n > this.DB ? (this[this.t - 1] |= (f & (1 << this.DB - a) - 1) << a, this[this.t++] = f >> this.DB - a) : this[this.t - 1] |= f << a, (a += n) >= this.DB && (a -= this.DB))
|
||||||
|
}!r && 8 == n && 128 & t[0] && (this.s = -1, a > 0 && (this[this.t - 1] |= (1 << this.DB - a) - 1 << a)), this.clamp(), o && s.ZERO.subTo(this, this)
|
||||||
|
}, s.prototype.fromByteArray = function(t, e) {
|
||||||
|
this.fromString(t, 256, e)
|
||||||
|
}, s.prototype.fromBuffer = function(t) {
|
||||||
|
this.fromString(t, 256, !0)
|
||||||
|
}, s.prototype.clamp = function() {
|
||||||
|
for (var t = this.s & this.DM; this.t > 0 && this[this.t - 1] == t;) --this.t
|
||||||
|
}, s.prototype.dlShiftTo = function(t, e) {
|
||||||
|
var r;
|
||||||
|
for (r = this.t - 1; r >= 0; --r) e[r + t] = this[r];
|
||||||
|
for (r = t - 1; r >= 0; --r) e[r] = 0;
|
||||||
|
e.t = this.t + t, e.s = this.s
|
||||||
|
}, s.prototype.drShiftTo = function(t, e) {
|
||||||
|
for (var r = t; r < this.t; ++r) e[r - t] = this[r];
|
||||||
|
e.t = Math.max(this.t - t, 0), e.s = this.s
|
||||||
|
}, s.prototype.lShiftTo = function(t, e) {
|
||||||
|
var r, n = t % this.DB,
|
||||||
|
i = this.DB - n,
|
||||||
|
o = (1 << i) - 1,
|
||||||
|
s = Math.floor(t / this.DB),
|
||||||
|
a = this.s << n & this.DM;
|
||||||
|
for (r = this.t - 1; r >= 0; --r) e[r + s + 1] = this[r] >> i | a, a = (this[r] & o) << n;
|
||||||
|
for (r = s - 1; r >= 0; --r) e[r] = 0;
|
||||||
|
e[s] = a, e.t = this.t + s + 1, e.s = this.s, e.clamp()
|
||||||
|
}, s.prototype.rShiftTo = function(t, e) {
|
||||||
|
e.s = this.s;
|
||||||
|
var r = Math.floor(t / this.DB);
|
||||||
|
if (r >= this.t) e.t = 0;
|
||||||
|
else {
|
||||||
|
var n = t % this.DB,
|
||||||
|
i = this.DB - n,
|
||||||
|
o = (1 << n) - 1;
|
||||||
|
e[0] = this[r] >> n;
|
||||||
|
for (var s = r + 1; s < this.t; ++s) e[s - r - 1] |= (this[s] & o) << i, e[s - r] = this[s] >> n;
|
||||||
|
n > 0 && (e[this.t - r - 1] |= (this.s & o) << i), e.t = this.t - r, e.clamp()
|
||||||
|
}
|
||||||
|
}, s.prototype.subTo = function(t, e) {
|
||||||
|
for (var r = 0, n = 0, i = Math.min(t.t, this.t); r < i;) n += this[r] - t[r], e[r++] = n & this.DM, n >>= this.DB;
|
||||||
|
if (t.t < this.t) {
|
||||||
|
for (n -= t.s; r < this.t;) n += this[r], e[r++] = n & this.DM, n >>= this.DB;
|
||||||
|
n += this.s
|
||||||
|
} else {
|
||||||
|
for (n += this.s; r < t.t;) n -= t[r], e[r++] = n & this.DM, n >>= this.DB;
|
||||||
|
n -= t.s
|
||||||
|
}
|
||||||
|
e.s = n < 0 ? -1 : 0, n < -1 ? e[r++] = this.DV + n : n > 0 && (e[r++] = n), e.t = r, e.clamp()
|
||||||
|
}, s.prototype.multiplyTo = function(t, e) {
|
||||||
|
var r = this.abs(),
|
||||||
|
n = t.abs(),
|
||||||
|
i = r.t;
|
||||||
|
for (e.t = i + n.t; --i >= 0;) e[i] = 0;
|
||||||
|
for (i = 0; i < n.t; ++i) e[i + r.t] = r.am(0, n[i], e, i, 0, r.t);
|
||||||
|
e.s = 0, e.clamp(), this.s != t.s && s.ZERO.subTo(e, e)
|
||||||
|
}, s.prototype.squareTo = function(t) {
|
||||||
|
for (var e = this.abs(), r = t.t = 2 * e.t; --r >= 0;) t[r] = 0;
|
||||||
|
for (r = 0; r < e.t - 1; ++r) {
|
||||||
|
var n = e.am(r, e[r], t, 2 * r, 0, 1);
|
||||||
|
(t[r + e.t] += e.am(r + 1, 2 * e[r], t, 2 * r + 1, n, e.t - r - 1)) >= e.DV && (t[r + e.t] -= e.DV, t[r + e.t + 1] = 1)
|
||||||
|
}
|
||||||
|
t.t > 0 && (t[t.t - 1] += e.am(r, e[r], t, 2 * r, 0, 1)), t.s = 0, t.clamp()
|
||||||
|
}, s.prototype.divRemTo = function(t, e, r) {
|
||||||
|
var n = t.abs();
|
||||||
|
if (!(n.t <= 0)) {
|
||||||
|
var i = this.abs();
|
||||||
|
if (i.t < n.t) return null != e && e.fromInt(0), void(null != r && this.copyTo(r));
|
||||||
|
null == r && (r = a());
|
||||||
|
var o = a(),
|
||||||
|
f = this.s,
|
||||||
|
u = t.s,
|
||||||
|
c = this.DB - y(n[n.t - 1]);
|
||||||
|
c > 0 ? (n.lShiftTo(c, o), i.lShiftTo(c, r)) : (n.copyTo(o), i.copyTo(r));
|
||||||
|
var h = o.t,
|
||||||
|
p = o[h - 1];
|
||||||
|
if (0 !== p) {
|
||||||
|
var l = p * (1 << this.F1) + (h > 1 ? o[h - 2] >> this.F2 : 0),
|
||||||
|
g = this.FV / l,
|
||||||
|
d = (1 << this.F1) / l,
|
||||||
|
v = 1 << this.F2,
|
||||||
|
m = r.t,
|
||||||
|
S = m - h,
|
||||||
|
_ = null == e ? a() : e;
|
||||||
|
for (o.dlShiftTo(S, _), r.compareTo(_) >= 0 && (r[r.t++] = 1, r.subTo(_, r)), s.ONE.dlShiftTo(h, _), _.subTo(o, o); o.t < h;) o[o.t++] = 0;
|
||||||
|
for (; --S >= 0;) {
|
||||||
|
var b = r[--m] == p ? this.DM : Math.floor(r[m] * g + (r[m - 1] + v) * d);
|
||||||
|
if ((r[m] += o.am(0, b, r, S, 0, h)) < b)
|
||||||
|
for (o.dlShiftTo(S, _), r.subTo(_, r); r[m] < --b;) r.subTo(_, r)
|
||||||
|
}
|
||||||
|
null != e && (r.drShiftTo(h, e), f != u && s.ZERO.subTo(e, e)), r.t = h, r.clamp(), c > 0 && r.rShiftTo(c, r), f < 0 && s.ZERO.subTo(r, r)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, s.prototype.invDigit = function() {
|
||||||
|
if (this.t < 1) return 0;
|
||||||
|
var t = this[0];
|
||||||
|
if (!(1 & t)) return 0;
|
||||||
|
var e = 3 & t;
|
||||||
|
return (e = (e = (e = (e = e * (2 - (15 & t) * e) & 15) * (2 - (255 & t) * e) & 255) * (2 - ((65535 & t) * e & 65535)) & 65535) * (2 - t * e % this.DV) % this.DV) > 0 ? this.DV - e : -e
|
||||||
|
}, s.prototype.isEven = function() {
|
||||||
|
return 0 === (this.t > 0 ? 1 & this[0] : this.s)
|
||||||
|
}, s.prototype.exp = function(t, e) {
|
||||||
|
if (t > 4294967295 || t < 1) return s.ONE;
|
||||||
|
var r = a(),
|
||||||
|
n = a(),
|
||||||
|
i = e.convert(this),
|
||||||
|
o = y(t) - 1;
|
||||||
|
for (i.copyTo(r); --o >= 0;)
|
||||||
|
if (e.sqrTo(r, n), (t & 1 << o) > 0) e.mulTo(n, i, r);
|
||||||
|
else {
|
||||||
|
var f = r;
|
||||||
|
r = n, n = f
|
||||||
|
} return e.revert(r)
|
||||||
|
}, s.prototype.chunkSize = function(t) {
|
||||||
|
return Math.floor(Math.LN2 * this.DB / Math.log(t))
|
||||||
|
}, s.prototype.toRadix = function(t) {
|
||||||
|
if (null == t && (t = 10), 0 === this.signum() || t < 2 || t > 36) return "0";
|
||||||
|
var e = this.chunkSize(t),
|
||||||
|
r = Math.pow(t, e),
|
||||||
|
n = l(r),
|
||||||
|
i = a(),
|
||||||
|
o = a(),
|
||||||
|
s = "";
|
||||||
|
for (this.divRemTo(n, i, o); i.signum() > 0;) s = (r + o.intValue()).toString(t).substr(1) + s, i.divRemTo(n, i, o);
|
||||||
|
return o.intValue().toString(t) + s
|
||||||
|
}, s.prototype.fromRadix = function(t, e) {
|
||||||
|
this.fromInt(0), null == e && (e = 10);
|
||||||
|
for (var r = this.chunkSize(e), n = Math.pow(e, r), i = !1, o = 0, a = 0, f = 0; f < t.length; ++f) {
|
||||||
|
var u = p(t, f);
|
||||||
|
u < 0 ? "-" == t.charAt(f) && 0 === this.signum() && (i = !0) : (a = e * a + u, ++o >= r && (this.dMultiply(n), this.dAddOffset(a, 0), o = 0, a = 0))
|
||||||
|
}
|
||||||
|
o > 0 && (this.dMultiply(Math.pow(e, o)), this.dAddOffset(a, 0)), i && s.ZERO.subTo(this, this)
|
||||||
|
}, s.prototype.fromNumber = function(t, e) {
|
||||||
|
if ("number" == typeof e)
|
||||||
|
if (t < 2) this.fromInt(1);
|
||||||
|
else
|
||||||
|
for (this.fromNumber(t), this.testBit(t - 1) || this.bitwiseTo(s.ONE.shiftLeft(t - 1), m, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(e);) this.dAddOffset(2, 0), this.bitLength() > t && this.subTo(s.ONE.shiftLeft(t - 1), this);
|
||||||
|
else {
|
||||||
|
var r = i.randomBytes(1 + (t >> 3)),
|
||||||
|
n = 7 & t;
|
||||||
|
n > 0 ? r[0] &= (1 << n) - 1 : r[0] = 0, this.fromByteArray(r)
|
||||||
|
}
|
||||||
|
}, s.prototype.bitwiseTo = function(t, e, r) {
|
||||||
|
var n, i, o = Math.min(t.t, this.t);
|
||||||
|
for (n = 0; n < o; ++n) r[n] = e(this[n], t[n]);
|
||||||
|
if (t.t < this.t) {
|
||||||
|
for (i = t.s & this.DM, n = o; n < this.t; ++n) r[n] = e(this[n], i);
|
||||||
|
r.t = this.t
|
||||||
|
} else {
|
||||||
|
for (i = this.s & this.DM, n = o; n < t.t; ++n) r[n] = e(i, t[n]);
|
||||||
|
r.t = t.t
|
||||||
|
}
|
||||||
|
r.s = e(this.s, t.s), r.clamp()
|
||||||
|
}, s.prototype.changeBit = function(t, e) {
|
||||||
|
var r = s.ONE.shiftLeft(t);
|
||||||
|
return this.bitwiseTo(r, e, r), r
|
||||||
|
}, s.prototype.addTo = function(t, e) {
|
||||||
|
for (var r = 0, n = 0, i = Math.min(t.t, this.t); r < i;) n += this[r] + t[r], e[r++] = n & this.DM, n >>= this.DB;
|
||||||
|
if (t.t < this.t) {
|
||||||
|
for (n += t.s; r < this.t;) n += this[r], e[r++] = n & this.DM, n >>= this.DB;
|
||||||
|
n += this.s
|
||||||
|
} else {
|
||||||
|
for (n += this.s; r < t.t;) n += t[r], e[r++] = n & this.DM, n >>= this.DB;
|
||||||
|
n += t.s
|
||||||
|
}
|
||||||
|
e.s = n < 0 ? -1 : 0, n > 0 ? e[r++] = n : n < -1 && (e[r++] = this.DV + n), e.t = r, e.clamp()
|
||||||
|
}, s.prototype.dMultiply = function(t) {
|
||||||
|
this[this.t] = this.am(0, t - 1, this, 0, 0, this.t), ++this.t, this.clamp()
|
||||||
|
}, s.prototype.dAddOffset = function(t, e) {
|
||||||
|
if (0 !== t) {
|
||||||
|
for (; this.t <= e;) this[this.t++] = 0;
|
||||||
|
for (this[e] += t; this[e] >= this.DV;) this[e] -= this.DV, ++e >= this.t && (this[this.t++] = 0), ++this[e]
|
||||||
|
}
|
||||||
|
}, s.prototype.multiplyLowerTo = function(t, e, r) {
|
||||||
|
var n, i = Math.min(this.t + t.t, e);
|
||||||
|
for (r.s = 0, r.t = i; i > 0;) r[--i] = 0;
|
||||||
|
for (n = r.t - this.t; i < n; ++i) r[i + this.t] = this.am(0, t[i], r, i, 0, this.t);
|
||||||
|
for (n = Math.min(t.t, e); i < n; ++i) this.am(0, t[i], r, i, 0, e - i);
|
||||||
|
r.clamp()
|
||||||
|
}, s.prototype.multiplyUpperTo = function(t, e, r) {
|
||||||
|
--e;
|
||||||
|
var n = r.t = this.t + t.t - e;
|
||||||
|
for (r.s = 0; --n >= 0;) r[n] = 0;
|
||||||
|
for (n = Math.max(e - this.t, 0); n < t.t; ++n) r[this.t + n - e] = this.am(e - n, t[n], r, 0, 0, this.t + n - e);
|
||||||
|
r.clamp(), r.drShiftTo(1, r)
|
||||||
|
}, s.prototype.modInt = function(t) {
|
||||||
|
if (t <= 0) return 0;
|
||||||
|
var e = this.DV % t,
|
||||||
|
r = this.s < 0 ? t - 1 : 0;
|
||||||
|
if (this.t > 0)
|
||||||
|
if (0 === e) r = this[0] % t;
|
||||||
|
else
|
||||||
|
for (var n = this.t - 1; n >= 0; --n) r = (e * r + this[n]) % t;
|
||||||
|
return r
|
||||||
|
}, s.prototype.millerRabin = function(t) {
|
||||||
|
var e = this.subtract(s.ONE),
|
||||||
|
r = e.getLowestSetBit();
|
||||||
|
if (r <= 0) return !1;
|
||||||
|
var n = e.shiftRight(r);
|
||||||
|
(t = t + 1 >> 1) > A.length && (t = A.length);
|
||||||
|
for (var i = a(), o = 0; o < t; ++o) {
|
||||||
|
i.fromInt(A[Math.floor(Math.random() * A.length)]);
|
||||||
|
var f = i.modPow(n, this);
|
||||||
|
if (0 != f.compareTo(s.ONE) && 0 != f.compareTo(e)) {
|
||||||
|
for (var u = 1; u++ < r && 0 != f.compareTo(e);)
|
||||||
|
if (0 === (f = f.modPowInt(2, this)).compareTo(s.ONE)) return !1;
|
||||||
|
if (0 != f.compareTo(e)) return !1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return !0
|
||||||
|
}, s.prototype.toString = function(t) {
|
||||||
|
if (this.s < 0) return "-" + this.negate().toString(t);
|
||||||
|
var e;
|
||||||
|
if (16 == t) e = 4;
|
||||||
|
else if (8 == t) e = 3;
|
||||||
|
else if (2 == t) e = 1;
|
||||||
|
else if (32 == t) e = 5;
|
||||||
|
else {
|
||||||
|
if (4 != t) return this.toRadix(t);
|
||||||
|
e = 2
|
||||||
|
}
|
||||||
|
var r, n = (1 << e) - 1,
|
||||||
|
i = !1,
|
||||||
|
o = "",
|
||||||
|
s = this.t,
|
||||||
|
a = this.DB - s * this.DB % e;
|
||||||
|
if (s-- > 0)
|
||||||
|
for (a < this.DB && (r = this[s] >> a) > 0 && (i = !0, o = h(r)); s >= 0;) a < e ? (r = (this[s] & (1 << a) - 1) << e - a, r |= this[--s] >> (a += this.DB - e)) : (r = this[s] >> (a -= e) & n, a <= 0 && (a += this.DB, --s)), r > 0 && (i = !0), i && (o += h(r));
|
||||||
|
return i ? o : "0"
|
||||||
|
}, s.prototype.negate = function() {
|
||||||
|
var t = a();
|
||||||
|
return s.ZERO.subTo(this, t), t
|
||||||
|
}, s.prototype.abs = function() {
|
||||||
|
return this.s < 0 ? this.negate() : this
|
||||||
|
}, s.prototype.compareTo = function(t) {
|
||||||
|
var e = this.s - t.s;
|
||||||
|
if (0 != e) return e;
|
||||||
|
var r = this.t;
|
||||||
|
if (0 != (e = r - t.t)) return this.s < 0 ? -e : e;
|
||||||
|
for (; --r >= 0;)
|
||||||
|
if (0 != (e = this[r] - t[r])) return e;
|
||||||
|
return 0
|
||||||
|
}, s.prototype.bitLength = function() {
|
||||||
|
return this.t <= 0 ? 0 : this.DB * (this.t - 1) + y(this[this.t - 1] ^ this.s & this.DM)
|
||||||
|
}, s.prototype.mod = function(t) {
|
||||||
|
var e = a();
|
||||||
|
return this.abs().divRemTo(t, null, e), this.s < 0 && e.compareTo(s.ZERO) > 0 && t.subTo(e, e), e
|
||||||
|
}, s.prototype.modPowInt = function(t, e) {
|
||||||
|
var r;
|
||||||
|
return r = t < 256 || e.isEven() ? new g(e) : new d(e), this.exp(t, r)
|
||||||
|
}, s.prototype.clone = function() {
|
||||||
|
var t = a();
|
||||||
|
return this.copyTo(t), t
|
||||||
|
}, s.prototype.intValue = function() {
|
||||||
|
if (this.s < 0) {
|
||||||
|
if (1 == this.t) return this[0] - this.DV;
|
||||||
|
if (0 === this.t) return -1
|
||||||
|
} else {
|
||||||
|
if (1 == this.t) return this[0];
|
||||||
|
if (0 === this.t) return 0
|
||||||
|
}
|
||||||
|
return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0]
|
||||||
|
}, s.prototype.byteValue = function() {
|
||||||
|
return 0 == this.t ? this.s : this[0] << 24 >> 24
|
||||||
|
}, s.prototype.shortValue = function() {
|
||||||
|
return 0 == this.t ? this.s : this[0] << 16 >> 16
|
||||||
|
}, s.prototype.signum = function() {
|
||||||
|
return this.s < 0 ? -1 : this.t <= 0 || 1 == this.t && this[0] <= 0 ? 0 : 1
|
||||||
|
}, s.prototype.toByteArray = function() {
|
||||||
|
var t = this.t,
|
||||||
|
e = new Array;
|
||||||
|
e[0] = this.s;
|
||||||
|
var r, n = this.DB - t * this.DB % 8,
|
||||||
|
i = 0;
|
||||||
|
if (t-- > 0)
|
||||||
|
for (n < this.DB && (r = this[t] >> n) != (this.s & this.DM) >> n && (e[i++] = r | this.s << this.DB - n); t >= 0;) n < 8 ? (r = (this[t] & (1 << n) - 1) << 8 - n, r |= this[--t] >> (n += this.DB - 8)) : (r = this[t] >> (n -= 8) & 255, n <= 0 && (n += this.DB, --t)), 128 & r && (r |= -256), 0 === i && (128 & this.s) != (128 & r) && ++i, (i > 0 || r != this.s) && (e[i++] = r);
|
||||||
|
return e
|
||||||
|
}, s.prototype.toBuffer = function(t) {
|
||||||
|
var e = n.from(this.toByteArray());
|
||||||
|
if (!0 === t && 0 === e[0]) e = e.slice(1);
|
||||||
|
else if (o.isNumber(t)) {
|
||||||
|
if (e.length > t) {
|
||||||
|
for (var r = 0; r < e.length - t; r++)
|
||||||
|
if (0 !== e[r]) return null;
|
||||||
|
return e.slice(e.length - t)
|
||||||
|
}
|
||||||
|
if (e.length < t) {
|
||||||
|
var i = n.alloc(t);
|
||||||
|
return i.fill(0, 0, t - e.length), e.copy(i, t - e.length), i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return e
|
||||||
|
}, s.prototype.equals = function(t) {
|
||||||
|
return 0 == this.compareTo(t)
|
||||||
|
}, s.prototype.min = function(t) {
|
||||||
|
return this.compareTo(t) < 0 ? this : t
|
||||||
|
}, s.prototype.max = function(t) {
|
||||||
|
return this.compareTo(t) > 0 ? this : t
|
||||||
|
}, s.prototype.and = function(t) {
|
||||||
|
var e = a();
|
||||||
|
return this.bitwiseTo(t, v, e), e
|
||||||
|
}, s.prototype.or = function(t) {
|
||||||
|
var e = a();
|
||||||
|
return this.bitwiseTo(t, m, e), e
|
||||||
|
}, s.prototype.xor = function(t) {
|
||||||
|
var e = a();
|
||||||
|
return this.bitwiseTo(t, S, e), e
|
||||||
|
}, s.prototype.andNot = function(t) {
|
||||||
|
var e = a();
|
||||||
|
return this.bitwiseTo(t, _, e), e
|
||||||
|
}, s.prototype.not = function() {
|
||||||
|
for (var t = a(), e = 0; e < this.t; ++e) t[e] = this.DM & ~this[e];
|
||||||
|
return t.t = this.t, t.s = ~this.s, t
|
||||||
|
}, s.prototype.shiftLeft = function(t) {
|
||||||
|
var e = a();
|
||||||
|
return t < 0 ? this.rShiftTo(-t, e) : this.lShiftTo(t, e), e
|
||||||
|
}, s.prototype.shiftRight = function(t) {
|
||||||
|
var e = a();
|
||||||
|
return t < 0 ? this.lShiftTo(-t, e) : this.rShiftTo(t, e), e
|
||||||
|
}, s.prototype.getLowestSetBit = function() {
|
||||||
|
for (var t = 0; t < this.t; ++t)
|
||||||
|
if (0 != this[t]) return t * this.DB + b(this[t]);
|
||||||
|
return this.s < 0 ? this.t * this.DB : -1
|
||||||
|
}, s.prototype.bitCount = function() {
|
||||||
|
for (var t = 0, e = this.s & this.DM, r = 0; r < this.t; ++r) t += E(this[r] ^ e);
|
||||||
|
return t
|
||||||
|
}, s.prototype.testBit = function(t) {
|
||||||
|
var e = Math.floor(t / this.DB);
|
||||||
|
return e >= this.t ? 0 != this.s : !!(this[e] & 1 << t % this.DB)
|
||||||
|
}, s.prototype.setBit = function(t) {
|
||||||
|
return this.changeBit(t, m)
|
||||||
|
}, s.prototype.clearBit = function(t) {
|
||||||
|
return this.changeBit(t, _)
|
||||||
|
}, s.prototype.flipBit = function(t) {
|
||||||
|
return this.changeBit(t, S)
|
||||||
|
}, s.prototype.add = function(t) {
|
||||||
|
var e = a();
|
||||||
|
return this.addTo(t, e), e
|
||||||
|
}, s.prototype.subtract = function(t) {
|
||||||
|
var e = a();
|
||||||
|
return this.subTo(t, e), e
|
||||||
|
}, s.prototype.multiply = function(t) {
|
||||||
|
var e = a();
|
||||||
|
return this.multiplyTo(t, e), e
|
||||||
|
}, s.prototype.divide = function(t) {
|
||||||
|
var e = a();
|
||||||
|
return this.divRemTo(t, e, null), e
|
||||||
|
}, s.prototype.remainder = function(t) {
|
||||||
|
var e = a();
|
||||||
|
return this.divRemTo(t, null, e), e
|
||||||
|
}, s.prototype.divideAndRemainder = function(t) {
|
||||||
|
var e = a(),
|
||||||
|
r = a();
|
||||||
|
return this.divRemTo(t, e, r), new Array(e, r)
|
||||||
|
}, s.prototype.modPow = function(t, e) {
|
||||||
|
var r, n, i = t.bitLength(),
|
||||||
|
o = l(1);
|
||||||
|
if (i <= 0) return o;
|
||||||
|
r = i < 18 ? 1 : i < 48 ? 3 : i < 144 ? 4 : i < 768 ? 5 : 6, n = i < 8 ? new g(e) : e.isEven() ? new B(e) : new d(e);
|
||||||
|
var s = new Array,
|
||||||
|
f = 3,
|
||||||
|
u = r - 1,
|
||||||
|
c = (1 << r) - 1;
|
||||||
|
if (s[1] = n.convert(this), r > 1) {
|
||||||
|
var h = a();
|
||||||
|
for (n.sqrTo(s[1], h); f <= c;) s[f] = a(), n.mulTo(h, s[f - 2], s[f]), f += 2
|
||||||
|
}
|
||||||
|
var p, v, m = t.t - 1,
|
||||||
|
S = !0,
|
||||||
|
_ = a();
|
||||||
|
for (i = y(t[m]) - 1; m >= 0;) {
|
||||||
|
for (i >= u ? p = t[m] >> i - u & c : (p = (t[m] & (1 << i + 1) - 1) << u - i, m > 0 && (p |= t[m - 1] >> this.DB + i - u)), f = r; !(1 & p);) p >>= 1, --f;
|
||||||
|
if ((i -= f) < 0 && (i += this.DB, --m), S) s[p].copyTo(o), S = !1;
|
||||||
|
else {
|
||||||
|
for (; f > 1;) n.sqrTo(o, _), n.sqrTo(_, o), f -= 2;
|
||||||
|
f > 0 ? n.sqrTo(o, _) : (v = o, o = _, _ = v), n.mulTo(_, s[p], o)
|
||||||
|
}
|
||||||
|
for (; m >= 0 && !(t[m] & 1 << i);) n.sqrTo(o, _), v = o, o = _, _ = v, --i < 0 && (i = this.DB - 1, --m)
|
||||||
|
}
|
||||||
|
return n.revert(o)
|
||||||
|
}, s.prototype.modInverse = function(t) {
|
||||||
|
var e = t.isEven();
|
||||||
|
if (this.isEven() && e || 0 === t.signum()) return s.ZERO;
|
||||||
|
for (var r = t.clone(), n = this.clone(), i = l(1), o = l(0), a = l(0), f = l(1); 0 != r.signum();) {
|
||||||
|
for (; r.isEven();) r.rShiftTo(1, r), e ? (i.isEven() && o.isEven() || (i.addTo(this, i), o.subTo(t, o)), i.rShiftTo(1, i)) : o.isEven() || o.subTo(t, o), o.rShiftTo(1, o);
|
||||||
|
for (; n.isEven();) n.rShiftTo(1, n), e ? (a.isEven() && f.isEven() || (a.addTo(this, a), f.subTo(t, f)), a.rShiftTo(1, a)) : f.isEven() || f.subTo(t, f), f.rShiftTo(1, f);
|
||||||
|
r.compareTo(n) >= 0 ? (r.subTo(n, r), e && i.subTo(a, i), o.subTo(f, o)) : (n.subTo(r, n), e && a.subTo(i, a), f.subTo(o, f))
|
||||||
|
}
|
||||||
|
return 0 != n.compareTo(s.ONE) ? s.ZERO : f.compareTo(t) >= 0 ? f.subtract(t) : f.signum() < 0 ? (f.addTo(t, f), f.signum() < 0 ? f.add(t) : f) : f
|
||||||
|
}, s.prototype.pow = function(t) {
|
||||||
|
return this.exp(t, new w)
|
||||||
|
}, s.prototype.gcd = function(t) {
|
||||||
|
var e = this.s < 0 ? this.negate() : this.clone(),
|
||||||
|
r = t.s < 0 ? t.negate() : t.clone();
|
||||||
|
if (e.compareTo(r) < 0) {
|
||||||
|
var n = e;
|
||||||
|
e = r, r = n
|
||||||
|
}
|
||||||
|
var i = e.getLowestSetBit(),
|
||||||
|
o = r.getLowestSetBit();
|
||||||
|
if (o < 0) return e;
|
||||||
|
for (i < o && (o = i), o > 0 && (e.rShiftTo(o, e), r.rShiftTo(o, r)); e.signum() > 0;)(i = e.getLowestSetBit()) > 0 && e.rShiftTo(i, e), (i = r.getLowestSetBit()) > 0 && r.rShiftTo(i, r), e.compareTo(r) >= 0 ? (e.subTo(r, e), e.rShiftTo(1, e)) : (r.subTo(e, r), r.rShiftTo(1, r));
|
||||||
|
return o > 0 && r.lShiftTo(o, r), r
|
||||||
|
}, s.prototype.isProbablePrime = function(t) {
|
||||||
|
var e, r = this.abs();
|
||||||
|
if (1 == r.t && r[0] <= A[A.length - 1]) {
|
||||||
|
for (e = 0; e < A.length; ++e)
|
||||||
|
if (r[0] == A[e]) return !0;
|
||||||
|
return !1
|
||||||
|
}
|
||||||
|
if (r.isEven()) return !1;
|
||||||
|
for (e = 1; e < A.length;) {
|
||||||
|
for (var n = A[e], i = e + 1; i < A.length && n < x;) n *= A[i++];
|
||||||
|
for (n = r.modInt(n); e < i;)
|
||||||
|
if (n % A[e++] == 0) return !1
|
||||||
|
}
|
||||||
|
return r.millerRabin(t)
|
||||||
|
}, s.int2char = h, s.ZERO = l(0), s.ONE = l(1), s.prototype.square = function() {
|
||||||
|
var t = a();
|
||||||
|
return this.squareTo(t), t
|
||||||
|
}, t.exports = s
|
||||||
|
},
|
||||||
|
5682: (t, e, r) => {
|
||||||
|
var n = r(8287).Buffer,
|
||||||
|
i = r(8226)._,
|
||||||
|
o = (r(3200), r(1973)),
|
||||||
|
s = r(8226),
|
||||||
|
a = r(1768),
|
||||||
|
f = r(4538);
|
||||||
|
e.BigInteger = o, t.exports.Key = function() {
|
||||||
|
function t() {
|
||||||
|
this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null, this.dmq1 = null, this.coeff = null
|
||||||
|
}
|
||||||
|
return t.prototype.setOptions = function(t) {
|
||||||
|
var e = a[t.signingScheme],
|
||||||
|
r = a[t.encryptionScheme];
|
||||||
|
e === r ? this.signingScheme = this.encryptionScheme = r.makeScheme(this, t) : (this.encryptionScheme = r.makeScheme(this, t), this.signingScheme = e.makeScheme(this, t)), this.encryptEngine = f.getEngine(this, t)
|
||||||
|
}, t.prototype.generate = function(t, e) {
|
||||||
|
var r = t >> 1;
|
||||||
|
this.e = parseInt(e, 16);
|
||||||
|
for (var n = new o(e, 16);;) {
|
||||||
|
for (; this.p = new o(t - r, 1), 0 !== this.p.subtract(o.ONE).gcd(n).compareTo(o.ONE) || !this.p.isProbablePrime(10););
|
||||||
|
for (; this.q = new o(r, 1), 0 !== this.q.subtract(o.ONE).gcd(n).compareTo(o.ONE) || !this.q.isProbablePrime(10););
|
||||||
|
if (this.p.compareTo(this.q) <= 0) {
|
||||||
|
var i = this.p;
|
||||||
|
this.p = this.q, this.q = i
|
||||||
|
}
|
||||||
|
var s = this.p.subtract(o.ONE),
|
||||||
|
a = this.q.subtract(o.ONE),
|
||||||
|
f = s.multiply(a);
|
||||||
|
if (0 === f.gcd(n).compareTo(o.ONE)) {
|
||||||
|
if (this.n = this.p.multiply(this.q), this.n.bitLength() < t) continue;
|
||||||
|
this.d = n.modInverse(f), this.dmp1 = this.d.mod(s), this.dmq1 = this.d.mod(a), this.coeff = this.q.modInverse(this.p);
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.$$recalculateCache()
|
||||||
|
}, t.prototype.setPrivate = function(t, e, r, n, a, f, u, c) {
|
||||||
|
if (!(t && e && r && t.length > 0 && (i.isNumber(e) || e.length > 0) && r.length > 0)) throw Error("Invalid RSA private key");
|
||||||
|
this.n = new o(t), this.e = i.isNumber(e) ? e : s.get32IntFromBuffer(e, 0), this.d = new o(r), n && a && f && u && c && (this.p = new o(n), this.q = new o(a), this.dmp1 = new o(f), this.dmq1 = new o(u), this.coeff = new o(c)), this.$$recalculateCache()
|
||||||
|
}, t.prototype.setPublic = function(t, e) {
|
||||||
|
if (!(t && e && t.length > 0 && (i.isNumber(e) || e.length > 0))) throw Error("Invalid RSA public key");
|
||||||
|
this.n = new o(t), this.e = i.isNumber(e) ? e : s.get32IntFromBuffer(e, 0), this.$$recalculateCache()
|
||||||
|
}, t.prototype.$doPrivate = function(t) {
|
||||||
|
if (this.p || this.q) return t.modPow(this.d, this.n);
|
||||||
|
for (var e = t.mod(this.p).modPow(this.dmp1, this.p), r = t.mod(this.q).modPow(this.dmq1, this.q); e.compareTo(r) < 0;) e = e.add(this.p);
|
||||||
|
return e.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)
|
||||||
|
}, t.prototype.$doPublic = function(t) {
|
||||||
|
return t.modPowInt(this.e, this.n)
|
||||||
|
}, t.prototype.encrypt = function(t, e) {
|
||||||
|
var r = [],
|
||||||
|
i = [],
|
||||||
|
o = t.length,
|
||||||
|
s = Math.ceil(o / this.maxMessageLength) || 1,
|
||||||
|
a = Math.ceil(o / s || 1);
|
||||||
|
if (1 == s) r.push(t);
|
||||||
|
else
|
||||||
|
for (var f = 0; f < s; f++) r.push(t.slice(f * a, (f + 1) * a));
|
||||||
|
for (var u = 0; u < r.length; u++) i.push(this.encryptEngine.encrypt(r[u], e));
|
||||||
|
return n.concat(i)
|
||||||
|
}, t.prototype.decrypt = function(t, e) {
|
||||||
|
if (t.length % this.encryptedDataLength > 0) throw Error("Incorrect data or key");
|
||||||
|
for (var r = [], i = 0, o = 0, s = t.length / this.encryptedDataLength, a = 0; a < s; a++) o = (i = a * this.encryptedDataLength) + this.encryptedDataLength, r.push(this.encryptEngine.decrypt(t.slice(i, Math.min(o, t.length)), e));
|
||||||
|
return n.concat(r)
|
||||||
|
}, t.prototype.sign = function(t) {
|
||||||
|
return this.signingScheme.sign.apply(this.signingScheme, arguments)
|
||||||
|
}, t.prototype.verify = function(t, e, r) {
|
||||||
|
return this.signingScheme.verify.apply(this.signingScheme, arguments)
|
||||||
|
}, t.prototype.isPrivate = function() {
|
||||||
|
return !!(this.n && this.e && this.d)
|
||||||
|
}, t.prototype.isPublic = function(t) {
|
||||||
|
return this.n && this.e && !(t && this.d) || !1
|
||||||
|
}, Object.defineProperty(t.prototype, "keySize", {
|
||||||
|
get: function() {
|
||||||
|
return this.cache.keyBitLength
|
||||||
|
}
|
||||||
|
}), Object.defineProperty(t.prototype, "encryptedDataLength", {
|
||||||
|
get: function() {
|
||||||
|
return this.cache.keyByteLength
|
||||||
|
}
|
||||||
|
}), Object.defineProperty(t.prototype, "maxMessageLength", {
|
||||||
|
get: function() {
|
||||||
|
return this.encryptionScheme.maxMessageLength()
|
||||||
|
}
|
||||||
|
}), t.prototype.$$recalculateCache = function() {
|
||||||
|
this.cache = this.cache || {}, this.cache.keyBitLength = this.n.bitLength(), this.cache.keyByteLength = this.cache.keyBitLength + 6 >> 3
|
||||||
|
}, t
|
||||||
|
}()
|
||||||
|
},
|
||||||
|
2487: (t, e, r) => {
|
||||||
|
var n = r(8287).Buffer,
|
||||||
|
i = (r(1973), r(3200));
|
||||||
|
t.exports = {
|
||||||
|
isEncryption: !0,
|
||||||
|
isSignature: !1
|
||||||
|
}, t.exports.digestLength = {
|
||||||
|
md4: 16,
|
||||||
|
md5: 16,
|
||||||
|
ripemd160: 20,
|
||||||
|
rmd160: 20,
|
||||||
|
sha1: 20,
|
||||||
|
sha224: 28,
|
||||||
|
sha256: 32,
|
||||||
|
sha384: 48,
|
||||||
|
sha512: 64
|
||||||
|
};
|
||||||
|
var o = "sha1";
|
||||||
|
t.exports.eme_oaep_mgf1 = function(e, r, s) {
|
||||||
|
s = s || o;
|
||||||
|
for (var a = t.exports.digestLength[s], f = Math.ceil(r / a), u = n.alloc(a * f), c = n.alloc(4), h = 0; h < f; ++h) {
|
||||||
|
var p = i.createHash(s);
|
||||||
|
p.update(e), c.writeUInt32BE(h, 0), p.update(c), p.digest().copy(u, h * a)
|
||||||
|
}
|
||||||
|
return u.slice(0, r)
|
||||||
|
}, t.exports.makeScheme = function(e, r) {
|
||||||
|
function s(t, e) {
|
||||||
|
this.key = t, this.options = e
|
||||||
|
}
|
||||||
|
return s.prototype.maxMessageLength = function() {
|
||||||
|
return this.key.encryptedDataLength - 2 * t.exports.digestLength[this.options.encryptionSchemeOptions.hash || o] - 2
|
||||||
|
}, s.prototype.encPad = function(e) {
|
||||||
|
var r = this.options.encryptionSchemeOptions.hash || o,
|
||||||
|
s = this.options.encryptionSchemeOptions.mgf || t.exports.eme_oaep_mgf1,
|
||||||
|
a = this.options.encryptionSchemeOptions.label || n.alloc(0),
|
||||||
|
f = this.key.encryptedDataLength,
|
||||||
|
u = t.exports.digestLength[r];
|
||||||
|
if (e.length > f - 2 * u - 2) throw new Error("Message is too long to encode into an encoded message with a length of " + f + " bytes, increaseemLen to fix this error (minimum value for given parameters and options: " + (f - 2 * u - 2) + ")");
|
||||||
|
var c = i.createHash(r);
|
||||||
|
c.update(a), c = c.digest();
|
||||||
|
var h = n.alloc(f - e.length - 2 * u - 1);
|
||||||
|
h.fill(0), h[h.length - 1] = 1;
|
||||||
|
for (var p = n.concat([c, h, e]), l = i.randomBytes(u), y = s(l, p.length, r), g = 0; g < p.length; g++) p[g] ^= y[g];
|
||||||
|
for (y = s(p, u, r), g = 0; g < l.length; g++) l[g] ^= y[g];
|
||||||
|
var d = n.alloc(1 + l.length + p.length);
|
||||||
|
return d[0] = 0, l.copy(d, 1), p.copy(d, 1 + l.length), d
|
||||||
|
}, s.prototype.encUnPad = function(e) {
|
||||||
|
var r = this.options.encryptionSchemeOptions.hash || o,
|
||||||
|
s = this.options.encryptionSchemeOptions.mgf || t.exports.eme_oaep_mgf1,
|
||||||
|
a = this.options.encryptionSchemeOptions.label || n.alloc(0),
|
||||||
|
f = t.exports.digestLength[r];
|
||||||
|
if (e.length < 2 * f + 2) throw new Error("Error decoding message, the supplied message is not long enough to be a valid OAEP encoded message");
|
||||||
|
for (var u = e.slice(1, f + 1), c = e.slice(1 + f), h = s(c, f, r), p = 0; p < u.length; p++) u[p] ^= h[p];
|
||||||
|
for (h = s(u, c.length, r), p = 0; p < c.length; p++) c[p] ^= h[p];
|
||||||
|
var l = i.createHash(r);
|
||||||
|
if (l.update(a), l = l.digest(), c.slice(0, f).toString("hex") != l.toString("hex")) throw new Error("Error decoding message, the lHash calculated from the label provided and the lHash in the encrypted data do not match.");
|
||||||
|
for (p = f; 0 === c[p++] && p < c.length;);
|
||||||
|
if (1 != c[p - 1]) throw new Error("Error decoding message, there is no padding message separator byte");
|
||||||
|
return c.slice(p)
|
||||||
|
}, new s(e, r)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
8290: (t, e, r) => {
|
||||||
|
var n = r(8287).Buffer,
|
||||||
|
i = r(1973),
|
||||||
|
o = r(3200),
|
||||||
|
s = r(7449),
|
||||||
|
a = {
|
||||||
|
md2: n.from("3020300c06082a864886f70d020205000410", "hex"),
|
||||||
|
md5: n.from("3020300c06082a864886f70d020505000410", "hex"),
|
||||||
|
sha1: n.from("3021300906052b0e03021a05000414", "hex"),
|
||||||
|
sha224: n.from("302d300d06096086480165030402040500041c", "hex"),
|
||||||
|
sha256: n.from("3031300d060960864801650304020105000420", "hex"),
|
||||||
|
sha384: n.from("3041300d060960864801650304020205000430", "hex"),
|
||||||
|
sha512: n.from("3051300d060960864801650304020305000440", "hex"),
|
||||||
|
ripemd160: n.from("3021300906052b2403020105000414", "hex"),
|
||||||
|
rmd160: n.from("3021300906052b2403020105000414", "hex")
|
||||||
|
},
|
||||||
|
f = {
|
||||||
|
ripemd160: "rmd160"
|
||||||
|
},
|
||||||
|
u = "sha256";
|
||||||
|
t.exports = {
|
||||||
|
isEncryption: !0,
|
||||||
|
isSignature: !0
|
||||||
|
}, t.exports.makeScheme = function(t, e) {
|
||||||
|
function r(t, e) {
|
||||||
|
this.key = t, this.options = e
|
||||||
|
}
|
||||||
|
return r.prototype.maxMessageLength = function() {
|
||||||
|
return this.options.encryptionSchemeOptions && this.options.encryptionSchemeOptions.padding == s.RSA_NO_PADDING ? this.key.encryptedDataLength : this.key.encryptedDataLength - 11
|
||||||
|
}, r.prototype.encPad = function(t, e) {
|
||||||
|
var r;
|
||||||
|
if (e = e || {}, t.length > this.key.maxMessageLength) throw new Error("Message too long for RSA (n=" + this.key.encryptedDataLength + ", l=" + t.length + ")");
|
||||||
|
if (this.options.encryptionSchemeOptions && this.options.encryptionSchemeOptions.padding == s.RSA_NO_PADDING) return (r = n.alloc(this.key.maxMessageLength - t.length)).fill(0), n.concat([r, t]);
|
||||||
|
if (1 === e.type) return (r = n.alloc(this.key.encryptedDataLength - t.length - 1)).fill(255, 0, r.length - 1), r[0] = 1, r[r.length - 1] = 0, n.concat([r, t]);
|
||||||
|
(r = n.alloc(this.key.encryptedDataLength - t.length))[0] = 0, r[1] = 2;
|
||||||
|
for (var i = o.randomBytes(r.length - 3), a = 0; a < i.length; a++) {
|
||||||
|
for (var f = i[a]; 0 === f;) f = o.randomBytes(1)[0];
|
||||||
|
r[a + 2] = f
|
||||||
|
}
|
||||||
|
return r[r.length - 1] = 0, n.concat([r, t])
|
||||||
|
}, r.prototype.encUnPad = function(t, e) {
|
||||||
|
e = e || {};
|
||||||
|
var r = 0;
|
||||||
|
if (this.options.encryptionSchemeOptions && this.options.encryptionSchemeOptions.padding == s.RSA_NO_PADDING) return "function" == typeof t.lastIndexOf ? t.slice(t.lastIndexOf("\0") + 1, t.length) : t.slice(String.prototype.lastIndexOf.call(t, "\0") + 1, t.length);
|
||||||
|
if (t.length < 4) return null;
|
||||||
|
if (1 === e.type) {
|
||||||
|
if (0 !== t[0] || 1 !== t[1]) return null;
|
||||||
|
for (r = 3; 0 !== t[r];)
|
||||||
|
if (255 != t[r] || ++r >= t.length) return null
|
||||||
|
} else {
|
||||||
|
if (0 !== t[0] || 2 !== t[1]) return null;
|
||||||
|
for (r = 3; 0 !== t[r];)
|
||||||
|
if (++r >= t.length) return null
|
||||||
|
}
|
||||||
|
return t.slice(r + 1, t.length)
|
||||||
|
}, r.prototype.sign = function(t) {
|
||||||
|
var e = this.options.signingSchemeOptions.hash || u;
|
||||||
|
if ("browser" === this.options.environment) {
|
||||||
|
e = f[e] || e;
|
||||||
|
var r = o.createHash(e);
|
||||||
|
r.update(t);
|
||||||
|
var n = this.pkcs1pad(r.digest(), e);
|
||||||
|
return this.key.$doPrivate(new i(n)).toBuffer(this.key.encryptedDataLength)
|
||||||
|
}
|
||||||
|
var s = o.createSign("RSA-" + e.toUpperCase());
|
||||||
|
return s.update(t), s.sign(this.options.rsaUtils.exportKey("private"))
|
||||||
|
}, r.prototype.verify = function(t, e, r) {
|
||||||
|
if (this.options.encryptionSchemeOptions && this.options.encryptionSchemeOptions.padding == s.RSA_NO_PADDING) return !1;
|
||||||
|
var a = this.options.signingSchemeOptions.hash || u;
|
||||||
|
if ("browser" === this.options.environment) {
|
||||||
|
a = f[a] || a, r && (e = n.from(e, r));
|
||||||
|
var c = o.createHash(a);
|
||||||
|
c.update(t);
|
||||||
|
var h = this.pkcs1pad(c.digest(), a);
|
||||||
|
return this.key.$doPublic(new i(e)).toBuffer().toString("hex") == h.toString("hex")
|
||||||
|
}
|
||||||
|
var p = o.createVerify("RSA-" + a.toUpperCase());
|
||||||
|
return p.update(t), p.verify(this.options.rsaUtils.exportKey("public"), e, r)
|
||||||
|
}, r.prototype.pkcs0pad = function(t) {
|
||||||
|
var e = n.alloc(this.key.maxMessageLength - t.length);
|
||||||
|
return e.fill(0), n.concat([e, t])
|
||||||
|
}, r.prototype.pkcs0unpad = function(t) {
|
||||||
|
return "function" == typeof t.lastIndexOf ? t.slice(t.lastIndexOf("\0") + 1, t.length) : t.slice(String.prototype.lastIndexOf.call(t, "\0") + 1, t.length)
|
||||||
|
}, r.prototype.pkcs1pad = function(t, e) {
|
||||||
|
var r = a[e];
|
||||||
|
if (!r) throw Error("Unsupported hash algorithm");
|
||||||
|
var i = n.concat([r, t]);
|
||||||
|
if (i.length + 10 > this.key.encryptedDataLength) throw Error("Key is too short for signing algorithm (" + e + ")");
|
||||||
|
var o = n.alloc(this.key.encryptedDataLength - i.length - 1);
|
||||||
|
return o.fill(255, 0, o.length - 1), o[0] = 1, o[o.length - 1] = 0, n.concat([o, i])
|
||||||
|
}, new r(t, e)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
4414: (t, e, r) => {
|
||||||
|
var n = r(8287).Buffer,
|
||||||
|
i = r(1973),
|
||||||
|
o = r(3200);
|
||||||
|
t.exports = {
|
||||||
|
isEncryption: !1,
|
||||||
|
isSignature: !0
|
||||||
|
};
|
||||||
|
var s = "sha1";
|
||||||
|
t.exports.makeScheme = function(t, e) {
|
||||||
|
var a = r(1768).pkcs1_oaep;
|
||||||
|
|
||||||
|
function f(t, e) {
|
||||||
|
this.key = t, this.options = e
|
||||||
|
}
|
||||||
|
return f.prototype.sign = function(t) {
|
||||||
|
var e = o.createHash(this.options.signingSchemeOptions.hash || s);
|
||||||
|
e.update(t);
|
||||||
|
var r = this.emsa_pss_encode(e.digest(), this.key.keySize - 1);
|
||||||
|
return this.key.$doPrivate(new i(r)).toBuffer(this.key.encryptedDataLength)
|
||||||
|
}, f.prototype.verify = function(t, e, r) {
|
||||||
|
r && (e = n.from(e, r)), e = new i(e);
|
||||||
|
var a = Math.ceil((this.key.keySize - 1) / 8),
|
||||||
|
f = this.key.$doPublic(e).toBuffer(a),
|
||||||
|
u = o.createHash(this.options.signingSchemeOptions.hash || s);
|
||||||
|
return u.update(t), this.emsa_pss_verify(u.digest(), f, this.key.keySize - 1)
|
||||||
|
}, f.prototype.emsa_pss_encode = function(t, e) {
|
||||||
|
var r = this.options.signingSchemeOptions.hash || s,
|
||||||
|
i = this.options.signingSchemeOptions.mgf || a.eme_oaep_mgf1,
|
||||||
|
f = this.options.signingSchemeOptions.saltLength || 20,
|
||||||
|
u = a.digestLength[r],
|
||||||
|
c = Math.ceil(e / 8);
|
||||||
|
if (c < u + f + 2) throw new Error("Output length passed to emBits(" + e + ") is too small for the options specified(" + r + ", " + f + "). To fix this issue increase the value of emBits. (minimum size: " + (8 * u + 8 * f + 9) + ")");
|
||||||
|
var h = o.randomBytes(f),
|
||||||
|
p = n.alloc(8 + u + f);
|
||||||
|
p.fill(0, 0, 8), t.copy(p, 8), h.copy(p, 8 + t.length);
|
||||||
|
var l = o.createHash(r);
|
||||||
|
l.update(p), l = l.digest();
|
||||||
|
var y = n.alloc(c - h.length - u - 2);
|
||||||
|
y.fill(0);
|
||||||
|
var g = n.alloc(y.length + 1 + h.length);
|
||||||
|
y.copy(g), g[y.length] = 1, h.copy(g, y.length + 1);
|
||||||
|
for (var d = i(l, g.length, r), v = n.alloc(g.length), m = 0; m < d.length; m++) v[m] = g[m] ^ d[m];
|
||||||
|
var S = 8 * c - e,
|
||||||
|
_ = 255 ^ 255 >> 8 - S << 8 - S;
|
||||||
|
v[0] = v[0] & _;
|
||||||
|
var b = n.alloc(v.length + l.length + 1);
|
||||||
|
return v.copy(b, 0), l.copy(b, v.length), b[b.length - 1] = 188, b
|
||||||
|
}, f.prototype.emsa_pss_verify = function(t, e, r) {
|
||||||
|
var i = this.options.signingSchemeOptions.hash || s,
|
||||||
|
f = this.options.signingSchemeOptions.mgf || a.eme_oaep_mgf1,
|
||||||
|
u = this.options.signingSchemeOptions.saltLength || 20,
|
||||||
|
c = a.digestLength[i],
|
||||||
|
h = Math.ceil(r / 8);
|
||||||
|
if (h < c + u + 2 || 188 != e[e.length - 1]) return !1;
|
||||||
|
var p = n.alloc(h - c - 1);
|
||||||
|
e.copy(p, 0, 0, h - c - 1);
|
||||||
|
for (var l = 0, y = 0, g = 8 * h - r; y < g; y++) l |= 1 << 7 - y;
|
||||||
|
if (p[0] & l) return !1;
|
||||||
|
var d = e.slice(h - c - 1, h - 1),
|
||||||
|
v = f(d, p.length, i);
|
||||||
|
for (y = 0; y < p.length; y++) p[y] ^= v[y];
|
||||||
|
for (l = 255 ^ 255 >> 8 - (g = 8 * h - r) << 8 - g, p[0] = p[0] & l, y = 0; 0 === p[y] && y < p.length; y++);
|
||||||
|
if (1 != p[y]) return !1;
|
||||||
|
var m = p.slice(p.length - u),
|
||||||
|
S = n.alloc(8 + c + u);
|
||||||
|
S.fill(0, 0, 8), t.copy(S, 8), m.copy(S, 8 + t.length);
|
||||||
|
var _ = o.createHash(i);
|
||||||
|
return _.update(S), _ = _.digest(), d.toString("hex") === _.toString("hex")
|
||||||
|
}, new f(t, e)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
1768: (t, e, r) => {
|
||||||
|
t.exports = {
|
||||||
|
pkcs1: r(8290),
|
||||||
|
pkcs1_oaep: r(2487),
|
||||||
|
pss: r(4414),
|
||||||
|
isEncryption: function(e) {
|
||||||
|
return t.exports[e] && t.exports[e].isEncryption
|
||||||
|
},
|
||||||
|
isSignature: function(e) {
|
||||||
|
return t.exports[e] && t.exports[e].isSignature
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
8226: (t, e, r) => {
|
||||||
|
var n = r(5606);
|
||||||
|
r(3200), t.exports.linebrk = function(t, e) {
|
||||||
|
for (var r = "", n = 0; n + e < t.length;) r += t.substring(n, n + e) + "\n", n += e;
|
||||||
|
return r + t.substring(n, t.length)
|
||||||
|
}, t.exports.detectEnvironment = function() {
|
||||||
|
return "browser";
|
||||||
|
"undefined" == typeof window || !window || n && "node" === n.title ? "node" : "browser"
|
||||||
|
}, t.exports.get32IntFromBuffer = function(t, e) {
|
||||||
|
var r;
|
||||||
|
if (e = e || 0, (r = t.length - e) > 0) {
|
||||||
|
if (r >= 4) return t.readUIntBE(e, r);
|
||||||
|
for (var n = 0, i = e + r, o = 0; i > e; i--, o += 2) n += t[i - 1] * Math.pow(16, o);
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
return NaN
|
||||||
|
}, t.exports._ = {
|
||||||
|
isObject: function(t) {
|
||||||
|
var e = typeof t;
|
||||||
|
return !!t && ("object" == e || "function" == e)
|
||||||
|
},
|
||||||
|
isString: function(t) {
|
||||||
|
return "string" == typeof t || t instanceof String
|
||||||
|
},
|
||||||
|
isNumber: function(t) {
|
||||||
|
return "number" == typeof t || !isNaN(parseFloat(t)) && isFinite(t)
|
||||||
|
},
|
||||||
|
omit: function(t, e) {
|
||||||
|
var r = {};
|
||||||
|
for (var n in t) t.hasOwnProperty(n) && n !== e && (r[n] = t[n]);
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
}, t.exports.trimSurroundingText = function(t, e, r) {
|
||||||
|
var n = 0,
|
||||||
|
i = t.length,
|
||||||
|
o = t.indexOf(e);
|
||||||
|
o >= 0 && (n = o + e.length);
|
||||||
|
var s = t.indexOf(r, o);
|
||||||
|
return s >= 0 && (i = s), t.substring(n, i)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
8875: (t, e, r) => {
|
||||||
|
"use strict";
|
||||||
|
var n;
|
||||||
|
if (!Object.keys) {
|
||||||
|
var i = Object.prototype.hasOwnProperty,
|
||||||
|
o = Object.prototype.toString,
|
||||||
|
s = r(1093),
|
||||||
|
a = Object.prototype.propertyIsEnumerable,
|
||||||
|
f = !a.call({
|
||||||
|
toString: null
|
||||||
|
}, "toString"),
|
||||||
|
u = a.call((function() {}), "prototype"),
|
||||||
|
c = ["toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "constructor"],
|
||||||
|
h = function(t) {
|
||||||
|
var e = t.constructor;
|
||||||
|
return e && e.prototype === t
|
||||||
|
},
|
||||||
|
p = {
|
||||||
|
$applicationCache: !0,
|
||||||
|
$console: !0,
|
||||||
|
$external: !0,
|
||||||
|
$frame: !0,
|
||||||
|
$frameElement: !0,
|
||||||
|
$frames: !0,
|
||||||
|
$innerHeight: !0,
|
||||||
|
$innerWidth: !0,
|
||||||
|
$onmozfullscreenchange: !0,
|
||||||
|
$onmozfullscreenerror: !0,
|
||||||
|
$outerHeight: !0,
|
||||||
|
$outerWidth: !0,
|
||||||
|
$pageXOffset: !0,
|
||||||
|
$pageYOffset: !0,
|
||||||
|
$parent: !0,
|
||||||
|
$scrollLeft: !0,
|
||||||
|
$scrollTop: !0,
|
||||||
|
$scrollX: !0,
|
||||||
|
$scrollY: !0,
|
||||||
|
$self: !0,
|
||||||
|
$webkitIndexedDB: !0,
|
||||||
|
$webkitStorageInfo: !0,
|
||||||
|
$window: !0
|
||||||
|
},
|
||||||
|
l = function() {
|
||||||
|
if ("undefined" == typeof window) return !1;
|
||||||
|
for (var t in window) try {
|
||||||
|
if (!p["$" + t] && i.call(window, t) && null !== window[t] && "object" == typeof window[t]) try {
|
||||||
|
h(window[t])
|
||||||
|
} catch (t) {
|
||||||
|
return !0
|
||||||
|
}
|
||||||
|
} catch (t) {
|
||||||
|
return !0
|
||||||
|
}
|
||||||
|
return !1
|
||||||
|
}();
|
||||||
|
n = function(t) {
|
||||||
|
var e = null !== t && "object" == typeof t,
|
||||||
|
r = "[object Function]" === o.call(t),
|
||||||
|
n = s(t),
|
||||||
|
a = e && "[object String]" === o.call(t),
|
||||||
|
p = [];
|
||||||
|
if (!e && !r && !n) throw new TypeError("Object.keys called on a non-object");
|
||||||
|
var y = u && r;
|
||||||
|
if (a && t.length > 0 && !i.call(t, 0))
|
||||||
|
for (var g = 0; g < t.length; ++g) p.push(String(g));
|
||||||
|
if (n && t.length > 0)
|
||||||
|
for (var d = 0; d < t.length; ++d) p.push(String(d));
|
||||||
|
else
|
||||||
|
for (var v in t) y && "prototype" === v || !i.call(t, v) || p.push(String(v));
|
||||||
|
if (f)
|
||||||
|
for (var m = function(t) {
|
||||||
|
if ("undefined" == typeof window || !l) return h(t);
|
||||||
|
try {
|
||||||
|
return h(t)
|
||||||
|
} catch (t) {
|
||||||
|
return !1
|
||||||
|
}
|
||||||
|
}(t), S = 0; S < c.length; ++S) m && "constructor" === c[S] || !i.call(t, c[S]) || p.push(c[S]);
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t.exports = n
|
||||||
|
},
|
||||||
|
1189: (t, e, r) => {
|
||||||
|
"use strict";
|
||||||
|
var n = Array.prototype.slice,
|
||||||
|
i = r(1093),
|
||||||
|
o = Object.keys,
|
||||||
|
s = o ? function(t) {
|
||||||
|
return o(t)
|
||||||
|
} : r(8875),
|
||||||
|
a = Object.keys;
|
||||||
|
s.shim = function() {
|
||||||
|
if (Object.keys) {
|
||||||
|
var t = function() {
|
||||||
|
var t = Object.keys(arguments);
|
||||||
|
return t && t.length === arguments.length
|
||||||
|
}(1, 2);
|
||||||
|
t || (Object.keys = function(t) {
|
||||||
|
return i(t) ? a(n.call(t)) : a(t)
|
||||||
|
})
|
||||||
|
} else Object.keys = s;
|
||||||
|
return Object.keys || s
|
||||||
|
}, t.exports = s
|
||||||
|
},
|
||||||
|
1093: t => {
|
||||||
|
"use strict";
|
||||||
|
var e = Object.prototype.toString;
|
||||||
|
t.exports = function(t) {
|
||||||
|
var r = e.call(t),
|
||||||
|
n = "[object Arguments]" === r;
|
||||||
|
return n || (n = "[object Array]" !== r && null !== t && "object" == typeof t && "number" == typeof t.length && t.length >= 0 && "[object Function]" === e.call(t.callee)), n
|
||||||
|
}
|
||||||
|
},
|
||||||
|
8403: (t, e, r) => {
|
||||||
|
"use strict";
|
||||||
|
var n = r(1189),
|
||||||
|
i = r(1333)(),
|
||||||
|
o = r(8075),
|
||||||
|
s = Object,
|
||||||
|
a = o("Array.prototype.push"),
|
||||||
|
f = o("Object.prototype.propertyIsEnumerable"),
|
||||||
|
u = i ? Object.getOwnPropertySymbols : null;
|
||||||
|
t.exports = function(t, e) {
|
||||||
|
if (null == t) throw new TypeError("target must be an object");
|
||||||
|
var r = s(t);
|
||||||
|
if (1 === arguments.length) return r;
|
||||||
|
for (var o = 1; o < arguments.length; ++o) {
|
||||||
|
var c = s(arguments[o]),
|
||||||
|
h = n(c),
|
||||||
|
p = i && (Object.getOwnPropertySymbols || u);
|
||||||
|
if (p)
|
||||||
|
for (var l = p(c), y = 0; y < l.length; ++y) {
|
||||||
|
var g = l[y];
|
||||||
|
f(c, g) && a(h, g)
|
||||||
|
}
|
||||||
|
for (var d = 0; d < h.length; ++d) {
|
||||||
|
var v = h[d];
|
||||||
|
if (f(c, v)) {
|
||||||
|
var m = c[v];
|
||||||
|
r[v] = m
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
},
|
||||||
|
1514: (t, e, r) => {
|
||||||
|
"use strict";
|
||||||
|
var n = r(8403);
|
||||||
|
t.exports = function() {
|
||||||
|
return Object.assign ? function() {
|
||||||
|
if (!Object.assign) return !1;
|
||||||
|
for (var t = "abcdefghijklmnopqrst", e = t.split(""), r = {}, n = 0; n < e.length; ++n) r[e[n]] = e[n];
|
||||||
|
var i = Object.assign({}, r),
|
||||||
|
o = "";
|
||||||
|
for (var s in i) o += s;
|
||||||
|
return t !== o
|
||||||
|
}() || function() {
|
||||||
|
if (!Object.assign || !Object.preventExtensions) return !1;
|
||||||
|
var t = Object.preventExtensions({
|
||||||
|
1: 2
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
Object.assign(t, "xy")
|
||||||
|
} catch (e) {
|
||||||
|
return "y" === t[1]
|
||||||
|
}
|
||||||
|
return !1
|
||||||
|
}() ? n : Object.assign : n
|
||||||
|
}
|
||||||
|
},
|
||||||
|
5606: t => {
|
||||||
|
var e, r, n = t.exports = {};
|
||||||
|
|
||||||
|
function i() {
|
||||||
|
throw new Error("setTimeout has not been defined")
|
||||||
|
}
|
||||||
|
|
||||||
|
function o() {
|
||||||
|
throw new Error("clearTimeout has not been defined")
|
||||||
|
}
|
||||||
|
|
||||||
|
function s(t) {
|
||||||
|
if (e === setTimeout) return setTimeout(t, 0);
|
||||||
|
if ((e === i || !e) && setTimeout) return e = setTimeout, setTimeout(t, 0);
|
||||||
|
try {
|
||||||
|
return e(t, 0)
|
||||||
|
} catch (r) {
|
||||||
|
try {
|
||||||
|
return e.call(null, t, 0)
|
||||||
|
} catch (r) {
|
||||||
|
return e.call(this, t, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}! function() {
|
||||||
|
try {
|
||||||
|
e = "function" == typeof setTimeout ? setTimeout : i
|
||||||
|
} catch (t) {
|
||||||
|
e = i
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
r = "function" == typeof clearTimeout ? clearTimeout : o
|
||||||
|
} catch (t) {
|
||||||
|
r = o
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
var a, f = [],
|
||||||
|
u = !1,
|
||||||
|
c = -1;
|
||||||
|
|
||||||
|
function h() {
|
||||||
|
u && a && (u = !1, a.length ? f = a.concat(f) : c = -1, f.length && p())
|
||||||
|
}
|
||||||
|
|
||||||
|
function p() {
|
||||||
|
if (!u) {
|
||||||
|
var t = s(h);
|
||||||
|
u = !0;
|
||||||
|
for (var e = f.length; e;) {
|
||||||
|
for (a = f, f = []; ++c < e;) a && a[c].run();
|
||||||
|
c = -1, e = f.length
|
||||||
|
}
|
||||||
|
a = null, u = !1,
|
||||||
|
function(t) {
|
||||||
|
if (r === clearTimeout) return clearTimeout(t);
|
||||||
|
if ((r === o || !r) && clearTimeout) return r = clearTimeout, clearTimeout(t);
|
||||||
|
try {
|
||||||
|
return r(t)
|
||||||
|
} catch (e) {
|
||||||
|
try {
|
||||||
|
return r.call(null, t)
|
||||||
|
} catch (e) {
|
||||||
|
return r.call(this, t)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}(t)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function l(t, e) {
|
||||||
|
this.fun = t, this.array = e
|
||||||
|
}
|
||||||
|
|
||||||
|
function y() {}
|
||||||
|
n.nextTick = function(t) {
|
||||||
|
var e = new Array(arguments.length - 1);
|
||||||
|
if (arguments.length > 1)
|
||||||
|
for (var r = 1; r < arguments.length; r++) e[r - 1] = arguments[r];
|
||||||
|
f.push(new l(t, e)), 1 !== f.length || u || s(p)
|
||||||
|
}, l.prototype.run = function() {
|
||||||
|
this.fun.apply(null, this.array)
|
||||||
|
}, n.title = "browser", n.browser = !0, n.env = {}, n.argv = [], n.version = "", n.versions = {}, n.on = y, n.addListener = y, n.once = y, n.off = y, n.removeListener = y, n.removeAllListeners = y, n.emit = y, n.prependListener = y, n.prependOnceListener = y, n.listeners = function(t) {
|
||||||
|
return []
|
||||||
|
}, n.binding = function(t) {
|
||||||
|
throw new Error("process.binding is not supported")
|
||||||
|
}, n.cwd = function() {
|
||||||
|
return "/"
|
||||||
|
}, n.chdir = function(t) {
|
||||||
|
throw new Error("process.chdir is not supported")
|
||||||
|
}, n.umask = function() {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
4774: (t, e, r) => {
|
||||||
|
"use strict";
|
||||||
|
var n, i = r(5606),
|
||||||
|
o = r(8287),
|
||||||
|
s = o.Buffer,
|
||||||
|
a = {};
|
||||||
|
for (n in o) o.hasOwnProperty(n) && "SlowBuffer" !== n && "Buffer" !== n && (a[n] = o[n]);
|
||||||
|
var f = a.Buffer = {};
|
||||||
|
for (n in s) s.hasOwnProperty(n) && "allocUnsafe" !== n && "allocUnsafeSlow" !== n && (f[n] = s[n]);
|
||||||
|
if (a.Buffer.prototype = s.prototype, f.from && f.from !== Uint8Array.from || (f.from = function(t, e, r) {
|
||||||
|
if ("number" == typeof t) throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof t);
|
||||||
|
if (t && void 0 === t.length) throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof t);
|
||||||
|
return s(t, e, r)
|
||||||
|
}), f.alloc || (f.alloc = function(t, e, r) {
|
||||||
|
if ("number" != typeof t) throw new TypeError('The "size" argument must be of type number. Received type ' + typeof t);
|
||||||
|
if (t < 0 || t >= 2 * (1 << 30)) throw new RangeError('The value "' + t + '" is invalid for option "size"');
|
||||||
|
var n = s(t);
|
||||||
|
return e && 0 !== e.length ? "string" == typeof r ? n.fill(e, r) : n.fill(e) : n.fill(0), n
|
||||||
|
}), !a.kStringMaxLength) try {
|
||||||
|
a.kStringMaxLength = i.binding("buffer").kStringMaxLength
|
||||||
|
} catch (t) {}
|
||||||
|
a.constants || (a.constants = {
|
||||||
|
MAX_LENGTH: a.kMaxLength
|
||||||
|
}, a.kStringMaxLength && (a.constants.MAX_STRING_LENGTH = a.kStringMaxLength)), t.exports = a
|
||||||
|
},
|
||||||
|
6897: (t, e, r) => {
|
||||||
|
"use strict";
|
||||||
|
var n = r(453),
|
||||||
|
i = r(41),
|
||||||
|
o = r(592)(),
|
||||||
|
s = r(5795),
|
||||||
|
a = r(9675),
|
||||||
|
f = n("%Math.floor%");
|
||||||
|
t.exports = function(t, e) {
|
||||||
|
if ("function" != typeof t) throw new a("`fn` is not a function");
|
||||||
|
if ("number" != typeof e || e < 0 || e > 4294967295 || f(e) !== e) throw new a("`length` must be a positive 32-bit integer");
|
||||||
|
var r = arguments.length > 2 && !!arguments[2],
|
||||||
|
n = !0,
|
||||||
|
u = !0;
|
||||||
|
if ("length" in t && s) {
|
||||||
|
var c = s(t, "length");
|
||||||
|
c && !c.configurable && (n = !1), c && !c.writable && (u = !1)
|
||||||
|
}
|
||||||
|
return (n || u || !r) && (o ? i(t, "length", e, !0, !0) : i(t, "length", e)), t
|
||||||
|
}
|
||||||
|
},
|
||||||
|
3200: (t, e, r) => {
|
||||||
|
var n = r(8287).Buffer,
|
||||||
|
i = r(1396),
|
||||||
|
o = {
|
||||||
|
randomBytes: function(t) {
|
||||||
|
for (var e = [], r = 0; r < t; r++) e.push(Math.floor(256 * Math.random()));
|
||||||
|
return n.from(e)
|
||||||
|
},
|
||||||
|
createHash(t) {
|
||||||
|
let e = n.from([]);
|
||||||
|
return {
|
||||||
|
update: function(t) {
|
||||||
|
return e = n.concat([e, t]), this
|
||||||
|
},
|
||||||
|
digest: function() {
|
||||||
|
let r = i[t.toUpperCase()](i.lib.WordArray.create(new Uint8Array(e))).toString();
|
||||||
|
return n.from(r, "hex")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
t.exports = o
|
||||||
|
},
|
||||||
|
7033: (t, e, r) => {
|
||||||
|
var n = r(8287).Buffer;
|
||||||
|
const i = r(3229);
|
||||||
|
let o = {
|
||||||
|
outputEncoding: "",
|
||||||
|
PublicFormat: "pkcs1-public",
|
||||||
|
PrivateFormat: "pkcs1-private",
|
||||||
|
options: {
|
||||||
|
environment: "browser",
|
||||||
|
encryptionScheme: "pkcs1"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
t.exports = {
|
||||||
|
NodeRSA: i,
|
||||||
|
encryptRSAWithPublicKey: function(t, e, r = {}) {
|
||||||
|
return r = Object.assign({}, o, r), new i(e, r.PublicFormat, r.options).encrypt(t, r.outEncoding || "base64")
|
||||||
|
},
|
||||||
|
encryptRSAWithPrivateKey: function(t, e, r = {}) {
|
||||||
|
return r = Object.assign({}, o, r), new i(e, r.PrivateFormat, r.options).encryptPrivate(t, r.outputEncoding || "base64")
|
||||||
|
},
|
||||||
|
decryptRSAWithPublicKey: function(t, e, r = {}) {
|
||||||
|
return r = Object.assign({}, o, r), new i(e, r.PublicEncoding, r.options).decryptPublic(t, r.outEncoding || "utf8")
|
||||||
|
},
|
||||||
|
decryptRSAWithPrivateKey: function(t, e, r = {}) {
|
||||||
|
return r = Object.assign({}, o, r), new i(e, r.PrivateEncoding, r.options).decrypt(t, r.outEncoding || "utf8")
|
||||||
|
},
|
||||||
|
sign: function(t, e, r = {}) {
|
||||||
|
return r = Object.assign({}, o, r), new i(e, r.PrivateEncoding, r.options).sign(t, r.outEncoding || "base64")
|
||||||
|
},
|
||||||
|
verify: function(t, e, r, s = {}) {
|
||||||
|
return "string" == typeof e && e.match(/^([0-9a-fA-F]{2})*$/) ? e = n.from(e, "hex") : "string" == typeof e && (e = n.from(e, "base64")), s = Object.assign({}, o, s), new i(r, s.PublicEncoding, s.options).verify(t, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
7449: t => {
|
||||||
|
"use strict";
|
||||||
|
t.exports = JSON.parse('{"O_RDONLY":0,"O_WRONLY":1,"O_RDWR":2,"S_IFMT":61440,"S_IFREG":32768,"S_IFDIR":16384,"S_IFCHR":8192,"S_IFBLK":24576,"S_IFIFO":4096,"S_IFLNK":40960,"S_IFSOCK":49152,"O_CREAT":512,"O_EXCL":2048,"O_NOCTTY":131072,"O_TRUNC":1024,"O_APPEND":8,"O_DIRECTORY":1048576,"O_NOFOLLOW":256,"O_SYNC":128,"O_SYMLINK":2097152,"O_NONBLOCK":4,"S_IRWXU":448,"S_IRUSR":256,"S_IWUSR":128,"S_IXUSR":64,"S_IRWXG":56,"S_IRGRP":32,"S_IWGRP":16,"S_IXGRP":8,"S_IRWXO":7,"S_IROTH":4,"S_IWOTH":2,"S_IXOTH":1,"E2BIG":7,"EACCES":13,"EADDRINUSE":48,"EADDRNOTAVAIL":49,"EAFNOSUPPORT":47,"EAGAIN":35,"EALREADY":37,"EBADF":9,"EBADMSG":94,"EBUSY":16,"ECANCELED":89,"ECHILD":10,"ECONNABORTED":53,"ECONNREFUSED":61,"ECONNRESET":54,"EDEADLK":11,"EDESTADDRREQ":39,"EDOM":33,"EDQUOT":69,"EEXIST":17,"EFAULT":14,"EFBIG":27,"EHOSTUNREACH":65,"EIDRM":90,"EILSEQ":92,"EINPROGRESS":36,"EINTR":4,"EINVAL":22,"EIO":5,"EISCONN":56,"EISDIR":21,"ELOOP":62,"EMFILE":24,"EMLINK":31,"EMSGSIZE":40,"EMULTIHOP":95,"ENAMETOOLONG":63,"ENETDOWN":50,"ENETRESET":52,"ENETUNREACH":51,"ENFILE":23,"ENOBUFS":55,"ENODATA":96,"ENODEV":19,"ENOENT":2,"ENOEXEC":8,"ENOLCK":77,"ENOLINK":97,"ENOMEM":12,"ENOMSG":91,"ENOPROTOOPT":42,"ENOSPC":28,"ENOSR":98,"ENOSTR":99,"ENOSYS":78,"ENOTCONN":57,"ENOTDIR":20,"ENOTEMPTY":66,"ENOTSOCK":38,"ENOTSUP":45,"ENOTTY":25,"ENXIO":6,"EOPNOTSUPP":102,"EOVERFLOW":84,"EPERM":1,"EPIPE":32,"EPROTO":100,"EPROTONOSUPPORT":43,"EPROTOTYPE":41,"ERANGE":34,"EROFS":30,"ESPIPE":29,"ESRCH":3,"ESTALE":70,"ETIME":101,"ETIMEDOUT":60,"ETXTBSY":26,"EWOULDBLOCK":35,"EXDEV":18,"SIGHUP":1,"SIGINT":2,"SIGQUIT":3,"SIGILL":4,"SIGTRAP":5,"SIGABRT":6,"SIGIOT":6,"SIGBUS":10,"SIGFPE":8,"SIGKILL":9,"SIGUSR1":30,"SIGSEGV":11,"SIGUSR2":31,"SIGPIPE":13,"SIGALRM":14,"SIGTERM":15,"SIGCHLD":20,"SIGCONT":19,"SIGSTOP":17,"SIGTSTP":18,"SIGTTIN":21,"SIGTTOU":22,"SIGURG":16,"SIGXCPU":24,"SIGXFSZ":25,"SIGVTALRM":26,"SIGPROF":27,"SIGWINCH":28,"SIGIO":23,"SIGSYS":12,"SSL_OP_ALL":2147486719,"SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION":262144,"SSL_OP_CIPHER_SERVER_PREFERENCE":4194304,"SSL_OP_CISCO_ANYCONNECT":32768,"SSL_OP_COOKIE_EXCHANGE":8192,"SSL_OP_CRYPTOPRO_TLSEXT_BUG":2147483648,"SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS":2048,"SSL_OP_EPHEMERAL_RSA":0,"SSL_OP_LEGACY_SERVER_CONNECT":4,"SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER":32,"SSL_OP_MICROSOFT_SESS_ID_BUG":1,"SSL_OP_MSIE_SSLV2_RSA_PADDING":0,"SSL_OP_NETSCAPE_CA_DN_BUG":536870912,"SSL_OP_NETSCAPE_CHALLENGE_BUG":2,"SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG":1073741824,"SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG":8,"SSL_OP_NO_COMPRESSION":131072,"SSL_OP_NO_QUERY_MTU":4096,"SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION":65536,"SSL_OP_NO_SSLv2":16777216,"SSL_OP_NO_SSLv3":33554432,"SSL_OP_NO_TICKET":16384,"SSL_OP_NO_TLSv1":67108864,"SSL_OP_NO_TLSv1_1":268435456,"SSL_OP_NO_TLSv1_2":134217728,"SSL_OP_PKCS1_CHECK_1":0,"SSL_OP_PKCS1_CHECK_2":0,"SSL_OP_SINGLE_DH_USE":1048576,"SSL_OP_SINGLE_ECDH_USE":524288,"SSL_OP_SSLEAY_080_CLIENT_DH_BUG":128,"SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG":0,"SSL_OP_TLS_BLOCK_PADDING_BUG":512,"SSL_OP_TLS_D5_BUG":256,"SSL_OP_TLS_ROLLBACK_BUG":8388608,"ENGINE_METHOD_DSA":2,"ENGINE_METHOD_DH":4,"ENGINE_METHOD_RAND":8,"ENGINE_METHOD_ECDH":16,"ENGINE_METHOD_ECDSA":32,"ENGINE_METHOD_CIPHERS":64,"ENGINE_METHOD_DIGESTS":128,"ENGINE_METHOD_STORE":256,"ENGINE_METHOD_PKEY_METHS":512,"ENGINE_METHOD_PKEY_ASN1_METHS":1024,"ENGINE_METHOD_ALL":65535,"ENGINE_METHOD_NONE":0,"DH_CHECK_P_NOT_SAFE_PRIME":2,"DH_CHECK_P_NOT_PRIME":1,"DH_UNABLE_TO_CHECK_GENERATOR":4,"DH_NOT_SUITABLE_GENERATOR":8,"NPN_ENABLED":1,"RSA_PKCS1_PADDING":1,"RSA_SSLV23_PADDING":2,"RSA_NO_PADDING":3,"RSA_PKCS1_OAEP_PADDING":4,"RSA_X931_PADDING":5,"RSA_PKCS1_PSS_PADDING":6,"POINT_CONVERSION_COMPRESSED":2,"POINT_CONVERSION_UNCOMPRESSED":4,"POINT_CONVERSION_HYBRID":6,"F_OK":0,"R_OK":4,"W_OK":2,"X_OK":1,"UV_UDP_REUSEADDR":4}')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
e = {};
|
||||||
|
|
||||||
|
function r(n) {
|
||||||
|
var i = e[n];
|
||||||
|
if (void 0 !== i) return i.exports;
|
||||||
|
var o = e[n] = {
|
||||||
|
exports: {}
|
||||||
|
};
|
||||||
|
return t[n].call(o.exports, o, o.exports, r), o.exports
|
||||||
|
}
|
||||||
|
return r.g = function() {
|
||||||
|
if ("object" == typeof globalThis) return globalThis;
|
||||||
|
try {
|
||||||
|
return this || new Function("return this")()
|
||||||
|
} catch (t) {
|
||||||
|
if ("object" == typeof window) return window
|
||||||
|
}
|
||||||
|
}(), r(7033)
|
||||||
|
})()));
|
||||||
@@ -0,0 +1,429 @@
|
|||||||
|
if (typeof Object.assign !== 'function') {
|
||||||
|
Object.assign = function() {
|
||||||
|
let target = arguments[0];
|
||||||
|
for (let i = 1; i < arguments.length; i++) {
|
||||||
|
let source = arguments[i];
|
||||||
|
for (let key in source) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||||
|
target[key] = source[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// 通用免嗅探播放
|
||||||
|
let common_lazy = `js:
|
||||||
|
let html = request(input);
|
||||||
|
let hconf = html.match(/r player_.*?=(.*?)</)[1];
|
||||||
|
let json = JSON5.parse(hconf);
|
||||||
|
let url = json.url;
|
||||||
|
if (json.encrypt == '1') {
|
||||||
|
url = unescape(url);
|
||||||
|
} else if (json.encrypt == '2') {
|
||||||
|
url = unescape(base64Decode(url));
|
||||||
|
}
|
||||||
|
if (/\\.(m3u8|mp4|m4a|mp3)/.test(url)) {
|
||||||
|
input = {
|
||||||
|
parse: 0,
|
||||||
|
jx: 0,
|
||||||
|
url: url,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
input = url && url.startsWith('http') && tellIsJx(url) ? {parse:0,jx:1,url:url}:input;
|
||||||
|
}`;
|
||||||
|
// 默认嗅探播放
|
||||||
|
|
||||||
|
let def_lazy = `js:
|
||||||
|
input = { parse: 1, url: input, js: '' };`;
|
||||||
|
// 采集站播放
|
||||||
|
|
||||||
|
let cj_lazy = `js:
|
||||||
|
if (/\\.(m3u8|mp4)/.test(input)) {
|
||||||
|
input = { parse: 0, url: input };
|
||||||
|
} else {
|
||||||
|
if (rule.parse_url.startsWith('json:')) {
|
||||||
|
let purl = rule.parse_url.replace('json:', '') + input;
|
||||||
|
let html = request(purl);
|
||||||
|
let json = JSON.parse(html);
|
||||||
|
if (json.url) {
|
||||||
|
input = { parse: 0, url: json.url };
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
input = rule.parse_url + input;
|
||||||
|
}
|
||||||
|
}`;
|
||||||
|
|
||||||
|
function getMubans() {
|
||||||
|
const mubanDict = { // 模板字典
|
||||||
|
mx: {
|
||||||
|
title: '',
|
||||||
|
host: '',
|
||||||
|
url: '/vodshow/fyclass--------fypage---/',
|
||||||
|
searchUrl: '/vodsearch/**----------fypage---/',
|
||||||
|
class_parse: '.top_nav li;a&&Text;a&&href;.*/(.*?)/',
|
||||||
|
searchable: 2,
|
||||||
|
quickSearch: 0,
|
||||||
|
filterable: 0,
|
||||||
|
headers: {
|
||||||
|
'User-Agent': 'MOBILE_UA',
|
||||||
|
},
|
||||||
|
play_parse: true,
|
||||||
|
lazy: common_lazy,
|
||||||
|
limit: 6,
|
||||||
|
double: true,
|
||||||
|
推荐: '.cbox_list;*;*;*;*;*',
|
||||||
|
一级: 'ul.vodlist li;a&&title;a&&data-original;.pic_text&&Text;a&&href',
|
||||||
|
二级: {
|
||||||
|
title: 'h2&&Text;.content_detail:eq(1)&&li&&a:eq(2)&&Text',
|
||||||
|
img: '.vodlist_thumb&&data-original',
|
||||||
|
desc: '.content_detail:eq(1)&&li:eq(1)&&Text;.content_detail:eq(1)&&li&&a&&Text;.content_detail:eq(1)&&li&&a:eq(1)&&Text;.content_detail:eq(1)&&li:eq(2)&&Text;.content_detail:eq(1)&&li:eq(3)&&Text',
|
||||||
|
content: '.content_desc&&span&&Text',
|
||||||
|
tabs: '.play_source_tab&&a',
|
||||||
|
lists: '.content_playlist:eq(#id) li',
|
||||||
|
},
|
||||||
|
搜索: '*',
|
||||||
|
},
|
||||||
|
mxpro: {
|
||||||
|
title: '',
|
||||||
|
host: '', // homeUrl:'/',
|
||||||
|
url: '/vodshow/fyclass--------fypage---.html',
|
||||||
|
searchUrl: '/vodsearch/**----------fypage---.html',
|
||||||
|
searchable: 2, //是否启用全局搜索,
|
||||||
|
quickSearch: 0, //是否启用快速搜索,
|
||||||
|
filterable: 0, //是否启用分类筛选,
|
||||||
|
headers: { //网站的请求头,完整支持所有的,常带ua和cookies
|
||||||
|
'User-Agent': 'MOBILE_UA', // "Cookie": "searchneed=ok"
|
||||||
|
},
|
||||||
|
class_parse: '.navbar-items li:gt(0):lt(10);a&&Text;a&&href;/(\\d+)',
|
||||||
|
play_parse: true,
|
||||||
|
lazy: common_lazy,
|
||||||
|
limit: 6,
|
||||||
|
double: true, // 推荐内容是否双层定位
|
||||||
|
推荐: '.tab-list.active;a.module-poster-item.module-item;.module-poster-item-title&&Text;.lazyload&&data-original;.module-item-note&&Text;a&&href',
|
||||||
|
一级: 'body a.module-poster-item.module-item;a&&title;.lazyload&&data-original;.module-item-note&&Text;a&&href',
|
||||||
|
二级: {
|
||||||
|
title: 'h1&&Text;.module-info-tag-link:eq(-1)&&Text',
|
||||||
|
img: '.lazyload&&data-original||data-src||src',
|
||||||
|
desc: '.module-info-item:eq(-2)&&Text;.module-info-tag-link&&Text;.module-info-tag-link:eq(1)&&Text;.module-info-item:eq(2)&&Text;.module-info-item:eq(1)&&Text',
|
||||||
|
content: '.module-info-introduction&&Text',
|
||||||
|
tabs: '.module-tab-item',
|
||||||
|
lists: '.module-play-list:eq(#id) a',
|
||||||
|
tab_text: 'div--small&&Text',
|
||||||
|
},
|
||||||
|
搜索: 'body .module-item;.module-card-item-title&&Text;.lazyload&&data-original;.module-item-note&&Text;a&&href;.module-info-item-content&&Text',
|
||||||
|
},
|
||||||
|
mxone5: {
|
||||||
|
title: '',
|
||||||
|
host: '',
|
||||||
|
url: '/show/fyclass--------fypage---.html',
|
||||||
|
searchUrl: '/search/**----------fypage---.html',
|
||||||
|
searchable: 2, //是否启用全局搜索,
|
||||||
|
quickSearch: 0, //是否启用快速搜索,
|
||||||
|
filterable: 0, //是否启用分类筛选,
|
||||||
|
class_parse: '.nav-menu-items&&li;a&&Text;a&&href;.*/(.*?)\.html',
|
||||||
|
play_parse: true,
|
||||||
|
lazy: common_lazy,
|
||||||
|
limit: 6,
|
||||||
|
double: true, // 推荐内容是否双层定位
|
||||||
|
推荐: '.module-list;.module-items&&.module-item;a&&title;img&&data-src;.module-item-text&&Text;a&&href',
|
||||||
|
一级: '.module-items .module-item;a&&title;img&&data-src;.module-item-text&&Text;a&&href',
|
||||||
|
二级: {
|
||||||
|
title: 'h1&&Text;.tag-link&&Text',
|
||||||
|
img: '.module-item-pic&&img&&data-src',
|
||||||
|
desc: '.video-info-items:eq(3)&&Text;.tag-link:eq(2)&&Text;.tag-link:eq(1)&&Text;.video-info-items:eq(1)&&Text;.video-info-items:eq(0)&&Text',
|
||||||
|
content: '.vod_content&&Text',
|
||||||
|
tabs: '.module-tab-item',
|
||||||
|
lists: '.module-player-list:eq(#id)&&.scroll-content&&a',
|
||||||
|
tab_text: 'div--small&&Text',
|
||||||
|
},
|
||||||
|
搜索: '.module-items .module-search-item;a&&title;img&&data-src;.video-serial&&Text;a&&href',
|
||||||
|
},
|
||||||
|
首图: {
|
||||||
|
title: '',
|
||||||
|
host: '',
|
||||||
|
url: '/vodshow/fyclass--------fypage---/',
|
||||||
|
searchUrl: '/vodsearch/**----------fypage---.html',
|
||||||
|
searchable: 2, //是否启用全局搜索,
|
||||||
|
quickSearch: 0, //是否启用快速搜索,
|
||||||
|
filterable: 0, //是否启用分类筛选,
|
||||||
|
headers: { //网站的请求头,完整支持所有的,常带ua和cookies
|
||||||
|
'User-Agent': 'MOBILE_UA', // "Cookie": "searchneed=ok"
|
||||||
|
},
|
||||||
|
class_parse: '.myui-header__menu li.hidden-sm:gt(0):lt(7);a&&Text;a&&href;/(\\d+).html',
|
||||||
|
play_parse: true,
|
||||||
|
lazy: common_lazy,
|
||||||
|
limit: 6,
|
||||||
|
double: true, // 推荐内容是否双层定位
|
||||||
|
推荐: 'ul.myui-vodlist.clearfix;li;a&&title;a&&data-original;.pic-text&&Text;a&&href',
|
||||||
|
一级: '.myui-vodlist li;a&&title;a&&data-original;.pic-text&&Text;a&&href',
|
||||||
|
二级: {
|
||||||
|
title: '.myui-content__detail .title--span&&Text;.myui-content__detail p.data:eq(3)&&Text',
|
||||||
|
img: '.myui-content__thumb .lazyload&&data-original',
|
||||||
|
desc: '.myui-content__detail p.otherbox&&Text;.year&&Text;.myui-content__detail p.data:eq(4)&&Text;.myui-content__detail p.data:eq(2)&&Text;.myui-content__detail p.data:eq(0)&&Text',
|
||||||
|
content: '.content&&Text',
|
||||||
|
tabs: '.myui-panel__head&&li',
|
||||||
|
// tabs: '.nav-tabs&&li',
|
||||||
|
lists: '.myui-content__list:eq(#id) li',
|
||||||
|
},
|
||||||
|
搜索: '#searchList li;a&&title;.lazyload&&data-original;.pic-text&&Text;a&&href;.detail&&Text',
|
||||||
|
},
|
||||||
|
首图2: {
|
||||||
|
title: '',
|
||||||
|
host: '',
|
||||||
|
url: '/list/fyclass-fypage.html',
|
||||||
|
searchUrl: '/vodsearch/**----------fypage---.html',
|
||||||
|
searchable: 2, //是否启用全局搜索,
|
||||||
|
quickSearch: 0, //是否启用快速搜索,
|
||||||
|
filterable: 0, //是否启用分类筛选,
|
||||||
|
headers: {
|
||||||
|
'User-Agent': 'UC_UA', // "Cookie": ""
|
||||||
|
},
|
||||||
|
class_parse: '.stui-header__menu li:gt(0):lt(7);a&&Text;a&&href;.*/(.*?).html',
|
||||||
|
play_parse: true,
|
||||||
|
lazy: common_lazy,
|
||||||
|
limit: 6,
|
||||||
|
double: true, // 推荐内容是否双层定位
|
||||||
|
推荐: 'ul.stui-vodlist.clearfix;li;a&&title;.lazyload&&data-original;.pic-text&&Text;a&&href',
|
||||||
|
一级: '.stui-vodlist li;a&&title;a&&data-original;.pic-text&&Text;a&&href',
|
||||||
|
二级: {
|
||||||
|
title: '.stui-content__detail .title&&Text;.stui-content__detail&&p:eq(-2)&&a&&Text',
|
||||||
|
title1: '.stui-content__detail .title&&Text;.stui-content__detail&&p&&Text',
|
||||||
|
img: '.stui-content__thumb .lazyload&&data-original',
|
||||||
|
desc: '.stui-content__detail p&&Text;.stui-content__detail&&p:eq(-2)&&a:eq(2)&&Text;.stui-content__detail&&p:eq(-2)&&a:eq(1)&&Text;.stui-content__detail p:eq(2)&&Text;.stui-content__detail p:eq(1)&&Text',
|
||||||
|
desc1: '.stui-content__detail p:eq(4)&&Text;;;.stui-content__detail p:eq(1)&&Text',
|
||||||
|
content: '.detail&&Text',
|
||||||
|
tabs: '.stui-pannel__head h3',
|
||||||
|
tabs1: '.stui-vodlist__head h3',
|
||||||
|
lists: '.stui-content__playlist:eq(#id) li',
|
||||||
|
},
|
||||||
|
搜索: 'ul.stui-vodlist__media,ul.stui-vodlist,#searchList li;a&&title;.lazyload&&data-original;.pic-text&&Text;a&&href;.detail&&Text',
|
||||||
|
},
|
||||||
|
默认: {
|
||||||
|
title: '',
|
||||||
|
host: '',
|
||||||
|
url: '',
|
||||||
|
searchUrl: '',
|
||||||
|
searchable: 2,
|
||||||
|
quickSearch: 0,
|
||||||
|
filterable: 0,
|
||||||
|
filter: '',
|
||||||
|
filter_url: '',
|
||||||
|
filter_def: {},
|
||||||
|
headers: {
|
||||||
|
'User-Agent': 'MOBILE_UA',
|
||||||
|
},
|
||||||
|
timeout: 5000,
|
||||||
|
class_parse: '#side-menu li;a&&Text;a&&href;/(.*?)\.html',
|
||||||
|
cate_exclude: '',
|
||||||
|
play_parse: true,
|
||||||
|
lazy: def_lazy,
|
||||||
|
double: true,
|
||||||
|
推荐: '列表1;列表2;标题;图片;描述;链接;详情',
|
||||||
|
一级: '列表;标题;图片;描述;链接;详情',
|
||||||
|
二级: {
|
||||||
|
title: 'vod_name;vod_type',
|
||||||
|
img: '图片链接',
|
||||||
|
desc: '主要信息;年代;地区;演员;导演',
|
||||||
|
content: '简介',
|
||||||
|
tabs: '',
|
||||||
|
lists: 'xx:eq(#id)&&a',
|
||||||
|
tab_text: 'body&&Text',
|
||||||
|
list_text: 'body&&Text',
|
||||||
|
list_url: 'a&&href',
|
||||||
|
},
|
||||||
|
搜索: '列表;标题;图片;描述;链接;详情',
|
||||||
|
},
|
||||||
|
vfed: {
|
||||||
|
title: '',
|
||||||
|
host: '',
|
||||||
|
url: '/index.php/vod/show/id/fyclass/page/fypage.html',
|
||||||
|
searchUrl: '/index.php/vod/search/page/fypage/wd/**.html',
|
||||||
|
searchable: 2, //是否启用全局搜索,
|
||||||
|
quickSearch: 0, //是否启用快速搜索,
|
||||||
|
filterable: 0, //是否启用分类筛选,
|
||||||
|
headers: {
|
||||||
|
'User-Agent': 'UC_UA',
|
||||||
|
},
|
||||||
|
class_parse: '.fed-pops-navbar&&ul.fed-part-rows&&a;a&&Text;a&&href;.*/(.*?).html',
|
||||||
|
play_parse: true,
|
||||||
|
lazy: common_lazy,
|
||||||
|
limit: 6,
|
||||||
|
double: true, // 推荐内容是否双层定位
|
||||||
|
推荐: 'ul.fed-list-info.fed-part-rows;li;a.fed-list-title&&Text;a&&data-original;.fed-list-remarks&&Text;a&&href',
|
||||||
|
一级: '.fed-list-info&&li;a.fed-list-title&&Text;a&&data-original;.fed-list-remarks&&Text;a&&href',
|
||||||
|
二级: {
|
||||||
|
title: 'h1.fed-part-eone&&Text;.fed-deta-content&&.fed-part-rows&&li&&Text',
|
||||||
|
img: '.fed-list-info&&a&&data-original',
|
||||||
|
desc: '.fed-deta-content&&.fed-part-rows&&li:eq(1)&&Text;.fed-deta-content&&.fed-part-rows&&li:eq(2)&&Text;.fed-deta-content&&.fed-part-rows&&li:eq(3)&&Text',
|
||||||
|
content: '.fed-part-esan&&Text',
|
||||||
|
tabs: '.fed-drop-boxs&&.fed-part-rows&&li',
|
||||||
|
lists: '.fed-play-item:eq(#id)&&ul:eq(1)&&li',
|
||||||
|
},
|
||||||
|
搜索: '.fed-deta-info;h1&&Text;.lazyload&&data-original;.fed-list-remarks&&Text;a&&href;.fed-deta-content&&Text',
|
||||||
|
},
|
||||||
|
海螺3: {
|
||||||
|
title: '',
|
||||||
|
host: '',
|
||||||
|
searchUrl: '/v_search/**----------fypage---.html',
|
||||||
|
url: '/vod_____show/fyclass--------fypage---.html',
|
||||||
|
headers: {
|
||||||
|
'User-Agent': 'MOBILE_UA',
|
||||||
|
},
|
||||||
|
timeout: 5000,
|
||||||
|
class_parse: 'body&&.hl-nav li:gt(0);a&&Text;a&&href;.*/(.*?).html',
|
||||||
|
cate_exclude: '明星|专题|最新|排行',
|
||||||
|
limit: 40,
|
||||||
|
play_parse: true,
|
||||||
|
lazy: common_lazy,
|
||||||
|
double: true,
|
||||||
|
推荐: '.hl-vod-list;li;a&&title;a&&data-original;.remarks&&Text;a&&href',
|
||||||
|
一级: '.hl-vod-list&&.hl-list-item;a&&title;a&&data-original;.remarks&&Text;a&&href',
|
||||||
|
二级: {
|
||||||
|
title: '.hl-dc-title&&Text;.hl-dc-content&&li:eq(6)&&Text',
|
||||||
|
img: '.hl-lazy&&data-original',
|
||||||
|
desc: '.hl-dc-content&&li:eq(10)&&Text;.hl-dc-content&&li:eq(4)&&Text;.hl-dc-content&&li:eq(5)&&Text;.hl-dc-content&&li:eq(2)&&Text;.hl-dc-content&&li:eq(3)&&Text',
|
||||||
|
content: '.hl-content-text&&Text',
|
||||||
|
tabs: '.hl-tabs&&a',
|
||||||
|
tab_text: 'a--span&&Text',
|
||||||
|
lists: '.hl-plays-list:eq(#id)&&li',
|
||||||
|
},
|
||||||
|
搜索: '.hl-list-item;a&&title;a&&data-original;.remarks&&Text;a&&href',
|
||||||
|
searchable: 2, //是否启用全局搜索,
|
||||||
|
quickSearch: 0, //是否启用快速搜索,
|
||||||
|
filterable: 0, //是否启用分类筛选,
|
||||||
|
},
|
||||||
|
海螺2: {
|
||||||
|
title: '',
|
||||||
|
host: '',
|
||||||
|
searchUrl: '/index.php/vod/search/page/fypage/wd/**/',
|
||||||
|
url: '/index.php/vod/show/id/fyclass/page/fypage/',
|
||||||
|
headers: {
|
||||||
|
'User-Agent': 'MOBILE_UA',
|
||||||
|
},
|
||||||
|
timeout: 5000,
|
||||||
|
class_parse: '#nav-bar li;a&&Text;a&&href;id/(.*?)/',
|
||||||
|
limit: 40,
|
||||||
|
play_parse: true,
|
||||||
|
lazy: common_lazy,
|
||||||
|
double: true,
|
||||||
|
推荐: '.list-a.size;li;a&&title;.lazy&&data-original;.bt&&Text;a&&href',
|
||||||
|
一级: '.list-a&&li;a&&title;.lazy&&data-original;.list-remarks&&Text;a&&href',
|
||||||
|
二级: {
|
||||||
|
title: 'h2&&Text;.deployment&&Text',
|
||||||
|
img: '.lazy&&data-original',
|
||||||
|
desc: '.deployment&&Text',
|
||||||
|
content: '.ec-show&&Text',
|
||||||
|
tabs: '#tag&&a',
|
||||||
|
lists: '.play_list_box:eq(#id)&&li',
|
||||||
|
},
|
||||||
|
搜索: '.search-list;a&&title;.lazy&&data-original;.deployment&&Text;a&&href',
|
||||||
|
searchable: 2, //是否启用全局搜索,
|
||||||
|
quickSearch: 0, //是否启用快速搜索,
|
||||||
|
filterable: 0, //是否启用分类筛选,
|
||||||
|
},
|
||||||
|
短视: {
|
||||||
|
title: '',
|
||||||
|
host: '', // homeUrl:'/',
|
||||||
|
url: '/channel/fyclass-fypage.html',
|
||||||
|
searchUrl: '/search.html?wd=**',
|
||||||
|
searchable: 2, //是否启用全局搜索,
|
||||||
|
quickSearch: 0, //是否启用快速搜索,
|
||||||
|
filterable: 0, //是否启用分类筛选,
|
||||||
|
headers: { //网站的请求头,完整支持所有的,常带ua和cookies
|
||||||
|
'User-Agent': 'MOBILE_UA', // "Cookie": "searchneed=ok"
|
||||||
|
},
|
||||||
|
class_parse: '.menu_bottom ul li;a&&Text;a&&href;.*/(.*?).html',
|
||||||
|
cate_exclude: '解析|动态',
|
||||||
|
play_parse: true,
|
||||||
|
lazy: common_lazy,
|
||||||
|
limit: 6,
|
||||||
|
double: true, // 推荐内容是否双层定位
|
||||||
|
推荐: '.indexShowBox;ul&&li;a&&title;img&&data-src;.s1&&Text;a&&href',
|
||||||
|
一级: '.pic-list&&li;a&&title;img&&data-src;.s1&&Text;a&&href',
|
||||||
|
二级: {
|
||||||
|
title: 'h1&&Text;.content-rt&&p:eq(0)&&Text',
|
||||||
|
img: '.img&&img&&data-src',
|
||||||
|
desc: '.content-rt&&p:eq(1)&&Text;.content-rt&&p:eq(2)&&Text;.content-rt&&p:eq(3)&&Text;.content-rt&&p:eq(4)&&Text;.content-rt&&p:eq(5)&&Text',
|
||||||
|
content: '.zkjj_a&&Text',
|
||||||
|
tabs: '.py-tabs&&option',
|
||||||
|
lists: '.player:eq(#id) li',
|
||||||
|
},
|
||||||
|
搜索: '.sr_lists&&ul&&li;h3&&Text;img&&data-src;.int&&p:eq(0)&&Text;a&&href',
|
||||||
|
},
|
||||||
|
短视2: {
|
||||||
|
title: '',
|
||||||
|
host: '',
|
||||||
|
class_name: '电影&电视剧&综艺&动漫',
|
||||||
|
class_url: '1&2&3&4',
|
||||||
|
searchUrl: '/index.php/ajax/suggest?mid=1&wd=**&limit=50',
|
||||||
|
searchable: 2,
|
||||||
|
quickSearch: 0,
|
||||||
|
headers: {
|
||||||
|
'User-Agent': 'MOBILE_UA'
|
||||||
|
},
|
||||||
|
url: '/index.php/api/vod#type=fyclass&page=fypage',
|
||||||
|
filterable: 0, //是否启用分类筛选,
|
||||||
|
filter_url: '',
|
||||||
|
filter: {},
|
||||||
|
filter_def: {},
|
||||||
|
detailUrl: '/index.php/vod/detail/id/fyid.html',
|
||||||
|
play_parse: true,
|
||||||
|
lazy: common_lazy,
|
||||||
|
limit: 6,
|
||||||
|
推荐: '.list-vod.flex .public-list-box;a&&title;.lazy&&data-original;.public-list-prb&&Text;a&&href',
|
||||||
|
一级: 'js:let body=input.split("#")[1];let t=Math.round(new Date/1e3).toString();let key=md5("DS"+t+"DCC147D11943AF75");let url=input.split("#")[0];body=body+"&time="+t+"&key="+key;print(body);fetch_params.body=body;let html=post(url,fetch_params);let data=JSON.parse(html);VODS=data.list.map(function(it){it.vod_pic=urljoin2(input.split("/i")[0],it.vod_pic);return it});',
|
||||||
|
二级: {
|
||||||
|
title: '.slide-info-title&&Text;.slide-info:eq(2)--strong&&Text',
|
||||||
|
img: '.detail-pic&&data-original',
|
||||||
|
desc: '.slide-info-remarks&&Text;.slide-info-remarks:eq(1)&&Text;.slide-info-remarks:eq(2)&&Text;.slide-info:eq(1)--strong&&Text;.info-parameter&&ul&&li:eq(3)&&Text',
|
||||||
|
content: '#height_limit&&Text',
|
||||||
|
tabs: '.anthology.wow.fadeInUp.animated&&.swiper-wrapper&&a',
|
||||||
|
tab_text: 'a--span&&Text',
|
||||||
|
lists: '.anthology-list-box:eq(#id) li',
|
||||||
|
},
|
||||||
|
搜索: 'json:list;name;pic;;id',
|
||||||
|
},
|
||||||
|
采集1: {
|
||||||
|
title: '',
|
||||||
|
host: '',
|
||||||
|
homeTid: '13',
|
||||||
|
homeUrl: '/api.php/provide/vod/?ac=detail&t={{rule.homeTid}}',
|
||||||
|
detailUrl: '/api.php/provide/vod/?ac=detail&ids=fyid',
|
||||||
|
searchUrl: '/api.php/provide/vod/?wd=**&pg=fypage',
|
||||||
|
url: '/api.php/provide/vod/?ac=detail&pg=fypage&t=fyclass',
|
||||||
|
headers: {
|
||||||
|
'User-Agent': 'MOBILE_UA'
|
||||||
|
},
|
||||||
|
timeout: 5000, // class_name: '电影&电视剧&综艺&动漫',
|
||||||
|
// class_url: '1&2&3&4',
|
||||||
|
// class_parse:'js:let html=request(input);input=JSON.parse(html).class;',
|
||||||
|
class_parse: 'json:class;',
|
||||||
|
limit: 20,
|
||||||
|
multi: 1,
|
||||||
|
searchable: 2, //是否启用全局搜索,
|
||||||
|
quickSearch: 1, //是否启用快速搜索,
|
||||||
|
filterable: 0, //是否启用分类筛选,
|
||||||
|
play_parse: true,
|
||||||
|
parse_url: '',
|
||||||
|
lazy: cj_lazy,
|
||||||
|
推荐: '*',
|
||||||
|
一级: 'json:list;vod_name;vod_pic;vod_remarks;vod_id;vod_play_from',
|
||||||
|
二级: `js:
|
||||||
|
let html=request(input);
|
||||||
|
html=JSON.parse(html);
|
||||||
|
let data=html.list;
|
||||||
|
VOD=data[0];`,
|
||||||
|
搜索: '*',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return JSON.parse(JSON.stringify(mubanDict));
|
||||||
|
}
|
||||||
|
|
||||||
|
var mubanDict = getMubans();
|
||||||
|
var muban = getMubans();
|
||||||
|
export default {
|
||||||
|
muban,
|
||||||
|
getMubans
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user