mini_program_gizwits_sdk 1.0.2 → 1.0.3-bololo

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/src/md5.js DELETED
@@ -1,683 +0,0 @@
1
- /**
2
- * [js-md5]{@link https://github.com/emn178/js-md5}
3
- *
4
- * @namespace md5
5
- * @version 0.7.3
6
- * @author Chen, Yi-Cyuan [emn178@gmail.com]
7
- * @copyright Chen, Yi-Cyuan 2014-2017
8
- * @license MIT
9
- */
10
- (function () {
11
- 'use strict';
12
-
13
- var ERROR = 'input is invalid type';
14
- var WINDOW = typeof window === 'object';
15
- var root = WINDOW ? window : {};
16
- if (root.JS_MD5_NO_WINDOW) {
17
- WINDOW = false;
18
- }
19
- var WEB_WORKER = !WINDOW && typeof self === 'object';
20
- var NODE_JS = !root.JS_MD5_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;
21
- if (NODE_JS) {
22
- root = global;
23
- } else if (WEB_WORKER) {
24
- root = self;
25
- }
26
- var COMMON_JS = !root.JS_MD5_NO_COMMON_JS && typeof module === 'object' && module.exports;
27
- var AMD = typeof define === 'function' && define.amd;
28
- var ARRAY_BUFFER = !root.JS_MD5_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';
29
- var HEX_CHARS = '0123456789abcdef'.split('');
30
- var EXTRA = [128, 32768, 8388608, -2147483648];
31
- var SHIFT = [0, 8, 16, 24];
32
- var OUTPUT_TYPES = ['hex', 'array', 'digest', 'buffer', 'arrayBuffer', 'base64'];
33
- var BASE64_ENCODE_CHAR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
34
-
35
- var blocks = [], buffer8;
36
- if (ARRAY_BUFFER) {
37
- var buffer = new ArrayBuffer(68);
38
- buffer8 = new Uint8Array(buffer);
39
- blocks = new Uint32Array(buffer);
40
- }
41
-
42
- if (root.JS_MD5_NO_NODE_JS || !Array.isArray) {
43
- Array.isArray = function (obj) {
44
- return Object.prototype.toString.call(obj) === '[object Array]';
45
- };
46
- }
47
-
48
- if (ARRAY_BUFFER && (root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {
49
- ArrayBuffer.isView = function (obj) {
50
- return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;
51
- };
52
- }
53
-
54
- /**
55
- * @method hex
56
- * @memberof md5
57
- * @description Output hash as hex string
58
- * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
59
- * @returns {String} Hex string
60
- * @example
61
- * md5.hex('The quick brown fox jumps over the lazy dog');
62
- * // equal to
63
- * md5('The quick brown fox jumps over the lazy dog');
64
- */
65
- /**
66
- * @method digest
67
- * @memberof md5
68
- * @description Output hash as bytes array
69
- * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
70
- * @returns {Array} Bytes array
71
- * @example
72
- * md5.digest('The quick brown fox jumps over the lazy dog');
73
- */
74
- /**
75
- * @method array
76
- * @memberof md5
77
- * @description Output hash as bytes array
78
- * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
79
- * @returns {Array} Bytes array
80
- * @example
81
- * md5.array('The quick brown fox jumps over the lazy dog');
82
- */
83
- /**
84
- * @method arrayBuffer
85
- * @memberof md5
86
- * @description Output hash as ArrayBuffer
87
- * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
88
- * @returns {ArrayBuffer} ArrayBuffer
89
- * @example
90
- * md5.arrayBuffer('The quick brown fox jumps over the lazy dog');
91
- */
92
- /**
93
- * @method buffer
94
- * @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
95
- * @memberof md5
96
- * @description Output hash as ArrayBuffer
97
- * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
98
- * @returns {ArrayBuffer} ArrayBuffer
99
- * @example
100
- * md5.buffer('The quick brown fox jumps over the lazy dog');
101
- */
102
- /**
103
- * @method base64
104
- * @memberof md5
105
- * @description Output hash as base64 string
106
- * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
107
- * @returns {String} base64 string
108
- * @example
109
- * md5.base64('The quick brown fox jumps over the lazy dog');
110
- */
111
- var createOutputMethod = function (outputType) {
112
- return function (message) {
113
- return new Md5(true).update(message)[outputType]();
114
- };
115
- };
116
-
117
- /**
118
- * @method create
119
- * @memberof md5
120
- * @description Create Md5 object
121
- * @returns {Md5} Md5 object.
122
- * @example
123
- * var hash = md5.create();
124
- */
125
- /**
126
- * @method update
127
- * @memberof md5
128
- * @description Create and update Md5 object
129
- * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
130
- * @returns {Md5} Md5 object.
131
- * @example
132
- * var hash = md5.update('The quick brown fox jumps over the lazy dog');
133
- * // equal to
134
- * var hash = md5.create();
135
- * hash.update('The quick brown fox jumps over the lazy dog');
136
- */
137
- var createMethod = function () {
138
- var method = createOutputMethod('hex');
139
- if (NODE_JS) {
140
- method = nodeWrap(method);
141
- }
142
- method.create = function () {
143
- return new Md5();
144
- };
145
- method.update = function (message) {
146
- return method.create().update(message);
147
- };
148
- for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
149
- var type = OUTPUT_TYPES[i];
150
- method[type] = createOutputMethod(type);
151
- }
152
- return method;
153
- };
154
-
155
- var nodeWrap = function (method) {
156
- var crypto = eval("require('crypto')");
157
- var Buffer = eval("require('buffer').Buffer");
158
- var nodeMethod = function (message) {
159
- if (typeof message === 'string') {
160
- return crypto.createHash('md5').update(message, 'utf8').digest('hex');
161
- } else {
162
- if (message === null || message === undefined) {
163
- throw ERROR;
164
- } else if (message.constructor === ArrayBuffer) {
165
- message = new Uint8Array(message);
166
- }
167
- }
168
- if (Array.isArray(message) || ArrayBuffer.isView(message) ||
169
- message.constructor === Buffer) {
170
- return crypto.createHash('md5').update(new Buffer(message)).digest('hex');
171
- } else {
172
- return method(message);
173
- }
174
- };
175
- return nodeMethod;
176
- };
177
-
178
- /**
179
- * Md5 class
180
- * @class Md5
181
- * @description This is internal class.
182
- * @see {@link md5.create}
183
- */
184
- function Md5(sharedMemory) {
185
- if (sharedMemory) {
186
- blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] =
187
- blocks[4] = blocks[5] = blocks[6] = blocks[7] =
188
- blocks[8] = blocks[9] = blocks[10] = blocks[11] =
189
- blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
190
- this.blocks = blocks;
191
- this.buffer8 = buffer8;
192
- } else {
193
- if (ARRAY_BUFFER) {
194
- var buffer = new ArrayBuffer(68);
195
- this.buffer8 = new Uint8Array(buffer);
196
- this.blocks = new Uint32Array(buffer);
197
- } else {
198
- this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
199
- }
200
- }
201
- this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = this.hBytes = 0;
202
- this.finalized = this.hashed = false;
203
- this.first = true;
204
- }
205
-
206
- /**
207
- * @method update
208
- * @memberof Md5
209
- * @instance
210
- * @description Update hash
211
- * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
212
- * @returns {Md5} Md5 object.
213
- * @see {@link md5.update}
214
- */
215
- Md5.prototype.update = function (message) {
216
- if (this.finalized) {
217
- return;
218
- }
219
-
220
- var notString, type = typeof message;
221
- if (type !== 'string') {
222
- if (type === 'object') {
223
- if (message === null) {
224
- throw ERROR;
225
- } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
226
- message = new Uint8Array(message);
227
- } else if (!Array.isArray(message)) {
228
- if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {
229
- throw ERROR;
230
- }
231
- }
232
- } else {
233
- throw ERROR;
234
- }
235
- notString = true;
236
- }
237
- var code, index = 0, i, length = message.length, blocks = this.blocks;
238
- var buffer8 = this.buffer8;
239
-
240
- while (index < length) {
241
- if (this.hashed) {
242
- this.hashed = false;
243
- blocks[0] = blocks[16];
244
- blocks[16] = blocks[1] = blocks[2] = blocks[3] =
245
- blocks[4] = blocks[5] = blocks[6] = blocks[7] =
246
- blocks[8] = blocks[9] = blocks[10] = blocks[11] =
247
- blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
248
- }
249
-
250
- if (notString) {
251
- if (ARRAY_BUFFER) {
252
- for (i = this.start; index < length && i < 64; ++index) {
253
- buffer8[i++] = message[index];
254
- }
255
- } else {
256
- for (i = this.start; index < length && i < 64; ++index) {
257
- blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
258
- }
259
- }
260
- } else {
261
- if (ARRAY_BUFFER) {
262
- for (i = this.start; index < length && i < 64; ++index) {
263
- code = message.charCodeAt(index);
264
- if (code < 0x80) {
265
- buffer8[i++] = code;
266
- } else if (code < 0x800) {
267
- buffer8[i++] = 0xc0 | (code >> 6);
268
- buffer8[i++] = 0x80 | (code & 0x3f);
269
- } else if (code < 0xd800 || code >= 0xe000) {
270
- buffer8[i++] = 0xe0 | (code >> 12);
271
- buffer8[i++] = 0x80 | ((code >> 6) & 0x3f);
272
- buffer8[i++] = 0x80 | (code & 0x3f);
273
- } else {
274
- code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
275
- buffer8[i++] = 0xf0 | (code >> 18);
276
- buffer8[i++] = 0x80 | ((code >> 12) & 0x3f);
277
- buffer8[i++] = 0x80 | ((code >> 6) & 0x3f);
278
- buffer8[i++] = 0x80 | (code & 0x3f);
279
- }
280
- }
281
- } else {
282
- for (i = this.start; index < length && i < 64; ++index) {
283
- code = message.charCodeAt(index);
284
- if (code < 0x80) {
285
- blocks[i >> 2] |= code << SHIFT[i++ & 3];
286
- } else if (code < 0x800) {
287
- blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];
288
- blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
289
- } else if (code < 0xd800 || code >= 0xe000) {
290
- blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];
291
- blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
292
- blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
293
- } else {
294
- code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
295
- blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];
296
- blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];
297
- blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
298
- blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
299
- }
300
- }
301
- }
302
- }
303
- this.lastByteIndex = i;
304
- this.bytes += i - this.start;
305
- if (i >= 64) {
306
- this.start = i - 64;
307
- this.hash();
308
- this.hashed = true;
309
- } else {
310
- this.start = i;
311
- }
312
- }
313
- if (this.bytes > 4294967295) {
314
- this.hBytes += this.bytes / 4294967296 << 0;
315
- this.bytes = this.bytes % 4294967296;
316
- }
317
- return this;
318
- };
319
-
320
- Md5.prototype.finalize = function () {
321
- if (this.finalized) {
322
- return;
323
- }
324
- this.finalized = true;
325
- var blocks = this.blocks, i = this.lastByteIndex;
326
- blocks[i >> 2] |= EXTRA[i & 3];
327
- if (i >= 56) {
328
- if (!this.hashed) {
329
- this.hash();
330
- }
331
- blocks[0] = blocks[16];
332
- blocks[16] = blocks[1] = blocks[2] = blocks[3] =
333
- blocks[4] = blocks[5] = blocks[6] = blocks[7] =
334
- blocks[8] = blocks[9] = blocks[10] = blocks[11] =
335
- blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
336
- }
337
- blocks[14] = this.bytes << 3;
338
- blocks[15] = this.hBytes << 3 | this.bytes >>> 29;
339
- this.hash();
340
- };
341
-
342
- Md5.prototype.hash = function () {
343
- var a, b, c, d, bc, da, blocks = this.blocks;
344
-
345
- if (this.first) {
346
- a = blocks[0] - 680876937;
347
- a = (a << 7 | a >>> 25) - 271733879 << 0;
348
- d = (-1732584194 ^ a & 2004318071) + blocks[1] - 117830708;
349
- d = (d << 12 | d >>> 20) + a << 0;
350
- c = (-271733879 ^ (d & (a ^ -271733879))) + blocks[2] - 1126478375;
351
- c = (c << 17 | c >>> 15) + d << 0;
352
- b = (a ^ (c & (d ^ a))) + blocks[3] - 1316259209;
353
- b = (b << 22 | b >>> 10) + c << 0;
354
- } else {
355
- a = this.h0;
356
- b = this.h1;
357
- c = this.h2;
358
- d = this.h3;
359
- a += (d ^ (b & (c ^ d))) + blocks[0] - 680876936;
360
- a = (a << 7 | a >>> 25) + b << 0;
361
- d += (c ^ (a & (b ^ c))) + blocks[1] - 389564586;
362
- d = (d << 12 | d >>> 20) + a << 0;
363
- c += (b ^ (d & (a ^ b))) + blocks[2] + 606105819;
364
- c = (c << 17 | c >>> 15) + d << 0;
365
- b += (a ^ (c & (d ^ a))) + blocks[3] - 1044525330;
366
- b = (b << 22 | b >>> 10) + c << 0;
367
- }
368
-
369
- a += (d ^ (b & (c ^ d))) + blocks[4] - 176418897;
370
- a = (a << 7 | a >>> 25) + b << 0;
371
- d += (c ^ (a & (b ^ c))) + blocks[5] + 1200080426;
372
- d = (d << 12 | d >>> 20) + a << 0;
373
- c += (b ^ (d & (a ^ b))) + blocks[6] - 1473231341;
374
- c = (c << 17 | c >>> 15) + d << 0;
375
- b += (a ^ (c & (d ^ a))) + blocks[7] - 45705983;
376
- b = (b << 22 | b >>> 10) + c << 0;
377
- a += (d ^ (b & (c ^ d))) + blocks[8] + 1770035416;
378
- a = (a << 7 | a >>> 25) + b << 0;
379
- d += (c ^ (a & (b ^ c))) + blocks[9] - 1958414417;
380
- d = (d << 12 | d >>> 20) + a << 0;
381
- c += (b ^ (d & (a ^ b))) + blocks[10] - 42063;
382
- c = (c << 17 | c >>> 15) + d << 0;
383
- b += (a ^ (c & (d ^ a))) + blocks[11] - 1990404162;
384
- b = (b << 22 | b >>> 10) + c << 0;
385
- a += (d ^ (b & (c ^ d))) + blocks[12] + 1804603682;
386
- a = (a << 7 | a >>> 25) + b << 0;
387
- d += (c ^ (a & (b ^ c))) + blocks[13] - 40341101;
388
- d = (d << 12 | d >>> 20) + a << 0;
389
- c += (b ^ (d & (a ^ b))) + blocks[14] - 1502002290;
390
- c = (c << 17 | c >>> 15) + d << 0;
391
- b += (a ^ (c & (d ^ a))) + blocks[15] + 1236535329;
392
- b = (b << 22 | b >>> 10) + c << 0;
393
- a += (c ^ (d & (b ^ c))) + blocks[1] - 165796510;
394
- a = (a << 5 | a >>> 27) + b << 0;
395
- d += (b ^ (c & (a ^ b))) + blocks[6] - 1069501632;
396
- d = (d << 9 | d >>> 23) + a << 0;
397
- c += (a ^ (b & (d ^ a))) + blocks[11] + 643717713;
398
- c = (c << 14 | c >>> 18) + d << 0;
399
- b += (d ^ (a & (c ^ d))) + blocks[0] - 373897302;
400
- b = (b << 20 | b >>> 12) + c << 0;
401
- a += (c ^ (d & (b ^ c))) + blocks[5] - 701558691;
402
- a = (a << 5 | a >>> 27) + b << 0;
403
- d += (b ^ (c & (a ^ b))) + blocks[10] + 38016083;
404
- d = (d << 9 | d >>> 23) + a << 0;
405
- c += (a ^ (b & (d ^ a))) + blocks[15] - 660478335;
406
- c = (c << 14 | c >>> 18) + d << 0;
407
- b += (d ^ (a & (c ^ d))) + blocks[4] - 405537848;
408
- b = (b << 20 | b >>> 12) + c << 0;
409
- a += (c ^ (d & (b ^ c))) + blocks[9] + 568446438;
410
- a = (a << 5 | a >>> 27) + b << 0;
411
- d += (b ^ (c & (a ^ b))) + blocks[14] - 1019803690;
412
- d = (d << 9 | d >>> 23) + a << 0;
413
- c += (a ^ (b & (d ^ a))) + blocks[3] - 187363961;
414
- c = (c << 14 | c >>> 18) + d << 0;
415
- b += (d ^ (a & (c ^ d))) + blocks[8] + 1163531501;
416
- b = (b << 20 | b >>> 12) + c << 0;
417
- a += (c ^ (d & (b ^ c))) + blocks[13] - 1444681467;
418
- a = (a << 5 | a >>> 27) + b << 0;
419
- d += (b ^ (c & (a ^ b))) + blocks[2] - 51403784;
420
- d = (d << 9 | d >>> 23) + a << 0;
421
- c += (a ^ (b & (d ^ a))) + blocks[7] + 1735328473;
422
- c = (c << 14 | c >>> 18) + d << 0;
423
- b += (d ^ (a & (c ^ d))) + blocks[12] - 1926607734;
424
- b = (b << 20 | b >>> 12) + c << 0;
425
- bc = b ^ c;
426
- a += (bc ^ d) + blocks[5] - 378558;
427
- a = (a << 4 | a >>> 28) + b << 0;
428
- d += (bc ^ a) + blocks[8] - 2022574463;
429
- d = (d << 11 | d >>> 21) + a << 0;
430
- da = d ^ a;
431
- c += (da ^ b) + blocks[11] + 1839030562;
432
- c = (c << 16 | c >>> 16) + d << 0;
433
- b += (da ^ c) + blocks[14] - 35309556;
434
- b = (b << 23 | b >>> 9) + c << 0;
435
- bc = b ^ c;
436
- a += (bc ^ d) + blocks[1] - 1530992060;
437
- a = (a << 4 | a >>> 28) + b << 0;
438
- d += (bc ^ a) + blocks[4] + 1272893353;
439
- d = (d << 11 | d >>> 21) + a << 0;
440
- da = d ^ a;
441
- c += (da ^ b) + blocks[7] - 155497632;
442
- c = (c << 16 | c >>> 16) + d << 0;
443
- b += (da ^ c) + blocks[10] - 1094730640;
444
- b = (b << 23 | b >>> 9) + c << 0;
445
- bc = b ^ c;
446
- a += (bc ^ d) + blocks[13] + 681279174;
447
- a = (a << 4 | a >>> 28) + b << 0;
448
- d += (bc ^ a) + blocks[0] - 358537222;
449
- d = (d << 11 | d >>> 21) + a << 0;
450
- da = d ^ a;
451
- c += (da ^ b) + blocks[3] - 722521979;
452
- c = (c << 16 | c >>> 16) + d << 0;
453
- b += (da ^ c) + blocks[6] + 76029189;
454
- b = (b << 23 | b >>> 9) + c << 0;
455
- bc = b ^ c;
456
- a += (bc ^ d) + blocks[9] - 640364487;
457
- a = (a << 4 | a >>> 28) + b << 0;
458
- d += (bc ^ a) + blocks[12] - 421815835;
459
- d = (d << 11 | d >>> 21) + a << 0;
460
- da = d ^ a;
461
- c += (da ^ b) + blocks[15] + 530742520;
462
- c = (c << 16 | c >>> 16) + d << 0;
463
- b += (da ^ c) + blocks[2] - 995338651;
464
- b = (b << 23 | b >>> 9) + c << 0;
465
- a += (c ^ (b | ~d)) + blocks[0] - 198630844;
466
- a = (a << 6 | a >>> 26) + b << 0;
467
- d += (b ^ (a | ~c)) + blocks[7] + 1126891415;
468
- d = (d << 10 | d >>> 22) + a << 0;
469
- c += (a ^ (d | ~b)) + blocks[14] - 1416354905;
470
- c = (c << 15 | c >>> 17) + d << 0;
471
- b += (d ^ (c | ~a)) + blocks[5] - 57434055;
472
- b = (b << 21 | b >>> 11) + c << 0;
473
- a += (c ^ (b | ~d)) + blocks[12] + 1700485571;
474
- a = (a << 6 | a >>> 26) + b << 0;
475
- d += (b ^ (a | ~c)) + blocks[3] - 1894986606;
476
- d = (d << 10 | d >>> 22) + a << 0;
477
- c += (a ^ (d | ~b)) + blocks[10] - 1051523;
478
- c = (c << 15 | c >>> 17) + d << 0;
479
- b += (d ^ (c | ~a)) + blocks[1] - 2054922799;
480
- b = (b << 21 | b >>> 11) + c << 0;
481
- a += (c ^ (b | ~d)) + blocks[8] + 1873313359;
482
- a = (a << 6 | a >>> 26) + b << 0;
483
- d += (b ^ (a | ~c)) + blocks[15] - 30611744;
484
- d = (d << 10 | d >>> 22) + a << 0;
485
- c += (a ^ (d | ~b)) + blocks[6] - 1560198380;
486
- c = (c << 15 | c >>> 17) + d << 0;
487
- b += (d ^ (c | ~a)) + blocks[13] + 1309151649;
488
- b = (b << 21 | b >>> 11) + c << 0;
489
- a += (c ^ (b | ~d)) + blocks[4] - 145523070;
490
- a = (a << 6 | a >>> 26) + b << 0;
491
- d += (b ^ (a | ~c)) + blocks[11] - 1120210379;
492
- d = (d << 10 | d >>> 22) + a << 0;
493
- c += (a ^ (d | ~b)) + blocks[2] + 718787259;
494
- c = (c << 15 | c >>> 17) + d << 0;
495
- b += (d ^ (c | ~a)) + blocks[9] - 343485551;
496
- b = (b << 21 | b >>> 11) + c << 0;
497
-
498
- if (this.first) {
499
- this.h0 = a + 1732584193 << 0;
500
- this.h1 = b - 271733879 << 0;
501
- this.h2 = c - 1732584194 << 0;
502
- this.h3 = d + 271733878 << 0;
503
- this.first = false;
504
- } else {
505
- this.h0 = this.h0 + a << 0;
506
- this.h1 = this.h1 + b << 0;
507
- this.h2 = this.h2 + c << 0;
508
- this.h3 = this.h3 + d << 0;
509
- }
510
- };
511
-
512
- /**
513
- * @method hex
514
- * @memberof Md5
515
- * @instance
516
- * @description Output hash as hex string
517
- * @returns {String} Hex string
518
- * @see {@link md5.hex}
519
- * @example
520
- * hash.hex();
521
- */
522
- Md5.prototype.hex = function () {
523
- this.finalize();
524
-
525
- var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3;
526
-
527
- return HEX_CHARS[(h0 >> 4) & 0x0F] + HEX_CHARS[h0 & 0x0F] +
528
- HEX_CHARS[(h0 >> 12) & 0x0F] + HEX_CHARS[(h0 >> 8) & 0x0F] +
529
- HEX_CHARS[(h0 >> 20) & 0x0F] + HEX_CHARS[(h0 >> 16) & 0x0F] +
530
- HEX_CHARS[(h0 >> 28) & 0x0F] + HEX_CHARS[(h0 >> 24) & 0x0F] +
531
- HEX_CHARS[(h1 >> 4) & 0x0F] + HEX_CHARS[h1 & 0x0F] +
532
- HEX_CHARS[(h1 >> 12) & 0x0F] + HEX_CHARS[(h1 >> 8) & 0x0F] +
533
- HEX_CHARS[(h1 >> 20) & 0x0F] + HEX_CHARS[(h1 >> 16) & 0x0F] +
534
- HEX_CHARS[(h1 >> 28) & 0x0F] + HEX_CHARS[(h1 >> 24) & 0x0F] +
535
- HEX_CHARS[(h2 >> 4) & 0x0F] + HEX_CHARS[h2 & 0x0F] +
536
- HEX_CHARS[(h2 >> 12) & 0x0F] + HEX_CHARS[(h2 >> 8) & 0x0F] +
537
- HEX_CHARS[(h2 >> 20) & 0x0F] + HEX_CHARS[(h2 >> 16) & 0x0F] +
538
- HEX_CHARS[(h2 >> 28) & 0x0F] + HEX_CHARS[(h2 >> 24) & 0x0F] +
539
- HEX_CHARS[(h3 >> 4) & 0x0F] + HEX_CHARS[h3 & 0x0F] +
540
- HEX_CHARS[(h3 >> 12) & 0x0F] + HEX_CHARS[(h3 >> 8) & 0x0F] +
541
- HEX_CHARS[(h3 >> 20) & 0x0F] + HEX_CHARS[(h3 >> 16) & 0x0F] +
542
- HEX_CHARS[(h3 >> 28) & 0x0F] + HEX_CHARS[(h3 >> 24) & 0x0F];
543
- };
544
-
545
- /**
546
- * @method toString
547
- * @memberof Md5
548
- * @instance
549
- * @description Output hash as hex string
550
- * @returns {String} Hex string
551
- * @see {@link md5.hex}
552
- * @example
553
- * hash.toString();
554
- */
555
- Md5.prototype.toString = Md5.prototype.hex;
556
-
557
- /**
558
- * @method digest
559
- * @memberof Md5
560
- * @instance
561
- * @description Output hash as bytes array
562
- * @returns {Array} Bytes array
563
- * @see {@link md5.digest}
564
- * @example
565
- * hash.digest();
566
- */
567
- Md5.prototype.digest = function () {
568
- this.finalize();
569
-
570
- var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3;
571
- return [
572
- h0 & 0xFF, (h0 >> 8) & 0xFF, (h0 >> 16) & 0xFF, (h0 >> 24) & 0xFF,
573
- h1 & 0xFF, (h1 >> 8) & 0xFF, (h1 >> 16) & 0xFF, (h1 >> 24) & 0xFF,
574
- h2 & 0xFF, (h2 >> 8) & 0xFF, (h2 >> 16) & 0xFF, (h2 >> 24) & 0xFF,
575
- h3 & 0xFF, (h3 >> 8) & 0xFF, (h3 >> 16) & 0xFF, (h3 >> 24) & 0xFF
576
- ];
577
- };
578
-
579
- /**
580
- * @method array
581
- * @memberof Md5
582
- * @instance
583
- * @description Output hash as bytes array
584
- * @returns {Array} Bytes array
585
- * @see {@link md5.array}
586
- * @example
587
- * hash.array();
588
- */
589
- Md5.prototype.array = Md5.prototype.digest;
590
-
591
- /**
592
- * @method arrayBuffer
593
- * @memberof Md5
594
- * @instance
595
- * @description Output hash as ArrayBuffer
596
- * @returns {ArrayBuffer} ArrayBuffer
597
- * @see {@link md5.arrayBuffer}
598
- * @example
599
- * hash.arrayBuffer();
600
- */
601
- Md5.prototype.arrayBuffer = function () {
602
- this.finalize();
603
-
604
- var buffer = new ArrayBuffer(16);
605
- var blocks = new Uint32Array(buffer);
606
- blocks[0] = this.h0;
607
- blocks[1] = this.h1;
608
- blocks[2] = this.h2;
609
- blocks[3] = this.h3;
610
- return buffer;
611
- };
612
-
613
- /**
614
- * @method buffer
615
- * @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
616
- * @memberof Md5
617
- * @instance
618
- * @description Output hash as ArrayBuffer
619
- * @returns {ArrayBuffer} ArrayBuffer
620
- * @see {@link md5.buffer}
621
- * @example
622
- * hash.buffer();
623
- */
624
- Md5.prototype.buffer = Md5.prototype.arrayBuffer;
625
-
626
- /**
627
- * @method base64
628
- * @memberof Md5
629
- * @instance
630
- * @description Output hash as base64 string
631
- * @returns {String} base64 string
632
- * @see {@link md5.base64}
633
- * @example
634
- * hash.base64();
635
- */
636
- Md5.prototype.base64 = function () {
637
- var v1, v2, v3, base64Str = '', bytes = this.array();
638
- for (var i = 0; i < 15;) {
639
- v1 = bytes[i++];
640
- v2 = bytes[i++];
641
- v3 = bytes[i++];
642
- base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
643
- BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] +
644
- BASE64_ENCODE_CHAR[(v2 << 2 | v3 >>> 6) & 63] +
645
- BASE64_ENCODE_CHAR[v3 & 63];
646
- }
647
- v1 = bytes[i];
648
- base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
649
- BASE64_ENCODE_CHAR[(v1 << 4) & 63] +
650
- '==';
651
- return base64Str;
652
- };
653
-
654
- var exports = createMethod();
655
-
656
- if (COMMON_JS) {
657
- module.exports = exports;
658
- } else {
659
- /**
660
- * @method md5
661
- * @description Md5 hash function, export to global in browsers.
662
- * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
663
- * @returns {String} md5 hashes
664
- * @example
665
- * md5(''); // d41d8cd98f00b204e9800998ecf8427e
666
- * md5('The quick brown fox jumps over the lazy dog'); // 9e107d9d372bb6826bd81d3542a419d6
667
- * md5('The quick brown fox jumps over the lazy dog.'); // e4d909c290d0fb1ca068ffaddf22cbd0
668
- *
669
- * // It also supports UTF-8 encoding
670
- * md5('中文'); // a7bac2239fcdcb3a067903d8077c4a07
671
- *
672
- * // It also supports byte `Array`, `Uint8Array`, `ArrayBuffer`
673
- * md5([]); // d41d8cd98f00b204e9800998ecf8427e
674
- * md5(new Uint8Array([])); // d41d8cd98f00b204e9800998ecf8427e
675
- */
676
- root.md5 = exports;
677
- if (AMD) {
678
- define(function () {
679
- return exports;
680
- });
681
- }
682
- }
683
- })();
@@ -1,20 +0,0 @@
1
- import request from './request';
2
- import { getGlobalData } from "./global";
3
-
4
-
5
- export default async function openApiRequest(url, options) {
6
-
7
- const requestOptions = { ...options };
8
- const headers = {
9
- 'Content-Type': 'application/json',
10
- 'X-Gizwits-Application-Id': getGlobalData('appID'),
11
- };
12
-
13
- headers['X-Gizwits-User-token'] = getGlobalData('token');
14
-
15
- requestOptions.header = { ...headers, ...options.headers };
16
- delete requestOptions.headers;
17
- console.log(`openApi request ${url}`, requestOptions);
18
- const openApiUrl = getGlobalData('cloudServiceInfo').openAPIInfo;
19
- return request('https://' + openApiUrl + url, requestOptions);
20
- }