Update
This commit is contained in:
142
core/bitrix/js/main/md5/dist/md5.bundle.js
vendored
142
core/bitrix/js/main/md5/dist/md5.bundle.js
vendored
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable */
|
||||
(function (exports) {
|
||||
'use strict';
|
||||
|
||||
@@ -37,23 +38,19 @@
|
||||
var md5 = function () {
|
||||
|
||||
var ERROR = 'input is invalid type';
|
||||
var WINDOW = (typeof window === "undefined" ? "undefined" : babelHelpers.typeof(window)) === 'object';
|
||||
var WINDOW = typeof window === 'object';
|
||||
var root = WINDOW ? window : {};
|
||||
|
||||
if (root.JS_MD5_NO_WINDOW) {
|
||||
WINDOW = false;
|
||||
}
|
||||
|
||||
var WEB_WORKER = !WINDOW && (typeof self === "undefined" ? "undefined" : babelHelpers.typeof(self)) === 'object';
|
||||
var NODE_JS = !root.JS_MD5_NO_NODE_JS && (typeof process === "undefined" ? "undefined" : babelHelpers.typeof(process)) === 'object' && process.versions && process.versions.node;
|
||||
|
||||
var WEB_WORKER = !WINDOW && typeof self === 'object';
|
||||
var NODE_JS = !root.JS_MD5_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;
|
||||
if (NODE_JS) {
|
||||
root = global;
|
||||
} else if (WEB_WORKER) {
|
||||
root = self;
|
||||
}
|
||||
|
||||
var COMMON_JS = !root.JS_MD5_NO_COMMON_JS && (typeof module === "undefined" ? "undefined" : babelHelpers.typeof(module)) === 'object' && module.exports;
|
||||
var COMMON_JS = !root.JS_MD5_NO_COMMON_JS && typeof module === 'object' && module.exports;
|
||||
var AMD = typeof define === 'function' && define.amd;
|
||||
var ARRAY_BUFFER = !root.JS_MD5_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';
|
||||
var HEX_CHARS = '0123456789abcdef'.split('');
|
||||
@@ -62,25 +59,23 @@
|
||||
var OUTPUT_TYPES = ['hex', 'array', 'digest', 'buffer', 'arrayBuffer', 'base64'];
|
||||
var BASE64_ENCODE_CHAR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
|
||||
var blocks = [],
|
||||
buffer8;
|
||||
|
||||
buffer8;
|
||||
if (ARRAY_BUFFER) {
|
||||
var buffer = new ArrayBuffer(68);
|
||||
buffer8 = new Uint8Array(buffer);
|
||||
blocks = new Uint32Array(buffer);
|
||||
}
|
||||
|
||||
if (root.JS_MD5_NO_NODE_JS || !Array.isArray) {
|
||||
Array.isArray = function (obj) {
|
||||
return Object.prototype.toString.call(obj) === '[object Array]';
|
||||
};
|
||||
}
|
||||
|
||||
if (ARRAY_BUFFER && (root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {
|
||||
ArrayBuffer.isView = function (obj) {
|
||||
return babelHelpers.typeof(obj) === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;
|
||||
return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @method hex
|
||||
* @memberof md5
|
||||
@@ -92,7 +87,6 @@
|
||||
* // equal to
|
||||
* md5('The quick brown fox jumps over the lazy dog');
|
||||
*/
|
||||
|
||||
/**
|
||||
* @method digest
|
||||
* @memberof md5
|
||||
@@ -102,7 +96,6 @@
|
||||
* @example
|
||||
* md5.digest('The quick brown fox jumps over the lazy dog');
|
||||
*/
|
||||
|
||||
/**
|
||||
* @method array
|
||||
* @memberof md5
|
||||
@@ -112,7 +105,6 @@
|
||||
* @example
|
||||
* md5.array('The quick brown fox jumps over the lazy dog');
|
||||
*/
|
||||
|
||||
/**
|
||||
* @method arrayBuffer
|
||||
* @memberof md5
|
||||
@@ -122,7 +114,6 @@
|
||||
* @example
|
||||
* md5.arrayBuffer('The quick brown fox jumps over the lazy dog');
|
||||
*/
|
||||
|
||||
/**
|
||||
* @method buffer
|
||||
* @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
|
||||
@@ -133,7 +124,6 @@
|
||||
* @example
|
||||
* md5.buffer('The quick brown fox jumps over the lazy dog');
|
||||
*/
|
||||
|
||||
/**
|
||||
* @method base64
|
||||
* @memberof md5
|
||||
@@ -143,13 +133,12 @@
|
||||
* @example
|
||||
* md5.base64('The quick brown fox jumps over the lazy dog');
|
||||
*/
|
||||
|
||||
|
||||
var createOutputMethod = function createOutputMethod(outputType) {
|
||||
var createOutputMethod = function (outputType) {
|
||||
return function (message) {
|
||||
return new Md5(true).update(message)[outputType]();
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @method create
|
||||
* @memberof md5
|
||||
@@ -158,7 +147,6 @@
|
||||
* @example
|
||||
* var hash = md5.create();
|
||||
*/
|
||||
|
||||
/**
|
||||
* @method update
|
||||
* @memberof md5
|
||||
@@ -171,36 +159,27 @@
|
||||
* var hash = md5.create();
|
||||
* hash.update('The quick brown fox jumps over the lazy dog');
|
||||
*/
|
||||
|
||||
|
||||
var createMethod = function createMethod() {
|
||||
var createMethod = function () {
|
||||
var method = createOutputMethod('hex');
|
||||
|
||||
if (NODE_JS) {
|
||||
method = nodeWrap(method);
|
||||
}
|
||||
|
||||
method.create = function () {
|
||||
return new Md5();
|
||||
};
|
||||
|
||||
method.update = function (message) {
|
||||
return method.create().update(message);
|
||||
};
|
||||
|
||||
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
|
||||
var type = OUTPUT_TYPES[i];
|
||||
method[type] = createOutputMethod(type);
|
||||
}
|
||||
|
||||
return method;
|
||||
};
|
||||
|
||||
var nodeWrap = function nodeWrap(method) {
|
||||
var nodeWrap = function (method) {
|
||||
var crypto = eval("require('crypto')");
|
||||
var Buffer = eval("require('buffer').Buffer");
|
||||
|
||||
var nodeMethod = function nodeMethod(message) {
|
||||
var nodeMethod = function (message) {
|
||||
if (typeof message === 'string') {
|
||||
return crypto.createHash('md5').update(message, 'utf8').digest('hex');
|
||||
} else {
|
||||
@@ -210,24 +189,21 @@
|
||||
message = new Uint8Array(message);
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(message) || ArrayBuffer.isView(message) || message.constructor === Buffer) {
|
||||
return crypto.createHash('md5').update(new Buffer(message)).digest('hex');
|
||||
} else {
|
||||
return method(message);
|
||||
}
|
||||
};
|
||||
|
||||
return nodeMethod;
|
||||
};
|
||||
|
||||
/**
|
||||
* Md5 class
|
||||
* @class Md5
|
||||
* @description This is internal class.
|
||||
* @see {@link md5.create}
|
||||
*/
|
||||
|
||||
|
||||
function Md5(sharedMemory) {
|
||||
if (sharedMemory) {
|
||||
blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
|
||||
@@ -242,11 +218,11 @@
|
||||
this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
}
|
||||
}
|
||||
|
||||
this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = this.hBytes = 0;
|
||||
this.finalized = this.hashed = false;
|
||||
this.first = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @method update
|
||||
* @memberof Md5
|
||||
@@ -256,16 +232,12 @@
|
||||
* @returns {Md5} Md5 object.
|
||||
* @see {@link md5.update}
|
||||
*/
|
||||
|
||||
|
||||
Md5.prototype.update = function (message) {
|
||||
if (this.finalized) {
|
||||
return;
|
||||
}
|
||||
|
||||
var notString,
|
||||
type = babelHelpers.typeof(message);
|
||||
|
||||
type = typeof message;
|
||||
if (type !== 'string') {
|
||||
if (type === 'object') {
|
||||
if (message === null) {
|
||||
@@ -280,24 +252,20 @@
|
||||
} else {
|
||||
throw ERROR;
|
||||
}
|
||||
|
||||
notString = true;
|
||||
}
|
||||
|
||||
var code,
|
||||
index = 0,
|
||||
i,
|
||||
length = message.length,
|
||||
blocks = this.blocks;
|
||||
index = 0,
|
||||
i,
|
||||
length = message.length,
|
||||
blocks = this.blocks;
|
||||
var buffer8 = this.buffer8;
|
||||
|
||||
while (index < length) {
|
||||
if (this.hashed) {
|
||||
this.hashed = false;
|
||||
blocks[0] = blocks[16];
|
||||
blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
|
||||
}
|
||||
|
||||
if (notString) {
|
||||
if (ARRAY_BUFFER) {
|
||||
for (i = this.start; index < length && i < 64; ++index) {
|
||||
@@ -312,7 +280,6 @@
|
||||
if (ARRAY_BUFFER) {
|
||||
for (i = this.start; index < length && i < 64; ++index) {
|
||||
code = message.charCodeAt(index);
|
||||
|
||||
if (code < 0x80) {
|
||||
buffer8[i++] = code;
|
||||
} else if (code < 0x800) {
|
||||
@@ -333,7 +300,6 @@
|
||||
} else {
|
||||
for (i = this.start; index < length && i < 64; ++index) {
|
||||
code = message.charCodeAt(index);
|
||||
|
||||
if (code < 0x80) {
|
||||
blocks[i >> 2] |= code << SHIFT[i++ & 3];
|
||||
} else if (code < 0x800) {
|
||||
@@ -353,10 +319,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.lastByteIndex = i;
|
||||
this.bytes += i - this.start;
|
||||
|
||||
if (i >= 64) {
|
||||
this.start = i - 64;
|
||||
this.hash();
|
||||
@@ -365,48 +329,39 @@
|
||||
this.start = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.bytes > 4294967295) {
|
||||
this.hBytes += this.bytes / 4294967296 << 0;
|
||||
this.bytes = this.bytes % 4294967296;
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Md5.prototype.finalize = function () {
|
||||
if (this.finalized) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.finalized = true;
|
||||
var blocks = this.blocks,
|
||||
i = this.lastByteIndex;
|
||||
i = this.lastByteIndex;
|
||||
blocks[i >> 2] |= EXTRA[i & 3];
|
||||
|
||||
if (i >= 56) {
|
||||
if (!this.hashed) {
|
||||
this.hash();
|
||||
}
|
||||
|
||||
blocks[0] = blocks[16];
|
||||
blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
|
||||
}
|
||||
|
||||
blocks[14] = this.bytes << 3;
|
||||
blocks[15] = this.hBytes << 3 | this.bytes >>> 29;
|
||||
this.hash();
|
||||
};
|
||||
|
||||
Md5.prototype.hash = function () {
|
||||
var a,
|
||||
b,
|
||||
c,
|
||||
d,
|
||||
bc,
|
||||
da,
|
||||
blocks = this.blocks;
|
||||
|
||||
b,
|
||||
c,
|
||||
d,
|
||||
bc,
|
||||
da,
|
||||
blocks = this.blocks;
|
||||
if (this.first) {
|
||||
a = blocks[0] - 680876937;
|
||||
a = (a << 7 | a >>> 25) - 271733879 << 0;
|
||||
@@ -430,7 +385,6 @@
|
||||
b += (a ^ c & (d ^ a)) + blocks[3] - 1044525330;
|
||||
b = (b << 22 | b >>> 10) + c << 0;
|
||||
}
|
||||
|
||||
a += (d ^ b & (c ^ d)) + blocks[4] - 176418897;
|
||||
a = (a << 7 | a >>> 25) + b << 0;
|
||||
d += (c ^ a & (b ^ c)) + blocks[5] + 1200080426;
|
||||
@@ -559,7 +513,6 @@
|
||||
c = (c << 15 | c >>> 17) + d << 0;
|
||||
b += (d ^ (c | ~a)) + blocks[9] - 343485551;
|
||||
b = (b << 21 | b >>> 11) + c << 0;
|
||||
|
||||
if (this.first) {
|
||||
this.h0 = a + 1732584193 << 0;
|
||||
this.h1 = b - 271733879 << 0;
|
||||
@@ -573,6 +526,7 @@
|
||||
this.h3 = this.h3 + d << 0;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @method hex
|
||||
* @memberof Md5
|
||||
@@ -583,16 +537,15 @@
|
||||
* @example
|
||||
* hash.hex();
|
||||
*/
|
||||
|
||||
|
||||
Md5.prototype.hex = function () {
|
||||
this.finalize();
|
||||
var h0 = this.h0,
|
||||
h1 = this.h1,
|
||||
h2 = this.h2,
|
||||
h3 = this.h3;
|
||||
h1 = this.h1,
|
||||
h2 = this.h2,
|
||||
h3 = this.h3;
|
||||
return HEX_CHARS[h0 >> 4 & 0x0F] + HEX_CHARS[h0 & 0x0F] + HEX_CHARS[h0 >> 12 & 0x0F] + HEX_CHARS[h0 >> 8 & 0x0F] + HEX_CHARS[h0 >> 20 & 0x0F] + HEX_CHARS[h0 >> 16 & 0x0F] + HEX_CHARS[h0 >> 28 & 0x0F] + HEX_CHARS[h0 >> 24 & 0x0F] + HEX_CHARS[h1 >> 4 & 0x0F] + HEX_CHARS[h1 & 0x0F] + HEX_CHARS[h1 >> 12 & 0x0F] + HEX_CHARS[h1 >> 8 & 0x0F] + HEX_CHARS[h1 >> 20 & 0x0F] + HEX_CHARS[h1 >> 16 & 0x0F] + HEX_CHARS[h1 >> 28 & 0x0F] + HEX_CHARS[h1 >> 24 & 0x0F] + HEX_CHARS[h2 >> 4 & 0x0F] + HEX_CHARS[h2 & 0x0F] + HEX_CHARS[h2 >> 12 & 0x0F] + HEX_CHARS[h2 >> 8 & 0x0F] + HEX_CHARS[h2 >> 20 & 0x0F] + HEX_CHARS[h2 >> 16 & 0x0F] + HEX_CHARS[h2 >> 28 & 0x0F] + HEX_CHARS[h2 >> 24 & 0x0F] + HEX_CHARS[h3 >> 4 & 0x0F] + HEX_CHARS[h3 & 0x0F] + HEX_CHARS[h3 >> 12 & 0x0F] + HEX_CHARS[h3 >> 8 & 0x0F] + HEX_CHARS[h3 >> 20 & 0x0F] + HEX_CHARS[h3 >> 16 & 0x0F] + HEX_CHARS[h3 >> 28 & 0x0F] + HEX_CHARS[h3 >> 24 & 0x0F];
|
||||
};
|
||||
|
||||
/**
|
||||
* @method toString
|
||||
* @memberof Md5
|
||||
@@ -603,9 +556,8 @@
|
||||
* @example
|
||||
* hash.toString();
|
||||
*/
|
||||
|
||||
|
||||
Md5.prototype.toString = Md5.prototype.hex;
|
||||
|
||||
/**
|
||||
* @method digest
|
||||
* @memberof Md5
|
||||
@@ -616,15 +568,15 @@
|
||||
* @example
|
||||
* hash.digest();
|
||||
*/
|
||||
|
||||
Md5.prototype.digest = function () {
|
||||
this.finalize();
|
||||
var h0 = this.h0,
|
||||
h1 = this.h1,
|
||||
h2 = this.h2,
|
||||
h3 = this.h3;
|
||||
h1 = this.h1,
|
||||
h2 = this.h2,
|
||||
h3 = this.h3;
|
||||
return [h0 & 0xFF, h0 >> 8 & 0xFF, h0 >> 16 & 0xFF, h0 >> 24 & 0xFF, h1 & 0xFF, h1 >> 8 & 0xFF, h1 >> 16 & 0xFF, h1 >> 24 & 0xFF, h2 & 0xFF, h2 >> 8 & 0xFF, h2 >> 16 & 0xFF, h2 >> 24 & 0xFF, h3 & 0xFF, h3 >> 8 & 0xFF, h3 >> 16 & 0xFF, h3 >> 24 & 0xFF];
|
||||
};
|
||||
|
||||
/**
|
||||
* @method array
|
||||
* @memberof Md5
|
||||
@@ -635,9 +587,8 @@
|
||||
* @example
|
||||
* hash.array();
|
||||
*/
|
||||
|
||||
|
||||
Md5.prototype.array = Md5.prototype.digest;
|
||||
|
||||
/**
|
||||
* @method arrayBuffer
|
||||
* @memberof Md5
|
||||
@@ -648,7 +599,6 @@
|
||||
* @example
|
||||
* hash.arrayBuffer();
|
||||
*/
|
||||
|
||||
Md5.prototype.arrayBuffer = function () {
|
||||
this.finalize();
|
||||
var buffer = new ArrayBuffer(16);
|
||||
@@ -659,6 +609,7 @@
|
||||
blocks[3] = this.h3;
|
||||
return buffer;
|
||||
};
|
||||
|
||||
/**
|
||||
* @method buffer
|
||||
* @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
|
||||
@@ -670,9 +621,8 @@
|
||||
* @example
|
||||
* hash.buffer();
|
||||
*/
|
||||
|
||||
|
||||
Md5.prototype.buffer = Md5.prototype.arrayBuffer;
|
||||
|
||||
/**
|
||||
* @method base64
|
||||
* @memberof Md5
|
||||
@@ -683,26 +633,22 @@
|
||||
* @example
|
||||
* hash.base64();
|
||||
*/
|
||||
|
||||
Md5.prototype.base64 = function () {
|
||||
var v1,
|
||||
v2,
|
||||
v3,
|
||||
base64Str = '',
|
||||
bytes = this.array();
|
||||
|
||||
v2,
|
||||
v3,
|
||||
base64Str = '',
|
||||
bytes = this.array();
|
||||
for (var i = 0; i < 15;) {
|
||||
v1 = bytes[i++];
|
||||
v2 = bytes[i++];
|
||||
v3 = bytes[i++];
|
||||
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] + BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] + BASE64_ENCODE_CHAR[(v2 << 2 | v3 >>> 6) & 63] + BASE64_ENCODE_CHAR[v3 & 63];
|
||||
}
|
||||
|
||||
v1 = bytes[i];
|
||||
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] + BASE64_ENCODE_CHAR[v1 << 4 & 63] + '==';
|
||||
return base64Str;
|
||||
};
|
||||
|
||||
return createMethod();
|
||||
}();
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
11
core/bitrix/js/main/md5/dist/md5.bundle.min.js
vendored
11
core/bitrix/js/main/md5/dist/md5.bundle.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user