js-md5 0.8.3 → 0.9.2

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