UNPKG

@cloudcome/utils-core

Version:
813 lines (812 loc) 24.7 kB
var hexcase$3 = 0; function hex_md5(s) { return rstr2hex$3(rstr_md5(str2rstr_utf8$3(s))); } function rstr_md5(s) { return binl2rstr(binl_md5(rstr2binl(s), s.length * 8)); } function rstr2hex$3(input) { try { hexcase$3; } catch (e) { hexcase$3 = 0; } var hex_tab = hexcase$3 ? "0123456789ABCDEF" : "0123456789abcdef"; var output = ""; var x; for (var i = 0; i < input.length; i++) { x = input.charCodeAt(i); output += hex_tab.charAt(x >>> 4 & 15) + hex_tab.charAt(x & 15); } return output; } function str2rstr_utf8$3(input) { var output = ""; var i = -1; var x, y; while (++i < input.length) { x = input.charCodeAt(i); y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0; if (55296 <= x && x <= 56319 && 56320 <= y && y <= 57343) { x = 65536 + ((x & 1023) << 10) + (y & 1023); i++; } if (x <= 127) output += String.fromCharCode(x); else if (x <= 2047) output += String.fromCharCode(192 | x >>> 6 & 31, 128 | x & 63); else if (x <= 65535) output += String.fromCharCode(224 | x >>> 12 & 15, 128 | x >>> 6 & 63, 128 | x & 63); else if (x <= 2097151) output += String.fromCharCode( 240 | x >>> 18 & 7, 128 | x >>> 12 & 63, 128 | x >>> 6 & 63, 128 | x & 63 ); } return output; } function rstr2binl(input) { var output = Array(input.length >> 2); for (var i = 0; i < output.length; i++) output[i] = 0; for (var i = 0; i < input.length * 8; i += 8) output[i >> 5] |= (input.charCodeAt(i / 8) & 255) << i % 32; return output; } function binl2rstr(input) { var output = ""; for (var i = 0; i < input.length * 32; i += 8) output += String.fromCharCode(input[i >> 5] >>> i % 32 & 255); return output; } function binl_md5(x, len) { x[len >> 5] |= 128 << len % 32; x[(len + 64 >>> 9 << 4) + 14] = len; var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; for (var i = 0; i < x.length; i += 16) { var olda = a; var oldb = b; var oldc = c; var oldd = d; a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936); d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586); c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819); b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330); a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897); d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426); c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341); b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983); a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416); d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417); c = md5_ff(c, d, a, b, x[i + 10], 17, -42063); b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162); a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682); d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101); c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290); b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329); a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510); d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632); c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713); b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302); a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691); d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083); c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335); b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848); a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438); d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690); c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961); b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501); a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467); d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784); c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473); b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734); a = md5_hh(a, b, c, d, x[i + 5], 4, -378558); d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463); c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562); b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556); a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060); d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353); c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632); b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640); a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174); d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222); c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979); b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189); a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487); d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835); c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520); b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651); a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844); d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415); c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905); b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055); a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571); d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606); c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523); b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799); a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359); d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744); c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380); b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649); a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070); d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379); c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259); b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551); a = safe_add$2(a, olda); b = safe_add$2(b, oldb); c = safe_add$2(c, oldc); d = safe_add$2(d, oldd); } return Array(a, b, c, d); } function md5_cmn(q, a, b, x, s, t) { return safe_add$2(bit_rol$1(safe_add$2(safe_add$2(a, q), safe_add$2(x, t)), s), b); } function md5_ff(a, b, c, d, x, s, t) { return md5_cmn(b & c | ~b & d, a, b, x, s, t); } function md5_gg(a, b, c, d, x, s, t) { return md5_cmn(b & d | c & ~d, a, b, x, s, t); } function md5_hh(a, b, c, d, x, s, t) { return md5_cmn(b ^ c ^ d, a, b, x, s, t); } function md5_ii(a, b, c, d, x, s, t) { return md5_cmn(c ^ (b | ~d), a, b, x, s, t); } function safe_add$2(x, y) { var lsw = (x & 65535) + (y & 65535); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return msw << 16 | lsw & 65535; } function bit_rol$1(num, cnt) { return num << cnt | num >>> 32 - cnt; } var hexcase$2 = 0; function hex_sha1(s) { return rstr2hex$2(rstr_sha1(str2rstr_utf8$2(s))); } function rstr_sha1(s) { return binb2rstr$2(binb_sha1(rstr2binb$2(s), s.length * 8)); } function rstr2hex$2(input) { try { hexcase$2; } catch (e) { hexcase$2 = 0; } var hex_tab = hexcase$2 ? "0123456789ABCDEF" : "0123456789abcdef"; var output = ""; var x; for (var i = 0; i < input.length; i++) { x = input.charCodeAt(i); output += hex_tab.charAt(x >>> 4 & 15) + hex_tab.charAt(x & 15); } return output; } function str2rstr_utf8$2(input) { var output = ""; var i = -1; var x, y; while (++i < input.length) { x = input.charCodeAt(i); y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0; if (55296 <= x && x <= 56319 && 56320 <= y && y <= 57343) { x = 65536 + ((x & 1023) << 10) + (y & 1023); i++; } if (x <= 127) output += String.fromCharCode(x); else if (x <= 2047) output += String.fromCharCode( 192 | x >>> 6 & 31, 128 | x & 63 ); else if (x <= 65535) output += String.fromCharCode( 224 | x >>> 12 & 15, 128 | x >>> 6 & 63, 128 | x & 63 ); else if (x <= 2097151) output += String.fromCharCode( 240 | x >>> 18 & 7, 128 | x >>> 12 & 63, 128 | x >>> 6 & 63, 128 | x & 63 ); } return output; } function rstr2binb$2(input) { var output = Array(input.length >> 2); for (var i = 0; i < output.length; i++) output[i] = 0; for (var i = 0; i < input.length * 8; i += 8) output[i >> 5] |= (input.charCodeAt(i / 8) & 255) << 24 - i % 32; return output; } function binb2rstr$2(input) { var output = ""; for (var i = 0; i < input.length * 32; i += 8) output += String.fromCharCode(input[i >> 5] >>> 24 - i % 32 & 255); return output; } function binb_sha1(x, len) { x[len >> 5] |= 128 << 24 - len % 32; x[(len + 64 >> 9 << 4) + 15] = len; var w = Array(80); var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; var e = -1009589776; for (var i = 0; i < x.length; i += 16) { var olda = a; var oldb = b; var oldc = c; var oldd = d; var olde = e; for (var j = 0; j < 80; j++) { if (j < 16) w[j] = x[i + j]; else w[j] = bit_rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1); var t = safe_add$1( safe_add$1(bit_rol(a, 5), sha1_ft(j, b, c, d)), safe_add$1(safe_add$1(e, w[j]), sha1_kt(j)) ); e = d; d = c; c = bit_rol(b, 30); b = a; a = t; } a = safe_add$1(a, olda); b = safe_add$1(b, oldb); c = safe_add$1(c, oldc); d = safe_add$1(d, oldd); e = safe_add$1(e, olde); } return Array(a, b, c, d, e); } function sha1_ft(t, b, c, d) { if (t < 20) return b & c | ~b & d; if (t < 40) return b ^ c ^ d; if (t < 60) return b & c | b & d | c & d; return b ^ c ^ d; } function sha1_kt(t) { return t < 20 ? 1518500249 : t < 40 ? 1859775393 : t < 60 ? -1894007588 : -899497514; } function safe_add$1(x, y) { var lsw = (x & 65535) + (y & 65535); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return msw << 16 | lsw & 65535; } function bit_rol(num, cnt) { return num << cnt | num >>> 32 - cnt; } var hexcase$1 = 0; function hex_sha256(s) { return rstr2hex$1(rstr_sha256(str2rstr_utf8$1(s))); } function rstr_sha256(s) { return binb2rstr$1(binb_sha256(rstr2binb$1(s), s.length * 8)); } function rstr2hex$1(input) { try { hexcase$1; } catch (e) { hexcase$1 = 0; } var hex_tab = hexcase$1 ? "0123456789ABCDEF" : "0123456789abcdef"; var output = ""; var x; for (var i = 0; i < input.length; i++) { x = input.charCodeAt(i); output += hex_tab.charAt(x >>> 4 & 15) + hex_tab.charAt(x & 15); } return output; } function str2rstr_utf8$1(input) { var output = ""; var i = -1; var x, y; while (++i < input.length) { x = input.charCodeAt(i); y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0; if (55296 <= x && x <= 56319 && 56320 <= y && y <= 57343) { x = 65536 + ((x & 1023) << 10) + (y & 1023); i++; } if (x <= 127) output += String.fromCharCode(x); else if (x <= 2047) output += String.fromCharCode( 192 | x >>> 6 & 31, 128 | x & 63 ); else if (x <= 65535) output += String.fromCharCode( 224 | x >>> 12 & 15, 128 | x >>> 6 & 63, 128 | x & 63 ); else if (x <= 2097151) output += String.fromCharCode( 240 | x >>> 18 & 7, 128 | x >>> 12 & 63, 128 | x >>> 6 & 63, 128 | x & 63 ); } return output; } function rstr2binb$1(input) { var output = Array(input.length >> 2); for (var i = 0; i < output.length; i++) output[i] = 0; for (var i = 0; i < input.length * 8; i += 8) output[i >> 5] |= (input.charCodeAt(i / 8) & 255) << 24 - i % 32; return output; } function binb2rstr$1(input) { var output = ""; for (var i = 0; i < input.length * 32; i += 8) output += String.fromCharCode(input[i >> 5] >>> 24 - i % 32 & 255); return output; } function sha256_S(X, n) { return X >>> n | X << 32 - n; } function sha256_R(X, n) { return X >>> n; } function sha256_Ch(x, y, z) { return x & y ^ ~x & z; } function sha256_Maj(x, y, z) { return x & y ^ x & z ^ y & z; } function sha256_Sigma0256(x) { return sha256_S(x, 2) ^ sha256_S(x, 13) ^ sha256_S(x, 22); } function sha256_Sigma1256(x) { return sha256_S(x, 6) ^ sha256_S(x, 11) ^ sha256_S(x, 25); } function sha256_Gamma0256(x) { return sha256_S(x, 7) ^ sha256_S(x, 18) ^ sha256_R(x, 3); } function sha256_Gamma1256(x) { return sha256_S(x, 17) ^ sha256_S(x, 19) ^ sha256_R(x, 10); } var sha256_K = new Array( 1116352408, 1899447441, -1245643825, -373957723, 961987163, 1508970993, -1841331548, -1424204075, -670586216, 310598401, 607225278, 1426881987, 1925078388, -2132889090, -1680079193, -1046744716, -459576895, -272742522, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, -1740746414, -1473132947, -1341970488, -1084653625, -958395405, -710438585, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, -2117940946, -1838011259, -1564481375, -1474664885, -1035236496, -949202525, -778901479, -694614492, -200395387, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, -2067236844, -1933114872, -1866530822, -1538233109, -1090935817, -965641998 ); function binb_sha256(m, l) { var HASH = new Array( 1779033703, -1150833019, 1013904242, -1521486534, 1359893119, -1694144372, 528734635, 1541459225 ); var W = new Array(64); var a, b, c, d, e, f, g, h; var i, j, T1, T2; m[l >> 5] |= 128 << 24 - l % 32; m[(l + 64 >> 9 << 4) + 15] = l; for (i = 0; i < m.length; i += 16) { a = HASH[0]; b = HASH[1]; c = HASH[2]; d = HASH[3]; e = HASH[4]; f = HASH[5]; g = HASH[6]; h = HASH[7]; for (j = 0; j < 64; j++) { if (j < 16) W[j] = m[j + i]; else W[j] = safe_add(safe_add( safe_add(sha256_Gamma1256(W[j - 2]), W[j - 7]), sha256_Gamma0256(W[j - 15]) ), W[j - 16]); T1 = safe_add(safe_add( safe_add(safe_add(h, sha256_Sigma1256(e)), sha256_Ch(e, f, g)), sha256_K[j] ), W[j]); T2 = safe_add(sha256_Sigma0256(a), sha256_Maj(a, b, c)); h = g; g = f; f = e; e = safe_add(d, T1); d = c; c = b; b = a; a = safe_add(T1, T2); } HASH[0] = safe_add(a, HASH[0]); HASH[1] = safe_add(b, HASH[1]); HASH[2] = safe_add(c, HASH[2]); HASH[3] = safe_add(d, HASH[3]); HASH[4] = safe_add(e, HASH[4]); HASH[5] = safe_add(f, HASH[5]); HASH[6] = safe_add(g, HASH[6]); HASH[7] = safe_add(h, HASH[7]); } return HASH; } function safe_add(x, y) { var lsw = (x & 65535) + (y & 65535); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return msw << 16 | lsw & 65535; } var hexcase = 0; function hex_sha512(s) { return rstr2hex(rstr_sha512(str2rstr_utf8(s))); } function rstr_sha512(s) { return binb2rstr(binb_sha512(rstr2binb(s), s.length * 8)); } function rstr2hex(input) { try { hexcase; } catch (e) { hexcase = 0; } var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var output = ""; var x; for (var i = 0; i < input.length; i++) { x = input.charCodeAt(i); output += hex_tab.charAt(x >>> 4 & 15) + hex_tab.charAt(x & 15); } return output; } function str2rstr_utf8(input) { var output = ""; var i = -1; var x, y; while (++i < input.length) { x = input.charCodeAt(i); y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0; if (55296 <= x && x <= 56319 && 56320 <= y && y <= 57343) { x = 65536 + ((x & 1023) << 10) + (y & 1023); i++; } if (x <= 127) output += String.fromCharCode(x); else if (x <= 2047) output += String.fromCharCode( 192 | x >>> 6 & 31, 128 | x & 63 ); else if (x <= 65535) output += String.fromCharCode( 224 | x >>> 12 & 15, 128 | x >>> 6 & 63, 128 | x & 63 ); else if (x <= 2097151) output += String.fromCharCode( 240 | x >>> 18 & 7, 128 | x >>> 12 & 63, 128 | x >>> 6 & 63, 128 | x & 63 ); } return output; } function rstr2binb(input) { var output = Array(input.length >> 2); for (var i = 0; i < output.length; i++) output[i] = 0; for (var i = 0; i < input.length * 8; i += 8) output[i >> 5] |= (input.charCodeAt(i / 8) & 255) << 24 - i % 32; return output; } function binb2rstr(input) { var output = ""; for (var i = 0; i < input.length * 32; i += 8) output += String.fromCharCode(input[i >> 5] >>> 24 - i % 32 & 255); return output; } var sha512_k; function binb_sha512(x, len) { if (sha512_k == void 0) { sha512_k = new Array( new int64(1116352408, -685199838), new int64(1899447441, 602891725), new int64(-1245643825, -330482897), new int64(-373957723, -2121671748), new int64(961987163, -213338824), new int64(1508970993, -1241133031), new int64(-1841331548, -1357295717), new int64(-1424204075, -630357736), new int64(-670586216, -1560083902), new int64(310598401, 1164996542), new int64(607225278, 1323610764), new int64(1426881987, -704662302), new int64(1925078388, -226784913), new int64(-2132889090, 991336113), new int64(-1680079193, 633803317), new int64(-1046744716, -815192428), new int64(-459576895, -1628353838), new int64(-272742522, 944711139), new int64(264347078, -1953704523), new int64(604807628, 2007800933), new int64(770255983, 1495990901), new int64(1249150122, 1856431235), new int64(1555081692, -1119749164), new int64(1996064986, -2096016459), new int64(-1740746414, -295247957), new int64(-1473132947, 766784016), new int64(-1341970488, -1728372417), new int64(-1084653625, -1091629340), new int64(-958395405, 1034457026), new int64(-710438585, -1828018395), new int64(113926993, -536640913), new int64(338241895, 168717936), new int64(666307205, 1188179964), new int64(773529912, 1546045734), new int64(1294757372, 1522805485), new int64(1396182291, -1651133473), new int64(1695183700, -1951439906), new int64(1986661051, 1014477480), new int64(-2117940946, 1206759142), new int64(-1838011259, 344077627), new int64(-1564481375, 1290863460), new int64(-1474664885, -1136513023), new int64(-1035236496, -789014639), new int64(-949202525, 106217008), new int64(-778901479, -688958952), new int64(-694614492, 1432725776), new int64(-200395387, 1467031594), new int64(275423344, 851169720), new int64(430227734, -1194143544), new int64(506948616, 1363258195), new int64(659060556, -544281703), new int64(883997877, -509917016), new int64(958139571, -976659869), new int64(1322822218, -482243893), new int64(1537002063, 2003034995), new int64(1747873779, -692930397), new int64(1955562222, 1575990012), new int64(2024104815, 1125592928), new int64(-2067236844, -1578062990), new int64(-1933114872, 442776044), new int64(-1866530822, 593698344), new int64(-1538233109, -561857047), new int64(-1090935817, -1295615723), new int64(-965641998, -479046869), new int64(-903397682, -366583396), new int64(-779700025, 566280711), new int64(-354779690, -840897762), new int64(-176337025, -294727304), new int64(116418474, 1914138554), new int64(174292421, -1563912026), new int64(289380356, -1090974290), new int64(460393269, 320620315), new int64(685471733, 587496836), new int64(852142971, 1086792851), new int64(1017036298, 365543100), new int64(1126000580, -1676669620), new int64(1288033470, -885112138), new int64(1501505948, -60457430), new int64(1607167915, 987167468), new int64(1816402316, 1246189591) ); } var H = new Array( new int64(1779033703, -205731576), new int64(-1150833019, -2067093701), new int64(1013904242, -23791573), new int64(-1521486534, 1595750129), new int64(1359893119, -1377402159), new int64(-1694144372, 725511199), new int64(528734635, -79577749), new int64(1541459225, 327033209) ); var T1 = new int64(0, 0), T2 = new int64(0, 0), a = new int64(0, 0), b = new int64(0, 0), c = new int64(0, 0), d = new int64(0, 0), e = new int64(0, 0), f = new int64(0, 0), g = new int64(0, 0), h = new int64(0, 0), s0 = new int64(0, 0), s1 = new int64(0, 0), Ch = new int64(0, 0), Maj = new int64(0, 0), r1 = new int64(0, 0), r2 = new int64(0, 0), r3 = new int64(0, 0); var j, i; var W = new Array(80); for (i = 0; i < 80; i++) W[i] = new int64(0, 0); x[len >> 5] |= 128 << 24 - (len & 31); x[(len + 128 >> 10 << 5) + 31] = len; for (i = 0; i < x.length; i += 32) { int64copy(a, H[0]); int64copy(b, H[1]); int64copy(c, H[2]); int64copy(d, H[3]); int64copy(e, H[4]); int64copy(f, H[5]); int64copy(g, H[6]); int64copy(h, H[7]); for (j = 0; j < 16; j++) { W[j].h = x[i + 2 * j]; W[j].l = x[i + 2 * j + 1]; } for (j = 16; j < 80; j++) { int64rrot(r1, W[j - 2], 19); int64revrrot(r2, W[j - 2], 29); int64shr(r3, W[j - 2], 6); s1.l = r1.l ^ r2.l ^ r3.l; s1.h = r1.h ^ r2.h ^ r3.h; int64rrot(r1, W[j - 15], 1); int64rrot(r2, W[j - 15], 8); int64shr(r3, W[j - 15], 7); s0.l = r1.l ^ r2.l ^ r3.l; s0.h = r1.h ^ r2.h ^ r3.h; int64add4(W[j], s1, W[j - 7], s0, W[j - 16]); } for (j = 0; j < 80; j++) { Ch.l = e.l & f.l ^ ~e.l & g.l; Ch.h = e.h & f.h ^ ~e.h & g.h; int64rrot(r1, e, 14); int64rrot(r2, e, 18); int64revrrot(r3, e, 9); s1.l = r1.l ^ r2.l ^ r3.l; s1.h = r1.h ^ r2.h ^ r3.h; int64rrot(r1, a, 28); int64revrrot(r2, a, 2); int64revrrot(r3, a, 7); s0.l = r1.l ^ r2.l ^ r3.l; s0.h = r1.h ^ r2.h ^ r3.h; Maj.l = a.l & b.l ^ a.l & c.l ^ b.l & c.l; Maj.h = a.h & b.h ^ a.h & c.h ^ b.h & c.h; int64add5(T1, h, s1, Ch, sha512_k[j], W[j]); int64add(T2, s0, Maj); int64copy(h, g); int64copy(g, f); int64copy(f, e); int64add(e, d, T1); int64copy(d, c); int64copy(c, b); int64copy(b, a); int64add(a, T1, T2); } int64add(H[0], H[0], a); int64add(H[1], H[1], b); int64add(H[2], H[2], c); int64add(H[3], H[3], d); int64add(H[4], H[4], e); int64add(H[5], H[5], f); int64add(H[6], H[6], g); int64add(H[7], H[7], h); } var hash = new Array(16); for (i = 0; i < 8; i++) { hash[2 * i] = H[i].h; hash[2 * i + 1] = H[i].l; } return hash; } function int64(h, l) { this.h = h; this.l = l; } function int64copy(dst, src) { dst.h = src.h; dst.l = src.l; } function int64rrot(dst, x, shift) { dst.l = x.l >>> shift | x.h << 32 - shift; dst.h = x.h >>> shift | x.l << 32 - shift; } function int64revrrot(dst, x, shift) { dst.l = x.h >>> shift | x.l << 32 - shift; dst.h = x.l >>> shift | x.h << 32 - shift; } function int64shr(dst, x, shift) { dst.l = x.l >>> shift | x.h << 32 - shift; dst.h = x.h >>> shift; } function int64add(dst, x, y) { var w0 = (x.l & 65535) + (y.l & 65535); var w1 = (x.l >>> 16) + (y.l >>> 16) + (w0 >>> 16); var w2 = (x.h & 65535) + (y.h & 65535) + (w1 >>> 16); var w3 = (x.h >>> 16) + (y.h >>> 16) + (w2 >>> 16); dst.l = w0 & 65535 | w1 << 16; dst.h = w2 & 65535 | w3 << 16; } function int64add4(dst, a, b, c, d) { var w0 = (a.l & 65535) + (b.l & 65535) + (c.l & 65535) + (d.l & 65535); var w1 = (a.l >>> 16) + (b.l >>> 16) + (c.l >>> 16) + (d.l >>> 16) + (w0 >>> 16); var w2 = (a.h & 65535) + (b.h & 65535) + (c.h & 65535) + (d.h & 65535) + (w1 >>> 16); var w3 = (a.h >>> 16) + (b.h >>> 16) + (c.h >>> 16) + (d.h >>> 16) + (w2 >>> 16); dst.l = w0 & 65535 | w1 << 16; dst.h = w2 & 65535 | w3 << 16; } function int64add5(dst, a, b, c, d, e) { var w0 = (a.l & 65535) + (b.l & 65535) + (c.l & 65535) + (d.l & 65535) + (e.l & 65535); var w1 = (a.l >>> 16) + (b.l >>> 16) + (c.l >>> 16) + (d.l >>> 16) + (e.l >>> 16) + (w0 >>> 16); var w2 = (a.h & 65535) + (b.h & 65535) + (c.h & 65535) + (d.h & 65535) + (e.h & 65535) + (w1 >>> 16); var w3 = (a.h >>> 16) + (b.h >>> 16) + (c.h >>> 16) + (d.h >>> 16) + (e.h >>> 16) + (w2 >>> 16); dst.l = w0 & 65535 | w1 << 16; dst.h = w2 & 65535 | w3 << 16; } function md5String(input) { return hex_md5(input); } function sha1String(input) { return hex_sha1(input); } function sha256String(input) { return hex_sha256(input); } function sha512String(input) { return hex_sha512(input); } export { md5String, sha1String, sha256String, sha512String }; //# sourceMappingURL=crypto.mjs.map