@vunk/form 2.18.2 → 2.19.1
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/components/_plugin-vue_export-helper.cjs +1 -11
- package/components/api-tables-select/index.cjs +1 -467
- package/components/api-tables-select/index.mjs +56 -413
- package/components/api-tables-select/src/ctx.d.ts +147 -173
- package/components/api-tables-select/src/index.vue.d.ts +390 -983
- package/components/button/index.cjs +1 -112
- package/components/button/index.mjs +56 -85
- package/components/button/src/ctx.d.ts +28 -113
- package/components/button/src/index.vue.d.ts +314 -621
- package/components/card-input-collection/index.cjs +1 -370
- package/components/card-input-collection/index.mjs +175 -277
- package/components/card-input-collection/src/core.vue.d.ts +57 -950
- package/components/card-input-collection/src/ctx.d.ts +19 -49
- package/components/card-input-collection/src/index.vue.d.ts +49 -112
- package/components/cascader/index.cjs +1 -150
- package/components/cascader/index.mjs +88 -116
- package/components/cascader/src/ctx.d.ts +148 -207
- package/components/cascader/src/index.vue.d.ts +335 -525
- package/components/cascader/src/use.d.ts +1 -1
- package/components/checkbox/index.cjs +1 -152
- package/components/checkbox/index.mjs +75 -119
- package/components/checkbox/src/ctx.d.ts +46 -69
- package/components/checkbox/src/index.vue.d.ts +445 -1012
- package/components/cloneDeep.cjs +1 -2106
- package/components/color-picker/index.cjs +1 -80
- package/components/color-picker/index.mjs +46 -69
- package/components/color-picker/src/ctx.d.ts +138 -107
- package/components/color-picker/src/index.vue.d.ts +305 -255
- package/components/date-picker/index.cjs +1 -119
- package/components/date-picker/index.mjs +63 -97
- package/components/date-picker/src/ctx.d.ts +131 -206
- package/components/date-picker/src/index.vue.d.ts +287 -1359
- package/components/date-picker/src/types.d.ts +7 -7
- package/components/date-picker-range/index.cjs +1 -177
- package/components/date-picker-range/index.mjs +62 -113
- package/components/date-picker-range/src/ctx.d.ts +139 -207
- package/components/date-picker-range/src/index.vue.d.ts +896 -450
- package/components/debounce.cjs +1 -0
- package/components/dialog/index.cjs +1 -126
- package/components/dialog/index.mjs +65 -99
- package/components/dialog/src/ctx.d.ts +17 -108
- package/components/dialog/src/index.vue.d.ts +77 -1070
- package/components/dialog-input-collection/index.cjs +1 -624
- package/components/dialog-input-collection/index.mjs +276 -498
- package/components/dialog-input-collection/src/ctx.d.ts +20 -50
- package/components/dialog-input-collection/src/dialog-form.vue.d.ts +28 -6366
- package/components/dialog-input-collection/src/index.vue.d.ts +66 -7629
- package/components/dialog-input-collection/src/layout.vue.d.ts +16 -72
- package/components/download-plus/index.cjs +1 -456
- package/components/download-plus/index.mjs +214 -358
- package/components/download-plus/src/ctx.d.ts +20 -50
- package/components/download-plus/src/index.vue.d.ts +434 -1171
- package/components/editable-text/index.cjs +1 -295
- package/components/editable-text/index.mjs +113 -239
- package/components/editable-text/src/ctx.d.ts +20 -50
- package/components/editable-text/src/index.vue.d.ts +62 -3257
- package/components/el-slider/index.cjs +1 -0
- package/components/el-slider/index.d.ts +5 -0
- package/components/el-slider/index.mjs +475 -0
- package/components/el-slider/src/button.d.ts +36 -0
- package/components/el-slider/src/button.vue.d.ts +42 -0
- package/components/el-slider/src/composables/index.cjs +1 -0
- package/components/el-slider/src/composables/index.d.ts +6 -0
- package/components/el-slider/src/composables/index.mjs +9 -0
- package/components/el-slider/src/composables/use-lifecycle.d.ts +4 -0
- package/components/el-slider/src/composables/use-marks.d.ts +7 -0
- package/components/el-slider/src/composables/use-slide.d.ts +23 -0
- package/components/el-slider/src/composables/use-slider-button.d.ts +18 -0
- package/components/el-slider/src/composables/use-stops.d.ts +8 -0
- package/components/el-slider/src/composables/use-watch.d.ts +4 -0
- package/components/el-slider/src/constants.d.ts +14 -0
- package/components/el-slider/src/marker.d.ts +37 -0
- package/components/el-slider/src/slider-core.vue.d.ts +219 -0
- package/components/el-slider/src/slider.d.ts +175 -0
- package/components/esri-input-geojson/index.cjs +2 -1604
- package/components/esri-input-geojson/index.mjs +666 -1289
- package/components/esri-input-geojson/src/append.vue.d.ts +225 -1084
- package/components/esri-input-geojson/src/const.d.ts +1 -1
- package/components/esri-input-geojson/src/ctx.d.ts +62 -158
- package/components/esri-input-geojson/src/default-view.vue.d.ts +12 -132
- package/components/esri-input-geojson/src/index.vue.d.ts +1470 -789
- package/components/esri-input-geojson/src/viewer.vue.d.ts +424 -287
- package/components/fieldset/index.cjs +1 -110
- package/components/fieldset/index.mjs +62 -77
- package/components/fieldset/src/ctx.d.ts +4 -4
- package/components/fieldset/src/index.vue.d.ts +10 -9
- package/components/form/index.cjs +1 -248
- package/components/form/index.mjs +107 -161
- package/components/form/src/ctx.d.ts +15 -64
- package/components/form/src/index.vue.d.ts +360 -2416
- package/components/form-item/index.cjs +1 -294
- package/components/form-item/index.mjs +139 -229
- package/components/form-item/src/core.vue.d.ts +33 -1853
- package/components/form-item/src/ctx.d.ts +17 -47
- package/components/form-item/src/index.vue.d.ts +41 -103
- package/components/form-item-renderer/index.cjs +1 -193
- package/components/form-item-renderer/index.mjs +102 -162
- package/components/form-item-renderer/src/core.vue.d.ts +12 -11
- package/components/form-item-renderer/src/ctx.d.ts +3 -3
- package/components/form-item-renderer/src/index.vue.d.ts +25 -73
- package/components/form-item-renderer-template/index.cjs +1 -47
- package/components/form-item-renderer-template/index.mjs +19 -33
- package/components/form-item-renderer-template/src/index.vue.d.ts +4 -3
- package/components/forms-provider/index.cjs +1 -99
- package/components/forms-provider/index.mjs +44 -73
- package/components/forms-provider/src/core.d.ts +3 -2
- package/components/forms-provider/src/index.vue.d.ts +5 -2
- package/components/forms-provider/src/segment.vue.d.ts +12 -8
- package/components/forms-provider/src/view.vue.d.ts +17 -3
- package/components/index.cjs +1 -399
- package/components/index2.cjs +1 -17
- package/components/information/index.cjs +1 -65
- package/components/information/index.mjs +28 -38
- package/components/information/src/ctx.d.ts +2 -2
- package/components/information/src/index.vue.d.ts +7 -6
- package/components/information-collection/index.cjs +1 -81
- package/components/information-collection/index.mjs +44 -48
- package/components/information-collection/src/ctx.d.ts +20 -50
- package/components/information-collection/src/index.vue.d.ts +49 -112
- package/components/information-renderer/index.cjs +1 -16
- package/components/information-renderer/index.mjs +9 -10
- package/components/information-tag/index.cjs +1 -101
- package/components/information-tag/index.mjs +44 -54
- package/components/information-tag/src/ctx.d.ts +5 -19
- package/components/information-tag/src/index.vue.d.ts +24 -51
- package/components/information-templates-default/index.cjs +1 -101
- package/components/information-templates-default/index.mjs +63 -73
- package/components/information-templates-default/src/index.vue.d.ts +2 -1
- package/components/input/index.cjs +1 -115
- package/components/input/index.mjs +60 -83
- package/components/input/src/ctx.d.ts +50 -151
- package/components/input/src/index.vue.d.ts +389 -947
- package/components/input-array/index.cjs +1 -310
- package/components/input-array/index.mjs +114 -244
- package/components/input-array/src/ctx.d.ts +19 -49
- package/components/input-array/src/form-template.vue.d.ts +2 -901
- package/components/input-array/src/index.vue.d.ts +45 -731
- package/components/input-collection/index.cjs +1 -452
- package/components/input-collection/index.mjs +195 -355
- package/components/input-collection/src/core.vue.d.ts +59 -1019
- package/components/input-collection/src/ctx.d.ts +19 -49
- package/components/input-collection/src/index.vue.d.ts +47 -110
- package/components/input-file/index.cjs +1 -142
- package/components/input-file/index.mjs +68 -100
- package/components/input-file/src/ctx.d.ts +8 -29
- package/components/input-file/src/index.vue.d.ts +447 -76
- package/components/input-file/src/template.vue.d.ts +2 -124
- package/components/input-link/index.cjs +1 -167
- package/components/input-link/index.mjs +60 -83
- package/components/input-link/src/ctx.d.ts +48 -135
- package/components/input-link/src/index.vue.d.ts +835 -312
- package/components/input-number/index.cjs +1 -119
- package/components/input-number/index.mjs +73 -87
- package/components/input-number/src/ctx.d.ts +38 -131
- package/components/input-number/src/index.vue.d.ts +321 -682
- package/components/input-tag/index.cjs +1 -100
- package/components/input-tag/index.mjs +51 -78
- package/components/input-tag/src/ctx.d.ts +41 -143
- package/components/input-tag/src/index.vue.d.ts +322 -775
- package/components/isObject.cjs +1 -165
- package/components/monaco-editor/index.cjs +1 -83
- package/components/monaco-editor/index.mjs +40 -59
- package/components/monaco-editor/src/ctx.d.ts +19 -44
- package/components/monaco-editor/src/index.vue.d.ts +212 -111
- package/components/radio/index.cjs +1 -267
- package/components/radio/index.mjs +110 -209
- package/components/radio/src/ctx.d.ts +27 -91
- package/components/radio/src/index.vue.d.ts +299 -1279
- package/components/radio/src/option.vue.d.ts +28 -878
- package/components/radio/src/wraper.vue.d.ts +67 -198
- package/components/renderer-data/index.cjs +1 -41
- package/components/renderer-data/index.mjs +19 -26
- package/components/renderer-data/src/ctx.d.ts +1 -1
- package/components/renderer-data/src/index.vue.d.ts +5 -4
- package/components/select/index.cjs +1 -311
- package/components/select/index.mjs +156 -214
- package/components/select/src/core.vue.d.ts +446 -1028
- package/components/select/src/ctx.d.ts +60 -215
- package/components/select/src/index.vue.d.ts +318 -593
- package/components/select/src/options.vue.d.ts +4 -3
- package/components/slider/index.cjs +1 -88
- package/components/slider/index.mjs +41 -70
- package/components/slider/src/ctx.d.ts +63 -174
- package/components/slider/src/index.vue.d.ts +154 -419
- package/components/style.css +1 -0
- package/components/switch/index.cjs +1 -88
- package/components/switch/index.mjs +37 -69
- package/components/switch/src/ctx.d.ts +30 -109
- package/components/switch/src/index.vue.d.ts +90 -697
- package/components/switch/src/types.d.ts +2 -2
- package/components/tables-select/index.cjs +1 -263
- package/components/tables-select/index.mjs +101 -172
- package/components/tables-select/src/ctx.d.ts +68 -99
- package/components/tables-select/src/index.vue.d.ts +233 -4988
- package/components/template-instances-provider/index.cjs +1 -31
- package/components/template-instances-provider/index.mjs +18 -22
- package/components/template-instances-provider/src/index.vue.d.ts +5 -4
- package/components/templates-default/index.cjs +1 -235
- package/components/templates-default/index.mjs +152 -211
- package/components/templates-default/src/ctx.d.ts +2 -2
- package/components/templates-default/src/index.vue.d.ts +7337 -145
- package/components/templates-element-plus/index.cjs +1 -112
- package/components/templates-element-plus/index.mjs +49 -91
- package/components/templates-element-plus/src/ctx.d.ts +1 -1
- package/components/templates-element-plus/src/index.vue.d.ts +59 -251
- package/components/templates-esri/index.cjs +1 -65
- package/components/templates-esri/index.mjs +29 -39
- package/components/templates-esri/src/ctx.d.ts +1 -1
- package/components/templates-esri/src/index.vue.d.ts +2184 -25
- package/components/templates-layout/index.cjs +1 -137
- package/components/templates-layout/index.mjs +78 -116
- package/components/templates-layout/src/ctx.d.ts +1 -1
- package/components/templates-layout/src/index.vue.d.ts +73 -404
- package/components/templates-variant/index.cjs +1 -70
- package/components/templates-variant/index.mjs +33 -43
- package/components/templates-variant/src/ctx.d.ts +1 -1
- package/components/templates-variant/src/index.vue.d.ts +1272 -25
- package/components/time-picker/index.cjs +1 -104
- package/components/time-picker/index.mjs +57 -87
- package/components/time-picker/src/ctx.d.ts +130 -212
- package/components/time-picker/src/index.vue.d.ts +283 -1371
- package/components/upload/index.cjs +1 -663
- package/components/upload/index.mjs +343 -537
- package/components/upload/src/ctx.d.ts +106 -191
- package/components/upload/src/file.vue.d.ts +168 -745
- package/components/upload/src/index.vue.d.ts +647 -1888
- package/components/upload/src/types.d.ts +1 -1
- package/components/upload/src/wraper.vue.d.ts +233 -407
- package/components/upload-plus/index.cjs +21 -18673
- package/components/upload-plus/index.mjs +4566 -18366
- package/components/upload-plus/src/api.d.ts +1 -1
- package/components/upload-plus/src/ctx.d.ts +21 -51
- package/components/upload-plus/src/index.vue.d.ts +53 -1657
- package/components/use-watch.cjs +1 -0
- package/components/van-cascader/index.cjs +1 -125
- package/components/van-cascader/index.mjs +51 -96
- package/components/van-cascader/src/ctx.d.ts +143 -203
- package/components/van-cascader/src/index.vue.d.ts +332 -988
- package/components/var-datetime-picker/index.cjs +1 -333
- package/components/var-datetime-picker/index.mjs +173 -254
- package/components/var-datetime-picker/src/ctx.d.ts +18 -48
- package/components/var-datetime-picker/src/index.vue.d.ts +628 -1090
- package/components/vditor/index.cjs +1 -86
- package/components/vditor/index.mjs +40 -66
- package/components/vditor/src/ctx.d.ts +15 -45
- package/components/vditor/src/index.vue.d.ts +195 -120
- package/composables/element-plus/index.cjs +1 -23
- package/composables/element-plus/index.mjs +14 -18
- package/composables/index.cjs +1 -161
- package/composables/index.d.ts +1 -0
- package/composables/index.mjs +100 -135
- package/composables/useForm.d.ts +2 -2
- package/composables/useRtl.d.ts +18 -0
- package/composables/useTemplateInstances.d.ts +3 -3
- package/index.css +1 -562
- package/index.d.ts +0 -3
- package/index.esm.js +23 -48
- package/locale/index.cjs +1 -102
- package/locale/index.mjs +34 -34
- package/locale/lang/index.cjs +1 -2
- package/locale/lang/index.d.ts +1 -0
- package/package.json +14 -85
- package/shared/const/index.cjs +1 -59
- package/shared/const/index.d.ts +1 -1
- package/shared/const/index.mjs +18 -20
- package/shared/element-plus/ctx.d.ts +40 -37
- package/shared/element-plus/index.cjs +1 -211
- package/shared/element-plus/index.mjs +93 -161
- package/shared/element-plus/instances.d.ts +224 -321
- package/shared/form/index.cjs +1 -33
- package/shared/form/index.mjs +23 -25
- package/shared/helper/index.cjs +1 -11
- package/shared/helper/index.mjs +7 -8
- package/shared/index.cjs +1 -8
- package/shared/index.mjs +5 -1
- package/shared/infer-prop/index.cjs +1 -36
- package/shared/infer-prop/index.mjs +22 -28
- package/shared/progress-it/index.cjs +1 -42
- package/shared/progress-it/index.mjs +15 -31
- package/shared/rules/index.cjs +1 -56
- package/shared/rules/index.mjs +19 -18
- package/shared/types/form/index.cjs +1 -2
- package/shared/types/index.cjs +1 -2
- package/shared/types/source/index.cjs +1 -2
- package/shared/types/source-manager/index.cjs +1 -2
- package/shared/upload/index.cjs +1 -774
- package/shared/upload/index.mjs +180 -764
- package/component.d.ts +0 -3
- package/components/_plugin-vue_export-helper.mjs +0 -9
- package/components/card-input-collection/index.css +0 -21
- package/components/cascader/index.css +0 -9
- package/components/checkbox/index.css +0 -30
- package/components/cloneDeep.mjs +0 -2104
- package/components/date-picker-range/index.css +0 -18
- package/components/dialog-input-collection/index.css +0 -21
- package/components/download-plus/index.css +0 -68
- package/components/editable-text/index.css +0 -9
- package/components/esri-input-geojson/index.css +0 -32
- package/components/fieldset/index.css +0 -5
- package/components/form-item/index.css +0 -35
- package/components/index.mjs +0 -378
- package/components/index2.mjs +0 -14
- package/components/information-tag/index.css +0 -6
- package/components/information-templates-default/index.css +0 -16
- package/components/input-array/index.css +0 -14
- package/components/input-collection/index.css +0 -20
- package/components/input-link/index.css +0 -4
- package/components/input-number/index.css +0 -13
- package/components/isObject.mjs +0 -158
- package/components/monaco-editor/index.css +0 -4
- package/components/radio/index.css +0 -40
- package/components/select/index.css +0 -15
- package/components/switch/index.css +0 -10
- package/components/tables-select/index.css +0 -3
- package/components/templates-layout/index.css +0 -3
- package/components/upload/index.css +0 -34
- package/components/upload-plus/index.css +0 -84
- package/components/van-cascader/index.css +0 -6
- package/components/var-datetime-picker/index.css +0 -17
- package/defaults.d.ts +0 -5
package/shared/upload/index.cjs
CHANGED
|
@@ -1,774 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function getDefaultExportFromCjs (x) {
|
|
4
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
var sparkMd5 = {exports: {}};
|
|
8
|
-
|
|
9
|
-
(function (module, exports) {
|
|
10
|
-
(function (factory) {
|
|
11
|
-
{
|
|
12
|
-
// Node/CommonJS
|
|
13
|
-
module.exports = factory();
|
|
14
|
-
}
|
|
15
|
-
}(function (undefined$1) {
|
|
16
|
-
|
|
17
|
-
/*
|
|
18
|
-
* Fastest md5 implementation around (JKM md5).
|
|
19
|
-
* Credits: Joseph Myers
|
|
20
|
-
*
|
|
21
|
-
* @see http://www.myersdaily.org/joseph/javascript/md5-text.html
|
|
22
|
-
* @see http://jsperf.com/md5-shootout/7
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/* this function is much faster,
|
|
26
|
-
so if possible we use it. Some IEs
|
|
27
|
-
are the only ones I know of that
|
|
28
|
-
need the idiotic second function,
|
|
29
|
-
generated by an if clause. */
|
|
30
|
-
var hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
|
|
31
|
-
|
|
32
|
-
function md5cycle(x, k) {
|
|
33
|
-
var a = x[0],
|
|
34
|
-
b = x[1],
|
|
35
|
-
c = x[2],
|
|
36
|
-
d = x[3];
|
|
37
|
-
|
|
38
|
-
a += (b & c | ~b & d) + k[0] - 680876936 | 0;
|
|
39
|
-
a = (a << 7 | a >>> 25) + b | 0;
|
|
40
|
-
d += (a & b | ~a & c) + k[1] - 389564586 | 0;
|
|
41
|
-
d = (d << 12 | d >>> 20) + a | 0;
|
|
42
|
-
c += (d & a | ~d & b) + k[2] + 606105819 | 0;
|
|
43
|
-
c = (c << 17 | c >>> 15) + d | 0;
|
|
44
|
-
b += (c & d | ~c & a) + k[3] - 1044525330 | 0;
|
|
45
|
-
b = (b << 22 | b >>> 10) + c | 0;
|
|
46
|
-
a += (b & c | ~b & d) + k[4] - 176418897 | 0;
|
|
47
|
-
a = (a << 7 | a >>> 25) + b | 0;
|
|
48
|
-
d += (a & b | ~a & c) + k[5] + 1200080426 | 0;
|
|
49
|
-
d = (d << 12 | d >>> 20) + a | 0;
|
|
50
|
-
c += (d & a | ~d & b) + k[6] - 1473231341 | 0;
|
|
51
|
-
c = (c << 17 | c >>> 15) + d | 0;
|
|
52
|
-
b += (c & d | ~c & a) + k[7] - 45705983 | 0;
|
|
53
|
-
b = (b << 22 | b >>> 10) + c | 0;
|
|
54
|
-
a += (b & c | ~b & d) + k[8] + 1770035416 | 0;
|
|
55
|
-
a = (a << 7 | a >>> 25) + b | 0;
|
|
56
|
-
d += (a & b | ~a & c) + k[9] - 1958414417 | 0;
|
|
57
|
-
d = (d << 12 | d >>> 20) + a | 0;
|
|
58
|
-
c += (d & a | ~d & b) + k[10] - 42063 | 0;
|
|
59
|
-
c = (c << 17 | c >>> 15) + d | 0;
|
|
60
|
-
b += (c & d | ~c & a) + k[11] - 1990404162 | 0;
|
|
61
|
-
b = (b << 22 | b >>> 10) + c | 0;
|
|
62
|
-
a += (b & c | ~b & d) + k[12] + 1804603682 | 0;
|
|
63
|
-
a = (a << 7 | a >>> 25) + b | 0;
|
|
64
|
-
d += (a & b | ~a & c) + k[13] - 40341101 | 0;
|
|
65
|
-
d = (d << 12 | d >>> 20) + a | 0;
|
|
66
|
-
c += (d & a | ~d & b) + k[14] - 1502002290 | 0;
|
|
67
|
-
c = (c << 17 | c >>> 15) + d | 0;
|
|
68
|
-
b += (c & d | ~c & a) + k[15] + 1236535329 | 0;
|
|
69
|
-
b = (b << 22 | b >>> 10) + c | 0;
|
|
70
|
-
|
|
71
|
-
a += (b & d | c & ~d) + k[1] - 165796510 | 0;
|
|
72
|
-
a = (a << 5 | a >>> 27) + b | 0;
|
|
73
|
-
d += (a & c | b & ~c) + k[6] - 1069501632 | 0;
|
|
74
|
-
d = (d << 9 | d >>> 23) + a | 0;
|
|
75
|
-
c += (d & b | a & ~b) + k[11] + 643717713 | 0;
|
|
76
|
-
c = (c << 14 | c >>> 18) + d | 0;
|
|
77
|
-
b += (c & a | d & ~a) + k[0] - 373897302 | 0;
|
|
78
|
-
b = (b << 20 | b >>> 12) + c | 0;
|
|
79
|
-
a += (b & d | c & ~d) + k[5] - 701558691 | 0;
|
|
80
|
-
a = (a << 5 | a >>> 27) + b | 0;
|
|
81
|
-
d += (a & c | b & ~c) + k[10] + 38016083 | 0;
|
|
82
|
-
d = (d << 9 | d >>> 23) + a | 0;
|
|
83
|
-
c += (d & b | a & ~b) + k[15] - 660478335 | 0;
|
|
84
|
-
c = (c << 14 | c >>> 18) + d | 0;
|
|
85
|
-
b += (c & a | d & ~a) + k[4] - 405537848 | 0;
|
|
86
|
-
b = (b << 20 | b >>> 12) + c | 0;
|
|
87
|
-
a += (b & d | c & ~d) + k[9] + 568446438 | 0;
|
|
88
|
-
a = (a << 5 | a >>> 27) + b | 0;
|
|
89
|
-
d += (a & c | b & ~c) + k[14] - 1019803690 | 0;
|
|
90
|
-
d = (d << 9 | d >>> 23) + a | 0;
|
|
91
|
-
c += (d & b | a & ~b) + k[3] - 187363961 | 0;
|
|
92
|
-
c = (c << 14 | c >>> 18) + d | 0;
|
|
93
|
-
b += (c & a | d & ~a) + k[8] + 1163531501 | 0;
|
|
94
|
-
b = (b << 20 | b >>> 12) + c | 0;
|
|
95
|
-
a += (b & d | c & ~d) + k[13] - 1444681467 | 0;
|
|
96
|
-
a = (a << 5 | a >>> 27) + b | 0;
|
|
97
|
-
d += (a & c | b & ~c) + k[2] - 51403784 | 0;
|
|
98
|
-
d = (d << 9 | d >>> 23) + a | 0;
|
|
99
|
-
c += (d & b | a & ~b) + k[7] + 1735328473 | 0;
|
|
100
|
-
c = (c << 14 | c >>> 18) + d | 0;
|
|
101
|
-
b += (c & a | d & ~a) + k[12] - 1926607734 | 0;
|
|
102
|
-
b = (b << 20 | b >>> 12) + c | 0;
|
|
103
|
-
|
|
104
|
-
a += (b ^ c ^ d) + k[5] - 378558 | 0;
|
|
105
|
-
a = (a << 4 | a >>> 28) + b | 0;
|
|
106
|
-
d += (a ^ b ^ c) + k[8] - 2022574463 | 0;
|
|
107
|
-
d = (d << 11 | d >>> 21) + a | 0;
|
|
108
|
-
c += (d ^ a ^ b) + k[11] + 1839030562 | 0;
|
|
109
|
-
c = (c << 16 | c >>> 16) + d | 0;
|
|
110
|
-
b += (c ^ d ^ a) + k[14] - 35309556 | 0;
|
|
111
|
-
b = (b << 23 | b >>> 9) + c | 0;
|
|
112
|
-
a += (b ^ c ^ d) + k[1] - 1530992060 | 0;
|
|
113
|
-
a = (a << 4 | a >>> 28) + b | 0;
|
|
114
|
-
d += (a ^ b ^ c) + k[4] + 1272893353 | 0;
|
|
115
|
-
d = (d << 11 | d >>> 21) + a | 0;
|
|
116
|
-
c += (d ^ a ^ b) + k[7] - 155497632 | 0;
|
|
117
|
-
c = (c << 16 | c >>> 16) + d | 0;
|
|
118
|
-
b += (c ^ d ^ a) + k[10] - 1094730640 | 0;
|
|
119
|
-
b = (b << 23 | b >>> 9) + c | 0;
|
|
120
|
-
a += (b ^ c ^ d) + k[13] + 681279174 | 0;
|
|
121
|
-
a = (a << 4 | a >>> 28) + b | 0;
|
|
122
|
-
d += (a ^ b ^ c) + k[0] - 358537222 | 0;
|
|
123
|
-
d = (d << 11 | d >>> 21) + a | 0;
|
|
124
|
-
c += (d ^ a ^ b) + k[3] - 722521979 | 0;
|
|
125
|
-
c = (c << 16 | c >>> 16) + d | 0;
|
|
126
|
-
b += (c ^ d ^ a) + k[6] + 76029189 | 0;
|
|
127
|
-
b = (b << 23 | b >>> 9) + c | 0;
|
|
128
|
-
a += (b ^ c ^ d) + k[9] - 640364487 | 0;
|
|
129
|
-
a = (a << 4 | a >>> 28) + b | 0;
|
|
130
|
-
d += (a ^ b ^ c) + k[12] - 421815835 | 0;
|
|
131
|
-
d = (d << 11 | d >>> 21) + a | 0;
|
|
132
|
-
c += (d ^ a ^ b) + k[15] + 530742520 | 0;
|
|
133
|
-
c = (c << 16 | c >>> 16) + d | 0;
|
|
134
|
-
b += (c ^ d ^ a) + k[2] - 995338651 | 0;
|
|
135
|
-
b = (b << 23 | b >>> 9) + c | 0;
|
|
136
|
-
|
|
137
|
-
a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;
|
|
138
|
-
a = (a << 6 | a >>> 26) + b | 0;
|
|
139
|
-
d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;
|
|
140
|
-
d = (d << 10 | d >>> 22) + a | 0;
|
|
141
|
-
c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;
|
|
142
|
-
c = (c << 15 | c >>> 17) + d | 0;
|
|
143
|
-
b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;
|
|
144
|
-
b = (b << 21 |b >>> 11) + c | 0;
|
|
145
|
-
a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;
|
|
146
|
-
a = (a << 6 | a >>> 26) + b | 0;
|
|
147
|
-
d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;
|
|
148
|
-
d = (d << 10 | d >>> 22) + a | 0;
|
|
149
|
-
c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;
|
|
150
|
-
c = (c << 15 | c >>> 17) + d | 0;
|
|
151
|
-
b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;
|
|
152
|
-
b = (b << 21 |b >>> 11) + c | 0;
|
|
153
|
-
a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;
|
|
154
|
-
a = (a << 6 | a >>> 26) + b | 0;
|
|
155
|
-
d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;
|
|
156
|
-
d = (d << 10 | d >>> 22) + a | 0;
|
|
157
|
-
c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;
|
|
158
|
-
c = (c << 15 | c >>> 17) + d | 0;
|
|
159
|
-
b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;
|
|
160
|
-
b = (b << 21 |b >>> 11) + c | 0;
|
|
161
|
-
a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;
|
|
162
|
-
a = (a << 6 | a >>> 26) + b | 0;
|
|
163
|
-
d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;
|
|
164
|
-
d = (d << 10 | d >>> 22) + a | 0;
|
|
165
|
-
c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;
|
|
166
|
-
c = (c << 15 | c >>> 17) + d | 0;
|
|
167
|
-
b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;
|
|
168
|
-
b = (b << 21 | b >>> 11) + c | 0;
|
|
169
|
-
|
|
170
|
-
x[0] = a + x[0] | 0;
|
|
171
|
-
x[1] = b + x[1] | 0;
|
|
172
|
-
x[2] = c + x[2] | 0;
|
|
173
|
-
x[3] = d + x[3] | 0;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function md5blk(s) {
|
|
177
|
-
var md5blks = [],
|
|
178
|
-
i; /* Andy King said do it this way. */
|
|
179
|
-
|
|
180
|
-
for (i = 0; i < 64; i += 4) {
|
|
181
|
-
md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
|
|
182
|
-
}
|
|
183
|
-
return md5blks;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
function md5blk_array(a) {
|
|
187
|
-
var md5blks = [],
|
|
188
|
-
i; /* Andy King said do it this way. */
|
|
189
|
-
|
|
190
|
-
for (i = 0; i < 64; i += 4) {
|
|
191
|
-
md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);
|
|
192
|
-
}
|
|
193
|
-
return md5blks;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
function md51(s) {
|
|
197
|
-
var n = s.length,
|
|
198
|
-
state = [1732584193, -271733879, -1732584194, 271733878],
|
|
199
|
-
i,
|
|
200
|
-
length,
|
|
201
|
-
tail,
|
|
202
|
-
tmp,
|
|
203
|
-
lo,
|
|
204
|
-
hi;
|
|
205
|
-
|
|
206
|
-
for (i = 64; i <= n; i += 64) {
|
|
207
|
-
md5cycle(state, md5blk(s.substring(i - 64, i)));
|
|
208
|
-
}
|
|
209
|
-
s = s.substring(i - 64);
|
|
210
|
-
length = s.length;
|
|
211
|
-
tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
212
|
-
for (i = 0; i < length; i += 1) {
|
|
213
|
-
tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3);
|
|
214
|
-
}
|
|
215
|
-
tail[i >> 2] |= 0x80 << ((i % 4) << 3);
|
|
216
|
-
if (i > 55) {
|
|
217
|
-
md5cycle(state, tail);
|
|
218
|
-
for (i = 0; i < 16; i += 1) {
|
|
219
|
-
tail[i] = 0;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// Beware that the final length might not fit in 32 bits so we take care of that
|
|
224
|
-
tmp = n * 8;
|
|
225
|
-
tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
|
|
226
|
-
lo = parseInt(tmp[2], 16);
|
|
227
|
-
hi = parseInt(tmp[1], 16) || 0;
|
|
228
|
-
|
|
229
|
-
tail[14] = lo;
|
|
230
|
-
tail[15] = hi;
|
|
231
|
-
|
|
232
|
-
md5cycle(state, tail);
|
|
233
|
-
return state;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
function md51_array(a) {
|
|
237
|
-
var n = a.length,
|
|
238
|
-
state = [1732584193, -271733879, -1732584194, 271733878],
|
|
239
|
-
i,
|
|
240
|
-
length,
|
|
241
|
-
tail,
|
|
242
|
-
tmp,
|
|
243
|
-
lo,
|
|
244
|
-
hi;
|
|
245
|
-
|
|
246
|
-
for (i = 64; i <= n; i += 64) {
|
|
247
|
-
md5cycle(state, md5blk_array(a.subarray(i - 64, i)));
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// Not sure if it is a bug, however IE10 will always produce a sub array of length 1
|
|
251
|
-
// containing the last element of the parent array if the sub array specified starts
|
|
252
|
-
// beyond the length of the parent array - weird.
|
|
253
|
-
// https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue
|
|
254
|
-
a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0);
|
|
255
|
-
|
|
256
|
-
length = a.length;
|
|
257
|
-
tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
258
|
-
for (i = 0; i < length; i += 1) {
|
|
259
|
-
tail[i >> 2] |= a[i] << ((i % 4) << 3);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
tail[i >> 2] |= 0x80 << ((i % 4) << 3);
|
|
263
|
-
if (i > 55) {
|
|
264
|
-
md5cycle(state, tail);
|
|
265
|
-
for (i = 0; i < 16; i += 1) {
|
|
266
|
-
tail[i] = 0;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// Beware that the final length might not fit in 32 bits so we take care of that
|
|
271
|
-
tmp = n * 8;
|
|
272
|
-
tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
|
|
273
|
-
lo = parseInt(tmp[2], 16);
|
|
274
|
-
hi = parseInt(tmp[1], 16) || 0;
|
|
275
|
-
|
|
276
|
-
tail[14] = lo;
|
|
277
|
-
tail[15] = hi;
|
|
278
|
-
|
|
279
|
-
md5cycle(state, tail);
|
|
280
|
-
|
|
281
|
-
return state;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
function rhex(n) {
|
|
285
|
-
var s = '',
|
|
286
|
-
j;
|
|
287
|
-
for (j = 0; j < 4; j += 1) {
|
|
288
|
-
s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F];
|
|
289
|
-
}
|
|
290
|
-
return s;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
function hex(x) {
|
|
294
|
-
var i;
|
|
295
|
-
for (i = 0; i < x.length; i += 1) {
|
|
296
|
-
x[i] = rhex(x[i]);
|
|
297
|
-
}
|
|
298
|
-
return x.join('');
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
// In some cases the fast add32 function cannot be used..
|
|
302
|
-
if (hex(md51('hello')) !== '5d41402abc4b2a76b9719d911017c592') ;
|
|
303
|
-
|
|
304
|
-
// ---------------------------------------------------
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* ArrayBuffer slice polyfill.
|
|
308
|
-
*
|
|
309
|
-
* @see https://github.com/ttaubert/node-arraybuffer-slice
|
|
310
|
-
*/
|
|
311
|
-
|
|
312
|
-
if (typeof ArrayBuffer !== 'undefined' && !ArrayBuffer.prototype.slice) {
|
|
313
|
-
(function () {
|
|
314
|
-
function clamp(val, length) {
|
|
315
|
-
val = (val | 0) || 0;
|
|
316
|
-
|
|
317
|
-
if (val < 0) {
|
|
318
|
-
return Math.max(val + length, 0);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
return Math.min(val, length);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
ArrayBuffer.prototype.slice = function (from, to) {
|
|
325
|
-
var length = this.byteLength,
|
|
326
|
-
begin = clamp(from, length),
|
|
327
|
-
end = length,
|
|
328
|
-
num,
|
|
329
|
-
target,
|
|
330
|
-
targetArray,
|
|
331
|
-
sourceArray;
|
|
332
|
-
|
|
333
|
-
if (to !== undefined$1) {
|
|
334
|
-
end = clamp(to, length);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
if (begin > end) {
|
|
338
|
-
return new ArrayBuffer(0);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
num = end - begin;
|
|
342
|
-
target = new ArrayBuffer(num);
|
|
343
|
-
targetArray = new Uint8Array(target);
|
|
344
|
-
|
|
345
|
-
sourceArray = new Uint8Array(this, begin, num);
|
|
346
|
-
targetArray.set(sourceArray);
|
|
347
|
-
|
|
348
|
-
return target;
|
|
349
|
-
};
|
|
350
|
-
})();
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
// ---------------------------------------------------
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* Helpers.
|
|
357
|
-
*/
|
|
358
|
-
|
|
359
|
-
function toUtf8(str) {
|
|
360
|
-
if (/[\u0080-\uFFFF]/.test(str)) {
|
|
361
|
-
str = unescape(encodeURIComponent(str));
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
return str;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
function utf8Str2ArrayBuffer(str, returnUInt8Array) {
|
|
368
|
-
var length = str.length,
|
|
369
|
-
buff = new ArrayBuffer(length),
|
|
370
|
-
arr = new Uint8Array(buff),
|
|
371
|
-
i;
|
|
372
|
-
|
|
373
|
-
for (i = 0; i < length; i += 1) {
|
|
374
|
-
arr[i] = str.charCodeAt(i);
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
return returnUInt8Array ? arr : buff;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
function arrayBuffer2Utf8Str(buff) {
|
|
381
|
-
return String.fromCharCode.apply(null, new Uint8Array(buff));
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
function concatenateArrayBuffers(first, second, returnUInt8Array) {
|
|
385
|
-
var result = new Uint8Array(first.byteLength + second.byteLength);
|
|
386
|
-
|
|
387
|
-
result.set(new Uint8Array(first));
|
|
388
|
-
result.set(new Uint8Array(second), first.byteLength);
|
|
389
|
-
|
|
390
|
-
return result ;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
function hexToBinaryString(hex) {
|
|
394
|
-
var bytes = [],
|
|
395
|
-
length = hex.length,
|
|
396
|
-
x;
|
|
397
|
-
|
|
398
|
-
for (x = 0; x < length - 1; x += 2) {
|
|
399
|
-
bytes.push(parseInt(hex.substr(x, 2), 16));
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
return String.fromCharCode.apply(String, bytes);
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
// ---------------------------------------------------
|
|
406
|
-
|
|
407
|
-
/**
|
|
408
|
-
* SparkMD5 OOP implementation.
|
|
409
|
-
*
|
|
410
|
-
* Use this class to perform an incremental md5, otherwise use the
|
|
411
|
-
* static methods instead.
|
|
412
|
-
*/
|
|
413
|
-
|
|
414
|
-
function SparkMD5() {
|
|
415
|
-
// call reset to init the instance
|
|
416
|
-
this.reset();
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
/**
|
|
420
|
-
* Appends a string.
|
|
421
|
-
* A conversion will be applied if an utf8 string is detected.
|
|
422
|
-
*
|
|
423
|
-
* @param {String} str The string to be appended
|
|
424
|
-
*
|
|
425
|
-
* @return {SparkMD5} The instance itself
|
|
426
|
-
*/
|
|
427
|
-
SparkMD5.prototype.append = function (str) {
|
|
428
|
-
// Converts the string to utf8 bytes if necessary
|
|
429
|
-
// Then append as binary
|
|
430
|
-
this.appendBinary(toUtf8(str));
|
|
431
|
-
|
|
432
|
-
return this;
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* Appends a binary string.
|
|
437
|
-
*
|
|
438
|
-
* @param {String} contents The binary string to be appended
|
|
439
|
-
*
|
|
440
|
-
* @return {SparkMD5} The instance itself
|
|
441
|
-
*/
|
|
442
|
-
SparkMD5.prototype.appendBinary = function (contents) {
|
|
443
|
-
this._buff += contents;
|
|
444
|
-
this._length += contents.length;
|
|
445
|
-
|
|
446
|
-
var length = this._buff.length,
|
|
447
|
-
i;
|
|
448
|
-
|
|
449
|
-
for (i = 64; i <= length; i += 64) {
|
|
450
|
-
md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i)));
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
this._buff = this._buff.substring(i - 64);
|
|
454
|
-
|
|
455
|
-
return this;
|
|
456
|
-
};
|
|
457
|
-
|
|
458
|
-
/**
|
|
459
|
-
* Finishes the incremental computation, reseting the internal state and
|
|
460
|
-
* returning the result.
|
|
461
|
-
*
|
|
462
|
-
* @param {Boolean} raw True to get the raw string, false to get the hex string
|
|
463
|
-
*
|
|
464
|
-
* @return {String} The result
|
|
465
|
-
*/
|
|
466
|
-
SparkMD5.prototype.end = function (raw) {
|
|
467
|
-
var buff = this._buff,
|
|
468
|
-
length = buff.length,
|
|
469
|
-
i,
|
|
470
|
-
tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
471
|
-
ret;
|
|
472
|
-
|
|
473
|
-
for (i = 0; i < length; i += 1) {
|
|
474
|
-
tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
this._finish(tail, length);
|
|
478
|
-
ret = hex(this._hash);
|
|
479
|
-
|
|
480
|
-
if (raw) {
|
|
481
|
-
ret = hexToBinaryString(ret);
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
this.reset();
|
|
485
|
-
|
|
486
|
-
return ret;
|
|
487
|
-
};
|
|
488
|
-
|
|
489
|
-
/**
|
|
490
|
-
* Resets the internal state of the computation.
|
|
491
|
-
*
|
|
492
|
-
* @return {SparkMD5} The instance itself
|
|
493
|
-
*/
|
|
494
|
-
SparkMD5.prototype.reset = function () {
|
|
495
|
-
this._buff = '';
|
|
496
|
-
this._length = 0;
|
|
497
|
-
this._hash = [1732584193, -271733879, -1732584194, 271733878];
|
|
498
|
-
|
|
499
|
-
return this;
|
|
500
|
-
};
|
|
501
|
-
|
|
502
|
-
/**
|
|
503
|
-
* Gets the internal state of the computation.
|
|
504
|
-
*
|
|
505
|
-
* @return {Object} The state
|
|
506
|
-
*/
|
|
507
|
-
SparkMD5.prototype.getState = function () {
|
|
508
|
-
return {
|
|
509
|
-
buff: this._buff,
|
|
510
|
-
length: this._length,
|
|
511
|
-
hash: this._hash.slice()
|
|
512
|
-
};
|
|
513
|
-
};
|
|
514
|
-
|
|
515
|
-
/**
|
|
516
|
-
* Gets the internal state of the computation.
|
|
517
|
-
*
|
|
518
|
-
* @param {Object} state The state
|
|
519
|
-
*
|
|
520
|
-
* @return {SparkMD5} The instance itself
|
|
521
|
-
*/
|
|
522
|
-
SparkMD5.prototype.setState = function (state) {
|
|
523
|
-
this._buff = state.buff;
|
|
524
|
-
this._length = state.length;
|
|
525
|
-
this._hash = state.hash;
|
|
526
|
-
|
|
527
|
-
return this;
|
|
528
|
-
};
|
|
529
|
-
|
|
530
|
-
/**
|
|
531
|
-
* Releases memory used by the incremental buffer and other additional
|
|
532
|
-
* resources. If you plan to use the instance again, use reset instead.
|
|
533
|
-
*/
|
|
534
|
-
SparkMD5.prototype.destroy = function () {
|
|
535
|
-
delete this._hash;
|
|
536
|
-
delete this._buff;
|
|
537
|
-
delete this._length;
|
|
538
|
-
};
|
|
539
|
-
|
|
540
|
-
/**
|
|
541
|
-
* Finish the final calculation based on the tail.
|
|
542
|
-
*
|
|
543
|
-
* @param {Array} tail The tail (will be modified)
|
|
544
|
-
* @param {Number} length The length of the remaining buffer
|
|
545
|
-
*/
|
|
546
|
-
SparkMD5.prototype._finish = function (tail, length) {
|
|
547
|
-
var i = length,
|
|
548
|
-
tmp,
|
|
549
|
-
lo,
|
|
550
|
-
hi;
|
|
551
|
-
|
|
552
|
-
tail[i >> 2] |= 0x80 << ((i % 4) << 3);
|
|
553
|
-
if (i > 55) {
|
|
554
|
-
md5cycle(this._hash, tail);
|
|
555
|
-
for (i = 0; i < 16; i += 1) {
|
|
556
|
-
tail[i] = 0;
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
// Do the final computation based on the tail and length
|
|
561
|
-
// Beware that the final length may not fit in 32 bits so we take care of that
|
|
562
|
-
tmp = this._length * 8;
|
|
563
|
-
tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
|
|
564
|
-
lo = parseInt(tmp[2], 16);
|
|
565
|
-
hi = parseInt(tmp[1], 16) || 0;
|
|
566
|
-
|
|
567
|
-
tail[14] = lo;
|
|
568
|
-
tail[15] = hi;
|
|
569
|
-
md5cycle(this._hash, tail);
|
|
570
|
-
};
|
|
571
|
-
|
|
572
|
-
/**
|
|
573
|
-
* Performs the md5 hash on a string.
|
|
574
|
-
* A conversion will be applied if utf8 string is detected.
|
|
575
|
-
*
|
|
576
|
-
* @param {String} str The string
|
|
577
|
-
* @param {Boolean} [raw] True to get the raw string, false to get the hex string
|
|
578
|
-
*
|
|
579
|
-
* @return {String} The result
|
|
580
|
-
*/
|
|
581
|
-
SparkMD5.hash = function (str, raw) {
|
|
582
|
-
// Converts the string to utf8 bytes if necessary
|
|
583
|
-
// Then compute it using the binary function
|
|
584
|
-
return SparkMD5.hashBinary(toUtf8(str), raw);
|
|
585
|
-
};
|
|
586
|
-
|
|
587
|
-
/**
|
|
588
|
-
* Performs the md5 hash on a binary string.
|
|
589
|
-
*
|
|
590
|
-
* @param {String} content The binary string
|
|
591
|
-
* @param {Boolean} [raw] True to get the raw string, false to get the hex string
|
|
592
|
-
*
|
|
593
|
-
* @return {String} The result
|
|
594
|
-
*/
|
|
595
|
-
SparkMD5.hashBinary = function (content, raw) {
|
|
596
|
-
var hash = md51(content),
|
|
597
|
-
ret = hex(hash);
|
|
598
|
-
|
|
599
|
-
return raw ? hexToBinaryString(ret) : ret;
|
|
600
|
-
};
|
|
601
|
-
|
|
602
|
-
// ---------------------------------------------------
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
* SparkMD5 OOP implementation for array buffers.
|
|
606
|
-
*
|
|
607
|
-
* Use this class to perform an incremental md5 ONLY for array buffers.
|
|
608
|
-
*/
|
|
609
|
-
SparkMD5.ArrayBuffer = function () {
|
|
610
|
-
// call reset to init the instance
|
|
611
|
-
this.reset();
|
|
612
|
-
};
|
|
613
|
-
|
|
614
|
-
/**
|
|
615
|
-
* Appends an array buffer.
|
|
616
|
-
*
|
|
617
|
-
* @param {ArrayBuffer} arr The array to be appended
|
|
618
|
-
*
|
|
619
|
-
* @return {SparkMD5.ArrayBuffer} The instance itself
|
|
620
|
-
*/
|
|
621
|
-
SparkMD5.ArrayBuffer.prototype.append = function (arr) {
|
|
622
|
-
var buff = concatenateArrayBuffers(this._buff.buffer, arr),
|
|
623
|
-
length = buff.length,
|
|
624
|
-
i;
|
|
625
|
-
|
|
626
|
-
this._length += arr.byteLength;
|
|
627
|
-
|
|
628
|
-
for (i = 64; i <= length; i += 64) {
|
|
629
|
-
md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i)));
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
this._buff = (i - 64) < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0);
|
|
633
|
-
|
|
634
|
-
return this;
|
|
635
|
-
};
|
|
636
|
-
|
|
637
|
-
/**
|
|
638
|
-
* Finishes the incremental computation, reseting the internal state and
|
|
639
|
-
* returning the result.
|
|
640
|
-
*
|
|
641
|
-
* @param {Boolean} raw True to get the raw string, false to get the hex string
|
|
642
|
-
*
|
|
643
|
-
* @return {String} The result
|
|
644
|
-
*/
|
|
645
|
-
SparkMD5.ArrayBuffer.prototype.end = function (raw) {
|
|
646
|
-
var buff = this._buff,
|
|
647
|
-
length = buff.length,
|
|
648
|
-
tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
649
|
-
i,
|
|
650
|
-
ret;
|
|
651
|
-
|
|
652
|
-
for (i = 0; i < length; i += 1) {
|
|
653
|
-
tail[i >> 2] |= buff[i] << ((i % 4) << 3);
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
this._finish(tail, length);
|
|
657
|
-
ret = hex(this._hash);
|
|
658
|
-
|
|
659
|
-
if (raw) {
|
|
660
|
-
ret = hexToBinaryString(ret);
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
this.reset();
|
|
664
|
-
|
|
665
|
-
return ret;
|
|
666
|
-
};
|
|
667
|
-
|
|
668
|
-
/**
|
|
669
|
-
* Resets the internal state of the computation.
|
|
670
|
-
*
|
|
671
|
-
* @return {SparkMD5.ArrayBuffer} The instance itself
|
|
672
|
-
*/
|
|
673
|
-
SparkMD5.ArrayBuffer.prototype.reset = function () {
|
|
674
|
-
this._buff = new Uint8Array(0);
|
|
675
|
-
this._length = 0;
|
|
676
|
-
this._hash = [1732584193, -271733879, -1732584194, 271733878];
|
|
677
|
-
|
|
678
|
-
return this;
|
|
679
|
-
};
|
|
680
|
-
|
|
681
|
-
/**
|
|
682
|
-
* Gets the internal state of the computation.
|
|
683
|
-
*
|
|
684
|
-
* @return {Object} The state
|
|
685
|
-
*/
|
|
686
|
-
SparkMD5.ArrayBuffer.prototype.getState = function () {
|
|
687
|
-
var state = SparkMD5.prototype.getState.call(this);
|
|
688
|
-
|
|
689
|
-
// Convert buffer to a string
|
|
690
|
-
state.buff = arrayBuffer2Utf8Str(state.buff);
|
|
691
|
-
|
|
692
|
-
return state;
|
|
693
|
-
};
|
|
694
|
-
|
|
695
|
-
/**
|
|
696
|
-
* Gets the internal state of the computation.
|
|
697
|
-
*
|
|
698
|
-
* @param {Object} state The state
|
|
699
|
-
*
|
|
700
|
-
* @return {SparkMD5.ArrayBuffer} The instance itself
|
|
701
|
-
*/
|
|
702
|
-
SparkMD5.ArrayBuffer.prototype.setState = function (state) {
|
|
703
|
-
// Convert string to buffer
|
|
704
|
-
state.buff = utf8Str2ArrayBuffer(state.buff, true);
|
|
705
|
-
|
|
706
|
-
return SparkMD5.prototype.setState.call(this, state);
|
|
707
|
-
};
|
|
708
|
-
|
|
709
|
-
SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;
|
|
710
|
-
|
|
711
|
-
SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;
|
|
712
|
-
|
|
713
|
-
/**
|
|
714
|
-
* Performs the md5 hash on an array buffer.
|
|
715
|
-
*
|
|
716
|
-
* @param {ArrayBuffer} arr The array buffer
|
|
717
|
-
* @param {Boolean} [raw] True to get the raw string, false to get the hex one
|
|
718
|
-
*
|
|
719
|
-
* @return {String} The result
|
|
720
|
-
*/
|
|
721
|
-
SparkMD5.ArrayBuffer.hash = function (arr, raw) {
|
|
722
|
-
var hash = md51_array(new Uint8Array(arr)),
|
|
723
|
-
ret = hex(hash);
|
|
724
|
-
|
|
725
|
-
return raw ? hexToBinaryString(ret) : ret;
|
|
726
|
-
};
|
|
727
|
-
|
|
728
|
-
return SparkMD5;
|
|
729
|
-
}));
|
|
730
|
-
} (sparkMd5));
|
|
731
|
-
|
|
732
|
-
var sparkMd5Exports = sparkMd5.exports;
|
|
733
|
-
var SparkMD5 = /*@__PURE__*/getDefaultExportFromCjs(sparkMd5Exports);
|
|
734
|
-
|
|
735
|
-
function createFileChunk(file, size) {
|
|
736
|
-
const chunks = [];
|
|
737
|
-
let cur = 0;
|
|
738
|
-
const intSize = parseInt(size + "");
|
|
739
|
-
while (cur < file.size) {
|
|
740
|
-
chunks.push(file.slice(cur, cur + intSize));
|
|
741
|
-
cur += intSize;
|
|
742
|
-
}
|
|
743
|
-
return chunks;
|
|
744
|
-
}
|
|
745
|
-
function calculateFileHashSample(file) {
|
|
746
|
-
return new Promise((resolve) => {
|
|
747
|
-
const spark = new SparkMD5.ArrayBuffer();
|
|
748
|
-
const reader = new FileReader();
|
|
749
|
-
const size = file.size;
|
|
750
|
-
const offset = 2 * 1024 * 1024;
|
|
751
|
-
const chunks = [file.slice(0, offset)];
|
|
752
|
-
let cur = offset;
|
|
753
|
-
while (cur < size) {
|
|
754
|
-
if (cur + offset >= size) {
|
|
755
|
-
chunks.push(file.slice(cur, cur + offset));
|
|
756
|
-
} else {
|
|
757
|
-
const mid = cur + offset / 2;
|
|
758
|
-
const end = cur + offset;
|
|
759
|
-
chunks.push(file.slice(cur, cur + 2));
|
|
760
|
-
chunks.push(file.slice(mid, mid + 2));
|
|
761
|
-
chunks.push(file.slice(end - 2, end));
|
|
762
|
-
}
|
|
763
|
-
cur += offset;
|
|
764
|
-
}
|
|
765
|
-
reader.readAsArrayBuffer(new Blob(chunks));
|
|
766
|
-
reader.onload = (e) => {
|
|
767
|
-
spark.append(e.target?.result);
|
|
768
|
-
resolve(spark.end());
|
|
769
|
-
};
|
|
770
|
-
});
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
exports.calculateFileHashSample = calculateFileHashSample;
|
|
774
|
-
exports.createFileChunk = createFileChunk;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function I(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var v={exports:{}};(function(u,m){(function(y){u.exports=y()})(function(y){var c=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function o(f,i){var r=f[0],t=f[1],n=f[2],e=f[3];r+=(t&n|~t&e)+i[0]-680876936|0,r=(r<<7|r>>>25)+t|0,e+=(r&t|~r&n)+i[1]-389564586|0,e=(e<<12|e>>>20)+r|0,n+=(e&r|~e&t)+i[2]+606105819|0,n=(n<<17|n>>>15)+e|0,t+=(n&e|~n&r)+i[3]-1044525330|0,t=(t<<22|t>>>10)+n|0,r+=(t&n|~t&e)+i[4]-176418897|0,r=(r<<7|r>>>25)+t|0,e+=(r&t|~r&n)+i[5]+1200080426|0,e=(e<<12|e>>>20)+r|0,n+=(e&r|~e&t)+i[6]-1473231341|0,n=(n<<17|n>>>15)+e|0,t+=(n&e|~n&r)+i[7]-45705983|0,t=(t<<22|t>>>10)+n|0,r+=(t&n|~t&e)+i[8]+1770035416|0,r=(r<<7|r>>>25)+t|0,e+=(r&t|~r&n)+i[9]-1958414417|0,e=(e<<12|e>>>20)+r|0,n+=(e&r|~e&t)+i[10]-42063|0,n=(n<<17|n>>>15)+e|0,t+=(n&e|~n&r)+i[11]-1990404162|0,t=(t<<22|t>>>10)+n|0,r+=(t&n|~t&e)+i[12]+1804603682|0,r=(r<<7|r>>>25)+t|0,e+=(r&t|~r&n)+i[13]-40341101|0,e=(e<<12|e>>>20)+r|0,n+=(e&r|~e&t)+i[14]-1502002290|0,n=(n<<17|n>>>15)+e|0,t+=(n&e|~n&r)+i[15]+1236535329|0,t=(t<<22|t>>>10)+n|0,r+=(t&e|n&~e)+i[1]-165796510|0,r=(r<<5|r>>>27)+t|0,e+=(r&n|t&~n)+i[6]-1069501632|0,e=(e<<9|e>>>23)+r|0,n+=(e&t|r&~t)+i[11]+643717713|0,n=(n<<14|n>>>18)+e|0,t+=(n&r|e&~r)+i[0]-373897302|0,t=(t<<20|t>>>12)+n|0,r+=(t&e|n&~e)+i[5]-701558691|0,r=(r<<5|r>>>27)+t|0,e+=(r&n|t&~n)+i[10]+38016083|0,e=(e<<9|e>>>23)+r|0,n+=(e&t|r&~t)+i[15]-660478335|0,n=(n<<14|n>>>18)+e|0,t+=(n&r|e&~r)+i[4]-405537848|0,t=(t<<20|t>>>12)+n|0,r+=(t&e|n&~e)+i[9]+568446438|0,r=(r<<5|r>>>27)+t|0,e+=(r&n|t&~n)+i[14]-1019803690|0,e=(e<<9|e>>>23)+r|0,n+=(e&t|r&~t)+i[3]-187363961|0,n=(n<<14|n>>>18)+e|0,t+=(n&r|e&~r)+i[8]+1163531501|0,t=(t<<20|t>>>12)+n|0,r+=(t&e|n&~e)+i[13]-1444681467|0,r=(r<<5|r>>>27)+t|0,e+=(r&n|t&~n)+i[2]-51403784|0,e=(e<<9|e>>>23)+r|0,n+=(e&t|r&~t)+i[7]+1735328473|0,n=(n<<14|n>>>18)+e|0,t+=(n&r|e&~r)+i[12]-1926607734|0,t=(t<<20|t>>>12)+n|0,r+=(t^n^e)+i[5]-378558|0,r=(r<<4|r>>>28)+t|0,e+=(r^t^n)+i[8]-2022574463|0,e=(e<<11|e>>>21)+r|0,n+=(e^r^t)+i[11]+1839030562|0,n=(n<<16|n>>>16)+e|0,t+=(n^e^r)+i[14]-35309556|0,t=(t<<23|t>>>9)+n|0,r+=(t^n^e)+i[1]-1530992060|0,r=(r<<4|r>>>28)+t|0,e+=(r^t^n)+i[4]+1272893353|0,e=(e<<11|e>>>21)+r|0,n+=(e^r^t)+i[7]-155497632|0,n=(n<<16|n>>>16)+e|0,t+=(n^e^r)+i[10]-1094730640|0,t=(t<<23|t>>>9)+n|0,r+=(t^n^e)+i[13]+681279174|0,r=(r<<4|r>>>28)+t|0,e+=(r^t^n)+i[0]-358537222|0,e=(e<<11|e>>>21)+r|0,n+=(e^r^t)+i[3]-722521979|0,n=(n<<16|n>>>16)+e|0,t+=(n^e^r)+i[6]+76029189|0,t=(t<<23|t>>>9)+n|0,r+=(t^n^e)+i[9]-640364487|0,r=(r<<4|r>>>28)+t|0,e+=(r^t^n)+i[12]-421815835|0,e=(e<<11|e>>>21)+r|0,n+=(e^r^t)+i[15]+530742520|0,n=(n<<16|n>>>16)+e|0,t+=(n^e^r)+i[2]-995338651|0,t=(t<<23|t>>>9)+n|0,r+=(n^(t|~e))+i[0]-198630844|0,r=(r<<6|r>>>26)+t|0,e+=(t^(r|~n))+i[7]+1126891415|0,e=(e<<10|e>>>22)+r|0,n+=(r^(e|~t))+i[14]-1416354905|0,n=(n<<15|n>>>17)+e|0,t+=(e^(n|~r))+i[5]-57434055|0,t=(t<<21|t>>>11)+n|0,r+=(n^(t|~e))+i[12]+1700485571|0,r=(r<<6|r>>>26)+t|0,e+=(t^(r|~n))+i[3]-1894986606|0,e=(e<<10|e>>>22)+r|0,n+=(r^(e|~t))+i[10]-1051523|0,n=(n<<15|n>>>17)+e|0,t+=(e^(n|~r))+i[1]-2054922799|0,t=(t<<21|t>>>11)+n|0,r+=(n^(t|~e))+i[8]+1873313359|0,r=(r<<6|r>>>26)+t|0,e+=(t^(r|~n))+i[15]-30611744|0,e=(e<<10|e>>>22)+r|0,n+=(r^(e|~t))+i[6]-1560198380|0,n=(n<<15|n>>>17)+e|0,t+=(e^(n|~r))+i[13]+1309151649|0,t=(t<<21|t>>>11)+n|0,r+=(n^(t|~e))+i[4]-145523070|0,r=(r<<6|r>>>26)+t|0,e+=(t^(r|~n))+i[11]-1120210379|0,e=(e<<10|e>>>22)+r|0,n+=(r^(e|~t))+i[2]+718787259|0,n=(n<<15|n>>>17)+e|0,t+=(e^(n|~r))+i[9]-343485551|0,t=(t<<21|t>>>11)+n|0,f[0]=r+f[0]|0,f[1]=t+f[1]|0,f[2]=n+f[2]|0,f[3]=e+f[3]|0}function p(f){var i=[],r;for(r=0;r<64;r+=4)i[r>>2]=f.charCodeAt(r)+(f.charCodeAt(r+1)<<8)+(f.charCodeAt(r+2)<<16)+(f.charCodeAt(r+3)<<24);return i}function g(f){var i=[],r;for(r=0;r<64;r+=4)i[r>>2]=f[r]+(f[r+1]<<8)+(f[r+2]<<16)+(f[r+3]<<24);return i}function s(f){var i=f.length,r=[1732584193,-271733879,-1732584194,271733878],t,n,e,a,l,b;for(t=64;t<=i;t+=64)o(r,p(f.substring(t-64,t)));for(f=f.substring(t-64),n=f.length,e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<n;t+=1)e[t>>2]|=f.charCodeAt(t)<<(t%4<<3);if(e[t>>2]|=128<<(t%4<<3),t>55)for(o(r,e),t=0;t<16;t+=1)e[t]=0;return a=i*8,a=a.toString(16).match(/(.*?)(.{0,8})$/),l=parseInt(a[2],16),b=parseInt(a[1],16)||0,e[14]=l,e[15]=b,o(r,e),r}function _(f){var i=f.length,r=[1732584193,-271733879,-1732584194,271733878],t,n,e,a,l,b;for(t=64;t<=i;t+=64)o(r,g(f.subarray(t-64,t)));for(f=t-64<i?f.subarray(t-64):new Uint8Array(0),n=f.length,e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<n;t+=1)e[t>>2]|=f[t]<<(t%4<<3);if(e[t>>2]|=128<<(t%4<<3),t>55)for(o(r,e),t=0;t<16;t+=1)e[t]=0;return a=i*8,a=a.toString(16).match(/(.*?)(.{0,8})$/),l=parseInt(a[2],16),b=parseInt(a[1],16)||0,e[14]=l,e[15]=b,o(r,e),r}function d(f){var i="",r;for(r=0;r<4;r+=1)i+=c[f>>r*8+4&15]+c[f>>r*8&15];return i}function A(f){var i;for(i=0;i<f.length;i+=1)f[i]=d(f[i]);return f.join("")}A(s("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&function(){function f(i,r){return i=i|0||0,i<0?Math.max(i+r,0):Math.min(i,r)}ArrayBuffer.prototype.slice=function(i,r){var t=this.byteLength,n=f(i,t),e=t,a,l,b,S;return r!==y&&(e=f(r,t)),n>e?new ArrayBuffer(0):(a=e-n,l=new ArrayBuffer(a),b=new Uint8Array(l),S=new Uint8Array(this,n,a),b.set(S),l)}}();function w(f){return/[\u0080-\uFFFF]/.test(f)&&(f=unescape(encodeURIComponent(f))),f}function U(f,i){var r=f.length,t=new ArrayBuffer(r),n=new Uint8Array(t),e;for(e=0;e<r;e+=1)n[e]=f.charCodeAt(e);return i?n:t}function C(f){return String.fromCharCode.apply(null,new Uint8Array(f))}function F(f,i,r){var t=new Uint8Array(f.byteLength+i.byteLength);return t.set(new Uint8Array(f)),t.set(new Uint8Array(i),f.byteLength),t}function B(f){var i=[],r=f.length,t;for(t=0;t<r-1;t+=2)i.push(parseInt(f.substr(t,2),16));return String.fromCharCode.apply(String,i)}function h(){this.reset()}return h.prototype.append=function(f){return this.appendBinary(w(f)),this},h.prototype.appendBinary=function(f){this._buff+=f,this._length+=f.length;var i=this._buff.length,r;for(r=64;r<=i;r+=64)o(this._hash,p(this._buff.substring(r-64,r)));return this._buff=this._buff.substring(r-64),this},h.prototype.end=function(f){var i=this._buff,r=i.length,t,n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e;for(t=0;t<r;t+=1)n[t>>2]|=i.charCodeAt(t)<<(t%4<<3);return this._finish(n,r),e=A(this._hash),f&&(e=B(e)),this.reset(),e},h.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},h.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},h.prototype.setState=function(f){return this._buff=f.buff,this._length=f.length,this._hash=f.hash,this},h.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},h.prototype._finish=function(f,i){var r=i,t,n,e;if(f[r>>2]|=128<<(r%4<<3),r>55)for(o(this._hash,f),r=0;r<16;r+=1)f[r]=0;t=this._length*8,t=t.toString(16).match(/(.*?)(.{0,8})$/),n=parseInt(t[2],16),e=parseInt(t[1],16)||0,f[14]=n,f[15]=e,o(this._hash,f)},h.hash=function(f,i){return h.hashBinary(w(f),i)},h.hashBinary=function(f,i){var r=s(f),t=A(r);return i?B(t):t},h.ArrayBuffer=function(){this.reset()},h.ArrayBuffer.prototype.append=function(f){var i=F(this._buff.buffer,f),r=i.length,t;for(this._length+=f.byteLength,t=64;t<=r;t+=64)o(this._hash,g(i.subarray(t-64,t)));return this._buff=t-64<r?new Uint8Array(i.buffer.slice(t-64)):new Uint8Array(0),this},h.ArrayBuffer.prototype.end=function(f){var i=this._buff,r=i.length,t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n,e;for(n=0;n<r;n+=1)t[n>>2]|=i[n]<<(n%4<<3);return this._finish(t,r),e=A(this._hash),f&&(e=B(e)),this.reset(),e},h.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},h.ArrayBuffer.prototype.getState=function(){var f=h.prototype.getState.call(this);return f.buff=C(f.buff),f},h.ArrayBuffer.prototype.setState=function(f){return f.buff=U(f.buff,!0),h.prototype.setState.call(this,f)},h.ArrayBuffer.prototype.destroy=h.prototype.destroy,h.ArrayBuffer.prototype._finish=h.prototype._finish,h.ArrayBuffer.hash=function(f,i){var r=_(new Uint8Array(f)),t=A(r);return i?B(t):t},h})})(v);var M=v.exports;const j=I(M);function L(u,m){const y=[];let c=0;const o=parseInt(m+"");for(;c<u.size;)y.push(u.slice(c,c+o)),c+=o;return y}function z(u){return new Promise(m=>{const y=new j.ArrayBuffer,c=new FileReader,o=u.size,p=2*1024*1024,g=[u.slice(0,p)];let s=p;for(;s<o;){if(s+p>=o)g.push(u.slice(s,s+p));else{const _=s+p/2,d=s+p;g.push(u.slice(s,s+2)),g.push(u.slice(_,_+2)),g.push(u.slice(d-2,d))}s+=p}c.readAsArrayBuffer(new Blob(g)),c.onload=_=>{var d;y.append((d=_.target)==null?void 0:d.result),m(y.end())}})}exports.calculateFileHashSample=z;exports.createFileChunk=L;
|