amos-tool 1.4.7 → 1.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierignore +2 -2
- package/.prettierrc +50 -50
- package/README.md +3 -0
- package/apis/objectPath.md +129 -129
- package/docs/Logger.html +160 -2
- package/docs/global.html +529 -65
- package/docs/index.html +5 -2
- package/index.d.ts +11 -2
- package/index.js +3 -3
- package/lib/_browser.js +10 -8
- package/lib/_clone.js +68 -57
- package/lib/_cookie.js +50 -47
- package/lib/_deepCopy.js +14 -19
- package/lib/_deepEqual.js +7 -8
- package/lib/_fastDeepEqual.js +26 -34
- package/lib/_flashSupport.js +13 -10
- package/lib/_forOwn.js +8 -7
- package/lib/_funcThrottle.js +16 -15
- package/lib/_isnode.js +2 -1
- package/lib/_list.js +74 -79
- package/lib/_object.assign.js +19 -19
- package/lib/_object.entries.js +8 -7
- package/lib/_object.values.js +8 -7
- package/lib/_omit.js +12 -11
- package/lib/_parseJson.js +7 -6
- package/lib/_pick.js +8 -7
- package/lib/_queue.js +24 -21
- package/lib/_shallowCopy.js +24 -23
- package/lib/_stringify.js +13 -10
- package/lib/_supportWs.js +5 -5
- package/lib/_trim.js +5 -4
- package/lib/_typeOfList.js +22 -21
- package/lib/_uuids.js +30 -35
- package/lib/amostool.js +4 -66
- package/lib/array2tree.js +9 -9
- package/lib/arrayFilter.js +18 -19
- package/lib/arrayUtils.js +10 -8
- package/lib/browser/Cookie.js +35 -36
- package/lib/browser/indexDB.js +72 -71
- package/lib/browserSupport.js +76 -71
- package/lib/completeUnit.js +7 -4
- package/lib/consts.js +2 -1
- package/lib/dom/canvas2img.js +61 -72
- package/lib/dom/canvasTools.js +11 -16
- package/lib/dom/downloadFile.js +17 -12
- package/lib/dom/eventHelper.js +8 -6
- package/lib/dom/fileBlob.js +14 -14
- package/lib/dom/fileSaveAs.js +54 -61
- package/lib/dom/getFontSize.js +7 -10
- package/lib/dom/minfyImg.js +27 -24
- package/lib/encrypt/_base64.js +32 -25
- package/lib/encrypt/_md5.js +68 -31
- package/lib/encrypt/des.js +430 -366
- package/lib/extra/_common.js +120 -161
- package/lib/extra/filterNull.js +5 -4
- package/lib/extra/find.js +10 -11
- package/lib/extra/index.js +4 -3
- package/lib/extra/memo.js +18 -0
- package/lib/extra/pathToTree.js +49 -36
- package/lib/extra/pwdStrength.js +4 -2
- package/lib/extra/sortBy.js +28 -30
- package/lib/flat.js +9 -13
- package/lib/locationParams.js +93 -95
- package/lib/log.js +23 -26
- package/lib/math/_keyColor.js +3 -1
- package/lib/math/addition.js +9 -7
- package/lib/math/amountCase.js +8 -12
- package/lib/math/coinFormat.js +6 -4
- package/lib/math/colorUtil.js +91 -94
- package/lib/math/dateTime.js +79 -97
- package/lib/math/operations.js +33 -37
- package/lib/math/pwdStrength.js +4 -2
- package/lib/math/randomColor.js +17 -5
- package/lib/math/subtraction.js +10 -9
- package/lib/merged.js +9 -9
- package/lib/objectPath.js +81 -82
- package/lib/parseText.js +8 -7
- package/lib/png/Identicon.js +32 -28
- package/lib/png/pnglib.js +59 -34
- package/lib/png/randomPic.js +8 -14
- package/lib/positionFactory.js +28 -28
- package/lib/pwdPolicy.js +27 -31
- package/lib/qs/_assign.js +7 -5
- package/lib/qs/_merge.js +20 -23
- package/lib/qs/_tools.js +3 -2
- package/lib/qs/formats.js +6 -5
- package/lib/qs/index.js +4 -4
- package/lib/qs/parse.js +56 -51
- package/lib/qs/stringify.js +54 -69
- package/lib/qs/utils.js +70 -83
- package/lib/random.js +5 -4
- package/lib/shallowEqual.js +25 -29
- package/lib/store.js +93 -95
- package/lib/strUtils.js +52 -43
- package/lib/tableFilter.js +178 -169
- package/lib/throttleDebounce.js +18 -22
- package/lib/url/encodeUrl.js +5 -4
- package/lib/url/restfulUrl.js +8 -7
- package/lib/utils.js +170 -222
- package/lib/xss/htmlEncode.js +3 -2
- package/lib/xss/implementEncode.js +36 -37
- package/lib/xss/index.js +4 -3
- package/package.json +4 -4
package/lib/dom/getFontSize.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
2
3
|
module.exports = function() {
|
|
3
|
-
|
|
4
|
-
var e =
|
|
5
|
-
e && (
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
i = n.documentElement,
|
|
10
|
-
o = "orientationchange" in window ? "orientationchange" : "resize";
|
|
11
|
-
t.addEventListener(o, e, !1), n.addEventListener("DOMContentLoaded", e, !1)
|
|
12
|
-
};
|
|
4
|
+
var e = document, n = window, t = e.documentElement, i = "orientationchange" in window ? "orientationchange" : "resize", o = function() {
|
|
5
|
+
var e = t.clientWidth;
|
|
6
|
+
e && (e > 750 && (e = 750), t.style.fontSize = e / 750 * 100 + "px");
|
|
7
|
+
};
|
|
8
|
+
n.addEventListener(i, o, !1), e.addEventListener("DOMContentLoaded", o, !1);
|
|
9
|
+
};
|
package/lib/dom/minfyImg.js
CHANGED
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function imageCompress(e,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
function imageCompress(e, t, n) {
|
|
4
|
+
n || (n = .92), function(e, t) {
|
|
5
|
+
var n = new FileReader;
|
|
6
|
+
n.onload = function() {
|
|
7
|
+
var e = this.result;
|
|
8
|
+
t(e);
|
|
9
|
+
}, n.readAsDataURL(e);
|
|
10
|
+
}(e, (function(e) {
|
|
11
|
+
!function(e, t) {
|
|
12
|
+
var n = new Image;
|
|
13
|
+
n.onload = function() {
|
|
14
|
+
t(n);
|
|
15
|
+
}, n.src = e;
|
|
16
|
+
}(e, (function(e) {
|
|
17
|
+
!function(e) {
|
|
18
|
+
var a = function(e) {
|
|
19
|
+
for (var t = atob(e.split(",")[1]), n = new ArrayBuffer(t.length), a = new Uint8Array(n), r = 0; r < t.length; r++) a[r] = t.charCodeAt(r);
|
|
20
|
+
return new Blob([ n ], {
|
|
12
21
|
type: "image/jpeg"
|
|
13
|
-
})
|
|
22
|
+
});
|
|
14
23
|
}(function(e) {
|
|
15
|
-
var t = document.createElement("canvas"),
|
|
16
|
-
|
|
17
|
-
a = e.height;
|
|
18
|
-
return t.width = n, t.height = a, t.getContext("2d").drawImage(e, 0, 0, n, a), t.toDataURL("image/jpeg", r)
|
|
24
|
+
var t = document.createElement("canvas"), a = e.width, r = e.height;
|
|
25
|
+
return t.width = a, t.height = r, t.getContext("2d").drawImage(e, 0, 0, a, r), t.toDataURL("image/jpeg", n);
|
|
19
26
|
}(e));
|
|
20
|
-
a
|
|
21
|
-
}(e)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
}, n.src = e
|
|
25
|
-
}, (o = new FileReader).onload = function() {
|
|
26
|
-
var e = this.result;
|
|
27
|
-
n(e)
|
|
28
|
-
}, o.readAsDataURL(t)
|
|
27
|
+
t(a);
|
|
28
|
+
}(e);
|
|
29
|
+
}));
|
|
30
|
+
}));
|
|
29
31
|
}
|
|
30
|
-
|
|
32
|
+
|
|
33
|
+
module.exports = imageCompress;
|
package/lib/encrypt/_base64.js
CHANGED
|
@@ -1,28 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
for (var t, e, o = "", a = 0, n = 0; a < r.length;)(t = r.charCodeAt(a)) < 128 ? (o += String.fromCharCode(t), a++) : 191 < t && t < 224 ? (n = r.charCodeAt(a + 1), o += String.fromCharCode((31 & t) << 6 | 63 & n), a += 2) : (n = r.charCodeAt(a + 1), e = r.charCodeAt(a + 2), o += String.fromCharCode((15 & t) << 12 | (63 & n) << 6 | 63 & e), a += 3);
|
|
25
|
-
return o
|
|
2
|
+
|
|
3
|
+
var utils = require("../utils"), Base64 = function() {
|
|
4
|
+
var r = this, t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
5
|
+
this.encode = function(e) {
|
|
6
|
+
var o, a, n, h, i, d, C, c = "", f = 0;
|
|
7
|
+
for (utils.isString(e) || (e += ""), e = r._utf8_encode(e); f < e.length; ) h = (o = e.charCodeAt(f++)) >> 2,
|
|
8
|
+
i = (3 & o) << 4 | (a = e.charCodeAt(f++)) >> 4, d = (15 & a) << 2 | (n = e.charCodeAt(f++)) >> 6,
|
|
9
|
+
C = 63 & n, isNaN(a) ? d = C = 64 : isNaN(n) && (C = 64), c = c + t.charAt(h) + t.charAt(i) + t.charAt(d) + t.charAt(C);
|
|
10
|
+
return c;
|
|
11
|
+
}, this.decode = function(e) {
|
|
12
|
+
var o, a, n, h, i, d, C = "", c = 0;
|
|
13
|
+
for (e = e.replace(/[^A-Za-z0-9\+\/\=]/g, ""); c < e.length; ) o = t.indexOf(e.charAt(c++)) << 2 | (h = t.indexOf(e.charAt(c++))) >> 4,
|
|
14
|
+
a = (15 & h) << 4 | (i = t.indexOf(e.charAt(c++))) >> 2, n = (3 & i) << 6 | (d = t.indexOf(e.charAt(c++))),
|
|
15
|
+
C += String.fromCharCode(o), 64 != i && (C += String.fromCharCode(a)), 64 != d && (C += String.fromCharCode(n));
|
|
16
|
+
return C = r._utf8_decode(C);
|
|
17
|
+
}, this._utf8_encode = function(r) {
|
|
18
|
+
r = r.replace(/\r\n/g, "\n");
|
|
19
|
+
for (var t = "", e = 0; e < r.length; e++) {
|
|
20
|
+
var o = r.charCodeAt(e);
|
|
21
|
+
o < 128 ? t += String.fromCharCode(o) : o > 127 && o < 2048 ? (t += String.fromCharCode(o >> 6 | 192),
|
|
22
|
+
t += String.fromCharCode(63 & o | 128)) : (t += String.fromCharCode(o >> 12 | 224),
|
|
23
|
+
t += String.fromCharCode(o >> 6 & 63 | 128), t += String.fromCharCode(63 & o | 128));
|
|
26
24
|
}
|
|
25
|
+
return t;
|
|
26
|
+
}, this._utf8_decode = function(r) {
|
|
27
|
+
for (var t = "", e = 0, o = 0, a = 0, n = 0; e < r.length; ) (o = r.charCodeAt(e)) < 128 ? (t += String.fromCharCode(o),
|
|
28
|
+
e++) : o > 191 && o < 224 ? (a = r.charCodeAt(e + 1), t += String.fromCharCode((31 & o) << 6 | 63 & a),
|
|
29
|
+
e += 2) : (a = r.charCodeAt(e + 1), n = r.charCodeAt(e + 2), t += String.fromCharCode((15 & o) << 12 | (63 & a) << 6 | 63 & n),
|
|
30
|
+
e += 3);
|
|
31
|
+
return t;
|
|
27
32
|
};
|
|
28
|
-
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
module.exports = Base64;
|
package/lib/encrypt/_md5.js
CHANGED
|
@@ -2,88 +2,125 @@
|
|
|
2
2
|
|
|
3
3
|
function safeAdd(r, d) {
|
|
4
4
|
var n = (65535 & r) + (65535 & d);
|
|
5
|
-
return (r >> 16) + (d >> 16) + (n >> 16) << 16 | 65535 & n
|
|
5
|
+
return (r >> 16) + (d >> 16) + (n >> 16) << 16 | 65535 & n;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
function bitRotateLeft(r, d) {
|
|
9
|
-
return r << d | r >>> 32 - d
|
|
9
|
+
return r << d | r >>> 32 - d;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
function md5cmn(r, d, n, t, m, f) {
|
|
13
|
-
return safeAdd(bitRotateLeft(safeAdd(safeAdd(d, r), safeAdd(t, f)), m), n)
|
|
13
|
+
return safeAdd(bitRotateLeft(safeAdd(safeAdd(d, r), safeAdd(t, f)), m), n);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
function md5ff(r, d, n, t, m, f, i) {
|
|
17
|
-
return md5cmn(d & n | ~d & t, r, d, m, f, i)
|
|
17
|
+
return md5cmn(d & n | ~d & t, r, d, m, f, i);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
function md5gg(r, d, n, t, m, f, i) {
|
|
21
|
-
return md5cmn(d & t | n & ~t, r, d, m, f, i)
|
|
21
|
+
return md5cmn(d & t | n & ~t, r, d, m, f, i);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
function md5hh(r, d, n, t, m, f, i) {
|
|
25
|
-
return md5cmn(d ^ n ^ t, r, d, m, f, i)
|
|
25
|
+
return md5cmn(d ^ n ^ t, r, d, m, f, i);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
function md5ii(r, d, n, t, m, f, i) {
|
|
29
|
-
return md5cmn(n ^ (d | ~t), r, d, m, f, i)
|
|
29
|
+
return md5cmn(n ^ (d | ~t), r, d, m, f, i);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function binlMD5(r, d) {
|
|
33
|
-
var n, t, m, f;
|
|
33
|
+
var n, t, m, f, i;
|
|
34
34
|
r[d >> 5] |= 128 << d % 32, r[14 + (d + 64 >>> 9 << 4)] = d;
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
var e = 1732584193, h = -271733879, g = -1732584194, u = 271733878;
|
|
36
|
+
for (n = 0; n < r.length; n += 16) t = e, m = h, f = g, i = u, e = md5ff(e, h, g, u, r[n], 7, -680876936),
|
|
37
|
+
u = md5ff(u, e, h, g, r[n + 1], 12, -389564586), g = md5ff(g, u, e, h, r[n + 2], 17, 606105819),
|
|
38
|
+
h = md5ff(h, g, u, e, r[n + 3], 22, -1044525330), e = md5ff(e, h, g, u, r[n + 4], 7, -176418897),
|
|
39
|
+
u = md5ff(u, e, h, g, r[n + 5], 12, 1200080426), g = md5ff(g, u, e, h, r[n + 6], 17, -1473231341),
|
|
40
|
+
h = md5ff(h, g, u, e, r[n + 7], 22, -45705983), e = md5ff(e, h, g, u, r[n + 8], 7, 1770035416),
|
|
41
|
+
u = md5ff(u, e, h, g, r[n + 9], 12, -1958414417), g = md5ff(g, u, e, h, r[n + 10], 17, -42063),
|
|
42
|
+
h = md5ff(h, g, u, e, r[n + 11], 22, -1990404162), e = md5ff(e, h, g, u, r[n + 12], 7, 1804603682),
|
|
43
|
+
u = md5ff(u, e, h, g, r[n + 13], 12, -40341101), g = md5ff(g, u, e, h, r[n + 14], 17, -1502002290),
|
|
44
|
+
e = md5gg(e, h = md5ff(h, g, u, e, r[n + 15], 22, 1236535329), g, u, r[n + 1], 5, -165796510),
|
|
45
|
+
u = md5gg(u, e, h, g, r[n + 6], 9, -1069501632), g = md5gg(g, u, e, h, r[n + 11], 14, 643717713),
|
|
46
|
+
h = md5gg(h, g, u, e, r[n], 20, -373897302), e = md5gg(e, h, g, u, r[n + 5], 5, -701558691),
|
|
47
|
+
u = md5gg(u, e, h, g, r[n + 10], 9, 38016083), g = md5gg(g, u, e, h, r[n + 15], 14, -660478335),
|
|
48
|
+
h = md5gg(h, g, u, e, r[n + 4], 20, -405537848), e = md5gg(e, h, g, u, r[n + 9], 5, 568446438),
|
|
49
|
+
u = md5gg(u, e, h, g, r[n + 14], 9, -1019803690), g = md5gg(g, u, e, h, r[n + 3], 14, -187363961),
|
|
50
|
+
h = md5gg(h, g, u, e, r[n + 8], 20, 1163531501), e = md5gg(e, h, g, u, r[n + 13], 5, -1444681467),
|
|
51
|
+
u = md5gg(u, e, h, g, r[n + 2], 9, -51403784), g = md5gg(g, u, e, h, r[n + 7], 14, 1735328473),
|
|
52
|
+
e = md5hh(e, h = md5gg(h, g, u, e, r[n + 12], 20, -1926607734), g, u, r[n + 5], 4, -378558),
|
|
53
|
+
u = md5hh(u, e, h, g, r[n + 8], 11, -2022574463), g = md5hh(g, u, e, h, r[n + 11], 16, 1839030562),
|
|
54
|
+
h = md5hh(h, g, u, e, r[n + 14], 23, -35309556), e = md5hh(e, h, g, u, r[n + 1], 4, -1530992060),
|
|
55
|
+
u = md5hh(u, e, h, g, r[n + 4], 11, 1272893353), g = md5hh(g, u, e, h, r[n + 7], 16, -155497632),
|
|
56
|
+
h = md5hh(h, g, u, e, r[n + 10], 23, -1094730640), e = md5hh(e, h, g, u, r[n + 13], 4, 681279174),
|
|
57
|
+
u = md5hh(u, e, h, g, r[n], 11, -358537222), g = md5hh(g, u, e, h, r[n + 3], 16, -722521979),
|
|
58
|
+
h = md5hh(h, g, u, e, r[n + 6], 23, 76029189), e = md5hh(e, h, g, u, r[n + 9], 4, -640364487),
|
|
59
|
+
u = md5hh(u, e, h, g, r[n + 12], 11, -421815835), g = md5hh(g, u, e, h, r[n + 15], 16, 530742520),
|
|
60
|
+
e = md5ii(e, h = md5hh(h, g, u, e, r[n + 2], 23, -995338651), g, u, r[n], 6, -198630844),
|
|
61
|
+
u = md5ii(u, e, h, g, r[n + 7], 10, 1126891415), g = md5ii(g, u, e, h, r[n + 14], 15, -1416354905),
|
|
62
|
+
h = md5ii(h, g, u, e, r[n + 5], 21, -57434055), e = md5ii(e, h, g, u, r[n + 12], 6, 1700485571),
|
|
63
|
+
u = md5ii(u, e, h, g, r[n + 3], 10, -1894986606), g = md5ii(g, u, e, h, r[n + 10], 15, -1051523),
|
|
64
|
+
h = md5ii(h, g, u, e, r[n + 1], 21, -2054922799), e = md5ii(e, h, g, u, r[n + 8], 6, 1873313359),
|
|
65
|
+
u = md5ii(u, e, h, g, r[n + 15], 10, -30611744), g = md5ii(g, u, e, h, r[n + 6], 15, -1560198380),
|
|
66
|
+
h = md5ii(h, g, u, e, r[n + 13], 21, 1309151649), e = md5ii(e, h, g, u, r[n + 4], 6, -145523070),
|
|
67
|
+
u = md5ii(u, e, h, g, r[n + 11], 10, -1120210379), g = md5ii(g, u, e, h, r[n + 2], 15, 718787259),
|
|
68
|
+
h = md5ii(h, g, u, e, r[n + 9], 21, -343485551), e = safeAdd(e, t), h = safeAdd(h, m),
|
|
69
|
+
g = safeAdd(g, f), u = safeAdd(u, i);
|
|
70
|
+
return [ e, h, g, u ];
|
|
37
71
|
}
|
|
38
72
|
|
|
39
73
|
function binl2rstr(r) {
|
|
40
|
-
|
|
41
|
-
|
|
74
|
+
var d, n = "", t = 32 * r.length;
|
|
75
|
+
for (d = 0; d < t; d += 8) n += String.fromCharCode(r[d >> 5] >>> d % 32 & 255);
|
|
76
|
+
return n;
|
|
42
77
|
}
|
|
43
78
|
|
|
44
79
|
function rstr2binl(r) {
|
|
45
|
-
var d = [];
|
|
46
|
-
for (
|
|
47
|
-
|
|
48
|
-
|
|
80
|
+
var d, n = [];
|
|
81
|
+
for (n[(r.length >> 2) - 1] = void 0, d = 0; d < n.length; d += 1) n[d] = 0;
|
|
82
|
+
var t = 8 * r.length;
|
|
83
|
+
for (d = 0; d < t; d += 8) n[d >> 5] |= (255 & r.charCodeAt(d / 8)) << d % 32;
|
|
84
|
+
return n;
|
|
49
85
|
}
|
|
50
86
|
|
|
51
87
|
function rstrMD5(r) {
|
|
52
|
-
return binl2rstr(binlMD5(rstr2binl(r), 8 * r.length))
|
|
88
|
+
return binl2rstr(binlMD5(rstr2binl(r), 8 * r.length));
|
|
53
89
|
}
|
|
54
90
|
|
|
55
91
|
function rstrHMACMD5(r, d) {
|
|
56
|
-
var n, t = rstr2binl(r),
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return d = binlMD5(m.concat(rstr2binl(d)), 512 + 8 * d.length), binl2rstr(binlMD5(f.concat(d), 640))
|
|
92
|
+
var n, t, m = rstr2binl(r), f = [], i = [];
|
|
93
|
+
for (f[15] = i[15] = void 0, m.length > 16 && (m = binlMD5(m, 8 * r.length)), n = 0; n < 16; n += 1) f[n] = 909522486 ^ m[n],
|
|
94
|
+
i[n] = 1549556828 ^ m[n];
|
|
95
|
+
return t = binlMD5(f.concat(rstr2binl(d)), 512 + 8 * d.length), binl2rstr(binlMD5(i.concat(t), 640));
|
|
61
96
|
}
|
|
62
97
|
|
|
63
98
|
function rstr2hex(r) {
|
|
64
|
-
|
|
65
|
-
|
|
99
|
+
var d, n, t = "0123456789abcdef", m = "";
|
|
100
|
+
for (n = 0; n < r.length; n += 1) d = r.charCodeAt(n), m += t.charAt(d >>> 4 & 15) + t.charAt(15 & d);
|
|
101
|
+
return m;
|
|
66
102
|
}
|
|
67
103
|
|
|
68
104
|
function str2rstrUTF8(r) {
|
|
69
|
-
return unescape(encodeURIComponent(r))
|
|
105
|
+
return unescape(encodeURIComponent(r));
|
|
70
106
|
}
|
|
71
107
|
|
|
72
108
|
function rawMD5(r) {
|
|
73
|
-
return rstrMD5(str2rstrUTF8(r))
|
|
109
|
+
return rstrMD5(str2rstrUTF8(r));
|
|
74
110
|
}
|
|
75
111
|
|
|
76
112
|
function hexMD5(r) {
|
|
77
|
-
return rstr2hex(rawMD5(r))
|
|
113
|
+
return rstr2hex(rawMD5(r));
|
|
78
114
|
}
|
|
79
115
|
|
|
80
116
|
function rawHMACMD5(r, d) {
|
|
81
|
-
return rstrHMACMD5(str2rstrUTF8(r), str2rstrUTF8(d))
|
|
117
|
+
return rstrHMACMD5(str2rstrUTF8(r), str2rstrUTF8(d));
|
|
82
118
|
}
|
|
83
119
|
|
|
84
120
|
function hexHMACMD5(r, d) {
|
|
85
|
-
return rstr2hex(rawHMACMD5(r, d))
|
|
121
|
+
return rstr2hex(rawHMACMD5(r, d));
|
|
86
122
|
}
|
|
123
|
+
|
|
87
124
|
module.exports = function(r, d, n) {
|
|
88
|
-
return d ?
|
|
89
|
-
};
|
|
125
|
+
return d ? n ? rawHMACMD5(d, r) : hexHMACMD5(d, r) : n ? rawMD5(r) : hexMD5(r);
|
|
126
|
+
};
|