@zip.js/zip.js 2.14.0 → 2.14.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/BENCHMARKS.md +342 -454
- package/deno.json +1 -1
- package/dist/zip-core-external.js +262 -81
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +260 -74
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +262 -81
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +260 -74
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +262 -81
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +262 -76
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +266 -85
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +262 -76
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-module.wasm +0 -0
- package/dist/zip-native.js +262 -76
- package/dist/zip-native.min.js +1 -1
- package/dist/zip-web-worker-native.js +1 -1
- package/dist/zip-web-worker.js +1 -1
- package/dist/zip.js +266 -85
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +262 -76
- package/index-native.min.js +1 -1
- package/index.cjs +266 -85
- package/index.min.js +1 -1
- package/lib/core/codec-worker.js +6 -5
- package/lib/core/streams/codecs/aes-hmac-sha1.js +194 -56
- package/lib/core/streams/zlib-wasm/zlib-streams.js +2 -7
- package/lib/core/streams/zlib-wasm/zlib-streams.wasm +0 -0
- package/lib/core/version.js +1 -1
- package/lib/core/web-worker-inline-native.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/core/zip-reader.js +53 -6
- package/lib/core/zlib-streams-inline.js +1 -1
- package/package.json +1 -1
package/dist/zip-fs-external.js
CHANGED
|
@@ -763,7 +763,7 @@ const BLOCK_LENGTH$1 = 16;
|
|
|
763
763
|
const ROUND_KEYS_LENGTH = 60;
|
|
764
764
|
const SHA1_BLOCK_LENGTH = 64;
|
|
765
765
|
const SHA1_DIGEST_LENGTH = 20;
|
|
766
|
-
const SHA1_SCHEDULE_LENGTH =
|
|
766
|
+
const SHA1_SCHEDULE_LENGTH = 16;
|
|
767
767
|
const SHA1_LENGTH_OFFSET = 56;
|
|
768
768
|
const SHA1_PADDING = new Uint8Array([0x80]);
|
|
769
769
|
const SHA1_ZERO = new Uint8Array(1);
|
|
@@ -782,9 +782,12 @@ function createEngine$2(key, authenticationKey) {
|
|
|
782
782
|
initTables();
|
|
783
783
|
const roundKeys = new Int32Array(ROUND_KEYS_LENGTH);
|
|
784
784
|
const rounds = expandKey(key, roundKeys);
|
|
785
|
-
const counter = new Uint8Array(BLOCK_LENGTH$1);
|
|
786
785
|
const keystream = new Int32Array(BLOCK_LENGTH$1 / 4);
|
|
787
786
|
const hmac = createHmac(authenticationKey);
|
|
787
|
+
let counter0 = 0;
|
|
788
|
+
let counter1 = 0;
|
|
789
|
+
let counter2 = 0;
|
|
790
|
+
let counter3 = 0;
|
|
788
791
|
return {
|
|
789
792
|
process(data, decrypt) {
|
|
790
793
|
if (decrypt) {
|
|
@@ -820,31 +823,83 @@ function createEngine$2(key, authenticationKey) {
|
|
|
820
823
|
}
|
|
821
824
|
|
|
822
825
|
function nextKeystream() {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
let
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
826
|
+
counter0 = (counter0 + 1) | 0;
|
|
827
|
+
if (!counter0) {
|
|
828
|
+
counter1 = (counter1 + 1) | 0;
|
|
829
|
+
if (!counter1) {
|
|
830
|
+
counter2 = (counter2 + 1) | 0;
|
|
831
|
+
if (!counter2) {
|
|
832
|
+
counter3 = (counter3 + 1) | 0;
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
let s0 = swapBytes(counter0) ^ roundKeys[0];
|
|
837
|
+
let s1 = swapBytes(counter1) ^ roundKeys[1];
|
|
838
|
+
let s2 = swapBytes(counter2) ^ roundKeys[2];
|
|
839
|
+
let s3 = swapBytes(counter3) ^ roundKeys[3];
|
|
840
|
+
let t0 = T0[s0 >>> 24] ^ T1[(s1 >>> 16) & 255] ^ T2[(s2 >>> 8) & 255] ^ T3[s3 & 255] ^ roundKeys[4];
|
|
841
|
+
let t1 = T0[s1 >>> 24] ^ T1[(s2 >>> 16) & 255] ^ T2[(s3 >>> 8) & 255] ^ T3[s0 & 255] ^ roundKeys[5];
|
|
842
|
+
let t2 = T0[s2 >>> 24] ^ T1[(s3 >>> 16) & 255] ^ T2[(s0 >>> 8) & 255] ^ T3[s1 & 255] ^ roundKeys[6];
|
|
843
|
+
let t3 = T0[s3 >>> 24] ^ T1[(s0 >>> 16) & 255] ^ T2[(s1 >>> 8) & 255] ^ T3[s2 & 255] ^ roundKeys[7];
|
|
844
|
+
s0 = T0[t0 >>> 24] ^ T1[(t1 >>> 16) & 255] ^ T2[(t2 >>> 8) & 255] ^ T3[t3 & 255] ^ roundKeys[8];
|
|
845
|
+
s1 = T0[t1 >>> 24] ^ T1[(t2 >>> 16) & 255] ^ T2[(t3 >>> 8) & 255] ^ T3[t0 & 255] ^ roundKeys[9];
|
|
846
|
+
s2 = T0[t2 >>> 24] ^ T1[(t3 >>> 16) & 255] ^ T2[(t0 >>> 8) & 255] ^ T3[t1 & 255] ^ roundKeys[10];
|
|
847
|
+
s3 = T0[t3 >>> 24] ^ T1[(t0 >>> 16) & 255] ^ T2[(t1 >>> 8) & 255] ^ T3[t2 & 255] ^ roundKeys[11];
|
|
848
|
+
t0 = T0[s0 >>> 24] ^ T1[(s1 >>> 16) & 255] ^ T2[(s2 >>> 8) & 255] ^ T3[s3 & 255] ^ roundKeys[12];
|
|
849
|
+
t1 = T0[s1 >>> 24] ^ T1[(s2 >>> 16) & 255] ^ T2[(s3 >>> 8) & 255] ^ T3[s0 & 255] ^ roundKeys[13];
|
|
850
|
+
t2 = T0[s2 >>> 24] ^ T1[(s3 >>> 16) & 255] ^ T2[(s0 >>> 8) & 255] ^ T3[s1 & 255] ^ roundKeys[14];
|
|
851
|
+
t3 = T0[s3 >>> 24] ^ T1[(s0 >>> 16) & 255] ^ T2[(s1 >>> 8) & 255] ^ T3[s2 & 255] ^ roundKeys[15];
|
|
852
|
+
s0 = T0[t0 >>> 24] ^ T1[(t1 >>> 16) & 255] ^ T2[(t2 >>> 8) & 255] ^ T3[t3 & 255] ^ roundKeys[16];
|
|
853
|
+
s1 = T0[t1 >>> 24] ^ T1[(t2 >>> 16) & 255] ^ T2[(t3 >>> 8) & 255] ^ T3[t0 & 255] ^ roundKeys[17];
|
|
854
|
+
s2 = T0[t2 >>> 24] ^ T1[(t3 >>> 16) & 255] ^ T2[(t0 >>> 8) & 255] ^ T3[t1 & 255] ^ roundKeys[18];
|
|
855
|
+
s3 = T0[t3 >>> 24] ^ T1[(t0 >>> 16) & 255] ^ T2[(t1 >>> 8) & 255] ^ T3[t2 & 255] ^ roundKeys[19];
|
|
856
|
+
t0 = T0[s0 >>> 24] ^ T1[(s1 >>> 16) & 255] ^ T2[(s2 >>> 8) & 255] ^ T3[s3 & 255] ^ roundKeys[20];
|
|
857
|
+
t1 = T0[s1 >>> 24] ^ T1[(s2 >>> 16) & 255] ^ T2[(s3 >>> 8) & 255] ^ T3[s0 & 255] ^ roundKeys[21];
|
|
858
|
+
t2 = T0[s2 >>> 24] ^ T1[(s3 >>> 16) & 255] ^ T2[(s0 >>> 8) & 255] ^ T3[s1 & 255] ^ roundKeys[22];
|
|
859
|
+
t3 = T0[s3 >>> 24] ^ T1[(s0 >>> 16) & 255] ^ T2[(s1 >>> 8) & 255] ^ T3[s2 & 255] ^ roundKeys[23];
|
|
860
|
+
s0 = T0[t0 >>> 24] ^ T1[(t1 >>> 16) & 255] ^ T2[(t2 >>> 8) & 255] ^ T3[t3 & 255] ^ roundKeys[24];
|
|
861
|
+
s1 = T0[t1 >>> 24] ^ T1[(t2 >>> 16) & 255] ^ T2[(t3 >>> 8) & 255] ^ T3[t0 & 255] ^ roundKeys[25];
|
|
862
|
+
s2 = T0[t2 >>> 24] ^ T1[(t3 >>> 16) & 255] ^ T2[(t0 >>> 8) & 255] ^ T3[t1 & 255] ^ roundKeys[26];
|
|
863
|
+
s3 = T0[t3 >>> 24] ^ T1[(t0 >>> 16) & 255] ^ T2[(t1 >>> 8) & 255] ^ T3[t2 & 255] ^ roundKeys[27];
|
|
864
|
+
t0 = T0[s0 >>> 24] ^ T1[(s1 >>> 16) & 255] ^ T2[(s2 >>> 8) & 255] ^ T3[s3 & 255] ^ roundKeys[28];
|
|
865
|
+
t1 = T0[s1 >>> 24] ^ T1[(s2 >>> 16) & 255] ^ T2[(s3 >>> 8) & 255] ^ T3[s0 & 255] ^ roundKeys[29];
|
|
866
|
+
t2 = T0[s2 >>> 24] ^ T1[(s3 >>> 16) & 255] ^ T2[(s0 >>> 8) & 255] ^ T3[s1 & 255] ^ roundKeys[30];
|
|
867
|
+
t3 = T0[s3 >>> 24] ^ T1[(s0 >>> 16) & 255] ^ T2[(s1 >>> 8) & 255] ^ T3[s2 & 255] ^ roundKeys[31];
|
|
868
|
+
s0 = T0[t0 >>> 24] ^ T1[(t1 >>> 16) & 255] ^ T2[(t2 >>> 8) & 255] ^ T3[t3 & 255] ^ roundKeys[32];
|
|
869
|
+
s1 = T0[t1 >>> 24] ^ T1[(t2 >>> 16) & 255] ^ T2[(t3 >>> 8) & 255] ^ T3[t0 & 255] ^ roundKeys[33];
|
|
870
|
+
s2 = T0[t2 >>> 24] ^ T1[(t3 >>> 16) & 255] ^ T2[(t0 >>> 8) & 255] ^ T3[t1 & 255] ^ roundKeys[34];
|
|
871
|
+
s3 = T0[t3 >>> 24] ^ T1[(t0 >>> 16) & 255] ^ T2[(t1 >>> 8) & 255] ^ T3[t2 & 255] ^ roundKeys[35];
|
|
872
|
+
t0 = T0[s0 >>> 24] ^ T1[(s1 >>> 16) & 255] ^ T2[(s2 >>> 8) & 255] ^ T3[s3 & 255] ^ roundKeys[36];
|
|
873
|
+
t1 = T0[s1 >>> 24] ^ T1[(s2 >>> 16) & 255] ^ T2[(s3 >>> 8) & 255] ^ T3[s0 & 255] ^ roundKeys[37];
|
|
874
|
+
t2 = T0[s2 >>> 24] ^ T1[(s3 >>> 16) & 255] ^ T2[(s0 >>> 8) & 255] ^ T3[s1 & 255] ^ roundKeys[38];
|
|
875
|
+
t3 = T0[s3 >>> 24] ^ T1[(s0 >>> 16) & 255] ^ T2[(s1 >>> 8) & 255] ^ T3[s2 & 255] ^ roundKeys[39];
|
|
876
|
+
let indexKey = 40;
|
|
877
|
+
if (rounds > 10) {
|
|
878
|
+
s0 = T0[t0 >>> 24] ^ T1[(t1 >>> 16) & 255] ^ T2[(t2 >>> 8) & 255] ^ T3[t3 & 255] ^ roundKeys[40];
|
|
879
|
+
s1 = T0[t1 >>> 24] ^ T1[(t2 >>> 16) & 255] ^ T2[(t3 >>> 8) & 255] ^ T3[t0 & 255] ^ roundKeys[41];
|
|
880
|
+
s2 = T0[t2 >>> 24] ^ T1[(t3 >>> 16) & 255] ^ T2[(t0 >>> 8) & 255] ^ T3[t1 & 255] ^ roundKeys[42];
|
|
881
|
+
s3 = T0[t3 >>> 24] ^ T1[(t0 >>> 16) & 255] ^ T2[(t1 >>> 8) & 255] ^ T3[t2 & 255] ^ roundKeys[43];
|
|
882
|
+
t0 = T0[s0 >>> 24] ^ T1[(s1 >>> 16) & 255] ^ T2[(s2 >>> 8) & 255] ^ T3[s3 & 255] ^ roundKeys[44];
|
|
883
|
+
t1 = T0[s1 >>> 24] ^ T1[(s2 >>> 16) & 255] ^ T2[(s3 >>> 8) & 255] ^ T3[s0 & 255] ^ roundKeys[45];
|
|
884
|
+
t2 = T0[s2 >>> 24] ^ T1[(s3 >>> 16) & 255] ^ T2[(s0 >>> 8) & 255] ^ T3[s1 & 255] ^ roundKeys[46];
|
|
885
|
+
t3 = T0[s3 >>> 24] ^ T1[(s0 >>> 16) & 255] ^ T2[(s1 >>> 8) & 255] ^ T3[s2 & 255] ^ roundKeys[47];
|
|
886
|
+
indexKey = 48;
|
|
887
|
+
}
|
|
888
|
+
if (rounds > 12) {
|
|
889
|
+
s0 = T0[t0 >>> 24] ^ T1[(t1 >>> 16) & 255] ^ T2[(t2 >>> 8) & 255] ^ T3[t3 & 255] ^ roundKeys[48];
|
|
890
|
+
s1 = T0[t1 >>> 24] ^ T1[(t2 >>> 16) & 255] ^ T2[(t3 >>> 8) & 255] ^ T3[t0 & 255] ^ roundKeys[49];
|
|
891
|
+
s2 = T0[t2 >>> 24] ^ T1[(t3 >>> 16) & 255] ^ T2[(t0 >>> 8) & 255] ^ T3[t1 & 255] ^ roundKeys[50];
|
|
892
|
+
s3 = T0[t3 >>> 24] ^ T1[(t0 >>> 16) & 255] ^ T2[(t1 >>> 8) & 255] ^ T3[t2 & 255] ^ roundKeys[51];
|
|
893
|
+
t0 = T0[s0 >>> 24] ^ T1[(s1 >>> 16) & 255] ^ T2[(s2 >>> 8) & 255] ^ T3[s3 & 255] ^ roundKeys[52];
|
|
894
|
+
t1 = T0[s1 >>> 24] ^ T1[(s2 >>> 16) & 255] ^ T2[(s3 >>> 8) & 255] ^ T3[s0 & 255] ^ roundKeys[53];
|
|
895
|
+
t2 = T0[s2 >>> 24] ^ T1[(s3 >>> 16) & 255] ^ T2[(s0 >>> 8) & 255] ^ T3[s1 & 255] ^ roundKeys[54];
|
|
896
|
+
t3 = T0[s3 >>> 24] ^ T1[(s0 >>> 16) & 255] ^ T2[(s1 >>> 8) & 255] ^ T3[s2 & 255] ^ roundKeys[55];
|
|
897
|
+
indexKey = 56;
|
|
898
|
+
}
|
|
899
|
+
keystream[0] = ((S_BOX[t0 >>> 24] << 24) | (S_BOX[(t1 >>> 16) & 255] << 16) | (S_BOX[(t2 >>> 8) & 255] << 8) | S_BOX[t3 & 255]) ^ roundKeys[indexKey];
|
|
900
|
+
keystream[1] = ((S_BOX[t1 >>> 24] << 24) | (S_BOX[(t2 >>> 16) & 255] << 16) | (S_BOX[(t3 >>> 8) & 255] << 8) | S_BOX[t0 & 255]) ^ roundKeys[indexKey + 1];
|
|
901
|
+
keystream[2] = ((S_BOX[t2 >>> 24] << 24) | (S_BOX[(t3 >>> 16) & 255] << 16) | (S_BOX[(t0 >>> 8) & 255] << 8) | S_BOX[t1 & 255]) ^ roundKeys[indexKey + 2];
|
|
902
|
+
keystream[3] = ((S_BOX[t3 >>> 24] << 24) | (S_BOX[(t0 >>> 16) & 255] << 16) | (S_BOX[(t1 >>> 8) & 255] << 8) | S_BOX[t2 & 255]) ^ roundKeys[indexKey + 3];
|
|
848
903
|
}
|
|
849
904
|
}
|
|
850
905
|
|
|
@@ -968,47 +1023,126 @@ function createSha1() {
|
|
|
968
1023
|
for (let index = 0; index < 16; index++) {
|
|
969
1024
|
schedule[index] = view.getInt32(offset + 4 * index);
|
|
970
1025
|
}
|
|
971
|
-
for (let index = 16; index < SHA1_SCHEDULE_LENGTH; index++) {
|
|
972
|
-
const word = schedule[index - 3] ^ schedule[index - 8] ^ schedule[index - 14] ^ schedule[index - 16];
|
|
973
|
-
schedule[index] = (word << 1) | (word >>> 31);
|
|
974
|
-
}
|
|
975
1026
|
let a = state[0];
|
|
976
1027
|
let b = state[1];
|
|
977
1028
|
let c = state[2];
|
|
978
1029
|
let d = state[3];
|
|
979
1030
|
let e = state[4];
|
|
980
1031
|
let t;
|
|
981
|
-
for (let index = 0; index <
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
d = c;
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1032
|
+
for (let index = 0; index < 15; index += 5) {
|
|
1033
|
+
e = (((a << 5) | (a >>> 27)) + (((c ^ d) & b) ^ d) + e + 0x5A827999 + schedule[index]) | 0;
|
|
1034
|
+
b = (b << 30) | (b >>> 2);
|
|
1035
|
+
d = (((e << 5) | (e >>> 27)) + (((b ^ c) & a) ^ c) + d + 0x5A827999 + schedule[index + 1]) | 0;
|
|
1036
|
+
a = (a << 30) | (a >>> 2);
|
|
1037
|
+
c = (((d << 5) | (d >>> 27)) + (((a ^ b) & e) ^ b) + c + 0x5A827999 + schedule[index + 2]) | 0;
|
|
1038
|
+
e = (e << 30) | (e >>> 2);
|
|
1039
|
+
b = (((c << 5) | (c >>> 27)) + (((e ^ a) & d) ^ a) + b + 0x5A827999 + schedule[index + 3]) | 0;
|
|
1040
|
+
d = (d << 30) | (d >>> 2);
|
|
1041
|
+
a = (((b << 5) | (b >>> 27)) + (((d ^ e) & c) ^ e) + a + 0x5A827999 + schedule[index + 4]) | 0;
|
|
1042
|
+
c = (c << 30) | (c >>> 2);
|
|
1043
|
+
}
|
|
1044
|
+
e = (((a << 5) | (a >>> 27)) + (((c ^ d) & b) ^ d) + e + 0x5A827999 + schedule[15]) | 0;
|
|
1045
|
+
b = (b << 30) | (b >>> 2);
|
|
1046
|
+
t = schedule[13] ^ schedule[8] ^ schedule[2] ^ schedule[0];
|
|
1047
|
+
t = (t << 1) | (t >>> 31);
|
|
1048
|
+
schedule[0] = t;
|
|
1049
|
+
d = (((e << 5) | (e >>> 27)) + (((b ^ c) & a) ^ c) + d + 0x5A827999 + t) | 0;
|
|
1050
|
+
a = (a << 30) | (a >>> 2);
|
|
1051
|
+
t = schedule[14] ^ schedule[9] ^ schedule[3] ^ schedule[1];
|
|
1052
|
+
t = (t << 1) | (t >>> 31);
|
|
1053
|
+
schedule[1] = t;
|
|
1054
|
+
c = (((d << 5) | (d >>> 27)) + (((a ^ b) & e) ^ b) + c + 0x5A827999 + t) | 0;
|
|
1055
|
+
e = (e << 30) | (e >>> 2);
|
|
1056
|
+
t = schedule[15] ^ schedule[10] ^ schedule[4] ^ schedule[2];
|
|
1057
|
+
t = (t << 1) | (t >>> 31);
|
|
1058
|
+
schedule[2] = t;
|
|
1059
|
+
b = (((c << 5) | (c >>> 27)) + (((e ^ a) & d) ^ a) + b + 0x5A827999 + t) | 0;
|
|
1060
|
+
d = (d << 30) | (d >>> 2);
|
|
1061
|
+
t = schedule[0] ^ schedule[11] ^ schedule[5] ^ schedule[3];
|
|
1062
|
+
t = (t << 1) | (t >>> 31);
|
|
1063
|
+
schedule[3] = t;
|
|
1064
|
+
a = (((b << 5) | (b >>> 27)) + (((d ^ e) & c) ^ e) + a + 0x5A827999 + t) | 0;
|
|
1065
|
+
c = (c << 30) | (c >>> 2);
|
|
1066
|
+
for (let index = 20; index < 40; index += 5) {
|
|
1067
|
+
t = schedule[(index - 3) & 15] ^ schedule[(index - 8) & 15] ^ schedule[(index - 14) & 15] ^ schedule[(index) & 15];
|
|
1068
|
+
t = (t << 1) | (t >>> 31);
|
|
1069
|
+
schedule[(index) & 15] = t;
|
|
1070
|
+
e = (((a << 5) | (a >>> 27)) + (b ^ c ^ d) + e + 0x6ED9EBA1 + t) | 0;
|
|
1071
|
+
b = (b << 30) | (b >>> 2);
|
|
1072
|
+
t = schedule[(index - 2) & 15] ^ schedule[(index - 7) & 15] ^ schedule[(index - 13) & 15] ^ schedule[(index + 1) & 15];
|
|
1073
|
+
t = (t << 1) | (t >>> 31);
|
|
1074
|
+
schedule[(index + 1) & 15] = t;
|
|
1075
|
+
d = (((e << 5) | (e >>> 27)) + (a ^ b ^ c) + d + 0x6ED9EBA1 + t) | 0;
|
|
1076
|
+
a = (a << 30) | (a >>> 2);
|
|
1077
|
+
t = schedule[(index - 1) & 15] ^ schedule[(index - 6) & 15] ^ schedule[(index - 12) & 15] ^ schedule[(index + 2) & 15];
|
|
1078
|
+
t = (t << 1) | (t >>> 31);
|
|
1079
|
+
schedule[(index + 2) & 15] = t;
|
|
1080
|
+
c = (((d << 5) | (d >>> 27)) + (e ^ a ^ b) + c + 0x6ED9EBA1 + t) | 0;
|
|
1081
|
+
e = (e << 30) | (e >>> 2);
|
|
1082
|
+
t = schedule[(index) & 15] ^ schedule[(index - 5) & 15] ^ schedule[(index - 11) & 15] ^ schedule[(index + 3) & 15];
|
|
1083
|
+
t = (t << 1) | (t >>> 31);
|
|
1084
|
+
schedule[(index + 3) & 15] = t;
|
|
1085
|
+
b = (((c << 5) | (c >>> 27)) + (d ^ e ^ a) + b + 0x6ED9EBA1 + t) | 0;
|
|
1086
|
+
d = (d << 30) | (d >>> 2);
|
|
1087
|
+
t = schedule[(index + 1) & 15] ^ schedule[(index - 4) & 15] ^ schedule[(index - 10) & 15] ^ schedule[(index + 4) & 15];
|
|
1088
|
+
t = (t << 1) | (t >>> 31);
|
|
1089
|
+
schedule[(index + 4) & 15] = t;
|
|
1090
|
+
a = (((b << 5) | (b >>> 27)) + (c ^ d ^ e) + a + 0x6ED9EBA1 + t) | 0;
|
|
1091
|
+
c = (c << 30) | (c >>> 2);
|
|
1092
|
+
}
|
|
1093
|
+
for (let index = 40; index < 60; index += 5) {
|
|
1094
|
+
t = schedule[(index - 3) & 15] ^ schedule[(index - 8) & 15] ^ schedule[(index - 14) & 15] ^ schedule[(index) & 15];
|
|
1095
|
+
t = (t << 1) | (t >>> 31);
|
|
1096
|
+
schedule[(index) & 15] = t;
|
|
1097
|
+
e = (((a << 5) | (a >>> 27)) + ((b & c) | ((b | c) & d)) + e + 0x8F1BBCDC + t) | 0;
|
|
1098
|
+
b = (b << 30) | (b >>> 2);
|
|
1099
|
+
t = schedule[(index - 2) & 15] ^ schedule[(index - 7) & 15] ^ schedule[(index - 13) & 15] ^ schedule[(index + 1) & 15];
|
|
1100
|
+
t = (t << 1) | (t >>> 31);
|
|
1101
|
+
schedule[(index + 1) & 15] = t;
|
|
1102
|
+
d = (((e << 5) | (e >>> 27)) + ((a & b) | ((a | b) & c)) + d + 0x8F1BBCDC + t) | 0;
|
|
1103
|
+
a = (a << 30) | (a >>> 2);
|
|
1104
|
+
t = schedule[(index - 1) & 15] ^ schedule[(index - 6) & 15] ^ schedule[(index - 12) & 15] ^ schedule[(index + 2) & 15];
|
|
1105
|
+
t = (t << 1) | (t >>> 31);
|
|
1106
|
+
schedule[(index + 2) & 15] = t;
|
|
1107
|
+
c = (((d << 5) | (d >>> 27)) + ((e & a) | ((e | a) & b)) + c + 0x8F1BBCDC + t) | 0;
|
|
1108
|
+
e = (e << 30) | (e >>> 2);
|
|
1109
|
+
t = schedule[(index) & 15] ^ schedule[(index - 5) & 15] ^ schedule[(index - 11) & 15] ^ schedule[(index + 3) & 15];
|
|
1110
|
+
t = (t << 1) | (t >>> 31);
|
|
1111
|
+
schedule[(index + 3) & 15] = t;
|
|
1112
|
+
b = (((c << 5) | (c >>> 27)) + ((d & e) | ((d | e) & a)) + b + 0x8F1BBCDC + t) | 0;
|
|
1113
|
+
d = (d << 30) | (d >>> 2);
|
|
1114
|
+
t = schedule[(index + 1) & 15] ^ schedule[(index - 4) & 15] ^ schedule[(index - 10) & 15] ^ schedule[(index + 4) & 15];
|
|
1115
|
+
t = (t << 1) | (t >>> 31);
|
|
1116
|
+
schedule[(index + 4) & 15] = t;
|
|
1117
|
+
a = (((b << 5) | (b >>> 27)) + ((c & d) | ((c | d) & e)) + a + 0x8F1BBCDC + t) | 0;
|
|
1118
|
+
c = (c << 30) | (c >>> 2);
|
|
1119
|
+
}
|
|
1120
|
+
for (let index = 60; index < 80; index += 5) {
|
|
1121
|
+
t = schedule[(index - 3) & 15] ^ schedule[(index - 8) & 15] ^ schedule[(index - 14) & 15] ^ schedule[(index) & 15];
|
|
1122
|
+
t = (t << 1) | (t >>> 31);
|
|
1123
|
+
schedule[(index) & 15] = t;
|
|
1124
|
+
e = (((a << 5) | (a >>> 27)) + (b ^ c ^ d) + e + 0xCA62C1D6 + t) | 0;
|
|
1125
|
+
b = (b << 30) | (b >>> 2);
|
|
1126
|
+
t = schedule[(index - 2) & 15] ^ schedule[(index - 7) & 15] ^ schedule[(index - 13) & 15] ^ schedule[(index + 1) & 15];
|
|
1127
|
+
t = (t << 1) | (t >>> 31);
|
|
1128
|
+
schedule[(index + 1) & 15] = t;
|
|
1129
|
+
d = (((e << 5) | (e >>> 27)) + (a ^ b ^ c) + d + 0xCA62C1D6 + t) | 0;
|
|
1130
|
+
a = (a << 30) | (a >>> 2);
|
|
1131
|
+
t = schedule[(index - 1) & 15] ^ schedule[(index - 6) & 15] ^ schedule[(index - 12) & 15] ^ schedule[(index + 2) & 15];
|
|
1132
|
+
t = (t << 1) | (t >>> 31);
|
|
1133
|
+
schedule[(index + 2) & 15] = t;
|
|
1134
|
+
c = (((d << 5) | (d >>> 27)) + (e ^ a ^ b) + c + 0xCA62C1D6 + t) | 0;
|
|
1135
|
+
e = (e << 30) | (e >>> 2);
|
|
1136
|
+
t = schedule[(index) & 15] ^ schedule[(index - 5) & 15] ^ schedule[(index - 11) & 15] ^ schedule[(index + 3) & 15];
|
|
1137
|
+
t = (t << 1) | (t >>> 31);
|
|
1138
|
+
schedule[(index + 3) & 15] = t;
|
|
1139
|
+
b = (((c << 5) | (c >>> 27)) + (d ^ e ^ a) + b + 0xCA62C1D6 + t) | 0;
|
|
1140
|
+
d = (d << 30) | (d >>> 2);
|
|
1141
|
+
t = schedule[(index + 1) & 15] ^ schedule[(index - 4) & 15] ^ schedule[(index - 10) & 15] ^ schedule[(index + 4) & 15];
|
|
1142
|
+
t = (t << 1) | (t >>> 31);
|
|
1143
|
+
schedule[(index + 4) & 15] = t;
|
|
1144
|
+
a = (((b << 5) | (b >>> 27)) + (c ^ d ^ e) + a + 0xCA62C1D6 + t) | 0;
|
|
1145
|
+
c = (c << 30) | (c >>> 2);
|
|
1012
1146
|
}
|
|
1013
1147
|
state[0] = (state[0] + a) | 0;
|
|
1014
1148
|
state[1] = (state[1] + b) | 0;
|
|
@@ -1071,6 +1205,10 @@ function substituteWord(word) {
|
|
|
1071
1205
|
return (S_BOX[word >>> 24] << 24) | (S_BOX[(word >>> 16) & 255] << 16) | (S_BOX[(word >>> 8) & 255] << 8) | S_BOX[word & 255];
|
|
1072
1206
|
}
|
|
1073
1207
|
|
|
1208
|
+
function swapBytes(value) {
|
|
1209
|
+
return (value << 24) | ((value & 0xff00) << 8) | ((value >>> 8) & 0xff00) | (value >>> 24);
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1074
1212
|
function multiplyByTwo(value) {
|
|
1075
1213
|
return ((value << 1) ^ ((value >> 7) * 0x1b)) & 255;
|
|
1076
1214
|
}
|
|
@@ -2368,7 +2506,8 @@ class CodecWorker {
|
|
|
2368
2506
|
return new Promise(resolve => {
|
|
2369
2507
|
const { worker, busy } = workerData;
|
|
2370
2508
|
if (busy) {
|
|
2371
|
-
workerData.
|
|
2509
|
+
workerData.terminateResolvers = workerData.terminateResolvers || [];
|
|
2510
|
+
workerData.terminateResolvers.push(resolve);
|
|
2372
2511
|
} else {
|
|
2373
2512
|
if (worker) {
|
|
2374
2513
|
worker.terminate();
|
|
@@ -2381,14 +2520,14 @@ class CodecWorker {
|
|
|
2381
2520
|
},
|
|
2382
2521
|
onTaskFinished() {
|
|
2383
2522
|
if (workerData.busy) {
|
|
2384
|
-
const {
|
|
2385
|
-
if (
|
|
2386
|
-
workerData.
|
|
2523
|
+
const { terminateResolvers, worker } = workerData;
|
|
2524
|
+
if (terminateResolvers) {
|
|
2525
|
+
workerData.terminateResolvers = null;
|
|
2387
2526
|
if (worker) {
|
|
2388
2527
|
workerData.terminated = true;
|
|
2389
2528
|
worker.terminate();
|
|
2390
2529
|
}
|
|
2391
|
-
|
|
2530
|
+
terminateResolvers.forEach(resolve => resolve());
|
|
2392
2531
|
}
|
|
2393
2532
|
workerData.busy = false;
|
|
2394
2533
|
onTaskFinished(workerData);
|
|
@@ -4574,7 +4713,7 @@ class ZipReader {
|
|
|
4574
4713
|
Object.assign(this, {
|
|
4575
4714
|
reader: new GenericReader(reader),
|
|
4576
4715
|
options,
|
|
4577
|
-
readRanges: new
|
|
4716
|
+
readRanges: { indexes: new Set(), sortedRanges: [], pendingRanges: [] }
|
|
4578
4717
|
});
|
|
4579
4718
|
}
|
|
4580
4719
|
|
|
@@ -5219,7 +5358,6 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
5219
5358
|
throw new Error(ERR_ENTRY_DATA_OUT_OF_BOUNDS);
|
|
5220
5359
|
}
|
|
5221
5360
|
const size = compressedSize;
|
|
5222
|
-
const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
|
|
5223
5361
|
const signal = checkSignalOption(getOptionValue$1(zipEntry, options, OPTION_SIGNAL));
|
|
5224
5362
|
throwIfAborted(signal);
|
|
5225
5363
|
let checkOverlappingEntry = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY);
|
|
@@ -5293,6 +5431,7 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
5293
5431
|
writer = new GenericWriter(writer);
|
|
5294
5432
|
await initStream(writer, getDecodableOutputSize(outputSize, compressedSize, compressed));
|
|
5295
5433
|
({ writable } = writer);
|
|
5434
|
+
const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
|
|
5296
5435
|
const { outputSize: writtenSize } = await runWorker({ readable, writable }, workerOptions);
|
|
5297
5436
|
if (writtenSize != outputSize) {
|
|
5298
5437
|
throw Object.assign(new Error(ERR_INVALID_UNCOMPRESSED_SIZE), { outputSize: writtenSize });
|
|
@@ -5728,14 +5867,61 @@ async function detectOverlappingEntry({
|
|
|
5728
5867
|
end: dataOffset + compressedSize + dataDescriptorLength,
|
|
5729
5868
|
fileEntry
|
|
5730
5869
|
};
|
|
5731
|
-
|
|
5732
|
-
|
|
5870
|
+
const { indexes, sortedRanges, pendingRanges } = readRanges;
|
|
5871
|
+
if (!indexes.has(index)) {
|
|
5872
|
+
const overlappingRange = findOverlappingRange(sortedRanges, range) || pendingRanges.find(otherRange => rangesOverlap(range, otherRange));
|
|
5873
|
+
if (overlappingRange) {
|
|
5733
5874
|
const error = new Error(ERR_OVERLAPPING_ENTRY);
|
|
5734
|
-
error.overlappingEntry =
|
|
5875
|
+
error.overlappingEntry = overlappingRange.fileEntry;
|
|
5735
5876
|
throw error;
|
|
5736
5877
|
}
|
|
5878
|
+
indexes.add(index);
|
|
5879
|
+
pendingRanges.push(range);
|
|
5880
|
+
if (pendingRanges.length * pendingRanges.length > sortedRanges.length) {
|
|
5881
|
+
pendingRanges.sort((range, otherRange) => range.start - otherRange.start);
|
|
5882
|
+
readRanges.sortedRanges = mergeRanges(sortedRanges, pendingRanges);
|
|
5883
|
+
pendingRanges.length = 0;
|
|
5884
|
+
}
|
|
5885
|
+
}
|
|
5886
|
+
}
|
|
5887
|
+
|
|
5888
|
+
function findOverlappingRange(sortedRanges, range) {
|
|
5889
|
+
let low = 0;
|
|
5890
|
+
let high = sortedRanges.length;
|
|
5891
|
+
while (low < high) {
|
|
5892
|
+
const middle = (low + high) >>> 1;
|
|
5893
|
+
if (sortedRanges[middle].start < range.start) {
|
|
5894
|
+
low = middle + 1;
|
|
5895
|
+
} else {
|
|
5896
|
+
high = middle;
|
|
5897
|
+
}
|
|
5898
|
+
}
|
|
5899
|
+
const previousRange = sortedRanges[low - 1];
|
|
5900
|
+
const nextRange = sortedRanges[low];
|
|
5901
|
+
if (previousRange && rangesOverlap(range, previousRange)) {
|
|
5902
|
+
return previousRange;
|
|
5903
|
+
}
|
|
5904
|
+
if (nextRange && rangesOverlap(range, nextRange)) {
|
|
5905
|
+
return nextRange;
|
|
5906
|
+
}
|
|
5907
|
+
}
|
|
5908
|
+
|
|
5909
|
+
function rangesOverlap(range, otherRange) {
|
|
5910
|
+
return range.start < otherRange.end && otherRange.start < range.end;
|
|
5911
|
+
}
|
|
5912
|
+
|
|
5913
|
+
function mergeRanges(sortedRanges, pendingRanges) {
|
|
5914
|
+
const mergedRanges = [];
|
|
5915
|
+
let indexSorted = 0;
|
|
5916
|
+
let indexPending = 0;
|
|
5917
|
+
while (indexSorted < sortedRanges.length || indexPending < pendingRanges.length) {
|
|
5918
|
+
if (indexPending == pendingRanges.length || (indexSorted < sortedRanges.length && sortedRanges[indexSorted].start < pendingRanges[indexPending].start)) {
|
|
5919
|
+
mergedRanges.push(sortedRanges[indexSorted++]);
|
|
5920
|
+
} else {
|
|
5921
|
+
mergedRanges.push(pendingRanges[indexPending++]);
|
|
5922
|
+
}
|
|
5737
5923
|
}
|
|
5738
|
-
|
|
5924
|
+
return mergedRanges;
|
|
5739
5925
|
}
|
|
5740
5926
|
|
|
5741
5927
|
function readDataDescriptor(dataDescriptorView, offset, extraFieldZip64) {
|
|
@@ -8666,7 +8852,7 @@ function formatSupported(StreamClass, format) {
|
|
|
8666
8852
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8667
8853
|
*/
|
|
8668
8854
|
|
|
8669
|
-
const VERSION = "2.14.
|
|
8855
|
+
const VERSION = "2.14.1";
|
|
8670
8856
|
|
|
8671
8857
|
/*
|
|
8672
8858
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
@@ -9189,7 +9375,6 @@ function _make(isCompress, type, options = {}) {
|
|
|
9189
9375
|
if (!this.out || !this.in) {
|
|
9190
9376
|
throw new Error("allocation failed");
|
|
9191
9377
|
}
|
|
9192
|
-
this._scratch = new Uint8Array(outBufferSize);
|
|
9193
9378
|
if (isCompress) {
|
|
9194
9379
|
this._process = wasm$1.deflate_process;
|
|
9195
9380
|
this._last_consumed = wasm$1.deflate_last_consumed;
|
|
@@ -9238,7 +9423,6 @@ function _make(isCompress, type, options = {}) {
|
|
|
9238
9423
|
const process = this._process;
|
|
9239
9424
|
const last_consumed = this._last_consumed;
|
|
9240
9425
|
const out = this.out;
|
|
9241
|
-
const scratch = this._scratch;
|
|
9242
9426
|
let offset = 0;
|
|
9243
9427
|
while (offset < buffer.length) {
|
|
9244
9428
|
const toRead = Math.min(buffer.length - offset, 32 * 1024);
|
|
@@ -9263,8 +9447,7 @@ function _make(isCompress, type, options = {}) {
|
|
|
9263
9447
|
}
|
|
9264
9448
|
const prod = result & 0x00ffffff;
|
|
9265
9449
|
if (prod) {
|
|
9266
|
-
|
|
9267
|
-
controller.enqueue(scratch.slice(0, prod));
|
|
9450
|
+
controller.enqueue(heap.slice(out, out + prod));
|
|
9268
9451
|
}
|
|
9269
9452
|
const consumed = last_consumed(this.streamHandle);
|
|
9270
9453
|
if (consumed === 0 && prod === 0) {
|
|
@@ -9282,7 +9465,6 @@ function _make(isCompress, type, options = {}) {
|
|
|
9282
9465
|
const heap = new Uint8Array(memory.buffer);
|
|
9283
9466
|
const process = this._process;
|
|
9284
9467
|
const out = this.out;
|
|
9285
|
-
const scratch = this._scratch;
|
|
9286
9468
|
while (true) {
|
|
9287
9469
|
const result = process(this.streamHandle, 0, 0, out, outBufferSize, 4);
|
|
9288
9470
|
const code = (result >> 24) & 0xff;
|
|
@@ -9292,8 +9474,7 @@ function _make(isCompress, type, options = {}) {
|
|
|
9292
9474
|
}
|
|
9293
9475
|
const produced = result & 0x00ffffff;
|
|
9294
9476
|
if (produced) {
|
|
9295
|
-
|
|
9296
|
-
controller.enqueue(scratch.slice(0, produced));
|
|
9477
|
+
controller.enqueue(heap.slice(out, out + produced));
|
|
9297
9478
|
}
|
|
9298
9479
|
if (code === 1 || produced === 0) {
|
|
9299
9480
|
break;
|