module-develop-kit 1.4.2 → 1.5.0
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/dist/commonjs-virtual-dir/index.js +3 -5
- package/dist/commonjs-virtual-dir/index2.js +5 -2
- package/dist/commonjs-virtual-dir/index3.js +5 -2
- package/dist/commonjs-virtual-dir/index4.js +2 -4
- package/dist/commonjs-virtual-dir/index5.js +4 -0
- package/dist/commonjs-virtual-dir/index6.js +4 -0
- package/dist/commonjs-virtual-dir/index7.js +4 -0
- package/dist/commonjs-virtual-dir/index8.js +4 -0
- package/dist/main.d.ts +92 -10
- package/dist/main.js +44 -40
- package/dist/src/outside-call/utils.js +1 -1
- package/dist/src/shield/crypto/const.js +4 -0
- package/dist/src/shield/crypto/index.js +53 -0
- package/dist/src/shield/crypto/sm2.js +7 -0
- package/dist/src/shield/crypto/sm4.js +15 -0
- package/dist/src/shield/crypto/util.js +29 -0
- package/dist/src/shield/gcm-crypto/axios-adapter.js +25 -23
- package/dist/src/shield/gcm-crypto/index.js +16 -15
- package/dist/vendor/base64-js/index.js +52 -0
- package/dist/vendor/file-type/source/detectors/zip.js +64 -60
- package/dist/vendor/file-type/source/index.js +146 -130
- package/dist/vendor/file-type/source/supported.js +4 -2
- package/dist/vendor/gm-crypt/index.js +10 -0
- package/dist/vendor/gm-crypt/src/crypt.js +60 -0
- package/dist/vendor/gm-crypt/src/sm4.js +513 -0
- package/dist/vendor/ieee754/index.js +1 -1
- package/dist/vendor/jsbn/index.js +714 -0
- package/dist/vendor/sdp-transform/lib/index.js +1 -1
- package/dist/vendor/sm-crypto/src/index.js +14 -0
- package/dist/vendor/sm-crypto/src/sm2/asn1.js +86 -0
- package/dist/vendor/sm-crypto/src/sm2/ec.js +205 -0
- package/dist/vendor/sm-crypto/src/sm2/index.js +114 -0
- package/dist/vendor/sm-crypto/src/sm2/sm3.js +71 -0
- package/dist/vendor/sm-crypto/src/sm2/utils.js +95 -0
- package/dist/vendor/sm-crypto/src/sm3/index.js +50 -0
- package/dist/vendor/sm-crypto/src/sm4/index.js +408 -0
- package/dist/vendor/token-types/lib/index.js +1 -1
- package/dist/vite-plugins/index.d.ts +42 -0
- package/package.json +13 -13
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
import { __require as B } from "./crypt.js";
|
|
2
|
+
var b, k;
|
|
3
|
+
function w() {
|
|
4
|
+
if (k) return b;
|
|
5
|
+
k = 1;
|
|
6
|
+
const h = B(), l = 16, y = Uint8Array.from([
|
|
7
|
+
214,
|
|
8
|
+
144,
|
|
9
|
+
233,
|
|
10
|
+
254,
|
|
11
|
+
204,
|
|
12
|
+
225,
|
|
13
|
+
61,
|
|
14
|
+
183,
|
|
15
|
+
22,
|
|
16
|
+
182,
|
|
17
|
+
20,
|
|
18
|
+
194,
|
|
19
|
+
40,
|
|
20
|
+
251,
|
|
21
|
+
44,
|
|
22
|
+
5,
|
|
23
|
+
43,
|
|
24
|
+
103,
|
|
25
|
+
154,
|
|
26
|
+
118,
|
|
27
|
+
42,
|
|
28
|
+
190,
|
|
29
|
+
4,
|
|
30
|
+
195,
|
|
31
|
+
170,
|
|
32
|
+
68,
|
|
33
|
+
19,
|
|
34
|
+
38,
|
|
35
|
+
73,
|
|
36
|
+
134,
|
|
37
|
+
6,
|
|
38
|
+
153,
|
|
39
|
+
156,
|
|
40
|
+
66,
|
|
41
|
+
80,
|
|
42
|
+
244,
|
|
43
|
+
145,
|
|
44
|
+
239,
|
|
45
|
+
152,
|
|
46
|
+
122,
|
|
47
|
+
51,
|
|
48
|
+
84,
|
|
49
|
+
11,
|
|
50
|
+
67,
|
|
51
|
+
237,
|
|
52
|
+
207,
|
|
53
|
+
172,
|
|
54
|
+
98,
|
|
55
|
+
228,
|
|
56
|
+
179,
|
|
57
|
+
28,
|
|
58
|
+
169,
|
|
59
|
+
201,
|
|
60
|
+
8,
|
|
61
|
+
232,
|
|
62
|
+
149,
|
|
63
|
+
128,
|
|
64
|
+
223,
|
|
65
|
+
148,
|
|
66
|
+
250,
|
|
67
|
+
117,
|
|
68
|
+
143,
|
|
69
|
+
63,
|
|
70
|
+
166,
|
|
71
|
+
71,
|
|
72
|
+
7,
|
|
73
|
+
167,
|
|
74
|
+
252,
|
|
75
|
+
243,
|
|
76
|
+
115,
|
|
77
|
+
23,
|
|
78
|
+
186,
|
|
79
|
+
131,
|
|
80
|
+
89,
|
|
81
|
+
60,
|
|
82
|
+
25,
|
|
83
|
+
230,
|
|
84
|
+
133,
|
|
85
|
+
79,
|
|
86
|
+
168,
|
|
87
|
+
104,
|
|
88
|
+
107,
|
|
89
|
+
129,
|
|
90
|
+
178,
|
|
91
|
+
113,
|
|
92
|
+
100,
|
|
93
|
+
218,
|
|
94
|
+
139,
|
|
95
|
+
248,
|
|
96
|
+
235,
|
|
97
|
+
15,
|
|
98
|
+
75,
|
|
99
|
+
112,
|
|
100
|
+
86,
|
|
101
|
+
157,
|
|
102
|
+
53,
|
|
103
|
+
30,
|
|
104
|
+
36,
|
|
105
|
+
14,
|
|
106
|
+
94,
|
|
107
|
+
99,
|
|
108
|
+
88,
|
|
109
|
+
209,
|
|
110
|
+
162,
|
|
111
|
+
37,
|
|
112
|
+
34,
|
|
113
|
+
124,
|
|
114
|
+
59,
|
|
115
|
+
1,
|
|
116
|
+
33,
|
|
117
|
+
120,
|
|
118
|
+
135,
|
|
119
|
+
212,
|
|
120
|
+
0,
|
|
121
|
+
70,
|
|
122
|
+
87,
|
|
123
|
+
159,
|
|
124
|
+
211,
|
|
125
|
+
39,
|
|
126
|
+
82,
|
|
127
|
+
76,
|
|
128
|
+
54,
|
|
129
|
+
2,
|
|
130
|
+
231,
|
|
131
|
+
160,
|
|
132
|
+
196,
|
|
133
|
+
200,
|
|
134
|
+
158,
|
|
135
|
+
234,
|
|
136
|
+
191,
|
|
137
|
+
138,
|
|
138
|
+
210,
|
|
139
|
+
64,
|
|
140
|
+
199,
|
|
141
|
+
56,
|
|
142
|
+
181,
|
|
143
|
+
163,
|
|
144
|
+
247,
|
|
145
|
+
242,
|
|
146
|
+
206,
|
|
147
|
+
249,
|
|
148
|
+
97,
|
|
149
|
+
21,
|
|
150
|
+
161,
|
|
151
|
+
224,
|
|
152
|
+
174,
|
|
153
|
+
93,
|
|
154
|
+
164,
|
|
155
|
+
155,
|
|
156
|
+
52,
|
|
157
|
+
26,
|
|
158
|
+
85,
|
|
159
|
+
173,
|
|
160
|
+
147,
|
|
161
|
+
50,
|
|
162
|
+
48,
|
|
163
|
+
245,
|
|
164
|
+
140,
|
|
165
|
+
177,
|
|
166
|
+
227,
|
|
167
|
+
29,
|
|
168
|
+
246,
|
|
169
|
+
226,
|
|
170
|
+
46,
|
|
171
|
+
130,
|
|
172
|
+
102,
|
|
173
|
+
202,
|
|
174
|
+
96,
|
|
175
|
+
192,
|
|
176
|
+
41,
|
|
177
|
+
35,
|
|
178
|
+
171,
|
|
179
|
+
13,
|
|
180
|
+
83,
|
|
181
|
+
78,
|
|
182
|
+
111,
|
|
183
|
+
213,
|
|
184
|
+
219,
|
|
185
|
+
55,
|
|
186
|
+
69,
|
|
187
|
+
222,
|
|
188
|
+
253,
|
|
189
|
+
142,
|
|
190
|
+
47,
|
|
191
|
+
3,
|
|
192
|
+
255,
|
|
193
|
+
106,
|
|
194
|
+
114,
|
|
195
|
+
109,
|
|
196
|
+
108,
|
|
197
|
+
91,
|
|
198
|
+
81,
|
|
199
|
+
141,
|
|
200
|
+
27,
|
|
201
|
+
175,
|
|
202
|
+
146,
|
|
203
|
+
187,
|
|
204
|
+
221,
|
|
205
|
+
188,
|
|
206
|
+
127,
|
|
207
|
+
17,
|
|
208
|
+
217,
|
|
209
|
+
92,
|
|
210
|
+
65,
|
|
211
|
+
31,
|
|
212
|
+
16,
|
|
213
|
+
90,
|
|
214
|
+
216,
|
|
215
|
+
10,
|
|
216
|
+
193,
|
|
217
|
+
49,
|
|
218
|
+
136,
|
|
219
|
+
165,
|
|
220
|
+
205,
|
|
221
|
+
123,
|
|
222
|
+
189,
|
|
223
|
+
45,
|
|
224
|
+
116,
|
|
225
|
+
208,
|
|
226
|
+
18,
|
|
227
|
+
184,
|
|
228
|
+
229,
|
|
229
|
+
180,
|
|
230
|
+
176,
|
|
231
|
+
137,
|
|
232
|
+
105,
|
|
233
|
+
151,
|
|
234
|
+
74,
|
|
235
|
+
12,
|
|
236
|
+
150,
|
|
237
|
+
119,
|
|
238
|
+
126,
|
|
239
|
+
101,
|
|
240
|
+
185,
|
|
241
|
+
241,
|
|
242
|
+
9,
|
|
243
|
+
197,
|
|
244
|
+
110,
|
|
245
|
+
198,
|
|
246
|
+
132,
|
|
247
|
+
24,
|
|
248
|
+
240,
|
|
249
|
+
125,
|
|
250
|
+
236,
|
|
251
|
+
58,
|
|
252
|
+
220,
|
|
253
|
+
77,
|
|
254
|
+
32,
|
|
255
|
+
121,
|
|
256
|
+
238,
|
|
257
|
+
95,
|
|
258
|
+
62,
|
|
259
|
+
215,
|
|
260
|
+
203,
|
|
261
|
+
57,
|
|
262
|
+
72
|
|
263
|
+
]), p = Uint32Array.from([
|
|
264
|
+
462357,
|
|
265
|
+
472066609,
|
|
266
|
+
943670861,
|
|
267
|
+
1415275113,
|
|
268
|
+
1886879365,
|
|
269
|
+
2358483617,
|
|
270
|
+
2830087869,
|
|
271
|
+
3301692121,
|
|
272
|
+
3773296373,
|
|
273
|
+
4228057617,
|
|
274
|
+
404694573,
|
|
275
|
+
876298825,
|
|
276
|
+
1347903077,
|
|
277
|
+
1819507329,
|
|
278
|
+
2291111581,
|
|
279
|
+
2762715833,
|
|
280
|
+
3234320085,
|
|
281
|
+
3705924337,
|
|
282
|
+
4177462797,
|
|
283
|
+
337322537,
|
|
284
|
+
808926789,
|
|
285
|
+
1280531041,
|
|
286
|
+
1752135293,
|
|
287
|
+
2223739545,
|
|
288
|
+
2695343797,
|
|
289
|
+
3166948049,
|
|
290
|
+
3638552301,
|
|
291
|
+
4110090761,
|
|
292
|
+
269950501,
|
|
293
|
+
741554753,
|
|
294
|
+
1213159005,
|
|
295
|
+
1684763257
|
|
296
|
+
]), u = Uint32Array.from([
|
|
297
|
+
2746333894,
|
|
298
|
+
1453994832,
|
|
299
|
+
1736282519,
|
|
300
|
+
2993693404
|
|
301
|
+
]);
|
|
302
|
+
class T {
|
|
303
|
+
/**
|
|
304
|
+
* Creates an instance of SM4.
|
|
305
|
+
* @param {Object} config
|
|
306
|
+
* @memberof SM4
|
|
307
|
+
*/
|
|
308
|
+
constructor(x) {
|
|
309
|
+
let e = h.stringToArrayBufferInUtf8(x.key);
|
|
310
|
+
if (e.length !== 16)
|
|
311
|
+
throw new Error("key should be a 16 bytes string");
|
|
312
|
+
this.key = e;
|
|
313
|
+
let t = new Uint8Array(0);
|
|
314
|
+
if (x.iv !== void 0 && x.iv !== null && (t = h.stringToArrayBufferInUtf8(x.iv), t.length !== 16))
|
|
315
|
+
throw new Error("iv should be a 16 bytes string");
|
|
316
|
+
this.iv = t, this.mode = "cbc", ["cbc", "ecb"].indexOf(x.mode) >= 0 && (this.mode = x.mode), this.cipherType = "base64", ["base64", "text"].indexOf(x.outType) >= 0 && (this.cipherType = x.outType), this.encryptRoundKeys = new Uint32Array(32), this.spawnEncryptRoundKeys(), this.decryptRoundKeys = Uint32Array.from(this.encryptRoundKeys), this.decryptRoundKeys.reverse();
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* general sm4 encrypt/decrypt algorithm for a 16 bytes block using roundKey
|
|
320
|
+
*
|
|
321
|
+
* @param {Uint32Array} blockData
|
|
322
|
+
* @param {Uint32Array} roundKeys
|
|
323
|
+
* @return {Uint32Array} return a 16 bytes cipher block
|
|
324
|
+
* @memberof SM4
|
|
325
|
+
*/
|
|
326
|
+
doBlockCrypt(x, e) {
|
|
327
|
+
let t = new Uint32Array(36);
|
|
328
|
+
t.set(x, 0);
|
|
329
|
+
for (let n = 0; n < 32; n++)
|
|
330
|
+
t[n + 4] = t[n] ^ this.tTransform1(t[n + 1] ^ t[n + 2] ^ t[n + 3] ^ e[n]);
|
|
331
|
+
let o = new Uint32Array(4);
|
|
332
|
+
return o[0] = t[35], o[1] = t[34], o[2] = t[33], o[3] = t[32], o;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* spawn round key array for encrypt. reverse this key array when decrypt.
|
|
336
|
+
* every round key's length is 32 bytes.
|
|
337
|
+
* there are 32 round keys.
|
|
338
|
+
* @return {Uint32Array}
|
|
339
|
+
* @memberof SM4
|
|
340
|
+
*/
|
|
341
|
+
spawnEncryptRoundKeys() {
|
|
342
|
+
let x = new Uint32Array(4);
|
|
343
|
+
x[0] = this.key[0] << 24 | this.key[1] << 16 | this.key[2] << 8 | this.key[3], x[1] = this.key[4] << 24 | this.key[5] << 16 | this.key[6] << 8 | this.key[7], x[2] = this.key[8] << 24 | this.key[9] << 16 | this.key[10] << 8 | this.key[11], x[3] = this.key[12] << 24 | this.key[13] << 16 | this.key[14] << 8 | this.key[15];
|
|
344
|
+
let e = new Uint32Array(36);
|
|
345
|
+
e[0] = x[0] ^ u[0], e[1] = x[1] ^ u[1], e[2] = x[2] ^ u[2], e[3] = x[3] ^ u[3];
|
|
346
|
+
for (let t = 0; t < 32; t++)
|
|
347
|
+
e[t + 4] = e[t] ^ this.tTransform2(e[t + 1] ^ e[t + 2] ^ e[t + 3] ^ p[t]), this.encryptRoundKeys[t] = e[t + 4];
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* left rotate x by y bits
|
|
351
|
+
*
|
|
352
|
+
* @param {*} x
|
|
353
|
+
* @param {Number} y
|
|
354
|
+
* @returns
|
|
355
|
+
* @memberof SM4
|
|
356
|
+
*/
|
|
357
|
+
rotateLeft(x, e) {
|
|
358
|
+
return x << e | x >>> 32 - e;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* L transform function for encrypt
|
|
362
|
+
*
|
|
363
|
+
* @param {Uint32Number} b
|
|
364
|
+
* @returns {Uint32Number}
|
|
365
|
+
* @memberof SM4
|
|
366
|
+
*/
|
|
367
|
+
linearTransform1(x) {
|
|
368
|
+
return x ^ this.rotateLeft(x, 2) ^ this.rotateLeft(x, 10) ^ this.rotateLeft(x, 18) ^ this.rotateLeft(x, 24);
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* L' transform function for key expand
|
|
372
|
+
*
|
|
373
|
+
* @param {Uint32Number} b
|
|
374
|
+
* @returns {Uint32Number}
|
|
375
|
+
* @memberof SM4
|
|
376
|
+
*/
|
|
377
|
+
linearTransform2(x) {
|
|
378
|
+
return x ^ this.rotateLeft(x, 13) ^ this.rotateLeft(x, 23);
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* τ transform function
|
|
382
|
+
*
|
|
383
|
+
* @param {Uint32Number} a
|
|
384
|
+
* @returns {Uint32Number}
|
|
385
|
+
* @memberof SM4
|
|
386
|
+
*/
|
|
387
|
+
tauTransform(x) {
|
|
388
|
+
return y[x >>> 24 & 255] << 24 | y[x >>> 16 & 255] << 16 | y[x >>> 8 & 255] << 8 | y[x & 255];
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* mix replacement T transform for encrypt
|
|
392
|
+
*
|
|
393
|
+
* @param {Uint32Number} z
|
|
394
|
+
* @returns {Uint32Number}
|
|
395
|
+
* @memberof SM4
|
|
396
|
+
*/
|
|
397
|
+
tTransform1(x) {
|
|
398
|
+
let e = this.tauTransform(x);
|
|
399
|
+
return this.linearTransform1(e);
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* mix replacement T transform for key expand
|
|
403
|
+
*
|
|
404
|
+
* @param {Uint32Number} z
|
|
405
|
+
* @returns {Uint32Number}
|
|
406
|
+
* @memberof SM4
|
|
407
|
+
*/
|
|
408
|
+
tTransform2(x) {
|
|
409
|
+
let e = this.tauTransform(x);
|
|
410
|
+
return this.linearTransform2(e);
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* padding the array length to multiple of BLOCK
|
|
414
|
+
*
|
|
415
|
+
* @param {ByteArray} originalBuffer
|
|
416
|
+
* @returns {ByteArray}
|
|
417
|
+
* @memberof SM4
|
|
418
|
+
*/
|
|
419
|
+
padding(x) {
|
|
420
|
+
if (x === null)
|
|
421
|
+
return null;
|
|
422
|
+
let e = l - x.length % l, t = new Uint8Array(x.length + e);
|
|
423
|
+
return t.set(x, 0), t.fill(e, x.length), t;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* depadding the byte array to its original length
|
|
427
|
+
*
|
|
428
|
+
* @param {ByteArray} paddedBuffer
|
|
429
|
+
* @returns {ByteArray}
|
|
430
|
+
* @memberof SM4
|
|
431
|
+
*/
|
|
432
|
+
dePadding(x) {
|
|
433
|
+
if (x === null)
|
|
434
|
+
return null;
|
|
435
|
+
let e = x[x.length - 1];
|
|
436
|
+
return x.slice(0, x.length - e);
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* exctract uint32 array block from uint8 array
|
|
440
|
+
*
|
|
441
|
+
* @param {Uint8Array} uint8Array
|
|
442
|
+
* @param {Number} baseIndex
|
|
443
|
+
* @returns {Uint32Array}
|
|
444
|
+
* @memberof SM4
|
|
445
|
+
*/
|
|
446
|
+
uint8ToUint32Block(x, e = 0) {
|
|
447
|
+
let t = new Uint32Array(4);
|
|
448
|
+
return t[0] = x[e] << 24 | x[e + 1] << 16 | x[e + 2] << 8 | x[e + 3], t[1] = x[e + 4] << 24 | x[e + 5] << 16 | x[e + 6] << 8 | x[e + 7], t[2] = x[e + 8] << 24 | x[e + 9] << 16 | x[e + 10] << 8 | x[e + 11], t[3] = x[e + 12] << 24 | x[e + 13] << 16 | x[e + 14] << 8 | x[e + 15], t;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* encrypt the string plaintext
|
|
452
|
+
*
|
|
453
|
+
* @param {String} plaintext
|
|
454
|
+
* @memberof SM4
|
|
455
|
+
* @return {String} ciphertext
|
|
456
|
+
*/
|
|
457
|
+
encrypt(x) {
|
|
458
|
+
let e = h.stringToArrayBufferInUtf8(x), t = this.padding(e), o = t.length / l, n = new Uint8Array(t.length);
|
|
459
|
+
if (this.mode === "cbc") {
|
|
460
|
+
if (this.iv === null || this.iv.length !== 16)
|
|
461
|
+
throw new Error("iv error");
|
|
462
|
+
let r = this.uint8ToUint32Block(this.iv);
|
|
463
|
+
for (let f = 0; f < o; f++) {
|
|
464
|
+
let a = f * l, s = this.uint8ToUint32Block(t, a);
|
|
465
|
+
r[0] = r[0] ^ s[0], r[1] = r[1] ^ s[1], r[2] = r[2] ^ s[2], r[3] = r[3] ^ s[3];
|
|
466
|
+
let i = this.doBlockCrypt(r, this.encryptRoundKeys);
|
|
467
|
+
r = i;
|
|
468
|
+
for (let c = 0; c < l; c++)
|
|
469
|
+
n[a + c] = i[parseInt(c / 4)] >> (3 - c) % 4 * 8 & 255;
|
|
470
|
+
}
|
|
471
|
+
} else
|
|
472
|
+
for (let r = 0; r < o; r++) {
|
|
473
|
+
let f = r * l, a = this.uint8ToUint32Block(t, f), s = this.doBlockCrypt(a, this.encryptRoundKeys);
|
|
474
|
+
for (let i = 0; i < l; i++)
|
|
475
|
+
n[f + i] = s[parseInt(i / 4)] >> (3 - i) % 4 * 8 & 255;
|
|
476
|
+
}
|
|
477
|
+
return this.cipherType === "base64" ? h.arrayBufferToBase64(n) : h.utf8ArrayBufferToString(n);
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* decrypt the string ciphertext
|
|
481
|
+
*
|
|
482
|
+
* @param {String} ciphertext
|
|
483
|
+
* @memberof SM4
|
|
484
|
+
*/
|
|
485
|
+
decrypt(x) {
|
|
486
|
+
let e = new Uint8Array();
|
|
487
|
+
this.cipherType === "base64" ? e = h.base64ToArrayBuffer(x) : e = h.stringToArrayBufferInUtf8(x);
|
|
488
|
+
let t = e.length / l, o = new Uint8Array(e.length);
|
|
489
|
+
if (this.mode === "cbc") {
|
|
490
|
+
if (this.iv === null || this.iv.length !== 16)
|
|
491
|
+
throw new Error("iv error");
|
|
492
|
+
let r = this.uint8ToUint32Block(this.iv);
|
|
493
|
+
for (let f = 0; f < t; f++) {
|
|
494
|
+
let a = f * l, s = this.uint8ToUint32Block(e, a), i = this.doBlockCrypt(s, this.decryptRoundKeys), c = new Uint32Array(4);
|
|
495
|
+
c[0] = r[0] ^ i[0], c[1] = r[1] ^ i[1], c[2] = r[2] ^ i[2], c[3] = r[3] ^ i[3], r = s;
|
|
496
|
+
for (let d = 0; d < l; d++)
|
|
497
|
+
o[a + d] = c[parseInt(d / 4)] >> (3 - d) % 4 * 8 & 255;
|
|
498
|
+
}
|
|
499
|
+
} else
|
|
500
|
+
for (let r = 0; r < t; r++) {
|
|
501
|
+
let f = r * l, a = this.uint8ToUint32Block(e, f), s = this.doBlockCrypt(a, this.decryptRoundKeys);
|
|
502
|
+
for (let i = 0; i < l; i++)
|
|
503
|
+
o[f + i] = s[parseInt(i / 4)] >> (3 - i) % 4 * 8 & 255;
|
|
504
|
+
}
|
|
505
|
+
let n = this.dePadding(o);
|
|
506
|
+
return h.utf8ArrayBufferToString(n);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
return b = T, b;
|
|
510
|
+
}
|
|
511
|
+
export {
|
|
512
|
+
w as __require
|
|
513
|
+
};
|