weapps-plugin-jingtong-verify 1.4.7 → 1.4.8

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "weapps-plugin-jingtong-verify",
3
3
  "pluginName": "weapps-plugin-jingtong-verify",
4
4
  "pluginType": "mp",
5
- "version": "1.4.7",
5
+ "version": "1.4.8",
6
6
  "description": "",
7
7
  "main": "sdk.js",
8
8
  "author": "tongyirenzheng",
@@ -0,0 +1,184 @@
1
+ /*!
2
+ * Minimal MD5 implementation (suitable as drop-in md5.min.js)
3
+ * Compatible usage: const md5 = require('./utils/md5.js');
4
+ * Returns lowercase hex string.
5
+ * License: Public domain / MIT-like (small utility implementation)
6
+ */
7
+
8
+ function safeAdd(x, y) {
9
+ var lsw = (x & 0xffff) + (y & 0xffff);
10
+ var msw = (x >>> 16) + (y >>> 16) + (lsw >>> 16);
11
+ return (msw << 16) | (lsw & 0xffff);
12
+ }
13
+
14
+ function bitRotateLeft(num, cnt) {
15
+ return (num << cnt) | (num >>> (32 - cnt));
16
+ }
17
+
18
+ function md5cmn(q, a, b, x, s, t) {
19
+ return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
20
+ }
21
+ function md5ff(a, b, c, d, x, s, t) {
22
+ return md5cmn((b & c) | (~b & d), a, b, x, s, t);
23
+ }
24
+ function md5gg(a, b, c, d, x, s, t) {
25
+ return md5cmn((b & d) | (c & ~d), a, b, x, s, t);
26
+ }
27
+ function md5hh(a, b, c, d, x, s, t) {
28
+ return md5cmn(b ^ c ^ d, a, b, x, s, t);
29
+ }
30
+ function md5ii(a, b, c, d, x, s, t) {
31
+ return md5cmn(c ^ (b | ~d), a, b, x, s, t);
32
+ }
33
+
34
+ function binlMD5(x, len) {
35
+ /* append padding */
36
+ x[len >> 5] |= 0x80 << (len % 32);
37
+ x[(((len + 64) >>> 9) << 4) + 14] = len;
38
+
39
+ var i;
40
+ var olda;
41
+ var oldb;
42
+ var oldc;
43
+ var oldd;
44
+ var a = 1732584193;
45
+ var b = -271733879;
46
+ var c = -1732584194;
47
+ var d = 271733878;
48
+
49
+ for (i = 0; i < x.length; i += 16) {
50
+ olda = a;
51
+ oldb = b;
52
+ oldc = c;
53
+ oldd = d;
54
+
55
+ a = md5ff(a, b, c, d, x[i], 7, -680876936);
56
+ d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
57
+ c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
58
+ b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
59
+ a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
60
+ d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
61
+ c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
62
+ b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
63
+ a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
64
+ d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
65
+ c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
66
+ b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
67
+ a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
68
+ d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
69
+ c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
70
+ b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
71
+
72
+ a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
73
+ d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
74
+ c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
75
+ b = md5gg(b, c, d, a, x[i], 20, -373897302);
76
+ a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
77
+ d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
78
+ c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
79
+ b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
80
+ a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
81
+ d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
82
+ c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
83
+ b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
84
+ a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
85
+ d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
86
+ c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
87
+ b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
88
+
89
+ a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
90
+ d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
91
+ c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
92
+ b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
93
+ a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
94
+ d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
95
+ c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
96
+ b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
97
+ a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
98
+ d = md5hh(d, a, b, c, x[i], 11, -358537222);
99
+ c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
100
+ b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
101
+ a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
102
+ d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
103
+ c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
104
+ b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
105
+
106
+ a = md5ii(a, b, c, d, x[i], 6, -198630844);
107
+ d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
108
+ c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
109
+ b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
110
+ a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
111
+ d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
112
+ c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
113
+ b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
114
+ a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
115
+ d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
116
+ c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
117
+ b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
118
+ a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
119
+ d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
120
+ c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
121
+ b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
122
+
123
+ a = safeAdd(a, olda);
124
+ b = safeAdd(b, oldb);
125
+ c = safeAdd(c, oldc);
126
+ d = safeAdd(d, oldd);
127
+ }
128
+ return [a, b, c, d];
129
+ }
130
+
131
+ function binl2hex(binarray) {
132
+ var hexTab = '0123456789abcdef';
133
+ var str = '';
134
+ for (var i = 0; i < binarray.length * 4; i++) {
135
+ var byte = (binarray[i >> 2] >> ((i % 4) * 8)) & 0xff;
136
+ str += hexTab.charAt((byte >>> 4) & 0x0f) + hexTab.charAt(byte & 0x0f);
137
+ }
138
+ return str;
139
+ }
140
+
141
+ function str2binl(str) {
142
+ var bin = [];
143
+ var mask = (1 << 8) - 1;
144
+ for (var i = 0; i < str.length * 8; i += 8) {
145
+ bin[i >> 5] |= (str.charCodeAt(i / 8) & mask) << (i % 32);
146
+ }
147
+ return bin;
148
+ }
149
+
150
+ /* UTF-8 encode */
151
+ function utf8Encode(str) {
152
+ str = str.replace(/\r\n/g, '\n');
153
+ var utftext = '';
154
+ for (var n = 0; n < str.length; n++) {
155
+ var c = str.charCodeAt(n);
156
+ if (c < 128) {
157
+ utftext += String.fromCharCode(c);
158
+ } else if (c < 2048) {
159
+ utftext += String.fromCharCode((c >> 6) | 192);
160
+ utftext += String.fromCharCode((c & 63) | 128);
161
+ } else {
162
+ utftext += String.fromCharCode((c >> 12) | 224);
163
+ utftext += String.fromCharCode(((c >> 6) & 63) | 128);
164
+ utftext += String.fromCharCode((c & 63) | 128);
165
+ }
166
+ }
167
+ return utftext;
168
+ }
169
+
170
+ /* Main MD5 function: input string -> hex digest */
171
+ function md5(input) {
172
+ if (input === null || input === undefined) input = '';
173
+ // Ensure string and UTF-8 encode
174
+ var s = String(input);
175
+ var utf8 = utf8Encode(s);
176
+ var x = str2binl(utf8);
177
+ var hash = binlMD5(x, utf8.length * 8);
178
+ return binl2hex(hash);
179
+ }
180
+
181
+ /* Export for CommonJS (miniprogram) */
182
+ if (typeof module !== 'undefined' && module.exports) {
183
+ module.exports = md5;
184
+ }