summaryrefslogtreecommitdiff
path: root/http/3rdParty/yaMD5
diff options
context:
space:
mode:
authorhorchi <vdr@jwendel.de>2017-03-05 16:39:28 +0100
committerhorchi <vdr@jwendel.de>2017-03-05 16:39:28 +0100
commite2a48d8701f91b8e24fbe9e99e91eb72a87bb749 (patch)
tree726f70554b4ca985a09ef6e30a7fdc8df089993c /http/3rdParty/yaMD5
downloadvdr-epg-daemon-e2a48d8701f91b8e24fbe9e99e91eb72a87bb749.tar.gz
vdr-epg-daemon-e2a48d8701f91b8e24fbe9e99e91eb72a87bb749.tar.bz2
git init1.1.103
Diffstat (limited to 'http/3rdParty/yaMD5')
-rw-r--r--http/3rdParty/yaMD5/README.md90
-rw-r--r--http/3rdParty/yaMD5/test/lib/ireal-md5.js346
-rw-r--r--http/3rdParty/yaMD5/test/lib/izumo-md5.js206
-rw-r--r--http/3rdParty/yaMD5/test/lib/jbt-md5.js74
-rw-r--r--http/3rdParty/yaMD5/test/lib/jkm-md5.js191
-rw-r--r--http/3rdParty/yaMD5/test/lib/paj-md5.js360
-rw-r--r--http/3rdParty/yaMD5/test/lib/satazor-md5.js600
-rw-r--r--http/3rdParty/yaMD5/test/lib/valums-md5.js218
-rw-r--r--http/3rdParty/yaMD5/test/test.html99
-rw-r--r--http/3rdParty/yaMD5/yamd5.js402
-rw-r--r--http/3rdParty/yaMD5/yamd5.min.js46
11 files changed, 2632 insertions, 0 deletions
diff --git a/http/3rdParty/yaMD5/README.md b/http/3rdParty/yaMD5/README.md
new file mode 100644
index 0000000..57ba203
--- /dev/null
+++ b/http/3rdParty/yaMD5/README.md
@@ -0,0 +1,90 @@
+### YaMD5 - Yet another MD5 hasher
+
+I needed an MD5 hasher, and as usual I want small code base, and fast.
+
+Originally found [md5-o-matic](https://github.com/trentmillar/md5-o-matic).
+It was fast but did not work with Unicode strings.
+Also, I eventually realized it was really based on [code from
+Joseph Myers](http://www.myersdaily.org/joseph/javascript/md5-text.html), which
+is itself a javascript adapation of the C language version the reference
+implementation of MD5 in Appendix 3 of
+[RFC 1321](http://www.rfc-editor.org/rfc/rfc1321.txt).
+
+Then I found [SparkMD5](https://github.com/satazor/SparkMD5), which works
+with Unicode strings, but at a steep cost to performance on large input strings.
+Also, glancing at the code I saw avoidable redundancies causing the code base
+to be larger than needed.
+
+So from this point I set out to write my own version, YaMD5 (sorry, I am
+not good with naming projects), of course heavily relying on the [original
+code from Joseph Myers](http://www.myersdaily.org/joseph/javascript/md5-text.html),
+(with modifications to incrementally improve performance as per profiling),
+and bits from [SparkMD5](https://github.com/satazor/SparkMD5) -- I started to
+work from SparkMD5 implementation, so there might be code original to
+SparkMD5 I kept in a few places (like say, code in md5.end() etc.)
+
+### Benefits of YaMD5
+
+- Can handle Unicode strings
+- Natively incremental
+- Small code base
+- Fastest MD5 hasher out there so far **for large input**:
+ * See <http://jsperf.com/md5-shootout/48> (all kind of implementations.)
+ * See <http://jsperf.com/md5-shootout/50> (implementations which supports Unicode strings.)
+ * Notes regarding the above _MD5 shootout_ benchmarks:
+ - Support both ASCII and Unicode strings:
+ * YaMD5
+ * [SparkMD5](https://github.com/satazor/SparkMD5)
+ * [Paul Johnston's MD5 ("Paj's MD5")](http://pajhome.org.uk/crypt/md5/md5.html)
+ * [js-crypto's MD5 ("TinyMD5")](https://github.com/jbt/js-crypto)
+ - Supports only ASCII strings:
+ * [Masanao Izumo's MD5 ("MD5_hexhash")](http://www.onicos.com/staff/iz/amuse/javascript/expert/md5.txt)
+ * [Joseph Myers's MD5 ("jkm MD5"](http://www.myersdaily.org/joseph/javascript/md5-text.html)
+ * [Trent Millar's MD5 ("MD5-o-matic")](https://github.com/trentmillar/md5-o-matic)
+ * [iReal's MD5 ("FastMD5")](https://github.com/iReal/FastMD5)
+ - _valums MD5_ code fails both ASCII and Unicode strings: **Do not use**.
+
+### Usage
+
+One pass:
+
+ YaMD5.hashStr('hello world\n') === "6f5902ac237024bdd0c176cb93063dc4"
+
+Incremental:
+
+ var md5Hasher = new YaMD5();
+ ...
+ md5Hasher.start();
+ md5Hasher.appendStr('hello');
+ md5Hasher.appendStr(' ');
+ md5Hasher.appendStr('world');
+ md5Hasher.appendStr('\n');
+ md5Hasher.end() === '6f5902ac237024bdd0c176cb93063dc4';
+
+### License
+
+I don't know what license covers Joseph Myers' code (need
+to find out). In any case, concerning whatever original code I contributed in
+there:
+
+The MIT License (MIT)
+
+Copyright (C) 2014 Raymond Hill
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/http/3rdParty/yaMD5/test/lib/ireal-md5.js b/http/3rdParty/yaMD5/test/lib/ireal-md5.js
new file mode 100644
index 0000000..ad69af4
--- /dev/null
+++ b/http/3rdParty/yaMD5/test/lib/ireal-md5.js
@@ -0,0 +1,346 @@
+// https://github.com/iReal/FastMD5
+;md5 = /* window.md5 || */ (function(window) {
+ var $0 = [], // res
+ $1 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // tail
+ $2 = [], // md5blks
+ $3 = [128, 32768, 8388608, -2147483648], // c4
+ $4 = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"], // c16
+ $5 = [0, 8, 16, 24]; // cS
+
+ function encode(s, sLen) {
+ var utf = "", start = end = 0;
+
+ for(var i = 0;i < sLen;i++) {
+ var c1 = s.charCodeAt(i),
+ enc = null;
+
+ if(c1 < 128) {
+ end++;
+ }else if(c1 > 127 && c1 < 2048) {
+ enc = String.fromCharCode((c1 >> 6) | 192, (c1 & 63) | 128);
+ }else{
+ enc = String.fromCharCode((c1 >> 12) | 224, ((c1 >> 6) & 63) | 128, (c1 & 63) | 128);
+ }
+ if(enc != null) {
+ if(end > start) {
+ utf += s.slice(start, end);
+ }
+ utf += enc;
+ start = end = i + 1;
+ }
+ }
+
+ if(end > start) {
+ utf += s.slice(start, sLen);
+ }
+
+ return utf;
+ }
+
+ function md51(s, sLen) {
+ var state,
+ N = sLen,
+ i;
+
+ s += "";
+
+ if(sLen > 63) {
+ md5blk(s.substring(0, 64));
+ state = md5cycle($2[0], $2[1], $2[2], $2[3], $2[4], $2[5], $2[6], $2[7], $2[8], $2[9], $2[10], $2[11], $2[12], $2[13], $2[14], $2[15])
+
+ for(i = 128;i <= sLen;i += 64) {
+ md5blk(s.substring(i - 64, i));
+ state = md5cycleAdd(state[0], state[1], state[2], state[3], $2[0], $2[1], $2[2], $2[3], $2[4], $2[5], $2[6], $2[7], $2[8], $2[9], $2[10], $2[11], $2[12], $2[13], $2[14], $2[15]);
+ }
+
+ s = s.substring(i - 64);
+ N = s.length;
+ }
+
+ for(i = ~~(N / 4);i < 16;i++) {
+ $1[i] = 0;
+ }
+
+ for(i = 0;i < N;i++) {
+ var I = i % 4;
+ if(I == 0) {
+ $1[i >> 2] = s.charCodeAt(i) << $5[I];
+ continue;
+ }
+
+ $1[i >> 2] |= s.charCodeAt(i) << $5[I];
+ }
+ $1[i >> 2] |= $3[i % 4];
+
+ if(i > 55) {
+ state = md5cycleAdd(1732584193, 4023233417, 2562383102, 271733878, $1[0], $1[1], $1[2], $1[3], $1[4], $1[5], $1[6], $1[7], $1[8], $1[9], $1[10], $1[11], $1[12], $1[13], $1[14], $1[15]);
+
+ return md5cycleAdd(state[0], state[1], state[2], state[3], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, sLen * 8, 0);
+ }
+
+ return !state ? md5cycle($1[0], $1[1], $1[2], $1[3], $1[4], $1[5], $1[6], $1[7], $1[8], $1[9], $1[10], $1[11], $1[12], $1[13], sLen * 8, $1[15]) : md5cycleAdd(state[0], state[1], state[2], state[3], $1[0], $1[1], $1[2], $1[3], $1[4], $1[5], $1[6], $1[7], $1[8], $1[9], $1[10], $1[11], $1[12], $1[13], sLen * 8, $1[15]);
+ }
+
+ function md5blk(s) {
+ var i = 16;
+ while(i--) {
+ var I = i << 2;
+ $2[i] = s.charCodeAt(I) + (s.charCodeAt(I + 1) << 8) + (s.charCodeAt(I + 2) << 16) + (s.charCodeAt(I + 3) << 24);
+ }
+ }
+
+ function md5_main(s, enc, arr) {
+ var sLen = s.length;
+ if(enc) {
+ s = encode(s, sLen);
+ sLen = s.length;
+ }
+ s = md51(s, sLen);
+
+ var tmp = s[0];$0[1] = $4[tmp & 15];
+ tmp >>= 4;$0[0] = $4[tmp & 15];
+ tmp >>= 4;$0[3] = $4[tmp & 15];
+ tmp >>= 4;$0[2] = $4[tmp & 15];
+ tmp >>= 4;$0[5] = $4[tmp & 15];
+ tmp >>= 4;$0[4] = $4[tmp & 15];
+ tmp >>= 4;$0[7] = $4[tmp & 15];
+ tmp >>= 4;$0[6] = $4[tmp & 15];
+
+ tmp = s[1];$0[9] = $4[tmp & 15];
+ tmp >>= 4;$0[8] = $4[tmp & 15];
+ tmp >>= 4;$0[11] = $4[tmp & 15];
+ tmp >>= 4;$0[10] = $4[tmp & 15];
+ tmp >>= 4;$0[13] = $4[tmp & 15];
+ tmp >>= 4;$0[12] = $4[tmp & 15];
+ tmp >>= 4;$0[15] = $4[tmp & 15];
+ tmp >>= 4;$0[14] = $4[tmp & 15];
+
+ tmp = s[2];$0[17] = $4[tmp & 15];
+ tmp >>= 4;$0[16] = $4[tmp & 15];
+ tmp >>= 4;$0[19] = $4[tmp & 15];
+ tmp >>= 4;$0[18] = $4[tmp & 15];
+ tmp >>= 4;$0[21] = $4[tmp & 15];
+ tmp >>= 4;$0[20] = $4[tmp & 15];
+ tmp >>= 4;$0[23] = $4[tmp & 15];
+ tmp >>= 4;$0[22] = $4[tmp & 15];
+
+ tmp = s[3];$0[25] = $4[tmp & 15];
+ tmp >>= 4;$0[24] = $4[tmp & 15];
+ tmp >>= 4;$0[27] = $4[tmp & 15];
+ tmp >>= 4;$0[26] = $4[tmp & 15];
+ tmp >>= 4;$0[29] = $4[tmp & 15];
+ tmp >>= 4;$0[28] = $4[tmp & 15];
+ tmp >>= 4;$0[31] = $4[tmp & 15];
+ tmp >>= 4;$0[30] = $4[tmp & 15];
+
+ return arr ? $0 : $0[0] + $0[1] + $0[2] + $0[3] + $0[4] + $0[5] + $0[6] + $0[7] + $0[8] + $0[9] + $0[10] + $0[11] + $0[12] + $0[13] + $0[14] + $0[15] + $0[16] + $0[17] + $0[18] + $0[19] + $0[20] + $0[21] + $0[22] + $0[23] + $0[24] + $0[25] + $0[26] + $0[27] + $0[28] + $0[29] + $0[30] + $0[31];
+ }
+
+ var md5_asmjs = (function(std, env, buf) {
+ "use asm";
+
+ var TA = new std.Int32Array(buf);
+
+ function R(q, a, b, x, s1, s2, t) {
+ q = q|0;
+ a = a|0;
+ b = b|0;
+ x = x|0;
+ s1 = s1|0;
+ s2 = s2|0;
+ t = t|0;
+
+ a = a + q + x + t;
+ return ((a << s1 | a >>> s2) + b) << 0;
+ }
+
+ function md5cycle(k0, k1, k2, k3, k4, k5, k6, k7, k8, k9, k10, k11, k12, k13, k14, k15) {
+ k0 = k0|0;
+ k1 = k1|0;
+ k2 = k2|0;
+ k3 = k3|0;
+ k4 = k4|0;
+ k5 = k5|0;
+ k6 = k6|0;
+ k7 = k7|0;
+ k8 = k8|0;
+ k9 = k9|0;
+ k10 = k10|0;
+ k11 = k11|0;
+ k12 = k12|0;
+ k13 = k13|0;
+ k14 = k14|0;
+ k15 = k15|0;
+
+ md5_rounds(1732584193, -271733879, -1732584194, 271733878, k0, k1, k2, k3, k4, k5, k6, k7, k8, k9, k10, k11, k12, k13, k14, k15, 1);
+
+ TA[0] = (TA[0] + 1732584193) << 0;
+ TA[1] = (TA[1] - 271733879) << 0;
+ TA[2] = (TA[2] - 1732584194) << 0;
+ TA[3] = (TA[3] + 271733878) << 0;
+
+ return TA;
+ }
+
+ function md5cycleAdd(x0, x1, x2, x3, k0, k1, k2, k3, k4, k5, k6, k7, k8, k9, k10, k11, k12, k13, k14, k15) {
+ x0 = x0|0;
+ x1 = x1|0;
+ x2 = x2|0;
+ x3 = x3|0;
+ k0 = k0|0;
+ k1 = k1|0;
+ k2 = k2|0;
+ k3 = k3|0;
+ k4 = k4|0;
+ k5 = k5|0;
+ k6 = k6|0;
+ k7 = k7|0;
+ k8 = k8|0;
+ k9 = k9|0;
+ k10 = k10|0;
+ k11 = k11|0;
+ k12 = k12|0;
+ k13 = k13|0;
+ k14 = k14|0;
+ k15 = k15|0;
+
+ md5_rounds(x0, x1, x2, x3, k0, k1, k2, k3, k4, k5, k6, k7, k8, k9, k10, k11, k12, k13, k14, k15, 0);
+
+ TA[0] = (TA[0] + x0) << 0;
+ TA[1] = (TA[1] + x1) << 0;
+ TA[2] = (TA[2] + x2) << 0;
+ TA[3] = (TA[3] + x3) << 0;
+
+ return TA;
+ }
+
+ function md5_rounds(a, b, c, d, k0, k1, k2, k3, k4, k5, k6, k7, k8, k9, k10, k11, k12, k13, k14, k15, simple) {
+ a = a|0;
+ b = b|0;
+ c = c|0;
+ d = d|0;
+ k0 = k0|0;
+ k1 = k1|0;
+ k2 = k2|0;
+ k3 = k3|0;
+ k4 = k4|0;
+ k5 = k5|0;
+ k6 = k6|0;
+ k7 = k7|0;
+ k8 = k8|0;
+ k9 = k9|0;
+ k10 = k10|0;
+ k11 = k11|0;
+ k12 = k12|0;
+ k13 = k13|0;
+ k14 = k14|0;
+ k15 = k15|0;
+ simple = simple|0;
+ var bc = bc|0;
+ var da = da|0;
+
+ if(simple == 1|0) {
+ a = k0 - 680876937;
+ a = ((a << 7 | a >>> 25) - 271733879) << 0;
+ d = k1 - 117830708 + ((2004318071 & a) ^ -1732584194);
+ d = ((d << 12 | d >>> 20) + a) << 0;
+ c = k2 - 1126478375 + (((a ^ -271733879) & d) ^ -271733879);
+ c = ((c << 17 | c >>> 15) + d) << 0;
+ b = k3 - 1316259209 + (((d ^ a) & c) ^ a);
+ b = ((b << 22 | b >>> 10) + c) << 0;
+ }else{
+ a = R(((c ^ d) & b) ^ d, a, b, k0, 7, 25, -680876936);
+ d = R(((b ^ c) & a) ^ c, d, a, k1, 12, 20, -389564586);
+ c = R(((a ^ b) & d) ^ b, c, d, k2, 17, 15, 606105819);
+ b = R(((d ^ a) & c) ^ a, b, c, k3, 22, 10, -1044525330);
+ }
+
+ a = R(((c ^ d) & b) ^ d, a, b, k4, 7, 25, -176418897);
+ d = R(((b ^ c) & a) ^ c, d, a, k5, 12, 20, 1200080426);
+ c = R(((a ^ b) & d) ^ b, c, d, k6, 17, 15, -1473231341);
+ b = R(((d ^ a) & c) ^ a, b, c, k7, 22, 10, -45705983);
+ a = R(((c ^ d) & b) ^ d, a, b, k8, 7, 25, 1770035416);
+ d = R(((b ^ c) & a) ^ c, d, a, k9, 12, 20, -1958414417);
+ c = R(((a ^ b) & d) ^ b, c, d, k10, 17, 15, -42063);
+ b = R(((d ^ a) & c) ^ a, b, c, k11, 22, 10, -1990404162);
+ a = R(((c ^ d) & b) ^ d, a, b, k12, 7, 25, 1804603682);
+ d = R(((b ^ c) & a) ^ c, d, a, k13, 12, 20, -40341101);
+ c = R(((a ^ b) & d) ^ b, c, d, k14, 17, 15, -1502002290);
+ b = R(((d ^ a) & c) ^ a, b, c, k15, 22, 10, 1236535329);
+
+ a = R(((b ^ c) & d) ^ c, a, b, k1, 5, 27, -165796510);
+ d = R(((a ^ b) & c) ^ b, d, a, k6, 9, 23, -1069501632);
+ c = R(((d ^ a) & b) ^ a, c, d, k11, 14, 18, 643717713);
+ b = R(((c ^ d) & a) ^ d, b, c, k0, 20, 12, -373897302);
+ a = R(((b ^ c) & d) ^ c, a, b, k5, 5, 27, -701558691);
+ d = R(((a ^ b) & c) ^ b, d, a, k10, 9, 23, 38016083);
+ c = R(((d ^ a) & b) ^ a, c, d, k15, 14, 18, -660478335);
+ b = R(((c ^ d) & a) ^ d, b, c, k4, 20, 12, -405537848);
+ a = R(((b ^ c) & d) ^ c, a, b, k9, 5, 27, 568446438);
+ d = R(((a ^ b) & c) ^ b, d, a, k14, 9, 23, -1019803690);
+ c = R(((d ^ a) & b) ^ a, c, d, k3, 14, 18, -187363961);
+ b = R(((c ^ d) & a) ^ d, b, c, k8, 20, 12, 1163531501);
+ a = R(((b ^ c) & d) ^ c, a, b, k13, 5, 27, -1444681467);
+ d = R(((a ^ b) & c) ^ b, d, a, k2, 9, 23, -51403784);
+ c = R(((d ^ a) & b) ^ a, c, d, k7, 14, 18, 1735328473);
+ b = R(((c ^ d) & a) ^ d, b, c, k12, 20, 12, -1926607734);
+
+ bc = b ^ c;
+ a = R(bc ^ d, a, b, k5, 4, 28, -378558);
+ d = R(bc ^ a, d, a, k8, 11, 21, -2022574463);
+ da = d ^ a;
+ c = R(da ^ b, c, d, k11, 16, 16, 1839030562);
+ b = R(da ^ c, b, c, k14, 23, 9, -35309556);
+ bc = b ^ c;
+ a = R(bc ^ d, a, b, k1, 4, 28, -1530992060);
+ d = R(bc ^ a, d, a, k4, 11, 21, 1272893353);
+ da = d ^ a;
+ c = R(da ^ b, c, d, k7, 16, 16, -155497632);
+ b = R(da ^ c, b, c, k10, 23, 9, -1094730640);
+ bc = b ^ c;
+ a = R(bc ^ d, a, b, k13, 4, 28, 681279174);
+ d = R(bc ^ a, d, a, k0, 11, 21, -358537222);
+ da = d ^ a;
+ c = R(da ^ b, c, d, k3, 16, 16, -722521979);
+ b = R(da ^ c, b, c, k6, 23, 9, 76029189);
+ bc = b ^ c;
+ a = R(bc ^ d, a, b, k9, 4, 28, -640364487);
+ d = R(bc ^ a, d, a, k12, 11, 21, -421815835);
+ da = d ^ a;
+ c = R(da ^ b, c, d, k15, 16, 16, 530742520);
+ b = R(da ^ c, b, c, k2, 23, 9, -995338651);
+
+ a = R(c ^ (b | ~d), a, b, k0, 6, 26, -198630844);
+ d = R(b ^ (a | ~c), d, a, k7, 10, 22, 1126891415);
+ c = R(a ^ (d | ~b), c, d, k14, 15, 17, -1416354905);
+ b = R(d ^ (c | ~a), b, c, k5, 21, 11, -57434055);
+ a = R(c ^ (b | ~d), a, b, k12, 6, 26, 1700485571);
+ d = R(b ^ (a | ~c), d, a, k3, 10, 22, -1894986606);
+ c = R(a ^ (d | ~b), c, d, k10, 15, 17, -1051523);
+ b = R(d ^ (c | ~a), b, c, k1, 21, 11, -2054922799);
+ a = R(c ^ (b | ~d), a, b, k8, 6, 26, 1873313359);
+ d = R(b ^ (a | ~c), d, a, k15, 10, 22, -30611744);
+ c = R(a ^ (d | ~b), c, d, k6, 15, 17, -1560198380);
+ b = R(d ^ (c | ~a), b, c, k13, 21, 11, 1309151649);
+ a = R(c ^ (b | ~d), a, b, k4, 6, 26, -145523070);
+ d = R(b ^ (a | ~c), d, a, k11, 10, 22, -1120210379);
+ c = R(a ^ (d | ~b), c, d, k2, 15, 17, 718787259);
+ b = R(d ^ (c | ~a), b, c, k9, 21, 11, -343485551);
+
+ TA[0] = a;
+ TA[1] = b;
+ TA[2] = c;
+ TA[3] = d;
+ }
+
+ return {
+ md5cycle: md5cycle,
+ md5cycleAdd: md5cycleAdd
+ };
+ })(window, null, new ArrayBuffer(16));
+
+ var md5cycle = md5_asmjs.md5cycle,
+ md5cycleAdd = md5_asmjs.md5cycleAdd;
+
+ return md5_main;
+})(window);
diff --git a/http/3rdParty/yaMD5/test/lib/izumo-md5.js b/http/3rdParty/yaMD5/test/lib/izumo-md5.js
new file mode 100644
index 0000000..bf400f6
--- /dev/null
+++ b/http/3rdParty/yaMD5/test/lib/izumo-md5.js
@@ -0,0 +1,206 @@
+// http://www.onicos.com/staff/iz/amuse/javascript/expert/md5.txt
+var izumoMD5 = (function(){
+
+/* md5.js - MD5 Message-Digest
+ * Copyright (C) 1999,2002 Masanao Izumo <iz@onicos.co.jp>
+ * Version: 2.0.0
+ * LastModified: May 13 2002
+ *
+ * This program is free software. You can redistribute it and/or modify
+ * it without any warranty. This library calculates the MD5 based on RFC1321.
+ * See RFC1321 for more information and algorism.
+ */
+
+/* Interface:
+ * md5_128bits = MD5_hash(data);
+ * md5_hexstr = MD5_hexhash(data);
+ */
+
+/* ChangeLog
+ * 2002/05/13: Version 2.0.0 released
+ * NOTICE: API is changed.
+ * 2002/04/15: Bug fix about MD5 length.
+ */
+
+
+// md5_T[i] = parseInt(Math.abs(Math.sin(i)) * 4294967296.0);
+var MD5_T = new Array(0x00000000, 0xd76aa478, 0xe8c7b756, 0x242070db,
+ 0xc1bdceee, 0xf57c0faf, 0x4787c62a, 0xa8304613,
+ 0xfd469501, 0x698098d8, 0x8b44f7af, 0xffff5bb1,
+ 0x895cd7be, 0x6b901122, 0xfd987193, 0xa679438e,
+ 0x49b40821, 0xf61e2562, 0xc040b340, 0x265e5a51,
+ 0xe9b6c7aa, 0xd62f105d, 0x02441453, 0xd8a1e681,
+ 0xe7d3fbc8, 0x21e1cde6, 0xc33707d6, 0xf4d50d87,
+ 0x455a14ed, 0xa9e3e905, 0xfcefa3f8, 0x676f02d9,
+ 0x8d2a4c8a, 0xfffa3942, 0x8771f681, 0x6d9d6122,
+ 0xfde5380c, 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60,
+ 0xbebfbc70, 0x289b7ec6, 0xeaa127fa, 0xd4ef3085,
+ 0x04881d05, 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8,
+ 0xc4ac5665, 0xf4292244, 0x432aff97, 0xab9423a7,
+ 0xfc93a039, 0x655b59c3, 0x8f0ccc92, 0xffeff47d,
+ 0x85845dd1, 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314,
+ 0x4e0811a1, 0xf7537e82, 0xbd3af235, 0x2ad7d2bb,
+ 0xeb86d391);
+
+var MD5_round1 = new Array(new Array( 0, 7, 1), new Array( 1,12, 2),
+ new Array( 2,17, 3), new Array( 3,22, 4),
+ new Array( 4, 7, 5), new Array( 5,12, 6),
+ new Array( 6,17, 7), new Array( 7,22, 8),
+ new Array( 8, 7, 9), new Array( 9,12,10),
+ new Array(10,17,11), new Array(11,22,12),
+ new Array(12, 7,13), new Array(13,12,14),
+ new Array(14,17,15), new Array(15,22,16));
+
+var MD5_round2 = new Array(new Array( 1, 5,17), new Array( 6, 9,18),
+ new Array(11,14,19), new Array( 0,20,20),
+ new Array( 5, 5,21), new Array(10, 9,22),
+ new Array(15,14,23), new Array( 4,20,24),
+ new Array( 9, 5,25), new Array(14, 9,26),
+ new Array( 3,14,27), new Array( 8,20,28),
+ new Array(13, 5,29), new Array( 2, 9,30),
+ new Array( 7,14,31), new Array(12,20,32));
+
+var MD5_round3 = new Array(new Array( 5, 4,33), new Array( 8,11,34),
+ new Array(11,16,35), new Array(14,23,36),
+ new Array( 1, 4,37), new Array( 4,11,38),
+ new Array( 7,16,39), new Array(10,23,40),
+ new Array(13, 4,41), new Array( 0,11,42),
+ new Array( 3,16,43), new Array( 6,23,44),
+ new Array( 9, 4,45), new Array(12,11,46),
+ new Array(15,16,47), new Array( 2,23,48));
+
+var MD5_round4 = new Array(new Array( 0, 6,49), new Array( 7,10,50),
+ new Array(14,15,51), new Array( 5,21,52),
+ new Array(12, 6,53), new Array( 3,10,54),
+ new Array(10,15,55), new Array( 1,21,56),
+ new Array( 8, 6,57), new Array(15,10,58),
+ new Array( 6,15,59), new Array(13,21,60),
+ new Array( 4, 6,61), new Array(11,10,62),
+ new Array( 2,15,63), new Array( 9,21,64));
+
+function MD5_F(x, y, z) { return (x & y) | (~x & z); }
+function MD5_G(x, y, z) { return (x & z) | (y & ~z); }
+function MD5_H(x, y, z) { return x ^ y ^ z; }
+function MD5_I(x, y, z) { return y ^ (x | ~z); }
+
+var MD5_round = new Array(new Array(MD5_F, MD5_round1),
+ new Array(MD5_G, MD5_round2),
+ new Array(MD5_H, MD5_round3),
+ new Array(MD5_I, MD5_round4));
+
+function MD5_pack(n32) {
+ return String.fromCharCode(n32 & 0xff) +
+ String.fromCharCode((n32 >>> 8) & 0xff) +
+ String.fromCharCode((n32 >>> 16) & 0xff) +
+ String.fromCharCode((n32 >>> 24) & 0xff);
+}
+
+function MD5_unpack(s4) {
+ return s4.charCodeAt(0) |
+ (s4.charCodeAt(1) << 8) |
+ (s4.charCodeAt(2) << 16) |
+ (s4.charCodeAt(3) << 24);
+}
+
+function MD5_number(n) {
+ while (n < 0)
+ n += 4294967296;
+ while (n > 4294967295)
+ n -= 4294967296;
+ return n;
+}
+
+function MD5_apply_round(x, s, f, abcd, r) {
+ var a, b, c, d;
+ var kk, ss, ii;
+ var t, u;
+
+ a = abcd[0];
+ b = abcd[1];
+ c = abcd[2];
+ d = abcd[3];
+ kk = r[0];
+ ss = r[1];
+ ii = r[2];
+
+ u = f(s[b], s[c], s[d]);
+ t = s[a] + u + x[kk] + MD5_T[ii];
+ t = MD5_number(t);
+ t = ((t<<ss) | (t>>>(32-ss)));
+ t += s[b];
+ s[a] = MD5_number(t);
+}
+
+function MD5_hash(data) {
+ var abcd, x, state, s;
+ var len, index, padLen, f, r;
+ var i, j, k;
+ var tmp;
+
+ state = new Array(0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476);
+ len = data.length;
+ index = len & 0x3f;
+ padLen = (index < 56) ? (56 - index) : (120 - index);
+ if(padLen > 0) {
+ data += "\x80";
+ for(i = 0; i < padLen - 1; i++)
+ data += "\x00";
+ }
+ data += MD5_pack(len * 8);
+ data += MD5_pack(0);
+ len += padLen + 8;
+ abcd = new Array(0, 1, 2, 3);
+ x = new Array(16);
+ s = new Array(4);
+
+ for(k = 0; k < len; k += 64) {
+ for(i = 0, j = k; i < 16; i++, j += 4) {
+ x[i] = data.charCodeAt(j) |
+ (data.charCodeAt(j + 1) << 8) |
+ (data.charCodeAt(j + 2) << 16) |
+ (data.charCodeAt(j + 3) << 24);
+ }
+ for(i = 0; i < 4; i++)
+ s[i] = state[i];
+ for(i = 0; i < 4; i++) {
+ f = MD5_round[i][0];
+ r = MD5_round[i][1];
+ for(j = 0; j < 16; j++) {
+ MD5_apply_round(x, s, f, abcd, r[j]);
+ tmp = abcd[0];
+ abcd[0] = abcd[3];
+ abcd[3] = abcd[2];
+ abcd[2] = abcd[1];
+ abcd[1] = tmp;
+ }
+ }
+
+ for(i = 0; i < 4; i++) {
+ state[i] += s[i];
+ state[i] = MD5_number(state[i]);
+ }
+ }
+
+ return MD5_pack(state[0]) +
+ MD5_pack(state[1]) +
+ MD5_pack(state[2]) +
+ MD5_pack(state[3]);
+}
+
+function MD5_hexhash(data) {
+ var i, out, c;
+ var bit128;
+
+ bit128 = MD5_hash(data);
+ out = "";
+ for(i = 0; i < 16; i++) {
+ c = bit128.charCodeAt(i);
+ out += "0123456789abcdef".charAt((c>>4) & 0xf);
+ out += "0123456789abcdef".charAt(c & 0xf);
+ }
+ return out;
+}
+
+return MD5_hexhash;
+
+})();
diff --git a/http/3rdParty/yaMD5/test/lib/jbt-md5.js b/http/3rdParty/yaMD5/test/lib/jbt-md5.js
new file mode 100644
index 0000000..4738877
--- /dev/null
+++ b/http/3rdParty/yaMD5/test/lib/jbt-md5.js
@@ -0,0 +1,74 @@
+// https://github.com/jbt/js-crypto
+md5 = function(sixteen){
+
+ var k = [],i=0;
+
+ for(;i<64;){
+ k[i] = 0|(Math.abs(Math.sin(++i)) * 4294967296);
+ }
+
+ function add(x, y){
+ return (((x>>1)+(y>>1))<<1)+(x&1)+(y&1) ;
+ //var msw = (x >> sixteen) + (y >> sixteen) + ((y=(x & ffff) + (y & ffff)) >> sixteen);
+ //return (msw << sixteen) | (y & ffff);
+ }
+
+ var calcMD5 = function(str){
+ var b,c,d,j,
+ x = [],
+ str2 = unescape(encodeURI(str)),
+ a = str2.length,
+ h = [b=1732584193,c=-271733879,~b,~c],
+ i=0;
+
+ for(;i<=a;) x[i >> 2] |= (str2.charCodeAt(i)||128) << 8*(i++ % 4);
+ x[str=(a+8 >> 6)*sixteen+14] = a * 8;
+ i = 0;
+
+ for(; i < str; i += sixteen){
+ a = h,j=0;
+ for(;j<64;){
+ a = [
+ d = a[3],
+ add(
+ b = a[1] ,
+ (d = add(
+ add(
+ a[0],
+ [
+ b&(c=a[2]) | ~b&d,
+ d&b | ~d&c,
+ b^c^d,
+ c^(b|~d)
+ ][a=j>>4]
+ ),
+ add(
+ k[j],
+ x[[
+ j,
+ 5*j+1,
+ 3*j+5,
+ 7*j
+ ][a]%sixteen+i]
+ )
+ )) << (a =[
+ 7, 12, 17, 22,
+ 5, 9, 14, 20,
+ 4, 11, sixteen, 23,
+ 6, 10, 15, 21
+ ][4*a+j++%4]) | d >>> 32-a
+ ),
+ b,
+ c
+ ];
+ }
+ for(j=4;j;) h[--j] = add(h[j], a[j]);
+ }
+
+ str = '';
+ for(;j<32;) str += ((h[j>>3] >> ((1^j++&7)*4)) & 15).toString(sixteen);
+
+ return str;
+ };
+ return calcMD5;
+}(16);
diff --git a/http/3rdParty/yaMD5/test/lib/jkm-md5.js b/http/3rdParty/yaMD5/test/lib/jkm-md5.js
new file mode 100644
index 0000000..69ed9fe
--- /dev/null
+++ b/http/3rdParty/yaMD5/test/lib/jkm-md5.js
@@ -0,0 +1,191 @@
+// http://www.myersdaily.org/joseph/javascript/md5-text.html
+var jkmMD5 = (function(){
+
+function md5cycle(x, k) {
+var a = x[0], b = x[1], c = x[2], d = x[3];
+
+a = ff(a, b, c, d, k[0], 7, -680876936);
+d = ff(d, a, b, c, k[1], 12, -389564586);
+c = ff(c, d, a, b, k[2], 17, 606105819);
+b = ff(b, c, d, a, k[3], 22, -1044525330);
+a = ff(a, b, c, d, k[4], 7, -176418897);
+d = ff(d, a, b, c, k[5], 12, 1200080426);
+c = ff(c, d, a, b, k[6], 17, -1473231341);
+b = ff(b, c, d, a, k[7], 22, -45705983);
+a = ff(a, b, c, d, k[8], 7, 1770035416);
+d = ff(d, a, b, c, k[9], 12, -1958414417);
+c = ff(c, d, a, b, k[10], 17, -42063);
+b = ff(b, c, d, a, k[11], 22, -1990404162);
+a = ff(a, b, c, d, k[12], 7, 1804603682);
+d = ff(d, a, b, c, k[13], 12, -40341101);
+c = ff(c, d, a, b, k[14], 17, -1502002290);
+b = ff(b, c, d, a, k[15], 22, 1236535329);
+
+a = gg(a, b, c, d, k[1], 5, -165796510);
+d = gg(d, a, b, c, k[6], 9, -1069501632);
+c = gg(c, d, a, b, k[11], 14, 643717713);
+b = gg(b, c, d, a, k[0], 20, -373897302);
+a = gg(a, b, c, d, k[5], 5, -701558691);
+d = gg(d, a, b, c, k[10], 9, 38016083);
+c = gg(c, d, a, b, k[15], 14, -660478335);
+b = gg(b, c, d, a, k[4], 20, -405537848);
+a = gg(a, b, c, d, k[9], 5, 568446438);
+d = gg(d, a, b, c, k[14], 9, -1019803690);
+c = gg(c, d, a, b, k[3], 14, -187363961);
+b = gg(b, c, d, a, k[8], 20, 1163531501);
+a = gg(a, b, c, d, k[13], 5, -1444681467);
+d = gg(d, a, b, c, k[2], 9, -51403784);
+c = gg(c, d, a, b, k[7], 14, 1735328473);
+b = gg(b, c, d, a, k[12], 20, -1926607734);
+
+a = hh(a, b, c, d, k[5], 4, -378558);
+d = hh(d, a, b, c, k[8], 11, -2022574463);
+c = hh(c, d, a, b, k[11], 16, 1839030562);
+b = hh(b, c, d, a, k[14], 23, -35309556);
+a = hh(a, b, c, d, k[1], 4, -1530992060);
+d = hh(d, a, b, c, k[4], 11, 1272893353);
+c = hh(c, d, a, b, k[7], 16, -155497632);
+b = hh(b, c, d, a, k[10], 23, -1094730640);
+a = hh(a, b, c, d, k[13], 4, 681279174);
+d = hh(d, a, b, c, k[0], 11, -358537222);
+c = hh(c, d, a, b, k[3], 16, -722521979);
+b = hh(b, c, d, a, k[6], 23, 76029189);
+a = hh(a, b, c, d, k[9], 4, -640364487);
+d = hh(d, a, b, c, k[12], 11, -421815835);
+c = hh(c, d, a, b, k[15], 16, 530742520);
+b = hh(b, c, d, a, k[2], 23, -995338651);
+
+a = ii(a, b, c, d, k[0], 6, -198630844);
+d = ii(d, a, b, c, k[7], 10, 1126891415);
+c = ii(c, d, a, b, k[14], 15, -1416354905);
+b = ii(b, c, d, a, k[5], 21, -57434055);
+a = ii(a, b, c, d, k[12], 6, 1700485571);
+d = ii(d, a, b, c, k[3], 10, -1894986606);
+c = ii(c, d, a, b, k[10], 15, -1051523);
+b = ii(b, c, d, a, k[1], 21, -2054922799);
+a = ii(a, b, c, d, k[8], 6, 1873313359);
+d = ii(d, a, b, c, k[15], 10, -30611744);
+c = ii(c, d, a, b, k[6], 15, -1560198380);
+b = ii(b, c, d, a, k[13], 21, 1309151649);
+a = ii(a, b, c, d, k[4], 6, -145523070);
+d = ii(d, a, b, c, k[11], 10, -1120210379);
+c = ii(c, d, a, b, k[2], 15, 718787259);
+b = ii(b, c, d, a, k[9], 21, -343485551);
+
+x[0] = add32(a, x[0]);
+x[1] = add32(b, x[1]);
+x[2] = add32(c, x[2]);
+x[3] = add32(d, x[3]);
+
+}
+
+function cmn(q, a, b, x, s, t) {
+a = add32(add32(a, q), add32(x, t));
+return add32((a << s) | (a >>> (32 - s)), b);
+}
+
+function ff(a, b, c, d, x, s, t) {
+return cmn((b & c) | ((~b) & d), a, b, x, s, t);
+}
+
+function gg(a, b, c, d, x, s, t) {
+return cmn((b & d) | (c & (~d)), a, b, x, s, t);
+}
+
+function hh(a, b, c, d, x, s, t) {
+return cmn(b ^ c ^ d, a, b, x, s, t);
+}
+
+function ii(a, b, c, d, x, s, t) {
+return cmn(c ^ (b | (~d)), a, b, x, s, t);
+}
+
+function md51(s) {
+txt = '';
+var n = s.length,
+state = [1732584193, -271733879, -1732584194, 271733878], i;
+for (i=64; i<=s.length; i+=64) {
+md5cycle(state, md5blk(s.substring(i-64, i)));
+}
+s = s.substring(i-64);
+var tail = [0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0];
+for (i=0; i<s.length; i++)
+tail[i>>2] |= s.charCodeAt(i) << ((i%4) << 3);
+tail[i>>2] |= 0x80 << ((i%4) << 3);
+if (i > 55) {
+md5cycle(state, tail);
+for (i=0; i<16; i++) tail[i] = 0;
+}
+tail[14] = n*8;
+md5cycle(state, tail);
+return state;
+}
+
+/* there needs to be support for Unicode here,
+ * unless we pretend that we can redefine the MD-5
+ * algorithm for multi-byte characters (perhaps
+ * by adding every four 16-bit characters and
+ * shortening the sum to 32 bits). Otherwise
+ * I suggest performing MD-5 as if every character
+ * was two bytes--e.g., 0040 0025 = @%--but then
+ * how will an ordinary MD-5 sum be matched?
+ * There is no way to standardize text to something
+ * like UTF-8 before transformation; speed cost is
+ * utterly prohibitive. The JavaScript standard
+ * itself needs to look at this: it should start
+ * providing access to strings as preformed UTF-8
+ * 8-bit unsigned value arrays.
+ */
+function md5blk(s) { /* I figured global was faster. */
+var md5blks = [], i; /* Andy King said do it this way. */
+for (i=0; i<64; i+=4) {
+md5blks[i>>2] = s.charCodeAt(i)
++ (s.charCodeAt(i+1) << 8)
++ (s.charCodeAt(i+2) << 16)
++ (s.charCodeAt(i+3) << 24);
+}
+return md5blks;
+}
+
+var hex_chr = '0123456789abcdef'.split('');
+
+function rhex(n)
+{
+var s='', j=0;
+for(; j<4; j++)
+s += hex_chr[(n >> (j * 8 + 4)) & 0x0F]
++ hex_chr[(n >> (j * 8)) & 0x0F];
+return s;
+}
+
+function hex(x) {
+for (var i=0; i<x.length; i++)
+x[i] = rhex(x[i]);
+return x.join('');
+}
+
+function md5(s) {
+return hex(md51(s));
+}
+
+/* this function is much faster,
+so if possible we use it. Some IEs
+are the only ones I know of that
+need the idiotic second function,
+generated by an if clause. */
+
+function add32(a, b) {
+return (a + b) & 0xFFFFFFFF;
+}
+
+if (md5('hello') != '5d41402abc4b2a76b9719d911017c592') {
+function add32(x, y) {
+var lsw = (x & 0xFFFF) + (y & 0xFFFF),
+msw = (x >> 16) + (y >> 16) + (lsw >> 16);
+return (msw << 16) | (lsw & 0xFFFF);
+}
+}
+
+return md5;
+
+})();
diff --git a/http/3rdParty/yaMD5/test/lib/paj-md5.js b/http/3rdParty/yaMD5/test/lib/paj-md5.js
new file mode 100644
index 0000000..1c4ce4b
--- /dev/null
+++ b/http/3rdParty/yaMD5/test/lib/paj-md5.js
@@ -0,0 +1,360 @@
+// http://pajhome.org.uk/crypt/md5/md5.html
+var pajMD5 = (function(){
+ /*
+ * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
+ * Digest Algorithm, as defined in RFC 1321.
+ * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
+ * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
+ * Distributed under the BSD License
+ * See http://pajhome.org.uk/crypt/md5 for more info.
+ */
+
+ /*
+ * Configurable variables. You may need to tweak these to be compatible with
+ * the server-side, but the defaults work in most cases.
+ */
+ var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
+ var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
+
+ /*
+ * These are the functions you'll usually want to call
+ * They take string arguments and return either hex or base-64 encoded strings
+ */
+
+ function hex_md5(s) {
+ return rstr2hex(rstr_md5(str2rstr_utf8(s)));
+ }
+
+ function b64_md5(s) {
+ return rstr2b64(rstr_md5(str2rstr_utf8(s)));
+ }
+
+ function any_md5(s, e) {
+ return rstr2any(rstr_md5(str2rstr_utf8(s)), e);
+ }
+
+ function hex_hmac_md5(k, d) {
+ return rstr2hex(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d)));
+ }
+
+ function b64_hmac_md5(k, d) {
+ return rstr2b64(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d)));
+ }
+
+ function any_hmac_md5(k, d, e) {
+ return rstr2any(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d)), e);
+ }
+
+ /*
+ * Perform a simple self-test to see if the VM is working
+ */
+
+ function md5_vm_test() {
+ return hex_md5("abc").toLowerCase() == "900150983cd24fb0d6963f7d28e17f72";
+ }
+
+ /*
+ * Calculate the MD5 of a raw string
+ */
+
+ function rstr_md5(s) {
+ return binl2rstr(binl_md5(rstr2binl(s), s.length * 8));
+ }
+
+ /*
+ * Calculate the HMAC-MD5, of a key and some data (raw strings)
+ */
+
+ function rstr_hmac_md5(key, data) {
+ var bkey = rstr2binl(key);
+ if (bkey.length > 16) bkey = binl_md5(bkey, key.length * 8);
+
+ var ipad = Array(16),
+ opad = Array(16);
+ for (var i = 0; i < 16; i++) {
+ ipad[i] = bkey[i] ^ 0x36363636;
+ opad[i] = bkey[i] ^ 0x5C5C5C5C;
+ }
+
+ var hash = binl_md5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
+ return binl2rstr(binl_md5(opad.concat(hash), 512 + 128));
+ }
+
+ /*
+ * Convert a raw string to a hex string
+ */
+
+ 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) & 0x0F) + hex_tab.charAt(x & 0x0F);
+ }
+ return output;
+ }
+
+ /*
+ * Convert a raw string to a base-64 string
+ */
+
+ function rstr2b64(input) {
+ try {
+ b64pad
+ } catch (e) {
+ b64pad = '';
+ }
+ var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ var output = "";
+ var len = input.length;
+ for (var i = 0; i < len; i += 3) {
+ var triplet = (input.charCodeAt(i) << 16) | (i + 1 < len ? input.charCodeAt(i + 1) << 8 : 0) | (i + 2 < len ? input.charCodeAt(i + 2) : 0);
+ for (var j = 0; j < 4; j++) {
+ if (i * 8 + j * 6 > input.length * 8) output += b64pad;
+ else output += tab.charAt((triplet >>> 6 * (3 - j)) & 0x3F);
+ }
+ }
+ return output;
+ }
+
+ /*
+ * Convert a raw string to an arbitrary string encoding
+ */
+
+ function rstr2any(input, encoding) {
+ var divisor = encoding.length;
+ var i, j, q, x, quotient;
+
+ /* Convert to an array of 16-bit big-endian values, forming the dividend */
+ var dividend = Array(Math.ceil(input.length / 2));
+ for (i = 0; i < dividend.length; i++) {
+ dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1);
+ }
+
+ /*
+ * Repeatedly perform a long division. The binary array forms the dividend,
+ * the length of the encoding is the divisor. Once computed, the quotient
+ * forms the dividend for the next step. All remainders are stored for later
+ * use.
+ */
+ var full_length = Math.ceil(input.length * 8 / (Math.log(encoding.length) / Math.log(2)));
+ var remainders = Array(full_length);
+ for (j = 0; j < full_length; j++) {
+ quotient = Array();
+ x = 0;
+ for (i = 0; i < dividend.length; i++) {
+ x = (x << 16) + dividend[i];
+ q = Math.floor(x / divisor);
+ x -= q * divisor;
+ if (quotient.length > 0 || q > 0) quotient[quotient.length] = q;
+ }
+ remainders[j] = x;
+ dividend = quotient;
+ }
+
+ /* Convert the remainders to the output string */
+ var output = "";
+ for (i = remainders.length - 1; i >= 0; i--)
+ output += encoding.charAt(remainders[i]);
+
+ return output;
+ }
+
+ /*
+ * Encode a string as utf-8.
+ * For efficiency, this assumes the input is valid utf-16.
+ */
+
+ function str2rstr_utf8(input) {
+ return unescape(encodeURI(input));
+ }
+
+ /*
+ * Encode a string as utf-16
+ */
+
+ function str2rstr_utf16le(input) {
+ var output = "";
+ for (var i = 0; i < input.length; i++)
+ output += String.fromCharCode(input.charCodeAt(i) & 0xFF, (input.charCodeAt(i) >>> 8) & 0xFF);
+ return output;
+ }
+
+ function str2rstr_utf16be(input) {
+ var output = "";
+ for (var i = 0; i < input.length; i++)
+ output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF, input.charCodeAt(i) & 0xFF);
+ return output;
+ }
+
+ /*
+ * Convert a raw string to an array of little-endian words
+ * Characters >255 have their high-byte silently ignored.
+ */
+
+ 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) & 0xFF) << (i % 32);
+ return output;
+ }
+
+ /*
+ * Convert an array of little-endian words to a string
+ */
+
+ function binl2rstr(input) {
+ var output = "";
+ for (var i = 0; i < input.length * 32; i += 8)
+ output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF);
+ return output;
+ }
+
+ /*
+ * Calculate the MD5 of an array of little-endian words, and a bit length.
+ */
+
+ function binl_md5(x, len) { /* append padding */
+ x[len >> 5] |= 0x80 << ((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(a, olda);
+ b = safe_add(b, oldb);
+ c = safe_add(c, oldc);
+ d = safe_add(d, oldd);
+ }
+ return Array(a, b, c, d);
+ }
+
+ /*
+ * These functions implement the four basic operations the algorithm uses.
+ */
+
+ function md5_cmn(q, a, b, x, s, t) {
+ return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(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);
+ }
+
+ /*
+ * Add integers, wrapping at 2^32. This uses 16-bit operations internally
+ * to work around bugs in some JS interpreters.
+ */
+
+ function safe_add(x, y) {
+ var lsw = (x & 0xFFFF) + (y & 0xFFFF);
+ var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
+ return (msw << 16) | (lsw & 0xFFFF);
+ }
+
+ /*
+ * Bitwise rotate a 32-bit number to the left.
+ */
+
+ function bit_rol(num, cnt) {
+ return (num << cnt) | (num >>> (32 - cnt));
+ }
+
+ return hex_md5;
+})();
diff --git a/http/3rdParty/yaMD5/test/lib/satazor-md5.js b/http/3rdParty/yaMD5/test/lib/satazor-md5.js
new file mode 100644
index 0000000..db606b3
--- /dev/null
+++ b/http/3rdParty/yaMD5/test/lib/satazor-md5.js
@@ -0,0 +1,600 @@
+// https://raw.githubusercontent.com/satazor/SparkMD5/master/spark-md5.js
+/*jshint bitwise:false*/
+/*global unescape*/
+
+(function (factory) {
+ if (typeof exports === 'object') {
+ // Node/CommonJS
+ module.exports = factory();
+ } else if (typeof define === 'function' && define.amd) {
+ // AMD
+ define(factory);
+ } else {
+ // Browser globals (with support for web workers)
+ var glob;
+ try {
+ glob = window;
+ } catch (e) {
+ glob = self;
+ }
+
+ glob.SparkMD5 = factory();
+ }
+}(function (undefined) {
+
+ 'use strict';
+
+ ////////////////////////////////////////////////////////////////////////////
+
+ /*
+ * Fastest md5 implementation around (JKM md5)
+ * Credits: Joseph Myers
+ *
+ * @see http://www.myersdaily.org/joseph/javascript/md5-text.html
+ * @see http://jsperf.com/md5-shootout/7
+ */
+
+ /* this function is much faster,
+ so if possible we use it. Some IEs
+ are the only ones I know of that
+ need the idiotic second function,
+ generated by an if clause. */
+ var add32 = function (a, b) {
+ return (a + b) & 0xFFFFFFFF;
+ },
+
+ cmn = function (q, a, b, x, s, t) {
+ a = add32(add32(a, q), add32(x, t));
+ return add32((a << s) | (a >>> (32 - s)), b);
+ },
+
+ ff = function (a, b, c, d, x, s, t) {
+ return cmn((b & c) | ((~b) & d), a, b, x, s, t);
+ },
+
+ gg = function (a, b, c, d, x, s, t) {
+ return cmn((b & d) | (c & (~d)), a, b, x, s, t);
+ },
+
+ hh = function (a, b, c, d, x, s, t) {
+ return cmn(b ^ c ^ d, a, b, x, s, t);
+ },
+
+ ii = function (a, b, c, d, x, s, t) {
+ return cmn(c ^ (b | (~d)), a, b, x, s, t);
+ },
+
+ md5cycle = function (x, k) {
+ var a = x[0],
+ b = x[1],
+ c = x[2],
+ d = x[3];
+
+ a = ff(a, b, c, d, k[0], 7, -680876936);
+ d = ff(d, a, b, c, k[1], 12, -389564586);
+ c = ff(c, d, a, b, k[2], 17, 606105819);
+ b = ff(b, c, d, a, k[3], 22, -1044525330);
+ a = ff(a, b, c, d, k[4], 7, -176418897);
+ d = ff(d, a, b, c, k[5], 12, 1200080426);
+ c = ff(c, d, a, b, k[6], 17, -1473231341);
+ b = ff(b, c, d, a, k[7], 22, -45705983);
+ a = ff(a, b, c, d, k[8], 7, 1770035416);
+ d = ff(d, a, b, c, k[9], 12, -1958414417);
+ c = ff(c, d, a, b, k[10], 17, -42063);
+ b = ff(b, c, d, a, k[11], 22, -1990404162);
+ a = ff(a, b, c, d, k[12], 7, 1804603682);
+ d = ff(d, a, b, c, k[13], 12, -40341101);
+ c = ff(c, d, a, b, k[14], 17, -1502002290);
+ b = ff(b, c, d, a, k[15], 22, 1236535329);
+
+ a = gg(a, b, c, d, k[1], 5, -165796510);
+ d = gg(d, a, b, c, k[6], 9, -1069501632);
+ c = gg(c, d, a, b, k[11], 14, 643717713);
+ b = gg(b, c, d, a, k[0], 20, -373897302);
+ a = gg(a, b, c, d, k[5], 5, -701558691);
+ d = gg(d, a, b, c, k[10], 9, 38016083);
+ c = gg(c, d, a, b, k[15], 14, -660478335);
+ b = gg(b, c, d, a, k[4], 20, -405537848);
+ a = gg(a, b, c, d, k[9], 5, 568446438);
+ d = gg(d, a, b, c, k[14], 9, -1019803690);
+ c = gg(c, d, a, b, k[3], 14, -187363961);
+ b = gg(b, c, d, a, k[8], 20, 1163531501);
+ a = gg(a, b, c, d, k[13], 5, -1444681467);
+ d = gg(d, a, b, c, k[2], 9, -51403784);
+ c = gg(c, d, a, b, k[7], 14, 1735328473);
+ b = gg(b, c, d, a, k[12], 20, -1926607734);
+
+ a = hh(a, b, c, d, k[5], 4, -378558);
+ d = hh(d, a, b, c, k[8], 11, -2022574463);
+ c = hh(c, d, a, b, k[11], 16, 1839030562);
+ b = hh(b, c, d, a, k[14], 23, -35309556);
+ a = hh(a, b, c, d, k[1], 4, -1530992060);
+ d = hh(d, a, b, c, k[4], 11, 1272893353);
+ c = hh(c, d, a, b, k[7], 16, -155497632);
+ b = hh(b, c, d, a, k[10], 23, -1094730640);
+ a = hh(a, b, c, d, k[13], 4, 681279174);
+ d = hh(d, a, b, c, k[0], 11, -358537222);
+ c = hh(c, d, a, b, k[3], 16, -722521979);
+ b = hh(b, c, d, a, k[6], 23, 76029189);
+ a = hh(a, b, c, d, k[9], 4, -640364487);
+ d = hh(d, a, b, c, k[12], 11, -421815835);
+ c = hh(c, d, a, b, k[15], 16, 530742520);
+ b = hh(b, c, d, a, k[2], 23, -995338651);
+
+ a = ii(a, b, c, d, k[0], 6, -198630844);
+ d = ii(d, a, b, c, k[7], 10, 1126891415);
+ c = ii(c, d, a, b, k[14], 15, -1416354905);
+ b = ii(b, c, d, a, k[5], 21, -57434055);
+ a = ii(a, b, c, d, k[12], 6, 1700485571);
+ d = ii(d, a, b, c, k[3], 10, -1894986606);
+ c = ii(c, d, a, b, k[10], 15, -1051523);
+ b = ii(b, c, d, a, k[1], 21, -2054922799);
+ a = ii(a, b, c, d, k[8], 6, 1873313359);
+ d = ii(d, a, b, c, k[15], 10, -30611744);
+ c = ii(c, d, a, b, k[6], 15, -1560198380);
+ b = ii(b, c, d, a, k[13], 21, 1309151649);
+ a = ii(a, b, c, d, k[4], 6, -145523070);
+ d = ii(d, a, b, c, k[11], 10, -1120210379);
+ c = ii(c, d, a, b, k[2], 15, 718787259);
+ b = ii(b, c, d, a, k[9], 21, -343485551);
+
+ x[0] = add32(a, x[0]);
+ x[1] = add32(b, x[1]);
+ x[2] = add32(c, x[2]);
+ x[3] = add32(d, x[3]);
+ },
+
+ /* there needs to be support for Unicode here,
+ * unless we pretend that we can redefine the MD-5
+ * algorithm for multi-byte characters (perhaps
+ * by adding every four 16-bit characters and
+ * shortening the sum to 32 bits). Otherwise
+ * I suggest performing MD-5 as if every character
+ * was two bytes--e.g., 0040 0025 = @%--but then
+ * how will an ordinary MD-5 sum be matched?
+ * There is no way to standardize text to something
+ * like UTF-8 before transformation; speed cost is
+ * utterly prohibitive. The JavaScript standard
+ * itself needs to look at this: it should start
+ * providing access to strings as preformed UTF-8
+ * 8-bit unsigned value arrays.
+ */
+ md5blk = function (s) {
+ var md5blks = [],
+ i; /* Andy King said do it this way. */
+
+ for (i = 0; i < 64; i += 4) {
+ md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
+ }
+ return md5blks;
+ },
+
+ md5blk_array = function (a) {
+ var md5blks = [],
+ i; /* Andy King said do it this way. */
+
+ for (i = 0; i < 64; i += 4) {
+ md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);
+ }
+ return md5blks;
+ },
+
+ md51 = function (s) {
+ var n = s.length,
+ state = [1732584193, -271733879, -1732584194, 271733878],
+ i,
+ length,
+ tail,
+ tmp,
+ lo,
+ hi;
+
+ for (i = 64; i <= n; i += 64) {
+ md5cycle(state, md5blk(s.substring(i - 64, i)));
+ }
+ s = s.substring(i - 64);
+ length = s.length;
+ tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
+ for (i = 0; i < length; i += 1) {
+ tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3);
+ }
+ tail[i >> 2] |= 0x80 << ((i % 4) << 3);
+ if (i > 55) {
+ md5cycle(state, tail);
+ for (i = 0; i < 16; i += 1) {
+ tail[i] = 0;
+ }
+ }
+
+ // Beware that the final length might not fit in 32 bits so we take care of that
+ tmp = n * 8;
+ tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
+ lo = parseInt(tmp[2], 16);
+ hi = parseInt(tmp[1], 16) || 0;
+
+ tail[14] = lo;
+ tail[15] = hi;
+
+ md5cycle(state, tail);
+ return state;
+ },
+
+ md51_array = function (a) {
+ var n = a.length,
+ state = [1732584193, -271733879, -1732584194, 271733878],
+ i,
+ length,
+ tail,
+ tmp,
+ lo,
+ hi;
+
+ for (i = 64; i <= n; i += 64) {
+ md5cycle(state, md5blk_array(a.subarray(i - 64, i)));
+ }
+
+ // Not sure if it is a bug, however IE10 will always produce a sub array of length 1
+ // containing the last element of the parent array if the sub array specified starts
+ // beyond the length of the parent array - weird.
+ // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue
+ a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0);
+
+ length = a.length;
+ tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
+ for (i = 0; i < length; i += 1) {
+ tail[i >> 2] |= a[i] << ((i % 4) << 3);
+ }
+
+ tail[i >> 2] |= 0x80 << ((i % 4) << 3);
+ if (i > 55) {
+ md5cycle(state, tail);
+ for (i = 0; i < 16; i += 1) {
+ tail[i] = 0;
+ }
+ }
+
+ // Beware that the final length might not fit in 32 bits so we take care of that
+ tmp = n * 8;
+ tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
+ lo = parseInt(tmp[2], 16);
+ hi = parseInt(tmp[1], 16) || 0;
+
+ tail[14] = lo;
+ tail[15] = hi;
+
+ md5cycle(state, tail);
+
+ return state;
+ },
+
+ hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'],
+
+ rhex = function (n) {
+ var s = '',
+ j;
+ for (j = 0; j < 4; j += 1) {
+ s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F];
+ }
+ return s;
+ },
+
+ hex = function (x) {
+ var i;
+ for (i = 0; i < x.length; i += 1) {
+ x[i] = rhex(x[i]);
+ }
+ return x.join('');
+ },
+
+ md5 = function (s) {
+ return hex(md51(s));
+ },
+
+
+
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * SparkMD5 OOP implementation.
+ *
+ * Use this class to perform an incremental md5, otherwise use the
+ * static methods instead.
+ */
+ SparkMD5 = function () {
+ // call reset to init the instance
+ this.reset();
+ };
+
+
+ // In some cases the fast add32 function cannot be used..
+ if (md5('hello') !== '5d41402abc4b2a76b9719d911017c592') {
+ add32 = function (x, y) {
+ var lsw = (x & 0xFFFF) + (y & 0xFFFF),
+ msw = (x >> 16) + (y >> 16) + (lsw >> 16);
+ return (msw << 16) | (lsw & 0xFFFF);
+ };
+ }
+
+
+ /**
+ * Appends a string.
+ * A conversion will be applied if an utf8 string is detected.
+ *
+ * @param {String} str The string to be appended
+ *
+ * @return {SparkMD5} The instance itself
+ */
+ SparkMD5.prototype.append = function (str) {
+ // converts the string to utf8 bytes if necessary
+ if (/[\u0080-\uFFFF]/.test(str)) {
+ str = unescape(encodeURIComponent(str));
+ }
+
+ // then append as binary
+ this.appendBinary(str);
+
+ return this;
+ };
+
+ /**
+ * Appends a binary string.
+ *
+ * @param {String} contents The binary string to be appended
+ *
+ * @return {SparkMD5} The instance itself
+ */
+ SparkMD5.prototype.appendBinary = function (contents) {
+ this._buff += contents;
+ this._length += contents.length;
+
+ var length = this._buff.length,
+ i;
+
+ for (i = 64; i <= length; i += 64) {
+ md5cycle(this._state, md5blk(this._buff.substring(i - 64, i)));
+ }
+
+ this._buff = this._buff.substr(i - 64);
+
+ return this;
+ };
+
+ /**
+ * Finishes the incremental computation, reseting the internal state and
+ * returning the result.
+ * Use the raw parameter to obtain the raw result instead of the hex one.
+ *
+ * @param {Boolean} raw True to get the raw result, false to get the hex result
+ *
+ * @return {String|Array} The result
+ */
+ SparkMD5.prototype.end = function (raw) {
+ var buff = this._buff,
+ length = buff.length,
+ i,
+ tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ ret;
+
+ for (i = 0; i < length; i += 1) {
+ tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3);
+ }
+
+ this._finish(tail, length);
+ ret = !!raw ? this._state : hex(this._state);
+
+ this.reset();
+
+ return ret;
+ };
+
+ /**
+ * Finish the final calculation based on the tail.
+ *
+ * @param {Array} tail The tail (will be modified)
+ * @param {Number} length The length of the remaining buffer
+ */
+ SparkMD5.prototype._finish = function (tail, length) {
+ var i = length,
+ tmp,
+ lo,
+ hi;
+
+ tail[i >> 2] |= 0x80 << ((i % 4) << 3);
+ if (i > 55) {
+ md5cycle(this._state, tail);
+ for (i = 0; i < 16; i += 1) {
+ tail[i] = 0;
+ }
+ }
+
+ // Do the final computation based on the tail and length
+ // Beware that the final length may not fit in 32 bits so we take care of that
+ tmp = this._length * 8;
+ tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
+ lo = parseInt(tmp[2], 16);
+ hi = parseInt(tmp[1], 16) || 0;
+
+ tail[14] = lo;
+ tail[15] = hi;
+ md5cycle(this._state, tail);
+ };
+
+ /**
+ * Resets the internal state of the computation.
+ *
+ * @return {SparkMD5} The instance itself
+ */
+ SparkMD5.prototype.reset = function () {
+ this._buff = "";
+ this._length = 0;
+ this._state = [1732584193, -271733879, -1732584194, 271733878];
+
+ return this;
+ };
+
+ /**
+ * Releases memory used by the incremental buffer and other aditional
+ * resources. If you plan to use the instance again, use reset instead.
+ */
+ SparkMD5.prototype.destroy = function () {
+ delete this._state;
+ delete this._buff;
+ delete this._length;
+ };
+
+
+ /**
+ * Performs the md5 hash on a string.
+ * A conversion will be applied if utf8 string is detected.
+ *
+ * @param {String} str The string
+ * @param {Boolean} raw True to get the raw result, false to get the hex result
+ *
+ * @return {String|Array} The result
+ */
+ SparkMD5.hash = function (str, raw) {
+ // converts the string to utf8 bytes if necessary
+ if (/[\u0080-\uFFFF]/.test(str)) {
+ str = unescape(encodeURIComponent(str));
+ }
+
+ var hash = md51(str);
+
+ return !!raw ? hash : hex(hash);
+ };
+
+ /**
+ * Performs the md5 hash on a binary string.
+ *
+ * @param {String} content The binary string
+ * @param {Boolean} raw True to get the raw result, false to get the hex result
+ *
+ * @return {String|Array} The result
+ */
+ SparkMD5.hashBinary = function (content, raw) {
+ var hash = md51(content);
+
+ return !!raw ? hash : hex(hash);
+ };
+
+ /**
+ * SparkMD5 OOP implementation for array buffers.
+ *
+ * Use this class to perform an incremental md5 ONLY for array buffers.
+ */
+ SparkMD5.ArrayBuffer = function () {
+ // call reset to init the instance
+ this.reset();
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Appends an array buffer.
+ *
+ * @param {ArrayBuffer} arr The array to be appended
+ *
+ * @return {SparkMD5.ArrayBuffer} The instance itself
+ */
+ SparkMD5.ArrayBuffer.prototype.append = function (arr) {
+ // TODO: we could avoid the concatenation here but the algorithm would be more complex
+ // if you find yourself needing extra performance, please make a PR.
+ var buff = this._concatArrayBuffer(this._buff, arr),
+ length = buff.length,
+ i;
+
+ this._length += arr.byteLength;
+
+ for (i = 64; i <= length; i += 64) {
+ md5cycle(this._state, md5blk_array(buff.subarray(i - 64, i)));
+ }
+
+ // Avoids IE10 weirdness (documented above)
+ this._buff = (i - 64) < length ? buff.subarray(i - 64) : new Uint8Array(0);
+
+ return this;
+ };
+
+ /**
+ * Finishes the incremental computation, reseting the internal state and
+ * returning the result.
+ * Use the raw parameter to obtain the raw result instead of the hex one.
+ *
+ * @param {Boolean} raw True to get the raw result, false to get the hex result
+ *
+ * @return {String|Array} The result
+ */
+ SparkMD5.ArrayBuffer.prototype.end = function (raw) {
+ var buff = this._buff,
+ length = buff.length,
+ tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ i,
+ ret;
+
+ for (i = 0; i < length; i += 1) {
+ tail[i >> 2] |= buff[i] << ((i % 4) << 3);
+ }
+
+ this._finish(tail, length);
+ ret = !!raw ? this._state : hex(this._state);
+
+ this.reset();
+
+ return ret;
+ };
+
+ SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;
+
+ /**
+ * Resets the internal state of the computation.
+ *
+ * @return {SparkMD5.ArrayBuffer} The instance itself
+ */
+ SparkMD5.ArrayBuffer.prototype.reset = function () {
+ this._buff = new Uint8Array(0);
+ this._length = 0;
+ this._state = [1732584193, -271733879, -1732584194, 271733878];
+
+ return this;
+ };
+
+ /**
+ * Releases memory used by the incremental buffer and other aditional
+ * resources. If you plan to use the instance again, use reset instead.
+ */
+ SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;
+
+ /**
+ * Concats two array buffers, returning a new one.
+ *
+ * @param {ArrayBuffer} first The first array buffer
+ * @param {ArrayBuffer} second The second array buffer
+ *
+ * @return {ArrayBuffer} The new array buffer
+ */
+ SparkMD5.ArrayBuffer.prototype._concatArrayBuffer = function (first, second) {
+ var firstLength = first.length,
+ result = new Uint8Array(firstLength + second.byteLength);
+
+ result.set(first);
+ result.set(new Uint8Array(second), firstLength);
+
+ return result;
+ };
+
+ /**
+ * Performs the md5 hash on an array buffer.
+ *
+ * @param {ArrayBuffer} arr The array buffer
+ * @param {Boolean} raw True to get the raw result, false to get the hex result
+ *
+ * @return {String|Array} The result
+ */
+ SparkMD5.ArrayBuffer.hash = function (arr, raw) {
+ var hash = md51_array(new Uint8Array(arr));
+
+ return !!raw ? hash : hex(hash);
+ };
+
+ return SparkMD5;
+}));
diff --git a/http/3rdParty/yaMD5/test/lib/valums-md5.js b/http/3rdParty/yaMD5/test/lib/valums-md5.js
new file mode 100644
index 0000000..865d626
--- /dev/null
+++ b/http/3rdParty/yaMD5/test/lib/valums-md5.js
@@ -0,0 +1,218 @@
+/**
+* Namespace for hashing and other cryptographic functions
+* Copyright (c) Andrew Valums
+* Licensed under the MIT license, http://valums.com/mit-license/
+*/
+
+var V = V || {};
+V.Security = V.Security || {};
+
+(function() {
+ // for faster access
+ var S = V.Security;
+
+ /**
+ * The highest integer value a number can go to without losing precision.
+ */
+ S.maxExactInt = Math.pow(2, 53);
+
+ /**
+ * Converts string from internal UTF-16 to UTF-8
+ * and saves it using array of numbers (bytes), 0-255 per cell
+ * @param {String} str
+ * @return {Array}
+ */
+ S.toUtf8ByteArr = function(str) {
+ var arr = [],
+ code;
+
+ for (var i = 0; i < str.length; i++) {
+ code = str.charCodeAt(i);
+
+ /*
+ Note that charCodeAt will always return a value that is less than 65,536.
+ This is because the higher code points are represented by a pair of (lower valued)
+ "surrogate" pseudo-characters which are used to comprise the real character.
+ Because of this, in order to examine or reproduce the full character for
+ individual characters of value 65,536 and above, for such characters,
+ it is necessary to retrieve not only charCodeAt(0), but also charCodeAt(1).
+ */
+ if (0xD800 <= code && code <= 0xDBFF) {
+ // UTF-16 high surrogate
+ var hi = code,
+ low = str.charCodeAt(i + 1);
+
+ code = ((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;
+
+ i++;
+ }
+
+ if (code <= 127) {
+ arr[arr.length] = code;
+ } else if (code <= 2047) {
+ arr[arr.length] = (code >>> 6) + 0xC0;
+ arr[arr.length] = code & 0x3F | 0x80;
+ } else if (code <= 65535) {
+ arr[arr.length] = (code >>> 12) + 0xE0;
+ arr[arr.length] = (code >>> 6 & 0x3F) | 0x80;
+ arr[arr.length] = (code & 0x3F) | 0x80;
+ } else if (code <= 1114111) {
+ arr[arr.length] = (code >>> 18) + 0xF0;
+ arr[arr.length] = (code >>> 12 & 0x3F) | 0x80;
+ arr[arr.length] = (code >>> 6 & 0x3F) | 0x80;
+ arr[arr.length] = (code & 0x3F) | 0x80;
+ } else {
+ throw 'Unicode standart supports code points up-to U+10FFFF';
+ }
+ }
+
+ return arr;
+ };
+
+ /**
+ * Outputs 32 integer bits of a number in hex format.
+ * Preserves leading zeros.
+ * @param {Number} num
+ */
+ S.toHex32 = function(num) {
+ // if negative
+ if (num & 0x80000000) {
+ // convert to positive number
+ num = num & (~0x80000000);
+ num += Math.pow(2, 31);
+ }
+
+ var str = num.toString(16);
+
+ while (str.length < 8) {
+ str = '0' + str;
+ }
+
+ return str;
+ };
+
+ /**
+ * Changes the order of 4 bytes in integer representation of number.
+ * From 1234 to 4321.
+ * @param {Number} num Only 32 int bits are used.
+ */
+ S.reverseBytes = function(num) {
+ var res = 0;
+ res += ((num >>> 24) & 0xff);
+ res += ((num >>> 16) & 0xff) << 8;
+ res += ((num >>> 8) & 0xff) << 16;
+ res += (num & 0xff) << 24;
+ return res;
+ };
+
+ S.leftRotate = function(x, c) {
+ return (x << c) | (x >>> (32 - c));
+ };
+
+ /**
+ * RSA Data Security, Inc. MD5 Message-Digest Algorithm
+ * http://tools.ietf.org/html/rfc1321
+ * http://en.wikipedia.org/wiki/MD5
+ * @param {String} message
+ */
+ S.md5 = function(message) {
+ // r specifies the per-round shift amounts
+ var r = [7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21];
+
+ // Use binary integer part of the sines of integers (Radians) as constants:
+ var k = [];
+ for (var i = 0; i <= 63; i++) {
+ k[i] = (Math.abs(Math.sin(i + 1)) * Math.pow(2, 32)) << 0;
+ }
+
+ var h0 = 0x67452301,
+ h1 = 0xEFCDAB89,
+ h2 = 0x98BADCFE,
+ h3 = 0x10325476,
+ bytes, unpadded;
+
+ //Pre-processing:
+ bytes = S.toUtf8ByteArr(message);
+ message = null;
+ unpadded = bytes.length;
+
+ //append "1" bit to message
+ //append "0" bits until message length in bits ≡ 448 (mod 512)
+ bytes.push(0x80);
+ var zeroBytes = Math.abs(448 - (bytes.length * 8) % 512) / 8;
+
+ while (zeroBytes--) {
+ bytes.push(0);
+ }
+
+ //append bit length of unpadded message as 64-bit little-endian integer to message
+ bytes.push(unpadded * 8 & 0xff, unpadded * 8 >> 8 & 0xff, unpadded * 8 >> 16 & 0xff, unpadded * 8 >> 24 & 0xff);
+
+ var i = 4;
+ while (i--) {
+ bytes.push(0);
+ }
+
+ var leftRotate = S.leftRotate;
+
+ //Process the message in successive 512-bit chunks:
+ var i = 0,
+ w = [];
+ while (i < bytes.length) {
+
+ //break chunk into sixteen 32-bit words w[i], 0 ≤ i ≤ 15
+ for (var j = 0; j <= 15; j++) {
+ w[j] = (bytes[i + 4 * j] << 0) + (bytes[i + 4 * j + 1] << 8) + (bytes[i + 4 * j + 2] << 16) + (bytes[i + 4 * j + 3] << 24);
+ }
+
+ //Initialize hash value for this chunk:
+ var a = h0,
+ b = h1,
+ c = h2,
+ d = h3,
+ f, g;
+
+ //Main loop:
+ for (var j = 0; j <= 63; j++) {
+
+ if (j <= 15) {
+ f = (b & c) | ((~b) & d);
+ g = j;
+ } else if (j <= 31) {
+ f = (d & b) | ((~d) & c);
+ g = (5 * j + 1) % 16;
+ } else if (j <= 47) {
+ f = b ^ c ^ d;
+ g = (3 * j + 5) % 16;
+ } else {
+ f = c ^ (b | (~d));
+ g = (7 * j) % 16;
+ }
+
+ var temp = d;
+
+ d = c;
+ c = b;
+ b = b + leftRotate((a + f + k[j] + w[g]), r[j]);
+ a = temp;
+ }
+
+ //Add this chunk's hash to result so far:
+ h0 = (h0 + a) << 0;
+ h1 = (h1 + b) << 0;
+ h2 = (h2 + c) << 0;
+ h3 = (h3 + d) << 0;
+
+ i += 512 / 8;
+ }
+
+ // fix when starting with 0
+ var res = out(h0) + out(h1) + out(h2) + out(h3);
+
+ function out(h) {
+ return S.toHex32(S.reverseBytes(h));
+ }
+
+ return res;
+ };
+})();
diff --git a/http/3rdParty/yaMD5/test/test.html b/http/3rdParty/yaMD5/test/test.html
new file mode 100644
index 0000000..ce2659f
--- /dev/null
+++ b/http/3rdParty/yaMD5/test/test.html
@@ -0,0 +1,99 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+body {
+ font: 13px mono;
+ }
+.good {
+ color: green;
+ }
+.bad {
+ color: red;
+ }
+</style>
+</head>
+<body>
+<script>
+var test = function(md5Name, md5Func) {
+ // Add tests here
+ // A test is a pair of strings: hash then data
+ var tests = [
+
+ // from Appendix 5 of http://www.ietf.org/rfc/rfc1321.txt
+ 'd41d8cd98f00b204e9800998ecf8427e', '',
+ '0cc175b9c0f1b6a831c399e269772661', 'a',
+ '900150983cd24fb0d6963f7d28e17f72', 'abc',
+ 'f96b697d7cb7938d525a2f31aaf161d0', 'message digest',
+ 'c3fcd3d76192e4007dfb496cca67e13b', 'abcdefghijklmnopqrstuvwxyz',
+ 'd174ab98d277d9f5a5611c2c9f419d9f', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',
+ '57edf4a22be3c955ac49da2e2107b67a', '12345678901234567890123456789012345678901234567890123456789012345678901234567890',
+
+ // Unicode strings taken from http://en.wikipedia.org/wiki/List_of_pangrams
+ // Then I ran them through md5sum
+ 'b69cf1b7b6888f1f8928e2e2b74da8bc', 'Voix ambiguë d\'un cœur qui au zéphyr préfère les jattes de kiwis',
+ 'd1ea7e7792c50a0386b1064ab220da0c', 'Жълтата дюля беше щастлива, че пухът, който цъфна, замръзна като гьон',
+ 'b6071a4fc17e44a7d0246e5b4c939a70', 'Hyvän lorun sangen pieneksi hyödyksi jäi suomen kirjaimet',
+ '47ee7efa5573066d43ab5f9ae1830cf8', 'Ταχίστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός',
+ '7e626d44cd9610f2fef198156730e7d9', '色は匂へど 散りぬるを 我が世誰ぞ 常ならむ 有為の奥山 今日越えて 浅き夢見じ 酔ひもせず',
+ 'ae5f9c6b87f4e50e68eb20c10e21733a', 'นายสังฆภัณฑ์ เฮงพิทักษ์ฝั่ง ผู้เฒ่าซึ่งมีอาชีพเป็นฅนขายฃวด ถูกตำรวจปฏิบัติการจับฟ้องศาล ฐานลักนาฬิกาคุณหญิงฉัตรชฎา ฌานสมาธิ'
+ ];
+ var templateSuccess = '<span class="good">Success: "{{hash}}" === md5("{{data}}")</span><br>';
+ var templateFailure = '<span class="bad">Failure: "{{hash}}" !== md5("{{data}}")</span><br>';
+
+ document.write('<h1>'+ md5Name + '</h1>');
+
+ var hash, data, template, output;
+ for ( var i = 0; i < tests.length; i += 2 ) {
+ hash = tests[i+0];
+ data = tests[i+1];
+ if ( md5Func(data) === hash ) {
+ template = templateSuccess;
+ } else {
+ template = templateFailure;
+ }
+ document.write(template.replace('{{data}}', data).replace('{{hash}}', hash));
+ }
+};
+
+var module = module || {};
+</script>
+
+<script src="../yamd5.js"></script>
+<script>test('github.com/gorhill/yamd5.js', YaMD5.hashStr);</script>
+<p>Project home: <a href="https://github.com/gorhill/yamd5.js">https://github.com/gorhill/yamd5.js</a></p>
+
+<script src="./lib/satazor-md5.js"></script>
+<script>test('github.com/satazor/SparkMD5', SparkMD5.hash);</script>
+<p>Project home: <a href="https://github.com/satazor/SparkMD5">https://github.com/satazor/SparkMD5</a></p>
+
+<script src="./lib/paj-md5.js"></script>
+<script>test('Paul Johnston', pajMD5);</script>
+<p>Project home: <a href="http://pajhome.org.uk/crypt/md5/md5.html">http://pajhome.org.uk/crypt/md5/md5.html</a></p>
+
+<script src="./lib/jbt-md5.js"></script>
+<script>test('github.com/jbt/js-crypto', md5);</script>
+<p>Project home: <a href="https://github.com/jbt/js-crypto">https://github.com/jbt/js-crypto</a></p>
+
+<script src="./lib/izumo-md5.js"></script>
+<script>test('Masanao Izumo', izumoMD5);</script>
+<p>Project home: <a href="http://www.onicos.com/staff/iz/amuse/javascript/expert/md5.txt">http://www.onicos.com/staff/iz/amuse/javascript/expert/md5.txt</a></p>
+
+<script src="./lib/jkm-md5.js"></script>
+<script>test('Joseph Myers', jkmMD5);</script>
+<p>Project home: <a href="http://www.myersdaily.org/joseph/javascript/md5-text.html">http://www.myersdaily.org/joseph/javascript/md5-text.html</a></p>
+
+<script src="https://rawgit.com/trentmillar/md5-o-matic/master/lib/md5omatic.js"></script>
+<script>test('github.com/trentmillar/md5-o-matic', module.exports);</script>
+<p>Project home: <a href="https://github.com/trentmillar/md5-o-matic">https://github.com/trentmillar/md5-o-matic</a></p>
+
+<script src="./lib/ireal-md5.js"></script>
+<script>test('github.com/iReal/FastMD5', function(s) { return md5(s, true); });</script>
+<p>Project home: <a href="https://github.com/iReal/FastMD5">https://github.com/iReal/FastMD5</a></p>
+
+<script src="./lib/valums-md5.js"></script>
+<script>test('valums', V.Security.md5);</script>
+<p>Code taken from: <a href="http://jsperf.com/md5-shootout/48">http://jsperf.com/md5-shootout/48</a></p>
+
+</body>
+</html>
diff --git a/http/3rdParty/yaMD5/yamd5.js b/http/3rdParty/yaMD5/yamd5.js
new file mode 100644
index 0000000..582b576
--- /dev/null
+++ b/http/3rdParty/yaMD5/yamd5.js
@@ -0,0 +1,402 @@
+/*******************************************************************************
+
+YaMD5 - Yet another MD5 hasher.
+home: https://github.com/gorhill/yamd5.js
+
+I needed an MD5 hasher, and as usual I want small code base, and fast.
+
+Originally found md5-o-matic [1]. It was fast but did not work with Unicode
+strings. Also, eventually realized it was really based on code from
+Joseph Myers [2] with no proper credits given (not nice).
+
+Then I found SparkMD5 [3], which works with Unicode strings, but at a steep
+cost to performance. Also, glancing at the code I saw avoidable redundancies
+causing the code base to be much larger than needed.
+
+So from this point I set out to write my own version, YaMD5 (sorry, I am
+not good with naming projects), of course heavily relying on the original
+code from Joseph Myers [2], and bits from SparkMD5 -- I started to work from
+SparkMD5 implementation, so there might be bits of code original to SparkMD5
+code left in a few places (like say, MD5.end()).
+
+Advantages of YaMD5:
+
+- Can handle Unicode strings
+- Natively incremental
+- Small code base
+- Fastest MD5 hasher out there so far for large input [4]
+- Even faster than versions supporting only simpler ascii strings
+
+
+ [1] https://github.com/trentmillar/md5-o-matic
+ [2] http://www.myersdaily.org/joseph/javascript/md5-text.html
+ [3] https://github.com/satazor/SparkMD5
+ [4] http://jsperf.com/md5-shootout/75
+
+So with that said, I don't know what license covers Joseph Myers' code (need
+to find out). In any case, concerning whatever original code I contributed in
+there:
+
+The MIT License (MIT)
+
+Copyright (C) 2014 Raymond Hill
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+**/
+
+/* jshint bitwise: false */
+
+(function(root) {
+
+ 'use strict';
+
+ /*
+ * Fastest md5 implementation around (JKM md5)
+ * Credits: Joseph Myers
+ *
+ * @see http://www.myersdaily.org/joseph/javascript/md5-text.html
+ * @see http://jsperf.com/md5-shootout/7
+ */
+
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence
+
+ var md5cycle = function(x, k) {
+ var a = x[0],
+ b = x[1],
+ c = x[2],
+ d = x[3];
+ // ff()
+ a += (b & c | ~b & d) + k[0] - 680876936 | 0;
+ a = (a << 7 | a >>> 25) + b | 0;
+ d += (a & b | ~a & c) + k[1] - 389564586 | 0;
+ d = (d << 12 | d >>> 20) + a | 0;
+ c += (d & a | ~d & b) + k[2] + 606105819 | 0;
+ c = (c << 17 | c >>> 15) + d | 0;
+ b += (c & d | ~c & a) + k[3] - 1044525330 | 0;
+ b = (b << 22 | b >>> 10) + c | 0;
+ a += (b & c | ~b & d) + k[4] - 176418897 | 0;
+ a = (a << 7 | a >>> 25) + b | 0;
+ d += (a & b | ~a & c) + k[5] + 1200080426 | 0;
+ d = (d << 12 | d >>> 20) + a | 0;
+ c += (d & a | ~d & b) + k[6] - 1473231341 | 0;
+ c = (c << 17 | c >>> 15) + d | 0;
+ b += (c & d | ~c & a) + k[7] - 45705983 | 0;
+ b = (b << 22 | b >>> 10) + c | 0;
+ a += (b & c | ~b & d) + k[8] + 1770035416 | 0;
+ a = (a << 7 | a >>> 25) + b | 0;
+ d += (a & b | ~a & c) + k[9] - 1958414417 | 0;
+ d = (d << 12 | d >>> 20) + a | 0;
+ c += (d & a | ~d & b) + k[10] - 42063 | 0;
+ c = (c << 17 | c >>> 15) + d | 0;
+ b += (c & d | ~c & a) + k[11] - 1990404162 | 0;
+ b = (b << 22 | b >>> 10) + c | 0;
+ a += (b & c | ~b & d) + k[12] + 1804603682 | 0;
+ a = (a << 7 | a >>> 25) + b | 0;
+ d += (a & b | ~a & c) + k[13] - 40341101 | 0;
+ d = (d << 12 | d >>> 20) + a | 0;
+ c += (d & a | ~d & b) + k[14] - 1502002290 | 0;
+ c = (c << 17 | c >>> 15) + d | 0;
+ b += (c & d | ~c & a) + k[15] + 1236535329 | 0;
+ b = (b << 22 | b >>> 10) + c | 0;
+ // gg()
+ a += (b & d | c & ~d) + k[1] - 165796510 | 0;
+ a = (a << 5 | a >>> 27) + b | 0;
+ d += (a & c | b & ~c) + k[6] - 1069501632 | 0;
+ d = (d << 9 | d >>> 23) + a | 0;
+ c += (d & b | a & ~b) + k[11] + 643717713 | 0;
+ c = (c << 14 | c >>> 18) + d | 0;
+ b += (c & a | d & ~a) + k[0] - 373897302 | 0;
+ b = (b << 20 | b >>> 12) + c | 0;
+ a += (b & d | c & ~d) + k[5] - 701558691 | 0;
+ a = (a << 5 | a >>> 27) + b | 0;
+ d += (a & c | b & ~c) + k[10] + 38016083 | 0;
+ d = (d << 9 | d >>> 23) + a | 0;
+ c += (d & b | a & ~b) + k[15] - 660478335 | 0;
+ c = (c << 14 | c >>> 18) + d | 0;
+ b += (c & a | d & ~a) + k[4] - 405537848 | 0;
+ b = (b << 20 | b >>> 12) + c | 0;
+ a += (b & d | c & ~d) + k[9] + 568446438 | 0;
+ a = (a << 5 | a >>> 27) + b | 0;
+ d += (a & c | b & ~c) + k[14] - 1019803690 | 0;
+ d = (d << 9 | d >>> 23) + a | 0;
+ c += (d & b | a & ~b) + k[3] - 187363961 | 0;
+ c = (c << 14 | c >>> 18) + d | 0;
+ b += (c & a | d & ~a) + k[8] + 1163531501 | 0;
+ b = (b << 20 | b >>> 12) + c | 0;
+ a += (b & d | c & ~d) + k[13] - 1444681467 | 0;
+ a = (a << 5 | a >>> 27) + b | 0;
+ d += (a & c | b & ~c) + k[2] - 51403784 | 0;
+ d = (d << 9 | d >>> 23) + a | 0;
+ c += (d & b | a & ~b) + k[7] + 1735328473 | 0;
+ c = (c << 14 | c >>> 18) + d | 0;
+ b += (c & a | d & ~a) + k[12] - 1926607734 | 0;
+ b = (b << 20 | b >>> 12) + c | 0;
+ // hh()
+ a += (b ^ c ^ d) + k[5] - 378558 | 0;
+ a = (a << 4 | a >>> 28) + b | 0;
+ d += (a ^ b ^ c) + k[8] - 2022574463 | 0;
+ d = (d << 11 | d >>> 21) + a | 0;
+ c += (d ^ a ^ b) + k[11] + 1839030562 | 0;
+ c = (c << 16 | c >>> 16) + d | 0;
+ b += (c ^ d ^ a) + k[14] - 35309556 | 0;
+ b = (b << 23 | b >>> 9) + c | 0;
+ a += (b ^ c ^ d) + k[1] - 1530992060 | 0;
+ a = (a << 4 | a >>> 28) + b | 0;
+ d += (a ^ b ^ c) + k[4] + 1272893353 | 0;
+ d = (d << 11 | d >>> 21) + a | 0;
+ c += (d ^ a ^ b) + k[7] - 155497632 | 0;
+ c = (c << 16 | c >>> 16) + d | 0;
+ b += (c ^ d ^ a) + k[10] - 1094730640 | 0;
+ b = (b << 23 | b >>> 9) + c | 0;
+ a += (b ^ c ^ d) + k[13] + 681279174 | 0;
+ a = (a << 4 | a >>> 28) + b | 0;
+ d += (a ^ b ^ c) + k[0] - 358537222 | 0;
+ d = (d << 11 | d >>> 21) + a | 0;
+ c += (d ^ a ^ b) + k[3] - 722521979 | 0;
+ c = (c << 16 | c >>> 16) + d | 0;
+ b += (c ^ d ^ a) + k[6] + 76029189 | 0;
+ b = (b << 23 | b >>> 9) + c | 0;
+ a += (b ^ c ^ d) + k[9] - 640364487 | 0;
+ a = (a << 4 | a >>> 28) + b | 0;
+ d += (a ^ b ^ c) + k[12] - 421815835 | 0;
+ d = (d << 11 | d >>> 21) + a | 0;
+ c += (d ^ a ^ b) + k[15] + 530742520 | 0;
+ c = (c << 16 | c >>> 16) + d | 0;
+ b += (c ^ d ^ a) + k[2] - 995338651 | 0;
+ b = (b << 23 | b >>> 9) + c | 0;
+ // ii()
+ a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;
+ a = (a << 6 | a >>> 26) + b | 0;
+ d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;
+ d = (d << 10 | d >>> 22) + a | 0;
+ c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;
+ c = (c << 15 | c >>> 17) + d | 0;
+ b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;
+ b = (b << 21 |b >>> 11) + c | 0;
+ a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;
+ a = (a << 6 | a >>> 26) + b | 0;
+ d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;
+ d = (d << 10 | d >>> 22) + a | 0;
+ c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;
+ c = (c << 15 | c >>> 17) + d | 0;
+ b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;
+ b = (b << 21 |b >>> 11) + c | 0;
+ a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;
+ a = (a << 6 | a >>> 26) + b | 0;
+ d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;
+ d = (d << 10 | d >>> 22) + a | 0;
+ c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;
+ c = (c << 15 | c >>> 17) + d | 0;
+ b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;
+ b = (b << 21 |b >>> 11) + c | 0;
+ a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;
+ a = (a << 6 | a >>> 26) + b | 0;
+ d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;
+ d = (d << 10 | d >>> 22) + a | 0;
+ c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;
+ c = (c << 15 | c >>> 17) + d | 0;
+ b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;
+ b = (b << 21 | b >>> 11) + c | 0;
+
+ x[0] = a + x[0] | 0;
+ x[1] = b + x[1] | 0;
+ x[2] = c + x[2] | 0;
+ x[3] = d + x[3] | 0;
+ };
+
+ var hexChars = '0123456789abcdef';
+ var hexOut = [];
+
+ var hex = function(x) {
+ var hc = hexChars;
+ var ho = hexOut;
+ var n, offset, j;
+ for (var i = 0; i < 4; i++) {
+ offset = i * 8;
+ n = x[i];
+ for ( j = 0; j < 8; j += 2 ) {
+ ho[offset+1+j] = hc.charAt(n & 0x0F);
+ n >>>= 4;
+ ho[offset+0+j] = hc.charAt(n & 0x0F);
+ n >>>= 4;
+ }
+ }
+ return ho.join('');
+ };
+
+ var MD5 = function() {
+ this._dataLength = 0;
+ this._state = new Int32Array(4);
+ this._buffer = new ArrayBuffer(68);
+ this._bufferLength = 0;
+ this._buffer8 = new Uint8Array(this._buffer, 0, 68);
+ this._buffer32 = new Uint32Array(this._buffer, 0, 17);
+ this.start();
+ };
+
+ var stateIdentity = new Int32Array([1732584193, -271733879, -1732584194, 271733878]);
+ var buffer32Identity = new Int32Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
+
+ // Char to code point to to array conversion:
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt#Example.3A_Fixing_charCodeAt_to_handle_non-Basic-Multilingual-Plane_characters_if_their_presence_earlier_in_the_string_is_unknown
+ MD5.prototype.appendStr = function(str) {
+ var buf8 = this._buffer8;
+ var buf32 = this._buffer32;
+ var bufLen = this._bufferLength;
+ var code;
+ for ( var i = 0; i < str.length; i++ ) {
+ code = str.charCodeAt(i);
+ if ( code < 128 ) {
+ buf8[bufLen++] = code;
+ } else if ( code < 0x800 ) {
+ buf8[bufLen++] = (code >>> 6) + 0xC0;
+ buf8[bufLen++] = code & 0x3F | 0x80;
+ } else if ( code < 0xD800 || code > 0xDBFF ) {
+ buf8[bufLen++] = (code >>> 12) + 0xE0;
+ buf8[bufLen++] = (code >>> 6 & 0x3F) | 0x80;
+ buf8[bufLen++] = (code & 0x3F) | 0x80;
+ } else {
+ code = ((code - 0xD800) * 0x400) + (str.charCodeAt(++i) - 0xDC00) + 0x10000;
+ if ( code > 0x10FFFF ) {
+ throw 'Unicode standard supports code points up to U+10FFFF';
+ }
+ buf8[bufLen++] = (code >>> 18) + 0xF0;
+ buf8[bufLen++] = (code >>> 12 & 0x3F) | 0x80;
+ buf8[bufLen++] = (code >>> 6 & 0x3F) | 0x80;
+ buf8[bufLen++] = (code & 0x3F) | 0x80;
+ }
+ if ( bufLen >= 64 ) {
+ this._dataLength += 64;
+ md5cycle(this._state, buf32);
+ bufLen -= 64;
+ buf32[0] = buf32[16];
+ }
+ }
+ this._bufferLength = bufLen;
+ return this;
+ };
+
+ MD5.prototype.appendAsciiStr = function(str) {
+ var buf8 = this._buffer8;
+ var buf32 = this._buffer32;
+ var bufLen = this._bufferLength;
+ var i, j = 0;
+ for (;;) {
+ i = Math.min(str.length-j, 64-bufLen);
+ while ( i-- ) {
+ buf8[bufLen++] = str.charCodeAt(j++);
+ }
+ if ( bufLen < 64 ) {
+ break;
+ }
+ this._dataLength += 64;
+ md5cycle(this._state, buf32);
+ bufLen = 0;
+ }
+ this._bufferLength = bufLen;
+ return this;
+ };
+
+ MD5.prototype.appendByteArray = function(input) {
+ var buf8 = this._buffer8;
+ var buf32 = this._buffer32;
+ var bufLen = this._bufferLength;
+ var i, j = 0;
+ for (;;) {
+ i = Math.min(input.length-j, 64-bufLen);
+ while ( i-- ) {
+ buf8[bufLen++] = input[j++];
+ }
+ if ( bufLen < 64 ) {
+ break;
+ }
+ this._dataLength += 64;
+ md5cycle(this._state, buf32);
+ bufLen = 0;
+ }
+ this._bufferLength = bufLen;
+ return this;
+ };
+
+ MD5.prototype.start = function() {
+ this._dataLength = 0;
+ this._bufferLength = 0;
+ this._state.set(stateIdentity);
+ return this;
+ };
+
+ MD5.prototype.end = function(raw) {
+ var bufLen = this._bufferLength;
+ this._dataLength += bufLen;
+ var buf8 = this._buffer8;
+ buf8[bufLen] = 0x80;
+ buf8[bufLen+1] = buf8[bufLen+2] = buf8[bufLen+3] = 0;
+ var buf32 = this._buffer32;
+ var i = (bufLen >> 2) + 1;
+ buf32.set(buffer32Identity.subarray(i), i);
+ if (bufLen > 55) {
+ md5cycle(this._state, buf32);
+ buf32.set(buffer32Identity);
+ }
+ // Do the final computation based on the tail and length
+ // Beware that the final length may not fit in 32 bits so we take care of that
+ var dataBitsLen = this._dataLength * 8;
+ if ( dataBitsLen <= 0xFFFFFFFF ) {
+ buf32[14] = dataBitsLen;
+ } else {
+ var matches = dataBitsLen.toString(16).match(/(.*?)(.{0,8})$/);
+ var lo = parseInt(matches[2], 16);
+ var hi = parseInt(matches[1], 16) || 0;
+ buf32[14] = lo;
+ buf32[15] = hi;
+ }
+ md5cycle(this._state, buf32);
+
+ return !!raw ? this._state : hex(this._state);
+ };
+
+ // This permanent instance is to use for one-call hashing
+ var onePassHasher = new MD5();
+
+ MD5.hashStr = function(str, raw) {
+ return onePassHasher
+ .start()
+ .appendStr(str)
+ .end(raw);
+ };
+
+ MD5.hashAsciiStr = function(str, raw) {
+ return onePassHasher
+ .start()
+ .appendAsciiStr(str)
+ .end(raw);
+ };
+
+ // Self-test
+ // In some cases the fast add32 function cannot be used..
+ if ( MD5.hashStr('hello') !== '5d41402abc4b2a76b9719d911017c592' ) {
+ console.error('YaMD5> this javascript engine does not support YaMD5. Sorry.');
+ }
+
+ if ( typeof root === 'object' ) {
+ root.YaMD5 = MD5;
+ }
+ return MD5;
+})(this);
diff --git a/http/3rdParty/yaMD5/yamd5.min.js b/http/3rdParty/yaMD5/yamd5.min.js
new file mode 100644
index 0000000..653d511
--- /dev/null
+++ b/http/3rdParty/yaMD5/yamd5.min.js
@@ -0,0 +1,46 @@
+// project home: https://github.com/gorhill/yamd5.js
+// minified using http://refresh-sf.com/yui/
+;(function(g){var b=function(l,n){var m=l[0],j=l[1],p=l[2],o=l[3];m+=(j&p|~j&o)+n[0]-680876936|0;m=(m<<7|m>>>25)+j|0;o+=(m&j|~m&p)+n[1]-389564586|0;
+o=(o<<12|o>>>20)+m|0;p+=(o&m|~o&j)+n[2]+606105819|0;p=(p<<17|p>>>15)+o|0;j+=(p&o|~p&m)+n[3]-1044525330|0;j=(j<<22|j>>>10)+p|0;
+m+=(j&p|~j&o)+n[4]-176418897|0;m=(m<<7|m>>>25)+j|0;o+=(m&j|~m&p)+n[5]+1200080426|0;o=(o<<12|o>>>20)+m|0;p+=(o&m|~o&j)+n[6]-1473231341|0;
+p=(p<<17|p>>>15)+o|0;j+=(p&o|~p&m)+n[7]-45705983|0;j=(j<<22|j>>>10)+p|0;m+=(j&p|~j&o)+n[8]+1770035416|0;m=(m<<7|m>>>25)+j|0;
+o+=(m&j|~m&p)+n[9]-1958414417|0;o=(o<<12|o>>>20)+m|0;p+=(o&m|~o&j)+n[10]-42063|0;p=(p<<17|p>>>15)+o|0;j+=(p&o|~p&m)+n[11]-1990404162|0;
+j=(j<<22|j>>>10)+p|0;m+=(j&p|~j&o)+n[12]+1804603682|0;m=(m<<7|m>>>25)+j|0;o+=(m&j|~m&p)+n[13]-40341101|0;o=(o<<12|o>>>20)+m|0;
+p+=(o&m|~o&j)+n[14]-1502002290|0;p=(p<<17|p>>>15)+o|0;j+=(p&o|~p&m)+n[15]+1236535329|0;j=(j<<22|j>>>10)+p|0;m+=(j&o|p&~o)+n[1]-165796510|0;
+m=(m<<5|m>>>27)+j|0;o+=(m&p|j&~p)+n[6]-1069501632|0;o=(o<<9|o>>>23)+m|0;p+=(o&j|m&~j)+n[11]+643717713|0;p=(p<<14|p>>>18)+o|0;
+j+=(p&m|o&~m)+n[0]-373897302|0;j=(j<<20|j>>>12)+p|0;m+=(j&o|p&~o)+n[5]-701558691|0;m=(m<<5|m>>>27)+j|0;o+=(m&p|j&~p)+n[10]+38016083|0;
+o=(o<<9|o>>>23)+m|0;p+=(o&j|m&~j)+n[15]-660478335|0;p=(p<<14|p>>>18)+o|0;j+=(p&m|o&~m)+n[4]-405537848|0;j=(j<<20|j>>>12)+p|0;
+m+=(j&o|p&~o)+n[9]+568446438|0;m=(m<<5|m>>>27)+j|0;o+=(m&p|j&~p)+n[14]-1019803690|0;o=(o<<9|o>>>23)+m|0;p+=(o&j|m&~j)+n[3]-187363961|0;
+p=(p<<14|p>>>18)+o|0;j+=(p&m|o&~m)+n[8]+1163531501|0;j=(j<<20|j>>>12)+p|0;m+=(j&o|p&~o)+n[13]-1444681467|0;m=(m<<5|m>>>27)+j|0;
+o+=(m&p|j&~p)+n[2]-51403784|0;o=(o<<9|o>>>23)+m|0;p+=(o&j|m&~j)+n[7]+1735328473|0;p=(p<<14|p>>>18)+o|0;j+=(p&m|o&~m)+n[12]-1926607734|0;
+j=(j<<20|j>>>12)+p|0;m+=(j^p^o)+n[5]-378558|0;m=(m<<4|m>>>28)+j|0;o+=(m^j^p)+n[8]-2022574463|0;o=(o<<11|o>>>21)+m|0;p+=(o^m^j)+n[11]+1839030562|0;
+p=(p<<16|p>>>16)+o|0;j+=(p^o^m)+n[14]-35309556|0;j=(j<<23|j>>>9)+p|0;m+=(j^p^o)+n[1]-1530992060|0;m=(m<<4|m>>>28)+j|0;o+=(m^j^p)+n[4]+1272893353|0;
+o=(o<<11|o>>>21)+m|0;p+=(o^m^j)+n[7]-155497632|0;p=(p<<16|p>>>16)+o|0;j+=(p^o^m)+n[10]-1094730640|0;j=(j<<23|j>>>9)+p|0;m+=(j^p^o)+n[13]+681279174|0;
+m=(m<<4|m>>>28)+j|0;o+=(m^j^p)+n[0]-358537222|0;o=(o<<11|o>>>21)+m|0;p+=(o^m^j)+n[3]-722521979|0;p=(p<<16|p>>>16)+o|0;j+=(p^o^m)+n[6]+76029189|0;
+j=(j<<23|j>>>9)+p|0;m+=(j^p^o)+n[9]-640364487|0;m=(m<<4|m>>>28)+j|0;o+=(m^j^p)+n[12]-421815835|0;o=(o<<11|o>>>21)+m|0;p+=(o^m^j)+n[15]+530742520|0;
+p=(p<<16|p>>>16)+o|0;j+=(p^o^m)+n[2]-995338651|0;j=(j<<23|j>>>9)+p|0;m+=(p^(j|~o))+n[0]-198630844|0;m=(m<<6|m>>>26)+j|0;o+=(j^(m|~p))+n[7]+1126891415|0;
+o=(o<<10|o>>>22)+m|0;p+=(m^(o|~j))+n[14]-1416354905|0;p=(p<<15|p>>>17)+o|0;j+=(o^(p|~m))+n[5]-57434055|0;j=(j<<21|j>>>11)+p|0;
+m+=(p^(j|~o))+n[12]+1700485571|0;m=(m<<6|m>>>26)+j|0;o+=(j^(m|~p))+n[3]-1894986606|0;o=(o<<10|o>>>22)+m|0;p+=(m^(o|~j))+n[10]-1051523|0;
+p=(p<<15|p>>>17)+o|0;j+=(o^(p|~m))+n[1]-2054922799|0;j=(j<<21|j>>>11)+p|0;m+=(p^(j|~o))+n[8]+1873313359|0;m=(m<<6|m>>>26)+j|0;
+o+=(j^(m|~p))+n[15]-30611744|0;o=(o<<10|o>>>22)+m|0;p+=(m^(o|~j))+n[6]-1560198380|0;p=(p<<15|p>>>17)+o|0;j+=(o^(p|~m))+n[13]+1309151649|0;
+j=(j<<21|j>>>11)+p|0;m+=(p^(j|~o))+n[4]-145523070|0;m=(m<<6|m>>>26)+j|0;o+=(j^(m|~p))+n[11]-1120210379|0;o=(o<<10|o>>>22)+m|0;
+p+=(m^(o|~j))+n[2]+718787259|0;p=(p<<15|p>>>17)+o|0;j+=(o^(p|~m))+n[9]-343485551|0;j=(j<<21|j>>>11)+p|0;l[0]=m+l[0]|0;l[1]=j+l[1]|0;
+l[2]=p+l[2]|0;l[3]=o+l[3]|0};var e="0123456789abcdef";var d=[];var c=function(k){var q=e;var o=d;var r,p,l;for(var m=0;m<4;
+m++){p=m*8;r=k[m];for(l=0;l<8;l+=2){o[p+1+l]=q.charAt(r&15);r>>>=4;o[p+0+l]=q.charAt(r&15);r>>>=4}}return o.join("")};var i=function(){this._dataLength=0;
+this._state=new Int32Array(4);this._buffer=new ArrayBuffer(68);this._bufferLength=0;this._buffer8=new Uint8Array(this._buffer,0,68);
+this._buffer32=new Uint32Array(this._buffer,0,17);this.start()};var a=new Int32Array([1732584193,-271733879,-1732584194,271733878]);
+var h=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);i.prototype.appendStr=function(n){var k=this._buffer8;var j=this._buffer32;
+var o=this._bufferLength;var m;for(var l=0;l<n.length;l++){m=n.charCodeAt(l);if(m<128){k[o++]=m}else{if(m<2048){k[o++]=(m>>>6)+192;
+k[o++]=m&63|128}else{if(m<55296||m>56319){k[o++]=(m>>>12)+224;k[o++]=(m>>>6&63)|128;k[o++]=(m&63)|128}else{m=((m-55296)*1024)+(n.charCodeAt(++l)-56320)+65536;
+if(m>1114111){throw"Unicode standard supports code points up to U+10FFFF"}k[o++]=(m>>>18)+240;k[o++]=(m>>>12&63)|128;k[o++]=(m>>>6&63)|128;
+k[o++]=(m&63)|128}}}if(o>=64){this._dataLength+=64;b(this._state,j);o-=64;j[0]=j[16]}}this._bufferLength=o;return this};i.prototype.appendAsciiStr=function(o){var l=this._buffer8;
+var k=this._buffer32;var p=this._bufferLength;var n,m=0;for(;;){n=Math.min(o.length-m,64-p);while(n--){l[p++]=o.charCodeAt(m++)
+}if(p<64){break}this._dataLength+=64;b(this._state,k);p=0}this._bufferLength=p;return this};i.prototype.appendByteArray=function(m){var l=this._buffer8;
+var k=this._buffer32;var p=this._bufferLength;var o,n=0;for(;;){o=Math.min(m.length-n,64-p);while(o--){l[p++]=m[n++]}if(p<64){break
+}this._dataLength+=64;b(this._state,k);p=0}this._bufferLength=p;return this};i.prototype.start=function(){this._dataLength=0;
+this._bufferLength=0;this._state.set(a);return this};i.prototype.end=function(p){var q=this._bufferLength;this._dataLength+=q;
+var r=this._buffer8;r[q]=128;r[q+1]=r[q+2]=r[q+3]=0;var k=this._buffer32;var m=(q>>2)+1;k.set(h.subarray(m),m);if(q>55){b(this._state,k);
+k.set(h)}var j=this._dataLength*8;if(j<=4294967295){k[14]=j}else{var n=j.toString(16).match(/(.*?)(.{0,8})$/);var o=parseInt(n[2],16);
+var l=parseInt(n[1],16)||0;k[14]=o;k[15]=l}b(this._state,k);return !!p?this._state:c(this._state)};var f=new i();i.hashStr=function(k,j){return f.start().appendStr(k).end(j)
+};i.hashAsciiStr=function(k,j){return f.start().appendAsciiStr(k).end(j)};if(i.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592"){console.error("YaMD5> this javascript engine does not support YaMD5. Sorry.")
+}if(typeof g==="object"){g.YaMD5=i}return i})(this); \ No newline at end of file