x4js 1.5.16 → 1.5.17

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.
Files changed (75) hide show
  1. package/lib/cjs/app_sockets.js +74 -0
  2. package/lib/cjs/index.js +1 -0
  3. package/lib/cjs/treeview.js +27 -12
  4. package/lib/cjs/version.js +1 -1
  5. package/lib/esm/app_sockets.js +70 -0
  6. package/lib/esm/index.mjs +1 -0
  7. package/lib/esm/treeview.js +26 -12
  8. package/lib/esm/version.js +1 -1
  9. package/lib/{src/version.ts → types/app_sockets.d.ts} +29 -30
  10. package/lib/types/index.d.ts +1 -0
  11. package/lib/types/treeview.d.ts +5 -2
  12. package/lib/types/version.d.ts +1 -1
  13. package/package.json +1 -1
  14. package/lib/src/MIT-license.md +0 -14
  15. package/lib/src/action.ts +0 -88
  16. package/lib/src/alpha.jpg +0 -0
  17. package/lib/src/application.ts +0 -251
  18. package/lib/src/autocomplete.ts +0 -197
  19. package/lib/src/base64.ts +0 -166
  20. package/lib/src/base_component.ts +0 -152
  21. package/lib/src/button.ts +0 -355
  22. package/lib/src/calendar.ts +0 -328
  23. package/lib/src/canvas.ts +0 -505
  24. package/lib/src/cardview.ts +0 -227
  25. package/lib/src/checkbox.ts +0 -188
  26. package/lib/src/color.ts +0 -752
  27. package/lib/src/colorpicker.ts +0 -1639
  28. package/lib/src/combobox.ts +0 -465
  29. package/lib/src/component.ts +0 -2329
  30. package/lib/src/datastore.ts +0 -1322
  31. package/lib/src/dialog.ts +0 -656
  32. package/lib/src/dom_events.ts +0 -315
  33. package/lib/src/drag_manager.ts +0 -199
  34. package/lib/src/drawtext.ts +0 -355
  35. package/lib/src/fileupload.ts +0 -213
  36. package/lib/src/form.ts +0 -375
  37. package/lib/src/formatters.ts +0 -105
  38. package/lib/src/gridview.ts +0 -1185
  39. package/lib/src/i18n.ts +0 -346
  40. package/lib/src/icon.ts +0 -335
  41. package/lib/src/image.ts +0 -204
  42. package/lib/src/index.ts +0 -88
  43. package/lib/src/input.ts +0 -249
  44. package/lib/src/label.ts +0 -128
  45. package/lib/src/layout.ts +0 -430
  46. package/lib/src/link.ts +0 -86
  47. package/lib/src/listview.ts +0 -765
  48. package/lib/src/md5.ts +0 -438
  49. package/lib/src/menu.ts +0 -425
  50. package/lib/src/messagebox.ts +0 -224
  51. package/lib/src/panel.ts +0 -86
  52. package/lib/src/popup.ts +0 -494
  53. package/lib/src/property_editor.ts +0 -337
  54. package/lib/src/radiobtn.ts +0 -197
  55. package/lib/src/rating.ts +0 -135
  56. package/lib/src/request.ts +0 -300
  57. package/lib/src/router.ts +0 -185
  58. package/lib/src/settings.ts +0 -77
  59. package/lib/src/sidebarview.ts +0 -103
  60. package/lib/src/spreadsheet.ts +0 -1449
  61. package/lib/src/styles.ts +0 -343
  62. package/lib/src/svgcomponent.ts +0 -577
  63. package/lib/src/tabbar.ts +0 -151
  64. package/lib/src/tabview.ts +0 -110
  65. package/lib/src/textarea.ts +0 -235
  66. package/lib/src/textedit.ts +0 -544
  67. package/lib/src/toaster.ts +0 -80
  68. package/lib/src/tools.ts +0 -1473
  69. package/lib/src/tooltips.ts +0 -191
  70. package/lib/src/treeview.ts +0 -696
  71. package/lib/src/x4.less +0 -2243
  72. package/lib/src/x4dom.ts +0 -57
  73. package/lib/src/x4events.ts +0 -585
  74. package/lib/src/x4react.ts +0 -90
  75. package/lib/x4.css +0 -1780
package/lib/src/md5.ts DELETED
@@ -1,438 +0,0 @@
1
- /**
2
- * ___ ___ __
3
- * \ \_/ / / _
4
- * \ / /_| |_
5
- * / _ \____ _|
6
- * /__/ \__\ |_|
7
- *
8
- * @file md5.ts
9
- * @author Etienne Cochard
10
- * @license
11
- *
12
- * Copyright (c) 2019-2022 R-libre ingenierie
13
- *
14
- * Permission is hereby granted, free of charge, to any person obtaining a copy
15
- * of this software and associated documentation files (the "Software"), to deal
16
- * in the Software without restriction, including without limitation the rights
17
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
18
- * of the Software, and to permit persons to whom the Software is furnished to do so,
19
- * subject to the following conditions:
20
- * The above copyright notice and this permission notice shall be included in all copies
21
- * or substantial portions of the Software.
22
- *
23
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
24
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
25
- * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
- **/
30
-
31
- /*
32
- TypeScript Md5
33
- ==============
34
- Based on work by
35
- * Joseph Myers: http://www.myersdaily.org/joseph/javascript/md5-text.html
36
- * André Cruz: https://github.com/satazor/SparkMD5
37
- * Raymond Hill: https://github.com/gorhill/yamd5.js
38
- Effectively a TypeScrypt re-write of Raymond Hill JS Library
39
- The MIT License (MIT)
40
- Copyright (C) 2014 Raymond Hill
41
- Permission is hereby granted, free of charge, to any person obtaining a copy
42
- of this software and associated documentation files (the "Software"), to deal
43
- in the Software without restriction, including without limitation the rights
44
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
45
- copies of the Software, and to permit persons to whom the Software is
46
- furnished to do so, subject to the following conditions:
47
- The above copyright notice and this permission notice shall be included in
48
- all copies or substantial portions of the Software.
49
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
52
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
55
- THE SOFTWARE.
56
- */
57
-
58
- export class Md5 {
59
-
60
- // One time hashing functions
61
- public static hashStr(str: string, raw?: false): string
62
- public static hashStr(str: string, raw?: true): Int32Array
63
- public static hashStr(str: string, raw: boolean = false) {
64
- return this.onePassHasher
65
- .start()
66
- .appendStr(str)
67
- .end(raw);
68
- }
69
-
70
- public static hashAsciiStr(str: string, raw?: false): string
71
- public static hashAsciiStr(str: string, raw?: true): Int32Array
72
- public static hashAsciiStr(str: string, raw: boolean = false) {
73
- return this.onePassHasher
74
- .start()
75
- .appendAsciiStr(str)
76
- .end(raw);
77
- }
78
- // Private Static Variables
79
- private static stateIdentity = new Int32Array([1732584193, -271733879, -1732584194, 271733878]);
80
- private static buffer32Identity = new Int32Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
81
- private static hexChars = '0123456789abcdef';
82
- private static hexOut: string[] = [];
83
-
84
- // Permanent instance is to use for one-call hashing
85
- private static onePassHasher = new Md5();
86
-
87
- private static _hex(x: any): string {
88
- const hc = Md5.hexChars;
89
- const ho = Md5.hexOut;
90
- let n;
91
- let offset;
92
- let j;
93
- let i;
94
-
95
- for (i = 0; i < 4; i += 1) {
96
- offset = i * 8;
97
- n = x[i];
98
- for (j = 0; j < 8; j += 2) {
99
- ho[offset + 1 + j] = hc.charAt(n & 0x0F);
100
- n >>>= 4;
101
- ho[offset + 0 + j] = hc.charAt(n & 0x0F);
102
- n >>>= 4;
103
- }
104
- }
105
- return ho.join('');
106
- }
107
-
108
- private static _md5cycle(x: Int32Array|Uint32Array, k: Int32Array|Uint32Array) {
109
- let a = x[0];
110
- let b = x[1];
111
- let c = x[2];
112
- let d = x[3];
113
- // ff()
114
- a += (b & c | ~b & d) + k[0] - 680876936 | 0;
115
- a = (a << 7 | a >>> 25) + b | 0;
116
- d += (a & b | ~a & c) + k[1] - 389564586 | 0;
117
- d = (d << 12 | d >>> 20) + a | 0;
118
- c += (d & a | ~d & b) + k[2] + 606105819 | 0;
119
- c = (c << 17 | c >>> 15) + d | 0;
120
- b += (c & d | ~c & a) + k[3] - 1044525330 | 0;
121
- b = (b << 22 | b >>> 10) + c | 0;
122
- a += (b & c | ~b & d) + k[4] - 176418897 | 0;
123
- a = (a << 7 | a >>> 25) + b | 0;
124
- d += (a & b | ~a & c) + k[5] + 1200080426 | 0;
125
- d = (d << 12 | d >>> 20) + a | 0;
126
- c += (d & a | ~d & b) + k[6] - 1473231341 | 0;
127
- c = (c << 17 | c >>> 15) + d | 0;
128
- b += (c & d | ~c & a) + k[7] - 45705983 | 0;
129
- b = (b << 22 | b >>> 10) + c | 0;
130
- a += (b & c | ~b & d) + k[8] + 1770035416 | 0;
131
- a = (a << 7 | a >>> 25) + b | 0;
132
- d += (a & b | ~a & c) + k[9] - 1958414417 | 0;
133
- d = (d << 12 | d >>> 20) + a | 0;
134
- c += (d & a | ~d & b) + k[10] - 42063 | 0;
135
- c = (c << 17 | c >>> 15) + d | 0;
136
- b += (c & d | ~c & a) + k[11] - 1990404162 | 0;
137
- b = (b << 22 | b >>> 10) + c | 0;
138
- a += (b & c | ~b & d) + k[12] + 1804603682 | 0;
139
- a = (a << 7 | a >>> 25) + b | 0;
140
- d += (a & b | ~a & c) + k[13] - 40341101 | 0;
141
- d = (d << 12 | d >>> 20) + a | 0;
142
- c += (d & a | ~d & b) + k[14] - 1502002290 | 0;
143
- c = (c << 17 | c >>> 15) + d | 0;
144
- b += (c & d | ~c & a) + k[15] + 1236535329 | 0;
145
- b = (b << 22 | b >>> 10) + c | 0;
146
- // gg()
147
- a += (b & d | c & ~d) + k[1] - 165796510 | 0;
148
- a = (a << 5 | a >>> 27) + b | 0;
149
- d += (a & c | b & ~c) + k[6] - 1069501632 | 0;
150
- d = (d << 9 | d >>> 23) + a | 0;
151
- c += (d & b | a & ~b) + k[11] + 643717713 | 0;
152
- c = (c << 14 | c >>> 18) + d | 0;
153
- b += (c & a | d & ~a) + k[0] - 373897302 | 0;
154
- b = (b << 20 | b >>> 12) + c | 0;
155
- a += (b & d | c & ~d) + k[5] - 701558691 | 0;
156
- a = (a << 5 | a >>> 27) + b | 0;
157
- d += (a & c | b & ~c) + k[10] + 38016083 | 0;
158
- d = (d << 9 | d >>> 23) + a | 0;
159
- c += (d & b | a & ~b) + k[15] - 660478335 | 0;
160
- c = (c << 14 | c >>> 18) + d | 0;
161
- b += (c & a | d & ~a) + k[4] - 405537848 | 0;
162
- b = (b << 20 | b >>> 12) + c | 0;
163
- a += (b & d | c & ~d) + k[9] + 568446438 | 0;
164
- a = (a << 5 | a >>> 27) + b | 0;
165
- d += (a & c | b & ~c) + k[14] - 1019803690 | 0;
166
- d = (d << 9 | d >>> 23) + a | 0;
167
- c += (d & b | a & ~b) + k[3] - 187363961 | 0;
168
- c = (c << 14 | c >>> 18) + d | 0;
169
- b += (c & a | d & ~a) + k[8] + 1163531501 | 0;
170
- b = (b << 20 | b >>> 12) + c | 0;
171
- a += (b & d | c & ~d) + k[13] - 1444681467 | 0;
172
- a = (a << 5 | a >>> 27) + b | 0;
173
- d += (a & c | b & ~c) + k[2] - 51403784 | 0;
174
- d = (d << 9 | d >>> 23) + a | 0;
175
- c += (d & b | a & ~b) + k[7] + 1735328473 | 0;
176
- c = (c << 14 | c >>> 18) + d | 0;
177
- b += (c & a | d & ~a) + k[12] - 1926607734 | 0;
178
- b = (b << 20 | b >>> 12) + c | 0;
179
- // hh()
180
- a += (b ^ c ^ d) + k[5] - 378558 | 0;
181
- a = (a << 4 | a >>> 28) + b | 0;
182
- d += (a ^ b ^ c) + k[8] - 2022574463 | 0;
183
- d = (d << 11 | d >>> 21) + a | 0;
184
- c += (d ^ a ^ b) + k[11] + 1839030562 | 0;
185
- c = (c << 16 | c >>> 16) + d | 0;
186
- b += (c ^ d ^ a) + k[14] - 35309556 | 0;
187
- b = (b << 23 | b >>> 9) + c | 0;
188
- a += (b ^ c ^ d) + k[1] - 1530992060 | 0;
189
- a = (a << 4 | a >>> 28) + b | 0;
190
- d += (a ^ b ^ c) + k[4] + 1272893353 | 0;
191
- d = (d << 11 | d >>> 21) + a | 0;
192
- c += (d ^ a ^ b) + k[7] - 155497632 | 0;
193
- c = (c << 16 | c >>> 16) + d | 0;
194
- b += (c ^ d ^ a) + k[10] - 1094730640 | 0;
195
- b = (b << 23 | b >>> 9) + c | 0;
196
- a += (b ^ c ^ d) + k[13] + 681279174 | 0;
197
- a = (a << 4 | a >>> 28) + b | 0;
198
- d += (a ^ b ^ c) + k[0] - 358537222 | 0;
199
- d = (d << 11 | d >>> 21) + a | 0;
200
- c += (d ^ a ^ b) + k[3] - 722521979 | 0;
201
- c = (c << 16 | c >>> 16) + d | 0;
202
- b += (c ^ d ^ a) + k[6] + 76029189 | 0;
203
- b = (b << 23 | b >>> 9) + c | 0;
204
- a += (b ^ c ^ d) + k[9] - 640364487 | 0;
205
- a = (a << 4 | a >>> 28) + b | 0;
206
- d += (a ^ b ^ c) + k[12] - 421815835 | 0;
207
- d = (d << 11 | d >>> 21) + a | 0;
208
- c += (d ^ a ^ b) + k[15] + 530742520 | 0;
209
- c = (c << 16 | c >>> 16) + d | 0;
210
- b += (c ^ d ^ a) + k[2] - 995338651 | 0;
211
- b = (b << 23 | b >>> 9) + c | 0;
212
- // ii()
213
- a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;
214
- a = (a << 6 | a >>> 26) + b | 0;
215
- d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;
216
- d = (d << 10 | d >>> 22) + a | 0;
217
- c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;
218
- c = (c << 15 | c >>> 17) + d | 0;
219
- b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;
220
- b = (b << 21 | b >>> 11) + c | 0;
221
- a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;
222
- a = (a << 6 | a >>> 26) + b | 0;
223
- d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;
224
- d = (d << 10 | d >>> 22) + a | 0;
225
- c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;
226
- c = (c << 15 | c >>> 17) + d | 0;
227
- b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;
228
- b = (b << 21 | b >>> 11) + c | 0;
229
- a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;
230
- a = (a << 6 | a >>> 26) + b | 0;
231
- d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;
232
- d = (d << 10 | d >>> 22) + a | 0;
233
- c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;
234
- c = (c << 15 | c >>> 17) + d | 0;
235
- b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;
236
- b = (b << 21 | b >>> 11) + c | 0;
237
- a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;
238
- a = (a << 6 | a >>> 26) + b | 0;
239
- d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;
240
- d = (d << 10 | d >>> 22) + a | 0;
241
- c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;
242
- c = (c << 15 | c >>> 17) + d | 0;
243
- b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;
244
- b = (b << 21 | b >>> 11) + c | 0;
245
-
246
- x[0] = a + x[0] | 0;
247
- x[1] = b + x[1] | 0;
248
- x[2] = c + x[2] | 0;
249
- x[3] = d + x[3] | 0;
250
- }
251
-
252
- private _dataLength: number;
253
- private _bufferLength: number;
254
-
255
- private _state: Int32Array = new Int32Array(4);
256
- private _buffer: ArrayBuffer = new ArrayBuffer(68);
257
- private _buffer8: Uint8Array;
258
- private _buffer32: Uint32Array;
259
-
260
- constructor() {
261
- this._buffer8 = new Uint8Array(this._buffer, 0, 68);
262
- this._buffer32 = new Uint32Array(this._buffer, 0, 17);
263
- this.start();
264
- }
265
-
266
- public start() {
267
- this._dataLength = 0;
268
- this._bufferLength = 0;
269
- this._state.set(Md5.stateIdentity);
270
- return this;
271
- }
272
-
273
- // Char to code point to to array conversion:
274
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt
275
- // #Example.3A_Fixing_charCodeAt_to_handle_non-Basic-Multilingual-Plane_characters_if_their_presence_earlier_in_the_string_is_unknown
276
- public appendStr(str: string) {
277
- const buf8 = this._buffer8;
278
- const buf32 = this._buffer32;
279
- let bufLen = this._bufferLength;
280
- let code;
281
- let i;
282
-
283
- for (i = 0; i < str.length; i += 1) {
284
- code = str.charCodeAt(i);
285
- if (code < 128) {
286
- buf8[bufLen++] = code;
287
- } else if (code < 0x800) {
288
- buf8[bufLen++] = (code >>> 6) + 0xC0;
289
- buf8[bufLen++] = code & 0x3F | 0x80;
290
- } else if (code < 0xD800 || code > 0xDBFF) {
291
- buf8[bufLen++] = (code >>> 12) + 0xE0;
292
- buf8[bufLen++] = (code >>> 6 & 0x3F) | 0x80;
293
- buf8[bufLen++] = (code & 0x3F) | 0x80;
294
- } else {
295
- code = ((code - 0xD800) * 0x400) + (str.charCodeAt(++i) - 0xDC00) + 0x10000;
296
- if (code > 0x10FFFF) {
297
- throw new Error('Unicode standard supports code points up to U+10FFFF');
298
- }
299
- buf8[bufLen++] = (code >>> 18) + 0xF0;
300
- buf8[bufLen++] = (code >>> 12 & 0x3F) | 0x80;
301
- buf8[bufLen++] = (code >>> 6 & 0x3F) | 0x80;
302
- buf8[bufLen++] = (code & 0x3F) | 0x80;
303
- }
304
- if (bufLen >= 64) {
305
- this._dataLength += 64;
306
- Md5._md5cycle(this._state, buf32);
307
- bufLen -= 64;
308
- buf32[0] = buf32[16];
309
- }
310
- }
311
- this._bufferLength = bufLen;
312
- return this;
313
- }
314
-
315
- public appendAsciiStr(str: string) {
316
- const buf8 = this._buffer8;
317
- const buf32 = this._buffer32;
318
- let bufLen = this._bufferLength;
319
- let i;
320
- let j = 0;
321
-
322
- for (; ;) {
323
- i = Math.min(str.length - j, 64 - bufLen);
324
- while (i--) {
325
- buf8[bufLen++] = str.charCodeAt(j++);
326
- }
327
- if (bufLen < 64) {
328
- break;
329
- }
330
- this._dataLength += 64;
331
- Md5._md5cycle(this._state, buf32);
332
- bufLen = 0;
333
- }
334
- this._bufferLength = bufLen;
335
- return this;
336
- }
337
-
338
- public appendByteArray(input: Uint8Array) {
339
- const buf8 = this._buffer8;
340
- const buf32 = this._buffer32;
341
- let bufLen = this._bufferLength;
342
- let i;
343
- let j = 0;
344
-
345
- for (; ;) {
346
- i = Math.min(input.length - j, 64 - bufLen);
347
- while (i--) {
348
- buf8[bufLen++] = input[j++];
349
- }
350
- if (bufLen < 64) {
351
- break;
352
- }
353
- this._dataLength += 64;
354
- Md5._md5cycle(this._state, buf32);
355
- bufLen = 0;
356
- }
357
- this._bufferLength = bufLen;
358
- return this;
359
- }
360
-
361
- public getState() {
362
- const self = this;
363
- const s = self._state;
364
-
365
- return {
366
- //@ts-ignore
367
- buffer: String.fromCharCode.apply(null, self._buffer8),
368
- buflen: self._bufferLength,
369
- length: self._dataLength,
370
- state: [s[0], s[1], s[2], s[3]]
371
- };
372
- }
373
-
374
- public setState(state: any) {
375
- const buf = state.buffer;
376
- const x = state.state;
377
- const s = this._state;
378
- let i;
379
-
380
- this._dataLength = state.length;
381
- this._bufferLength = state.buflen;
382
- s[0] = x[0];
383
- s[1] = x[1];
384
- s[2] = x[2];
385
- s[3] = x[3];
386
-
387
- for (i = 0; i < buf.length; i += 1) {
388
- this._buffer8[i] = buf.charCodeAt(i);
389
- }
390
- }
391
-
392
- public end(raw: boolean = false) {
393
- const bufLen = this._bufferLength;
394
- const buf8 = this._buffer8;
395
- const buf32 = this._buffer32;
396
- const i = (bufLen >> 2) + 1;
397
- let dataBitsLen;
398
-
399
- this._dataLength += bufLen;
400
-
401
- buf8[bufLen] = 0x80;
402
- buf8[bufLen + 1] = buf8[bufLen + 2] = buf8[bufLen + 3] = 0;
403
- buf32.set(Md5.buffer32Identity.subarray(i), i);
404
-
405
- if (bufLen > 55) {
406
- Md5._md5cycle(this._state, buf32);
407
- buf32.set(Md5.buffer32Identity);
408
- }
409
-
410
- // Do the final computation based on the tail and length
411
- // Beware that the final length may not fit in 32 bits so we take care of that
412
- dataBitsLen = this._dataLength * 8;
413
- if (dataBitsLen <= 0xFFFFFFFF) {
414
- buf32[14] = dataBitsLen;
415
- } else {
416
- const matches = dataBitsLen.toString(16).match(/(.*?)(.{0,8})$/);
417
- if (matches === null) {
418
- return;
419
- }
420
-
421
- const lo = parseInt(matches[2], 16);
422
- const hi = parseInt(matches[1], 16) || 0;
423
-
424
- buf32[14] = lo;
425
- buf32[15] = hi;
426
- }
427
-
428
- Md5._md5cycle(this._state, buf32);
429
-
430
- return raw ? this._state : Md5._hex(this._state);
431
- }
432
- }
433
-
434
- /*
435
- if (Md5.hashStr('hello') !== '5d41402abc4b2a76b9719d911017c592') {
436
- console.error('Md5 self test failed.');
437
- }
438
- */