@cathaysia/crown-wasm 0.19.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/LICENSE +201 -0
- package/README.md +29 -0
- package/crown_wasm.d.ts +209 -0
- package/crown_wasm.js +5 -0
- package/crown_wasm_bg.js +2881 -0
- package/crown_wasm_bg.wasm +0 -0
- package/package.json +30 -0
package/crown_wasm_bg.js
ADDED
|
@@ -0,0 +1,2881 @@
|
|
|
1
|
+
let wasm;
|
|
2
|
+
export function __wbg_set_wasm(val) {
|
|
3
|
+
wasm = val;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
let cachedUint8ArrayMemory0 = null;
|
|
8
|
+
|
|
9
|
+
function getUint8ArrayMemory0() {
|
|
10
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
11
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
12
|
+
}
|
|
13
|
+
return cachedUint8ArrayMemory0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
17
|
+
ptr = ptr >>> 0;
|
|
18
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
22
|
+
|
|
23
|
+
cachedTextDecoder.decode();
|
|
24
|
+
|
|
25
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
26
|
+
let numBytesDecoded = 0;
|
|
27
|
+
function decodeText(ptr, len) {
|
|
28
|
+
numBytesDecoded += len;
|
|
29
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
30
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
31
|
+
cachedTextDecoder.decode();
|
|
32
|
+
numBytesDecoded = len;
|
|
33
|
+
}
|
|
34
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function getStringFromWasm0(ptr, len) {
|
|
38
|
+
ptr = ptr >>> 0;
|
|
39
|
+
return decodeText(ptr, len);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let WASM_VECTOR_LEN = 0;
|
|
43
|
+
|
|
44
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
45
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
46
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
47
|
+
WASM_VECTOR_LEN = arg.length;
|
|
48
|
+
return ptr;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function takeFromExternrefTable0(idx) {
|
|
52
|
+
const value = wasm.__wbindgen_export_0.get(idx);
|
|
53
|
+
wasm.__externref_table_dealloc(idx);
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function isLikeNone(x) {
|
|
58
|
+
return x === undefined || x === null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const AeadCipherFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
62
|
+
? { register: () => {}, unregister: () => {} }
|
|
63
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_aeadcipher_free(ptr >>> 0, 1));
|
|
64
|
+
|
|
65
|
+
export class AeadCipher {
|
|
66
|
+
|
|
67
|
+
static __wrap(ptr) {
|
|
68
|
+
ptr = ptr >>> 0;
|
|
69
|
+
const obj = Object.create(AeadCipher.prototype);
|
|
70
|
+
obj.__wbg_ptr = ptr;
|
|
71
|
+
AeadCipherFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
72
|
+
return obj;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
__destroy_into_raw() {
|
|
76
|
+
const ptr = this.__wbg_ptr;
|
|
77
|
+
this.__wbg_ptr = 0;
|
|
78
|
+
AeadCipherFinalization.unregister(this);
|
|
79
|
+
return ptr;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
free() {
|
|
83
|
+
const ptr = this.__destroy_into_raw();
|
|
84
|
+
wasm.__wbg_aeadcipher_free(ptr, 0);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @param {Uint8Array} key
|
|
88
|
+
* @returns {AeadCipher}
|
|
89
|
+
*/
|
|
90
|
+
static new_aes_gcm(key) {
|
|
91
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
92
|
+
const len0 = WASM_VECTOR_LEN;
|
|
93
|
+
const ret = wasm.aeadcipher_new_aes_gcm(ptr0, len0);
|
|
94
|
+
if (ret[2]) {
|
|
95
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
96
|
+
}
|
|
97
|
+
return AeadCipher.__wrap(ret[0]);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @param {Uint8Array} key
|
|
101
|
+
* @param {number} tag_size
|
|
102
|
+
* @param {number} nonce_size
|
|
103
|
+
* @returns {AeadCipher}
|
|
104
|
+
*/
|
|
105
|
+
static new_aes_ocb3(key, tag_size, nonce_size) {
|
|
106
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
107
|
+
const len0 = WASM_VECTOR_LEN;
|
|
108
|
+
const ret = wasm.aeadcipher_new_aes_ocb3(ptr0, len0, tag_size, nonce_size);
|
|
109
|
+
if (ret[2]) {
|
|
110
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
111
|
+
}
|
|
112
|
+
return AeadCipher.__wrap(ret[0]);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* @param {Uint8Array} key
|
|
116
|
+
* @returns {AeadCipher}
|
|
117
|
+
*/
|
|
118
|
+
static new_blowfish_gcm(key) {
|
|
119
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
120
|
+
const len0 = WASM_VECTOR_LEN;
|
|
121
|
+
const ret = wasm.aeadcipher_new_blowfish_gcm(ptr0, len0);
|
|
122
|
+
if (ret[2]) {
|
|
123
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
124
|
+
}
|
|
125
|
+
return AeadCipher.__wrap(ret[0]);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* @param {Uint8Array} key
|
|
129
|
+
* @param {number} tag_size
|
|
130
|
+
* @param {number} nonce_size
|
|
131
|
+
* @returns {AeadCipher}
|
|
132
|
+
*/
|
|
133
|
+
static new_blowfish_ocb3(key, tag_size, nonce_size) {
|
|
134
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
135
|
+
const len0 = WASM_VECTOR_LEN;
|
|
136
|
+
const ret = wasm.aeadcipher_new_blowfish_ocb3(ptr0, len0, tag_size, nonce_size);
|
|
137
|
+
if (ret[2]) {
|
|
138
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
139
|
+
}
|
|
140
|
+
return AeadCipher.__wrap(ret[0]);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* @param {Uint8Array} key
|
|
144
|
+
* @returns {AeadCipher}
|
|
145
|
+
*/
|
|
146
|
+
static new_cast5_gcm(key) {
|
|
147
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
148
|
+
const len0 = WASM_VECTOR_LEN;
|
|
149
|
+
const ret = wasm.aeadcipher_new_cast5_gcm(ptr0, len0);
|
|
150
|
+
if (ret[2]) {
|
|
151
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
152
|
+
}
|
|
153
|
+
return AeadCipher.__wrap(ret[0]);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* @param {Uint8Array} key
|
|
157
|
+
* @param {number} tag_size
|
|
158
|
+
* @param {number} nonce_size
|
|
159
|
+
* @returns {AeadCipher}
|
|
160
|
+
*/
|
|
161
|
+
static new_cast5_ocb3(key, tag_size, nonce_size) {
|
|
162
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
163
|
+
const len0 = WASM_VECTOR_LEN;
|
|
164
|
+
const ret = wasm.aeadcipher_new_cast5_ocb3(ptr0, len0, tag_size, nonce_size);
|
|
165
|
+
if (ret[2]) {
|
|
166
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
167
|
+
}
|
|
168
|
+
return AeadCipher.__wrap(ret[0]);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* @param {Uint8Array} key
|
|
172
|
+
* @returns {AeadCipher}
|
|
173
|
+
*/
|
|
174
|
+
static new_des_gcm(key) {
|
|
175
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
176
|
+
const len0 = WASM_VECTOR_LEN;
|
|
177
|
+
const ret = wasm.aeadcipher_new_des_gcm(ptr0, len0);
|
|
178
|
+
if (ret[2]) {
|
|
179
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
180
|
+
}
|
|
181
|
+
return AeadCipher.__wrap(ret[0]);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* @param {Uint8Array} key
|
|
185
|
+
* @param {number} tag_size
|
|
186
|
+
* @param {number} nonce_size
|
|
187
|
+
* @returns {AeadCipher}
|
|
188
|
+
*/
|
|
189
|
+
static new_des_ocb3(key, tag_size, nonce_size) {
|
|
190
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
191
|
+
const len0 = WASM_VECTOR_LEN;
|
|
192
|
+
const ret = wasm.aeadcipher_new_des_ocb3(ptr0, len0, tag_size, nonce_size);
|
|
193
|
+
if (ret[2]) {
|
|
194
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
195
|
+
}
|
|
196
|
+
return AeadCipher.__wrap(ret[0]);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* @param {Uint8Array} key
|
|
200
|
+
* @returns {AeadCipher}
|
|
201
|
+
*/
|
|
202
|
+
static new_tripledes_gcm(key) {
|
|
203
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
204
|
+
const len0 = WASM_VECTOR_LEN;
|
|
205
|
+
const ret = wasm.aeadcipher_new_tripledes_gcm(ptr0, len0);
|
|
206
|
+
if (ret[2]) {
|
|
207
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
208
|
+
}
|
|
209
|
+
return AeadCipher.__wrap(ret[0]);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* @param {Uint8Array} key
|
|
213
|
+
* @param {number} tag_size
|
|
214
|
+
* @param {number} nonce_size
|
|
215
|
+
* @returns {AeadCipher}
|
|
216
|
+
*/
|
|
217
|
+
static new_tripledes_ocb3(key, tag_size, nonce_size) {
|
|
218
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
219
|
+
const len0 = WASM_VECTOR_LEN;
|
|
220
|
+
const ret = wasm.aeadcipher_new_tripledes_ocb3(ptr0, len0, tag_size, nonce_size);
|
|
221
|
+
if (ret[2]) {
|
|
222
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
223
|
+
}
|
|
224
|
+
return AeadCipher.__wrap(ret[0]);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* @param {Uint8Array} key
|
|
228
|
+
* @returns {AeadCipher}
|
|
229
|
+
*/
|
|
230
|
+
static new_tea_gcm(key) {
|
|
231
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
232
|
+
const len0 = WASM_VECTOR_LEN;
|
|
233
|
+
const ret = wasm.aeadcipher_new_tea_gcm(ptr0, len0);
|
|
234
|
+
if (ret[2]) {
|
|
235
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
236
|
+
}
|
|
237
|
+
return AeadCipher.__wrap(ret[0]);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* @param {Uint8Array} key
|
|
241
|
+
* @param {number} tag_size
|
|
242
|
+
* @param {number} nonce_size
|
|
243
|
+
* @returns {AeadCipher}
|
|
244
|
+
*/
|
|
245
|
+
static new_tea_ocb3(key, tag_size, nonce_size) {
|
|
246
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
247
|
+
const len0 = WASM_VECTOR_LEN;
|
|
248
|
+
const ret = wasm.aeadcipher_new_tea_ocb3(ptr0, len0, tag_size, nonce_size);
|
|
249
|
+
if (ret[2]) {
|
|
250
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
251
|
+
}
|
|
252
|
+
return AeadCipher.__wrap(ret[0]);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* @param {Uint8Array} key
|
|
256
|
+
* @returns {AeadCipher}
|
|
257
|
+
*/
|
|
258
|
+
static new_twofish_gcm(key) {
|
|
259
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
260
|
+
const len0 = WASM_VECTOR_LEN;
|
|
261
|
+
const ret = wasm.aeadcipher_new_twofish_gcm(ptr0, len0);
|
|
262
|
+
if (ret[2]) {
|
|
263
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
264
|
+
}
|
|
265
|
+
return AeadCipher.__wrap(ret[0]);
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* @param {Uint8Array} key
|
|
269
|
+
* @param {number} tag_size
|
|
270
|
+
* @param {number} nonce_size
|
|
271
|
+
* @returns {AeadCipher}
|
|
272
|
+
*/
|
|
273
|
+
static new_twofish_ocb3(key, tag_size, nonce_size) {
|
|
274
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
275
|
+
const len0 = WASM_VECTOR_LEN;
|
|
276
|
+
const ret = wasm.aeadcipher_new_twofish_ocb3(ptr0, len0, tag_size, nonce_size);
|
|
277
|
+
if (ret[2]) {
|
|
278
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
279
|
+
}
|
|
280
|
+
return AeadCipher.__wrap(ret[0]);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* @param {Uint8Array} key
|
|
284
|
+
* @returns {AeadCipher}
|
|
285
|
+
*/
|
|
286
|
+
static new_xtea_gcm(key) {
|
|
287
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
288
|
+
const len0 = WASM_VECTOR_LEN;
|
|
289
|
+
const ret = wasm.aeadcipher_new_xtea_gcm(ptr0, len0);
|
|
290
|
+
if (ret[2]) {
|
|
291
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
292
|
+
}
|
|
293
|
+
return AeadCipher.__wrap(ret[0]);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* @param {Uint8Array} key
|
|
297
|
+
* @param {number} tag_size
|
|
298
|
+
* @param {number} nonce_size
|
|
299
|
+
* @returns {AeadCipher}
|
|
300
|
+
*/
|
|
301
|
+
static new_xtea_ocb3(key, tag_size, nonce_size) {
|
|
302
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
303
|
+
const len0 = WASM_VECTOR_LEN;
|
|
304
|
+
const ret = wasm.aeadcipher_new_xtea_ocb3(ptr0, len0, tag_size, nonce_size);
|
|
305
|
+
if (ret[2]) {
|
|
306
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
307
|
+
}
|
|
308
|
+
return AeadCipher.__wrap(ret[0]);
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* @param {Uint8Array} key
|
|
312
|
+
* @returns {AeadCipher}
|
|
313
|
+
*/
|
|
314
|
+
static new_rc6_gcm(key) {
|
|
315
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
316
|
+
const len0 = WASM_VECTOR_LEN;
|
|
317
|
+
const ret = wasm.aeadcipher_new_rc6_gcm(ptr0, len0);
|
|
318
|
+
if (ret[2]) {
|
|
319
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
320
|
+
}
|
|
321
|
+
return AeadCipher.__wrap(ret[0]);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* @param {Uint8Array} key
|
|
325
|
+
* @param {number} tag_size
|
|
326
|
+
* @param {number} nonce_size
|
|
327
|
+
* @returns {AeadCipher}
|
|
328
|
+
*/
|
|
329
|
+
static new_rc6_ocb3(key, tag_size, nonce_size) {
|
|
330
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
331
|
+
const len0 = WASM_VECTOR_LEN;
|
|
332
|
+
const ret = wasm.aeadcipher_new_rc6_ocb3(ptr0, len0, tag_size, nonce_size);
|
|
333
|
+
if (ret[2]) {
|
|
334
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
335
|
+
}
|
|
336
|
+
return AeadCipher.__wrap(ret[0]);
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* @param {Uint8Array} key
|
|
340
|
+
* @returns {AeadCipher}
|
|
341
|
+
*/
|
|
342
|
+
static new_sm4_gcm(key) {
|
|
343
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
344
|
+
const len0 = WASM_VECTOR_LEN;
|
|
345
|
+
const ret = wasm.aeadcipher_new_sm4_gcm(ptr0, len0);
|
|
346
|
+
if (ret[2]) {
|
|
347
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
348
|
+
}
|
|
349
|
+
return AeadCipher.__wrap(ret[0]);
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* @param {Uint8Array} key
|
|
353
|
+
* @param {number} tag_size
|
|
354
|
+
* @param {number} nonce_size
|
|
355
|
+
* @returns {AeadCipher}
|
|
356
|
+
*/
|
|
357
|
+
static new_sm4_ocb3(key, tag_size, nonce_size) {
|
|
358
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
359
|
+
const len0 = WASM_VECTOR_LEN;
|
|
360
|
+
const ret = wasm.aeadcipher_new_sm4_ocb3(ptr0, len0, tag_size, nonce_size);
|
|
361
|
+
if (ret[2]) {
|
|
362
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
363
|
+
}
|
|
364
|
+
return AeadCipher.__wrap(ret[0]);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* @param {Uint8Array} key
|
|
368
|
+
* @returns {AeadCipher}
|
|
369
|
+
*/
|
|
370
|
+
static new_skipjack_gcm(key) {
|
|
371
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
372
|
+
const len0 = WASM_VECTOR_LEN;
|
|
373
|
+
const ret = wasm.aeadcipher_new_skipjack_gcm(ptr0, len0);
|
|
374
|
+
if (ret[2]) {
|
|
375
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
376
|
+
}
|
|
377
|
+
return AeadCipher.__wrap(ret[0]);
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* @param {Uint8Array} key
|
|
381
|
+
* @param {number} tag_size
|
|
382
|
+
* @param {number} nonce_size
|
|
383
|
+
* @returns {AeadCipher}
|
|
384
|
+
*/
|
|
385
|
+
static new_skipjack_ocb3(key, tag_size, nonce_size) {
|
|
386
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
387
|
+
const len0 = WASM_VECTOR_LEN;
|
|
388
|
+
const ret = wasm.aeadcipher_new_skipjack_ocb3(ptr0, len0, tag_size, nonce_size);
|
|
389
|
+
if (ret[2]) {
|
|
390
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
391
|
+
}
|
|
392
|
+
return AeadCipher.__wrap(ret[0]);
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* @param {Uint8Array} key
|
|
396
|
+
* @returns {AeadCipher}
|
|
397
|
+
*/
|
|
398
|
+
static new_kasumi_gcm(key) {
|
|
399
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
400
|
+
const len0 = WASM_VECTOR_LEN;
|
|
401
|
+
const ret = wasm.aeadcipher_new_kasumi_gcm(ptr0, len0);
|
|
402
|
+
if (ret[2]) {
|
|
403
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
404
|
+
}
|
|
405
|
+
return AeadCipher.__wrap(ret[0]);
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* @param {Uint8Array} key
|
|
409
|
+
* @param {number} tag_size
|
|
410
|
+
* @param {number} nonce_size
|
|
411
|
+
* @returns {AeadCipher}
|
|
412
|
+
*/
|
|
413
|
+
static new_kasumi_ocb3(key, tag_size, nonce_size) {
|
|
414
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
415
|
+
const len0 = WASM_VECTOR_LEN;
|
|
416
|
+
const ret = wasm.aeadcipher_new_kasumi_ocb3(ptr0, len0, tag_size, nonce_size);
|
|
417
|
+
if (ret[2]) {
|
|
418
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
419
|
+
}
|
|
420
|
+
return AeadCipher.__wrap(ret[0]);
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* @param {Uint8Array} key
|
|
424
|
+
* @returns {AeadCipher}
|
|
425
|
+
*/
|
|
426
|
+
static new_kseed_gcm(key) {
|
|
427
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
428
|
+
const len0 = WASM_VECTOR_LEN;
|
|
429
|
+
const ret = wasm.aeadcipher_new_kseed_gcm(ptr0, len0);
|
|
430
|
+
if (ret[2]) {
|
|
431
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
432
|
+
}
|
|
433
|
+
return AeadCipher.__wrap(ret[0]);
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* @param {Uint8Array} key
|
|
437
|
+
* @param {number} tag_size
|
|
438
|
+
* @param {number} nonce_size
|
|
439
|
+
* @returns {AeadCipher}
|
|
440
|
+
*/
|
|
441
|
+
static new_kseed_ocb3(key, tag_size, nonce_size) {
|
|
442
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
443
|
+
const len0 = WASM_VECTOR_LEN;
|
|
444
|
+
const ret = wasm.aeadcipher_new_kseed_ocb3(ptr0, len0, tag_size, nonce_size);
|
|
445
|
+
if (ret[2]) {
|
|
446
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
447
|
+
}
|
|
448
|
+
return AeadCipher.__wrap(ret[0]);
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* @param {Uint8Array} key
|
|
452
|
+
* @returns {AeadCipher}
|
|
453
|
+
*/
|
|
454
|
+
static new_anubis_gcm(key) {
|
|
455
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
456
|
+
const len0 = WASM_VECTOR_LEN;
|
|
457
|
+
const ret = wasm.aeadcipher_new_anubis_gcm(ptr0, len0);
|
|
458
|
+
if (ret[2]) {
|
|
459
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
460
|
+
}
|
|
461
|
+
return AeadCipher.__wrap(ret[0]);
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* @param {Uint8Array} key
|
|
465
|
+
* @param {number} tag_size
|
|
466
|
+
* @param {number} nonce_size
|
|
467
|
+
* @returns {AeadCipher}
|
|
468
|
+
*/
|
|
469
|
+
static new_anubis_ocb3(key, tag_size, nonce_size) {
|
|
470
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
471
|
+
const len0 = WASM_VECTOR_LEN;
|
|
472
|
+
const ret = wasm.aeadcipher_new_anubis_ocb3(ptr0, len0, tag_size, nonce_size);
|
|
473
|
+
if (ret[2]) {
|
|
474
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
475
|
+
}
|
|
476
|
+
return AeadCipher.__wrap(ret[0]);
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* @param {Uint8Array} key
|
|
480
|
+
* @returns {AeadCipher}
|
|
481
|
+
*/
|
|
482
|
+
static new_noekeon_gcm(key) {
|
|
483
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
484
|
+
const len0 = WASM_VECTOR_LEN;
|
|
485
|
+
const ret = wasm.aeadcipher_new_noekeon_gcm(ptr0, len0);
|
|
486
|
+
if (ret[2]) {
|
|
487
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
488
|
+
}
|
|
489
|
+
return AeadCipher.__wrap(ret[0]);
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* @param {Uint8Array} key
|
|
493
|
+
* @param {number} tag_size
|
|
494
|
+
* @param {number} nonce_size
|
|
495
|
+
* @returns {AeadCipher}
|
|
496
|
+
*/
|
|
497
|
+
static new_noekeon_ocb3(key, tag_size, nonce_size) {
|
|
498
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
499
|
+
const len0 = WASM_VECTOR_LEN;
|
|
500
|
+
const ret = wasm.aeadcipher_new_noekeon_ocb3(ptr0, len0, tag_size, nonce_size);
|
|
501
|
+
if (ret[2]) {
|
|
502
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
503
|
+
}
|
|
504
|
+
return AeadCipher.__wrap(ret[0]);
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* @param {Uint8Array} key
|
|
508
|
+
* @returns {AeadCipher}
|
|
509
|
+
*/
|
|
510
|
+
static new_khazad_gcm(key) {
|
|
511
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
512
|
+
const len0 = WASM_VECTOR_LEN;
|
|
513
|
+
const ret = wasm.aeadcipher_new_khazad_gcm(ptr0, len0);
|
|
514
|
+
if (ret[2]) {
|
|
515
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
516
|
+
}
|
|
517
|
+
return AeadCipher.__wrap(ret[0]);
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* @param {Uint8Array} key
|
|
521
|
+
* @param {number} tag_size
|
|
522
|
+
* @param {number} nonce_size
|
|
523
|
+
* @returns {AeadCipher}
|
|
524
|
+
*/
|
|
525
|
+
static new_khazad_ocb3(key, tag_size, nonce_size) {
|
|
526
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
527
|
+
const len0 = WASM_VECTOR_LEN;
|
|
528
|
+
const ret = wasm.aeadcipher_new_khazad_ocb3(ptr0, len0, tag_size, nonce_size);
|
|
529
|
+
if (ret[2]) {
|
|
530
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
531
|
+
}
|
|
532
|
+
return AeadCipher.__wrap(ret[0]);
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* @param {Uint8Array} key
|
|
536
|
+
* @returns {AeadCipher}
|
|
537
|
+
*/
|
|
538
|
+
static new_serpent_gcm(key) {
|
|
539
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
540
|
+
const len0 = WASM_VECTOR_LEN;
|
|
541
|
+
const ret = wasm.aeadcipher_new_serpent_gcm(ptr0, len0);
|
|
542
|
+
if (ret[2]) {
|
|
543
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
544
|
+
}
|
|
545
|
+
return AeadCipher.__wrap(ret[0]);
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* @param {Uint8Array} key
|
|
549
|
+
* @param {number} tag_size
|
|
550
|
+
* @param {number} nonce_size
|
|
551
|
+
* @returns {AeadCipher}
|
|
552
|
+
*/
|
|
553
|
+
static new_serpent_ocb3(key, tag_size, nonce_size) {
|
|
554
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
555
|
+
const len0 = WASM_VECTOR_LEN;
|
|
556
|
+
const ret = wasm.aeadcipher_new_serpent_ocb3(ptr0, len0, tag_size, nonce_size);
|
|
557
|
+
if (ret[2]) {
|
|
558
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
559
|
+
}
|
|
560
|
+
return AeadCipher.__wrap(ret[0]);
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* @param {Uint8Array} key
|
|
564
|
+
* @returns {AeadCipher}
|
|
565
|
+
*/
|
|
566
|
+
static new_idea_gcm(key) {
|
|
567
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
568
|
+
const len0 = WASM_VECTOR_LEN;
|
|
569
|
+
const ret = wasm.aeadcipher_new_idea_gcm(ptr0, len0);
|
|
570
|
+
if (ret[2]) {
|
|
571
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
572
|
+
}
|
|
573
|
+
return AeadCipher.__wrap(ret[0]);
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* @param {Uint8Array} key
|
|
577
|
+
* @param {number} tag_size
|
|
578
|
+
* @param {number} nonce_size
|
|
579
|
+
* @returns {AeadCipher}
|
|
580
|
+
*/
|
|
581
|
+
static new_idea_ocb3(key, tag_size, nonce_size) {
|
|
582
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
583
|
+
const len0 = WASM_VECTOR_LEN;
|
|
584
|
+
const ret = wasm.aeadcipher_new_idea_ocb3(ptr0, len0, tag_size, nonce_size);
|
|
585
|
+
if (ret[2]) {
|
|
586
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
587
|
+
}
|
|
588
|
+
return AeadCipher.__wrap(ret[0]);
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* @param {Uint8Array} key
|
|
592
|
+
* @param {number | null} [rounds]
|
|
593
|
+
* @returns {AeadCipher}
|
|
594
|
+
*/
|
|
595
|
+
static new_rc2_gcm(key, rounds) {
|
|
596
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
597
|
+
const len0 = WASM_VECTOR_LEN;
|
|
598
|
+
const ret = wasm.aeadcipher_new_rc2_gcm(ptr0, len0, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
599
|
+
if (ret[2]) {
|
|
600
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
601
|
+
}
|
|
602
|
+
return AeadCipher.__wrap(ret[0]);
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* @param {Uint8Array} key
|
|
606
|
+
* @param {number | null} [rounds]
|
|
607
|
+
* @returns {AeadCipher}
|
|
608
|
+
*/
|
|
609
|
+
static new_rc5_gcm(key, rounds) {
|
|
610
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
611
|
+
const len0 = WASM_VECTOR_LEN;
|
|
612
|
+
const ret = wasm.aeadcipher_new_rc5_gcm(ptr0, len0, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
613
|
+
if (ret[2]) {
|
|
614
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
615
|
+
}
|
|
616
|
+
return AeadCipher.__wrap(ret[0]);
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* @param {Uint8Array} key
|
|
620
|
+
* @param {number | null} [rounds]
|
|
621
|
+
* @returns {AeadCipher}
|
|
622
|
+
*/
|
|
623
|
+
static new_camellia_gcm(key, rounds) {
|
|
624
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
625
|
+
const len0 = WASM_VECTOR_LEN;
|
|
626
|
+
const ret = wasm.aeadcipher_new_camellia_gcm(ptr0, len0, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
627
|
+
if (ret[2]) {
|
|
628
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
629
|
+
}
|
|
630
|
+
return AeadCipher.__wrap(ret[0]);
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* @param {Uint8Array} key
|
|
634
|
+
* @param {number | null} [rounds]
|
|
635
|
+
* @returns {AeadCipher}
|
|
636
|
+
*/
|
|
637
|
+
static new_multi2_gcm(key, rounds) {
|
|
638
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
639
|
+
const len0 = WASM_VECTOR_LEN;
|
|
640
|
+
const ret = wasm.aeadcipher_new_multi2_gcm(ptr0, len0, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
641
|
+
if (ret[2]) {
|
|
642
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
643
|
+
}
|
|
644
|
+
return AeadCipher.__wrap(ret[0]);
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* @param {Uint8Array} key
|
|
648
|
+
* @returns {AeadCipher}
|
|
649
|
+
*/
|
|
650
|
+
static new_chacha20_poly1305(key) {
|
|
651
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
652
|
+
const len0 = WASM_VECTOR_LEN;
|
|
653
|
+
const ret = wasm.aeadcipher_new_chacha20_poly1305(ptr0, len0);
|
|
654
|
+
if (ret[2]) {
|
|
655
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
656
|
+
}
|
|
657
|
+
return AeadCipher.__wrap(ret[0]);
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* @param {Uint8Array} key
|
|
661
|
+
* @returns {AeadCipher}
|
|
662
|
+
*/
|
|
663
|
+
static new_xchacha20_poly1305(key) {
|
|
664
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
665
|
+
const len0 = WASM_VECTOR_LEN;
|
|
666
|
+
const ret = wasm.aeadcipher_new_xchacha20_poly1305(ptr0, len0);
|
|
667
|
+
if (ret[2]) {
|
|
668
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
669
|
+
}
|
|
670
|
+
return AeadCipher.__wrap(ret[0]);
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* @returns {number}
|
|
674
|
+
*/
|
|
675
|
+
nonce_size() {
|
|
676
|
+
const ret = wasm.aeadcipher_nonce_size(this.__wbg_ptr);
|
|
677
|
+
return ret >>> 0;
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* @returns {number}
|
|
681
|
+
*/
|
|
682
|
+
tag_size() {
|
|
683
|
+
const ret = wasm.aeadcipher_tag_size(this.__wbg_ptr);
|
|
684
|
+
return ret >>> 0;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* @param {Uint8Array} data
|
|
688
|
+
* @param {Uint8Array} nonce
|
|
689
|
+
* @param {Uint8Array} aad
|
|
690
|
+
* @returns {Uint8Array}
|
|
691
|
+
*/
|
|
692
|
+
seal_in_place_separate_tag(data, nonce, aad) {
|
|
693
|
+
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
694
|
+
var len0 = WASM_VECTOR_LEN;
|
|
695
|
+
const ptr1 = passArray8ToWasm0(nonce, wasm.__wbindgen_malloc);
|
|
696
|
+
const len1 = WASM_VECTOR_LEN;
|
|
697
|
+
const ptr2 = passArray8ToWasm0(aad, wasm.__wbindgen_malloc);
|
|
698
|
+
const len2 = WASM_VECTOR_LEN;
|
|
699
|
+
const ret = wasm.aeadcipher_seal_in_place_separate_tag(this.__wbg_ptr, ptr0, len0, data, ptr1, len1, ptr2, len2);
|
|
700
|
+
if (ret[3]) {
|
|
701
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
702
|
+
}
|
|
703
|
+
var v4 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
704
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
705
|
+
return v4;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* @param {Uint8Array} data
|
|
709
|
+
* @param {Uint8Array} tag
|
|
710
|
+
* @param {Uint8Array} nonce
|
|
711
|
+
* @param {Uint8Array} aad
|
|
712
|
+
*/
|
|
713
|
+
open_in_place_separate_tag(data, tag, nonce, aad) {
|
|
714
|
+
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
715
|
+
var len0 = WASM_VECTOR_LEN;
|
|
716
|
+
const ptr1 = passArray8ToWasm0(tag, wasm.__wbindgen_malloc);
|
|
717
|
+
const len1 = WASM_VECTOR_LEN;
|
|
718
|
+
const ptr2 = passArray8ToWasm0(nonce, wasm.__wbindgen_malloc);
|
|
719
|
+
const len2 = WASM_VECTOR_LEN;
|
|
720
|
+
const ptr3 = passArray8ToWasm0(aad, wasm.__wbindgen_malloc);
|
|
721
|
+
const len3 = WASM_VECTOR_LEN;
|
|
722
|
+
const ret = wasm.aeadcipher_open_in_place_separate_tag(this.__wbg_ptr, ptr0, len0, data, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
723
|
+
if (ret[1]) {
|
|
724
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
if (Symbol.dispose) AeadCipher.prototype[Symbol.dispose] = AeadCipher.prototype.free;
|
|
729
|
+
|
|
730
|
+
const BlockCipherFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
731
|
+
? { register: () => {}, unregister: () => {} }
|
|
732
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_blockcipher_free(ptr >>> 0, 1));
|
|
733
|
+
|
|
734
|
+
export class BlockCipher {
|
|
735
|
+
|
|
736
|
+
static __wrap(ptr) {
|
|
737
|
+
ptr = ptr >>> 0;
|
|
738
|
+
const obj = Object.create(BlockCipher.prototype);
|
|
739
|
+
obj.__wbg_ptr = ptr;
|
|
740
|
+
BlockCipherFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
741
|
+
return obj;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
__destroy_into_raw() {
|
|
745
|
+
const ptr = this.__wbg_ptr;
|
|
746
|
+
this.__wbg_ptr = 0;
|
|
747
|
+
BlockCipherFinalization.unregister(this);
|
|
748
|
+
return ptr;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
free() {
|
|
752
|
+
const ptr = this.__destroy_into_raw();
|
|
753
|
+
wasm.__wbg_blockcipher_free(ptr, 0);
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* @param {Uint8Array} key
|
|
757
|
+
* @param {Uint8Array} iv
|
|
758
|
+
* @returns {BlockCipher}
|
|
759
|
+
*/
|
|
760
|
+
static new_aes_cbc(key, iv) {
|
|
761
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
762
|
+
const len0 = WASM_VECTOR_LEN;
|
|
763
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
764
|
+
const len1 = WASM_VECTOR_LEN;
|
|
765
|
+
const ret = wasm.blockcipher_new_aes_cbc(ptr0, len0, ptr1, len1);
|
|
766
|
+
if (ret[2]) {
|
|
767
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
768
|
+
}
|
|
769
|
+
return BlockCipher.__wrap(ret[0]);
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* @param {Uint8Array} key
|
|
773
|
+
* @param {Uint8Array} iv
|
|
774
|
+
* @returns {BlockCipher}
|
|
775
|
+
*/
|
|
776
|
+
static new_blowfish_cbc(key, iv) {
|
|
777
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
778
|
+
const len0 = WASM_VECTOR_LEN;
|
|
779
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
780
|
+
const len1 = WASM_VECTOR_LEN;
|
|
781
|
+
const ret = wasm.blockcipher_new_blowfish_cbc(ptr0, len0, ptr1, len1);
|
|
782
|
+
if (ret[2]) {
|
|
783
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
784
|
+
}
|
|
785
|
+
return BlockCipher.__wrap(ret[0]);
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* @param {Uint8Array} key
|
|
789
|
+
* @param {Uint8Array} iv
|
|
790
|
+
* @returns {BlockCipher}
|
|
791
|
+
*/
|
|
792
|
+
static new_cast5_cbc(key, iv) {
|
|
793
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
794
|
+
const len0 = WASM_VECTOR_LEN;
|
|
795
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
796
|
+
const len1 = WASM_VECTOR_LEN;
|
|
797
|
+
const ret = wasm.blockcipher_new_cast5_cbc(ptr0, len0, ptr1, len1);
|
|
798
|
+
if (ret[2]) {
|
|
799
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
800
|
+
}
|
|
801
|
+
return BlockCipher.__wrap(ret[0]);
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* @param {Uint8Array} key
|
|
805
|
+
* @param {Uint8Array} iv
|
|
806
|
+
* @returns {BlockCipher}
|
|
807
|
+
*/
|
|
808
|
+
static new_des_cbc(key, iv) {
|
|
809
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
810
|
+
const len0 = WASM_VECTOR_LEN;
|
|
811
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
812
|
+
const len1 = WASM_VECTOR_LEN;
|
|
813
|
+
const ret = wasm.blockcipher_new_des_cbc(ptr0, len0, ptr1, len1);
|
|
814
|
+
if (ret[2]) {
|
|
815
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
816
|
+
}
|
|
817
|
+
return BlockCipher.__wrap(ret[0]);
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* @param {Uint8Array} key
|
|
821
|
+
* @param {Uint8Array} iv
|
|
822
|
+
* @returns {BlockCipher}
|
|
823
|
+
*/
|
|
824
|
+
static new_tripledes_cbc(key, iv) {
|
|
825
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
826
|
+
const len0 = WASM_VECTOR_LEN;
|
|
827
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
828
|
+
const len1 = WASM_VECTOR_LEN;
|
|
829
|
+
const ret = wasm.blockcipher_new_tripledes_cbc(ptr0, len0, ptr1, len1);
|
|
830
|
+
if (ret[2]) {
|
|
831
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
832
|
+
}
|
|
833
|
+
return BlockCipher.__wrap(ret[0]);
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* @param {Uint8Array} key
|
|
837
|
+
* @param {Uint8Array} iv
|
|
838
|
+
* @returns {BlockCipher}
|
|
839
|
+
*/
|
|
840
|
+
static new_tea_cbc(key, iv) {
|
|
841
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
842
|
+
const len0 = WASM_VECTOR_LEN;
|
|
843
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
844
|
+
const len1 = WASM_VECTOR_LEN;
|
|
845
|
+
const ret = wasm.blockcipher_new_tea_cbc(ptr0, len0, ptr1, len1);
|
|
846
|
+
if (ret[2]) {
|
|
847
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
848
|
+
}
|
|
849
|
+
return BlockCipher.__wrap(ret[0]);
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* @param {Uint8Array} key
|
|
853
|
+
* @param {Uint8Array} iv
|
|
854
|
+
* @returns {BlockCipher}
|
|
855
|
+
*/
|
|
856
|
+
static new_twofish_cbc(key, iv) {
|
|
857
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
858
|
+
const len0 = WASM_VECTOR_LEN;
|
|
859
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
860
|
+
const len1 = WASM_VECTOR_LEN;
|
|
861
|
+
const ret = wasm.blockcipher_new_twofish_cbc(ptr0, len0, ptr1, len1);
|
|
862
|
+
if (ret[2]) {
|
|
863
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
864
|
+
}
|
|
865
|
+
return BlockCipher.__wrap(ret[0]);
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* @param {Uint8Array} key
|
|
869
|
+
* @param {Uint8Array} iv
|
|
870
|
+
* @returns {BlockCipher}
|
|
871
|
+
*/
|
|
872
|
+
static new_xtea_cbc(key, iv) {
|
|
873
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
874
|
+
const len0 = WASM_VECTOR_LEN;
|
|
875
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
876
|
+
const len1 = WASM_VECTOR_LEN;
|
|
877
|
+
const ret = wasm.blockcipher_new_xtea_cbc(ptr0, len0, ptr1, len1);
|
|
878
|
+
if (ret[2]) {
|
|
879
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
880
|
+
}
|
|
881
|
+
return BlockCipher.__wrap(ret[0]);
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* @param {Uint8Array} key
|
|
885
|
+
* @param {Uint8Array} iv
|
|
886
|
+
* @returns {BlockCipher}
|
|
887
|
+
*/
|
|
888
|
+
static new_idea_cbc(key, iv) {
|
|
889
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
890
|
+
const len0 = WASM_VECTOR_LEN;
|
|
891
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
892
|
+
const len1 = WASM_VECTOR_LEN;
|
|
893
|
+
const ret = wasm.blockcipher_new_idea_cbc(ptr0, len0, ptr1, len1);
|
|
894
|
+
if (ret[2]) {
|
|
895
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
896
|
+
}
|
|
897
|
+
return BlockCipher.__wrap(ret[0]);
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* @param {Uint8Array} key
|
|
901
|
+
* @param {Uint8Array} iv
|
|
902
|
+
* @returns {BlockCipher}
|
|
903
|
+
*/
|
|
904
|
+
static new_rc6_cbc(key, iv) {
|
|
905
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
906
|
+
const len0 = WASM_VECTOR_LEN;
|
|
907
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
908
|
+
const len1 = WASM_VECTOR_LEN;
|
|
909
|
+
const ret = wasm.blockcipher_new_rc6_cbc(ptr0, len0, ptr1, len1);
|
|
910
|
+
if (ret[2]) {
|
|
911
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
912
|
+
}
|
|
913
|
+
return BlockCipher.__wrap(ret[0]);
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* @param {Uint8Array} key
|
|
917
|
+
* @param {Uint8Array} iv
|
|
918
|
+
* @returns {BlockCipher}
|
|
919
|
+
*/
|
|
920
|
+
static new_sm4_cbc(key, iv) {
|
|
921
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
922
|
+
const len0 = WASM_VECTOR_LEN;
|
|
923
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
924
|
+
const len1 = WASM_VECTOR_LEN;
|
|
925
|
+
const ret = wasm.blockcipher_new_sm4_cbc(ptr0, len0, ptr1, len1);
|
|
926
|
+
if (ret[2]) {
|
|
927
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
928
|
+
}
|
|
929
|
+
return BlockCipher.__wrap(ret[0]);
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* @param {Uint8Array} key
|
|
933
|
+
* @param {Uint8Array} iv
|
|
934
|
+
* @returns {BlockCipher}
|
|
935
|
+
*/
|
|
936
|
+
static new_skipjack_cbc(key, iv) {
|
|
937
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
938
|
+
const len0 = WASM_VECTOR_LEN;
|
|
939
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
940
|
+
const len1 = WASM_VECTOR_LEN;
|
|
941
|
+
const ret = wasm.blockcipher_new_skipjack_cbc(ptr0, len0, ptr1, len1);
|
|
942
|
+
if (ret[2]) {
|
|
943
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
944
|
+
}
|
|
945
|
+
return BlockCipher.__wrap(ret[0]);
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* @param {Uint8Array} key
|
|
949
|
+
* @param {Uint8Array} iv
|
|
950
|
+
* @returns {BlockCipher}
|
|
951
|
+
*/
|
|
952
|
+
static new_kasumi_cbc(key, iv) {
|
|
953
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
954
|
+
const len0 = WASM_VECTOR_LEN;
|
|
955
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
956
|
+
const len1 = WASM_VECTOR_LEN;
|
|
957
|
+
const ret = wasm.blockcipher_new_kasumi_cbc(ptr0, len0, ptr1, len1);
|
|
958
|
+
if (ret[2]) {
|
|
959
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
960
|
+
}
|
|
961
|
+
return BlockCipher.__wrap(ret[0]);
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
* @param {Uint8Array} key
|
|
965
|
+
* @param {Uint8Array} iv
|
|
966
|
+
* @returns {BlockCipher}
|
|
967
|
+
*/
|
|
968
|
+
static new_kseed_cbc(key, iv) {
|
|
969
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
970
|
+
const len0 = WASM_VECTOR_LEN;
|
|
971
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
972
|
+
const len1 = WASM_VECTOR_LEN;
|
|
973
|
+
const ret = wasm.blockcipher_new_kseed_cbc(ptr0, len0, ptr1, len1);
|
|
974
|
+
if (ret[2]) {
|
|
975
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
976
|
+
}
|
|
977
|
+
return BlockCipher.__wrap(ret[0]);
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* @param {Uint8Array} key
|
|
981
|
+
* @param {Uint8Array} iv
|
|
982
|
+
* @returns {BlockCipher}
|
|
983
|
+
*/
|
|
984
|
+
static new_anubis_cbc(key, iv) {
|
|
985
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
986
|
+
const len0 = WASM_VECTOR_LEN;
|
|
987
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
988
|
+
const len1 = WASM_VECTOR_LEN;
|
|
989
|
+
const ret = wasm.blockcipher_new_anubis_cbc(ptr0, len0, ptr1, len1);
|
|
990
|
+
if (ret[2]) {
|
|
991
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
992
|
+
}
|
|
993
|
+
return BlockCipher.__wrap(ret[0]);
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* @param {Uint8Array} key
|
|
997
|
+
* @param {Uint8Array} iv
|
|
998
|
+
* @returns {BlockCipher}
|
|
999
|
+
*/
|
|
1000
|
+
static new_noekeon_cbc(key, iv) {
|
|
1001
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1002
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1003
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1004
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1005
|
+
const ret = wasm.blockcipher_new_noekeon_cbc(ptr0, len0, ptr1, len1);
|
|
1006
|
+
if (ret[2]) {
|
|
1007
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1008
|
+
}
|
|
1009
|
+
return BlockCipher.__wrap(ret[0]);
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* @param {Uint8Array} key
|
|
1013
|
+
* @param {Uint8Array} iv
|
|
1014
|
+
* @returns {BlockCipher}
|
|
1015
|
+
*/
|
|
1016
|
+
static new_khazad_cbc(key, iv) {
|
|
1017
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1018
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1019
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1020
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1021
|
+
const ret = wasm.blockcipher_new_khazad_cbc(ptr0, len0, ptr1, len1);
|
|
1022
|
+
if (ret[2]) {
|
|
1023
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1024
|
+
}
|
|
1025
|
+
return BlockCipher.__wrap(ret[0]);
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* @param {Uint8Array} key
|
|
1029
|
+
* @param {Uint8Array} iv
|
|
1030
|
+
* @returns {BlockCipher}
|
|
1031
|
+
*/
|
|
1032
|
+
static new_serpent_cbc(key, iv) {
|
|
1033
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1034
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1035
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1036
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1037
|
+
const ret = wasm.blockcipher_new_serpent_cbc(ptr0, len0, ptr1, len1);
|
|
1038
|
+
if (ret[2]) {
|
|
1039
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1040
|
+
}
|
|
1041
|
+
return BlockCipher.__wrap(ret[0]);
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* @param {Uint8Array} key
|
|
1045
|
+
* @param {Uint8Array} iv
|
|
1046
|
+
* @param {number | null} [rounds]
|
|
1047
|
+
* @returns {BlockCipher}
|
|
1048
|
+
*/
|
|
1049
|
+
static new_rc2_cbc(key, iv, rounds) {
|
|
1050
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1051
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1052
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1053
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1054
|
+
const ret = wasm.blockcipher_new_rc2_cbc(ptr0, len0, ptr1, len1, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
1055
|
+
if (ret[2]) {
|
|
1056
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1057
|
+
}
|
|
1058
|
+
return BlockCipher.__wrap(ret[0]);
|
|
1059
|
+
}
|
|
1060
|
+
/**
|
|
1061
|
+
* @param {Uint8Array} key
|
|
1062
|
+
* @param {Uint8Array} iv
|
|
1063
|
+
* @param {number | null} [rounds]
|
|
1064
|
+
* @returns {BlockCipher}
|
|
1065
|
+
*/
|
|
1066
|
+
static new_rc5_cbc(key, iv, rounds) {
|
|
1067
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1068
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1069
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1070
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1071
|
+
const ret = wasm.blockcipher_new_rc5_cbc(ptr0, len0, ptr1, len1, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
1072
|
+
if (ret[2]) {
|
|
1073
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1074
|
+
}
|
|
1075
|
+
return BlockCipher.__wrap(ret[0]);
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* @param {Uint8Array} key
|
|
1079
|
+
* @param {Uint8Array} iv
|
|
1080
|
+
* @param {number | null} [rounds]
|
|
1081
|
+
* @returns {BlockCipher}
|
|
1082
|
+
*/
|
|
1083
|
+
static new_camellia_cbc(key, iv, rounds) {
|
|
1084
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1085
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1086
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1087
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1088
|
+
const ret = wasm.blockcipher_new_camellia_cbc(ptr0, len0, ptr1, len1, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
1089
|
+
if (ret[2]) {
|
|
1090
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1091
|
+
}
|
|
1092
|
+
return BlockCipher.__wrap(ret[0]);
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
* @param {Uint8Array} key
|
|
1096
|
+
* @param {Uint8Array} iv
|
|
1097
|
+
* @param {number | null} [rounds]
|
|
1098
|
+
* @returns {BlockCipher}
|
|
1099
|
+
*/
|
|
1100
|
+
static new_multi2_cbc(key, iv, rounds) {
|
|
1101
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1102
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1103
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1104
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1105
|
+
const ret = wasm.blockcipher_new_multi2_cbc(ptr0, len0, ptr1, len1, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
1106
|
+
if (ret[2]) {
|
|
1107
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1108
|
+
}
|
|
1109
|
+
return BlockCipher.__wrap(ret[0]);
|
|
1110
|
+
}
|
|
1111
|
+
/**
|
|
1112
|
+
* @param {Uint8Array} data
|
|
1113
|
+
* @param {number} pos
|
|
1114
|
+
* @returns {number}
|
|
1115
|
+
*/
|
|
1116
|
+
encrypt(data, pos) {
|
|
1117
|
+
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
1118
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1119
|
+
const ret = wasm.blockcipher_encrypt(this.__wbg_ptr, ptr0, len0, data, pos);
|
|
1120
|
+
if (ret[2]) {
|
|
1121
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1122
|
+
}
|
|
1123
|
+
return ret[0] >>> 0;
|
|
1124
|
+
}
|
|
1125
|
+
/**
|
|
1126
|
+
* @param {Uint8Array} data
|
|
1127
|
+
* @returns {number}
|
|
1128
|
+
*/
|
|
1129
|
+
decrypt(data) {
|
|
1130
|
+
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
1131
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1132
|
+
const ret = wasm.blockcipher_decrypt(this.__wbg_ptr, ptr0, len0, data);
|
|
1133
|
+
if (ret[2]) {
|
|
1134
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1135
|
+
}
|
|
1136
|
+
return ret[0] >>> 0;
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
if (Symbol.dispose) BlockCipher.prototype[Symbol.dispose] = BlockCipher.prototype.free;
|
|
1140
|
+
|
|
1141
|
+
const HashFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1142
|
+
? { register: () => {}, unregister: () => {} }
|
|
1143
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_hash_free(ptr >>> 0, 1));
|
|
1144
|
+
|
|
1145
|
+
export class Hash {
|
|
1146
|
+
|
|
1147
|
+
static __wrap(ptr) {
|
|
1148
|
+
ptr = ptr >>> 0;
|
|
1149
|
+
const obj = Object.create(Hash.prototype);
|
|
1150
|
+
obj.__wbg_ptr = ptr;
|
|
1151
|
+
HashFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1152
|
+
return obj;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
__destroy_into_raw() {
|
|
1156
|
+
const ptr = this.__wbg_ptr;
|
|
1157
|
+
this.__wbg_ptr = 0;
|
|
1158
|
+
HashFinalization.unregister(this);
|
|
1159
|
+
return ptr;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
free() {
|
|
1163
|
+
const ptr = this.__destroy_into_raw();
|
|
1164
|
+
wasm.__wbg_hash_free(ptr, 0);
|
|
1165
|
+
}
|
|
1166
|
+
/**
|
|
1167
|
+
* @returns {Hash}
|
|
1168
|
+
*/
|
|
1169
|
+
static new_md2() {
|
|
1170
|
+
const ret = wasm.hash_new_md2();
|
|
1171
|
+
if (ret[2]) {
|
|
1172
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1173
|
+
}
|
|
1174
|
+
return Hash.__wrap(ret[0]);
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* @param {Uint8Array} key
|
|
1178
|
+
* @returns {Hash}
|
|
1179
|
+
*/
|
|
1180
|
+
static new_md2_hmac(key) {
|
|
1181
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1182
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1183
|
+
const ret = wasm.hash_new_md2_hmac(ptr0, len0);
|
|
1184
|
+
if (ret[2]) {
|
|
1185
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1186
|
+
}
|
|
1187
|
+
return Hash.__wrap(ret[0]);
|
|
1188
|
+
}
|
|
1189
|
+
/**
|
|
1190
|
+
* @returns {Hash}
|
|
1191
|
+
*/
|
|
1192
|
+
static new_md4() {
|
|
1193
|
+
const ret = wasm.hash_new_md4();
|
|
1194
|
+
if (ret[2]) {
|
|
1195
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1196
|
+
}
|
|
1197
|
+
return Hash.__wrap(ret[0]);
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* @param {Uint8Array} key
|
|
1201
|
+
* @returns {Hash}
|
|
1202
|
+
*/
|
|
1203
|
+
static new_md4_hmac(key) {
|
|
1204
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1205
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1206
|
+
const ret = wasm.hash_new_md4_hmac(ptr0, len0);
|
|
1207
|
+
if (ret[2]) {
|
|
1208
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1209
|
+
}
|
|
1210
|
+
return Hash.__wrap(ret[0]);
|
|
1211
|
+
}
|
|
1212
|
+
/**
|
|
1213
|
+
* @returns {Hash}
|
|
1214
|
+
*/
|
|
1215
|
+
static new_md5() {
|
|
1216
|
+
const ret = wasm.hash_new_md5();
|
|
1217
|
+
if (ret[2]) {
|
|
1218
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1219
|
+
}
|
|
1220
|
+
return Hash.__wrap(ret[0]);
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* @param {Uint8Array} key
|
|
1224
|
+
* @returns {Hash}
|
|
1225
|
+
*/
|
|
1226
|
+
static new_md5_hmac(key) {
|
|
1227
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1228
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1229
|
+
const ret = wasm.hash_new_md5_hmac(ptr0, len0);
|
|
1230
|
+
if (ret[2]) {
|
|
1231
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1232
|
+
}
|
|
1233
|
+
return Hash.__wrap(ret[0]);
|
|
1234
|
+
}
|
|
1235
|
+
/**
|
|
1236
|
+
* @returns {Hash}
|
|
1237
|
+
*/
|
|
1238
|
+
static new_sha1() {
|
|
1239
|
+
const ret = wasm.hash_new_sha1();
|
|
1240
|
+
if (ret[2]) {
|
|
1241
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1242
|
+
}
|
|
1243
|
+
return Hash.__wrap(ret[0]);
|
|
1244
|
+
}
|
|
1245
|
+
/**
|
|
1246
|
+
* @param {Uint8Array} key
|
|
1247
|
+
* @returns {Hash}
|
|
1248
|
+
*/
|
|
1249
|
+
static new_sha1_hmac(key) {
|
|
1250
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1251
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1252
|
+
const ret = wasm.hash_new_sha1_hmac(ptr0, len0);
|
|
1253
|
+
if (ret[2]) {
|
|
1254
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1255
|
+
}
|
|
1256
|
+
return Hash.__wrap(ret[0]);
|
|
1257
|
+
}
|
|
1258
|
+
/**
|
|
1259
|
+
* @returns {Hash}
|
|
1260
|
+
*/
|
|
1261
|
+
static new_sha224() {
|
|
1262
|
+
const ret = wasm.hash_new_sha224();
|
|
1263
|
+
if (ret[2]) {
|
|
1264
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1265
|
+
}
|
|
1266
|
+
return Hash.__wrap(ret[0]);
|
|
1267
|
+
}
|
|
1268
|
+
/**
|
|
1269
|
+
* @param {Uint8Array} key
|
|
1270
|
+
* @returns {Hash}
|
|
1271
|
+
*/
|
|
1272
|
+
static new_sha224_hmac(key) {
|
|
1273
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1274
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1275
|
+
const ret = wasm.hash_new_sha224_hmac(ptr0, len0);
|
|
1276
|
+
if (ret[2]) {
|
|
1277
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1278
|
+
}
|
|
1279
|
+
return Hash.__wrap(ret[0]);
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* @returns {Hash}
|
|
1283
|
+
*/
|
|
1284
|
+
static new_sha256() {
|
|
1285
|
+
const ret = wasm.hash_new_sha256();
|
|
1286
|
+
if (ret[2]) {
|
|
1287
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1288
|
+
}
|
|
1289
|
+
return Hash.__wrap(ret[0]);
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* @param {Uint8Array} key
|
|
1293
|
+
* @returns {Hash}
|
|
1294
|
+
*/
|
|
1295
|
+
static new_sha256_hmac(key) {
|
|
1296
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1297
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1298
|
+
const ret = wasm.hash_new_sha256_hmac(ptr0, len0);
|
|
1299
|
+
if (ret[2]) {
|
|
1300
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1301
|
+
}
|
|
1302
|
+
return Hash.__wrap(ret[0]);
|
|
1303
|
+
}
|
|
1304
|
+
/**
|
|
1305
|
+
* @returns {Hash}
|
|
1306
|
+
*/
|
|
1307
|
+
static new_sha384() {
|
|
1308
|
+
const ret = wasm.hash_new_sha384();
|
|
1309
|
+
if (ret[2]) {
|
|
1310
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1311
|
+
}
|
|
1312
|
+
return Hash.__wrap(ret[0]);
|
|
1313
|
+
}
|
|
1314
|
+
/**
|
|
1315
|
+
* @param {Uint8Array} key
|
|
1316
|
+
* @returns {Hash}
|
|
1317
|
+
*/
|
|
1318
|
+
static new_sha384_hmac(key) {
|
|
1319
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1320
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1321
|
+
const ret = wasm.hash_new_sha384_hmac(ptr0, len0);
|
|
1322
|
+
if (ret[2]) {
|
|
1323
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1324
|
+
}
|
|
1325
|
+
return Hash.__wrap(ret[0]);
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* @returns {Hash}
|
|
1329
|
+
*/
|
|
1330
|
+
static new_sha512() {
|
|
1331
|
+
const ret = wasm.hash_new_sha512();
|
|
1332
|
+
if (ret[2]) {
|
|
1333
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1334
|
+
}
|
|
1335
|
+
return Hash.__wrap(ret[0]);
|
|
1336
|
+
}
|
|
1337
|
+
/**
|
|
1338
|
+
* @param {Uint8Array} key
|
|
1339
|
+
* @returns {Hash}
|
|
1340
|
+
*/
|
|
1341
|
+
static new_sha512_hmac(key) {
|
|
1342
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1343
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1344
|
+
const ret = wasm.hash_new_sha512_hmac(ptr0, len0);
|
|
1345
|
+
if (ret[2]) {
|
|
1346
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1347
|
+
}
|
|
1348
|
+
return Hash.__wrap(ret[0]);
|
|
1349
|
+
}
|
|
1350
|
+
/**
|
|
1351
|
+
* @returns {Hash}
|
|
1352
|
+
*/
|
|
1353
|
+
static new_sha512_224() {
|
|
1354
|
+
const ret = wasm.hash_new_sha512_224();
|
|
1355
|
+
if (ret[2]) {
|
|
1356
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1357
|
+
}
|
|
1358
|
+
return Hash.__wrap(ret[0]);
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* @param {Uint8Array} key
|
|
1362
|
+
* @returns {Hash}
|
|
1363
|
+
*/
|
|
1364
|
+
static new_sha512_224_hmac(key) {
|
|
1365
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1366
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1367
|
+
const ret = wasm.hash_new_sha512_224_hmac(ptr0, len0);
|
|
1368
|
+
if (ret[2]) {
|
|
1369
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1370
|
+
}
|
|
1371
|
+
return Hash.__wrap(ret[0]);
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* @returns {Hash}
|
|
1375
|
+
*/
|
|
1376
|
+
static new_sha512_256() {
|
|
1377
|
+
const ret = wasm.hash_new_sha512_256();
|
|
1378
|
+
if (ret[2]) {
|
|
1379
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1380
|
+
}
|
|
1381
|
+
return Hash.__wrap(ret[0]);
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* @param {Uint8Array} key
|
|
1385
|
+
* @returns {Hash}
|
|
1386
|
+
*/
|
|
1387
|
+
static new_sha512_256_hmac(key) {
|
|
1388
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1389
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1390
|
+
const ret = wasm.hash_new_sha512_256_hmac(ptr0, len0);
|
|
1391
|
+
if (ret[2]) {
|
|
1392
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1393
|
+
}
|
|
1394
|
+
return Hash.__wrap(ret[0]);
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1397
|
+
* @returns {Hash}
|
|
1398
|
+
*/
|
|
1399
|
+
static new_sha3_224() {
|
|
1400
|
+
const ret = wasm.hash_new_sha3_224();
|
|
1401
|
+
if (ret[2]) {
|
|
1402
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1403
|
+
}
|
|
1404
|
+
return Hash.__wrap(ret[0]);
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* @param {Uint8Array} key
|
|
1408
|
+
* @returns {Hash}
|
|
1409
|
+
*/
|
|
1410
|
+
static new_sha3_224_hmac(key) {
|
|
1411
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1412
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1413
|
+
const ret = wasm.hash_new_sha3_224_hmac(ptr0, len0);
|
|
1414
|
+
if (ret[2]) {
|
|
1415
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1416
|
+
}
|
|
1417
|
+
return Hash.__wrap(ret[0]);
|
|
1418
|
+
}
|
|
1419
|
+
/**
|
|
1420
|
+
* @returns {Hash}
|
|
1421
|
+
*/
|
|
1422
|
+
static new_sha3_256() {
|
|
1423
|
+
const ret = wasm.hash_new_sha3_256();
|
|
1424
|
+
if (ret[2]) {
|
|
1425
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1426
|
+
}
|
|
1427
|
+
return Hash.__wrap(ret[0]);
|
|
1428
|
+
}
|
|
1429
|
+
/**
|
|
1430
|
+
* @param {Uint8Array} key
|
|
1431
|
+
* @returns {Hash}
|
|
1432
|
+
*/
|
|
1433
|
+
static new_sha3_256_hmac(key) {
|
|
1434
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1435
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1436
|
+
const ret = wasm.hash_new_sha3_256_hmac(ptr0, len0);
|
|
1437
|
+
if (ret[2]) {
|
|
1438
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1439
|
+
}
|
|
1440
|
+
return Hash.__wrap(ret[0]);
|
|
1441
|
+
}
|
|
1442
|
+
/**
|
|
1443
|
+
* @returns {Hash}
|
|
1444
|
+
*/
|
|
1445
|
+
static new_sha3_384() {
|
|
1446
|
+
const ret = wasm.hash_new_sha3_384();
|
|
1447
|
+
if (ret[2]) {
|
|
1448
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1449
|
+
}
|
|
1450
|
+
return Hash.__wrap(ret[0]);
|
|
1451
|
+
}
|
|
1452
|
+
/**
|
|
1453
|
+
* @param {Uint8Array} key
|
|
1454
|
+
* @returns {Hash}
|
|
1455
|
+
*/
|
|
1456
|
+
static new_sha3_384_hmac(key) {
|
|
1457
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1458
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1459
|
+
const ret = wasm.hash_new_sha3_384_hmac(ptr0, len0);
|
|
1460
|
+
if (ret[2]) {
|
|
1461
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1462
|
+
}
|
|
1463
|
+
return Hash.__wrap(ret[0]);
|
|
1464
|
+
}
|
|
1465
|
+
/**
|
|
1466
|
+
* @returns {Hash}
|
|
1467
|
+
*/
|
|
1468
|
+
static new_sha3_512() {
|
|
1469
|
+
const ret = wasm.hash_new_sha3_512();
|
|
1470
|
+
if (ret[2]) {
|
|
1471
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1472
|
+
}
|
|
1473
|
+
return Hash.__wrap(ret[0]);
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* @param {Uint8Array} key
|
|
1477
|
+
* @returns {Hash}
|
|
1478
|
+
*/
|
|
1479
|
+
static new_sha3_512_hmac(key) {
|
|
1480
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1481
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1482
|
+
const ret = wasm.hash_new_sha3_512_hmac(ptr0, len0);
|
|
1483
|
+
if (ret[2]) {
|
|
1484
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1485
|
+
}
|
|
1486
|
+
return Hash.__wrap(ret[0]);
|
|
1487
|
+
}
|
|
1488
|
+
/**
|
|
1489
|
+
* @returns {Hash}
|
|
1490
|
+
*/
|
|
1491
|
+
static new_shake128() {
|
|
1492
|
+
const ret = wasm.hash_new_shake128();
|
|
1493
|
+
if (ret[2]) {
|
|
1494
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1495
|
+
}
|
|
1496
|
+
return Hash.__wrap(ret[0]);
|
|
1497
|
+
}
|
|
1498
|
+
/**
|
|
1499
|
+
* @param {Uint8Array} key
|
|
1500
|
+
* @returns {Hash}
|
|
1501
|
+
*/
|
|
1502
|
+
static new_shake128_hmac(key) {
|
|
1503
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1504
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1505
|
+
const ret = wasm.hash_new_shake128_hmac(ptr0, len0);
|
|
1506
|
+
if (ret[2]) {
|
|
1507
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1508
|
+
}
|
|
1509
|
+
return Hash.__wrap(ret[0]);
|
|
1510
|
+
}
|
|
1511
|
+
/**
|
|
1512
|
+
* @returns {Hash}
|
|
1513
|
+
*/
|
|
1514
|
+
static new_shake256() {
|
|
1515
|
+
const ret = wasm.hash_new_shake256();
|
|
1516
|
+
if (ret[2]) {
|
|
1517
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1518
|
+
}
|
|
1519
|
+
return Hash.__wrap(ret[0]);
|
|
1520
|
+
}
|
|
1521
|
+
/**
|
|
1522
|
+
* @param {Uint8Array} key
|
|
1523
|
+
* @returns {Hash}
|
|
1524
|
+
*/
|
|
1525
|
+
static new_shake256_hmac(key) {
|
|
1526
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1527
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1528
|
+
const ret = wasm.hash_new_shake256_hmac(ptr0, len0);
|
|
1529
|
+
if (ret[2]) {
|
|
1530
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1531
|
+
}
|
|
1532
|
+
return Hash.__wrap(ret[0]);
|
|
1533
|
+
}
|
|
1534
|
+
/**
|
|
1535
|
+
* @returns {Hash}
|
|
1536
|
+
*/
|
|
1537
|
+
static new_sm3() {
|
|
1538
|
+
const ret = wasm.hash_new_sm3();
|
|
1539
|
+
if (ret[2]) {
|
|
1540
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1541
|
+
}
|
|
1542
|
+
return Hash.__wrap(ret[0]);
|
|
1543
|
+
}
|
|
1544
|
+
/**
|
|
1545
|
+
* @param {Uint8Array} key
|
|
1546
|
+
* @returns {Hash}
|
|
1547
|
+
*/
|
|
1548
|
+
static new_sm3_hmac(key) {
|
|
1549
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1550
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1551
|
+
const ret = wasm.hash_new_sm3_hmac(ptr0, len0);
|
|
1552
|
+
if (ret[2]) {
|
|
1553
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1554
|
+
}
|
|
1555
|
+
return Hash.__wrap(ret[0]);
|
|
1556
|
+
}
|
|
1557
|
+
/**
|
|
1558
|
+
* @param {Uint8Array | null | undefined} key
|
|
1559
|
+
* @param {number} output_len
|
|
1560
|
+
* @returns {Hash}
|
|
1561
|
+
*/
|
|
1562
|
+
static new_blake2s(key, output_len) {
|
|
1563
|
+
var ptr0 = isLikeNone(key) ? 0 : passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1564
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1565
|
+
const ret = wasm.hash_new_blake2s(ptr0, len0, output_len);
|
|
1566
|
+
if (ret[2]) {
|
|
1567
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1568
|
+
}
|
|
1569
|
+
return Hash.__wrap(ret[0]);
|
|
1570
|
+
}
|
|
1571
|
+
/**
|
|
1572
|
+
* @param {Uint8Array | null | undefined} key
|
|
1573
|
+
* @param {number} output_len
|
|
1574
|
+
* @returns {Hash}
|
|
1575
|
+
*/
|
|
1576
|
+
static new_blake2b(key, output_len) {
|
|
1577
|
+
var ptr0 = isLikeNone(key) ? 0 : passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1578
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1579
|
+
const ret = wasm.hash_new_blake2b(ptr0, len0, output_len);
|
|
1580
|
+
if (ret[2]) {
|
|
1581
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1582
|
+
}
|
|
1583
|
+
return Hash.__wrap(ret[0]);
|
|
1584
|
+
}
|
|
1585
|
+
/**
|
|
1586
|
+
* @param {Uint8Array} data
|
|
1587
|
+
* @returns {number}
|
|
1588
|
+
*/
|
|
1589
|
+
write(data) {
|
|
1590
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
1591
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1592
|
+
const ret = wasm.hash_write(this.__wbg_ptr, ptr0, len0);
|
|
1593
|
+
if (ret[2]) {
|
|
1594
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1595
|
+
}
|
|
1596
|
+
return ret[0] >>> 0;
|
|
1597
|
+
}
|
|
1598
|
+
flush() {
|
|
1599
|
+
const ret = wasm.hash_flush(this.__wbg_ptr);
|
|
1600
|
+
if (ret[1]) {
|
|
1601
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
/**
|
|
1605
|
+
* @param {Uint8Array} buf
|
|
1606
|
+
* @returns {number}
|
|
1607
|
+
*/
|
|
1608
|
+
read(buf) {
|
|
1609
|
+
var ptr0 = passArray8ToWasm0(buf, wasm.__wbindgen_malloc);
|
|
1610
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1611
|
+
const ret = wasm.hash_read(this.__wbg_ptr, ptr0, len0, buf);
|
|
1612
|
+
if (ret[2]) {
|
|
1613
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1614
|
+
}
|
|
1615
|
+
return ret[0] >>> 0;
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1618
|
+
* @returns {Uint8Array}
|
|
1619
|
+
*/
|
|
1620
|
+
sum() {
|
|
1621
|
+
const ret = wasm.hash_sum(this.__wbg_ptr);
|
|
1622
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1623
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1624
|
+
return v1;
|
|
1625
|
+
}
|
|
1626
|
+
reset() {
|
|
1627
|
+
wasm.hash_reset(this.__wbg_ptr);
|
|
1628
|
+
}
|
|
1629
|
+
/**
|
|
1630
|
+
* @returns {number}
|
|
1631
|
+
*/
|
|
1632
|
+
size() {
|
|
1633
|
+
const ret = wasm.hash_size(this.__wbg_ptr);
|
|
1634
|
+
return ret >>> 0;
|
|
1635
|
+
}
|
|
1636
|
+
/**
|
|
1637
|
+
* @returns {number}
|
|
1638
|
+
*/
|
|
1639
|
+
block_size() {
|
|
1640
|
+
const ret = wasm.hash_block_size(this.__wbg_ptr);
|
|
1641
|
+
return ret >>> 0;
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
if (Symbol.dispose) Hash.prototype[Symbol.dispose] = Hash.prototype.free;
|
|
1645
|
+
|
|
1646
|
+
const StreamCipherFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1647
|
+
? { register: () => {}, unregister: () => {} }
|
|
1648
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_streamcipher_free(ptr >>> 0, 1));
|
|
1649
|
+
|
|
1650
|
+
export class StreamCipher {
|
|
1651
|
+
|
|
1652
|
+
static __wrap(ptr) {
|
|
1653
|
+
ptr = ptr >>> 0;
|
|
1654
|
+
const obj = Object.create(StreamCipher.prototype);
|
|
1655
|
+
obj.__wbg_ptr = ptr;
|
|
1656
|
+
StreamCipherFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1657
|
+
return obj;
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
__destroy_into_raw() {
|
|
1661
|
+
const ptr = this.__wbg_ptr;
|
|
1662
|
+
this.__wbg_ptr = 0;
|
|
1663
|
+
StreamCipherFinalization.unregister(this);
|
|
1664
|
+
return ptr;
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
free() {
|
|
1668
|
+
const ptr = this.__destroy_into_raw();
|
|
1669
|
+
wasm.__wbg_streamcipher_free(ptr, 0);
|
|
1670
|
+
}
|
|
1671
|
+
/**
|
|
1672
|
+
* @param {Uint8Array} key
|
|
1673
|
+
* @param {Uint8Array} iv
|
|
1674
|
+
* @returns {StreamCipher}
|
|
1675
|
+
*/
|
|
1676
|
+
static new_aes_cfb(key, iv) {
|
|
1677
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1678
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1679
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1680
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1681
|
+
const ret = wasm.streamcipher_new_aes_cfb(ptr0, len0, ptr1, len1);
|
|
1682
|
+
if (ret[2]) {
|
|
1683
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1684
|
+
}
|
|
1685
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1686
|
+
}
|
|
1687
|
+
/**
|
|
1688
|
+
* @param {Uint8Array} key
|
|
1689
|
+
* @param {Uint8Array} iv
|
|
1690
|
+
* @returns {StreamCipher}
|
|
1691
|
+
*/
|
|
1692
|
+
static new_aes_ctr(key, iv) {
|
|
1693
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1694
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1695
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1696
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1697
|
+
const ret = wasm.streamcipher_new_aes_ctr(ptr0, len0, ptr1, len1);
|
|
1698
|
+
if (ret[2]) {
|
|
1699
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1700
|
+
}
|
|
1701
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1702
|
+
}
|
|
1703
|
+
/**
|
|
1704
|
+
* @param {Uint8Array} key
|
|
1705
|
+
* @param {Uint8Array} iv
|
|
1706
|
+
* @returns {StreamCipher}
|
|
1707
|
+
*/
|
|
1708
|
+
static new_aes_ofb(key, iv) {
|
|
1709
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1710
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1711
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1712
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1713
|
+
const ret = wasm.streamcipher_new_aes_ofb(ptr0, len0, ptr1, len1);
|
|
1714
|
+
if (ret[2]) {
|
|
1715
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1716
|
+
}
|
|
1717
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1718
|
+
}
|
|
1719
|
+
/**
|
|
1720
|
+
* @param {Uint8Array} key
|
|
1721
|
+
* @param {Uint8Array} iv
|
|
1722
|
+
* @returns {StreamCipher}
|
|
1723
|
+
*/
|
|
1724
|
+
static new_blowfish_cfb(key, iv) {
|
|
1725
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1726
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1727
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1728
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1729
|
+
const ret = wasm.streamcipher_new_blowfish_cfb(ptr0, len0, ptr1, len1);
|
|
1730
|
+
if (ret[2]) {
|
|
1731
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1732
|
+
}
|
|
1733
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1734
|
+
}
|
|
1735
|
+
/**
|
|
1736
|
+
* @param {Uint8Array} key
|
|
1737
|
+
* @param {Uint8Array} iv
|
|
1738
|
+
* @returns {StreamCipher}
|
|
1739
|
+
*/
|
|
1740
|
+
static new_blowfish_ctr(key, iv) {
|
|
1741
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1742
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1743
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1744
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1745
|
+
const ret = wasm.streamcipher_new_blowfish_ctr(ptr0, len0, ptr1, len1);
|
|
1746
|
+
if (ret[2]) {
|
|
1747
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1748
|
+
}
|
|
1749
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1750
|
+
}
|
|
1751
|
+
/**
|
|
1752
|
+
* @param {Uint8Array} key
|
|
1753
|
+
* @param {Uint8Array} iv
|
|
1754
|
+
* @returns {StreamCipher}
|
|
1755
|
+
*/
|
|
1756
|
+
static new_blowfish_ofb(key, iv) {
|
|
1757
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1758
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1759
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1760
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1761
|
+
const ret = wasm.streamcipher_new_blowfish_ofb(ptr0, len0, ptr1, len1);
|
|
1762
|
+
if (ret[2]) {
|
|
1763
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1764
|
+
}
|
|
1765
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1766
|
+
}
|
|
1767
|
+
/**
|
|
1768
|
+
* @param {Uint8Array} key
|
|
1769
|
+
* @param {Uint8Array} iv
|
|
1770
|
+
* @returns {StreamCipher}
|
|
1771
|
+
*/
|
|
1772
|
+
static new_cast5_cfb(key, iv) {
|
|
1773
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1774
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1775
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1776
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1777
|
+
const ret = wasm.streamcipher_new_cast5_cfb(ptr0, len0, ptr1, len1);
|
|
1778
|
+
if (ret[2]) {
|
|
1779
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1780
|
+
}
|
|
1781
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1782
|
+
}
|
|
1783
|
+
/**
|
|
1784
|
+
* @param {Uint8Array} key
|
|
1785
|
+
* @param {Uint8Array} iv
|
|
1786
|
+
* @returns {StreamCipher}
|
|
1787
|
+
*/
|
|
1788
|
+
static new_cast5_ctr(key, iv) {
|
|
1789
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1790
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1791
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1792
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1793
|
+
const ret = wasm.streamcipher_new_cast5_ctr(ptr0, len0, ptr1, len1);
|
|
1794
|
+
if (ret[2]) {
|
|
1795
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1796
|
+
}
|
|
1797
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1798
|
+
}
|
|
1799
|
+
/**
|
|
1800
|
+
* @param {Uint8Array} key
|
|
1801
|
+
* @param {Uint8Array} iv
|
|
1802
|
+
* @returns {StreamCipher}
|
|
1803
|
+
*/
|
|
1804
|
+
static new_cast5_ofb(key, iv) {
|
|
1805
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1806
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1807
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1808
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1809
|
+
const ret = wasm.streamcipher_new_cast5_ofb(ptr0, len0, ptr1, len1);
|
|
1810
|
+
if (ret[2]) {
|
|
1811
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1812
|
+
}
|
|
1813
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1814
|
+
}
|
|
1815
|
+
/**
|
|
1816
|
+
* @param {Uint8Array} key
|
|
1817
|
+
* @param {Uint8Array} iv
|
|
1818
|
+
* @returns {StreamCipher}
|
|
1819
|
+
*/
|
|
1820
|
+
static new_des_cfb(key, iv) {
|
|
1821
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1822
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1823
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1824
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1825
|
+
const ret = wasm.streamcipher_new_des_cfb(ptr0, len0, ptr1, len1);
|
|
1826
|
+
if (ret[2]) {
|
|
1827
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1828
|
+
}
|
|
1829
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1830
|
+
}
|
|
1831
|
+
/**
|
|
1832
|
+
* @param {Uint8Array} key
|
|
1833
|
+
* @param {Uint8Array} iv
|
|
1834
|
+
* @returns {StreamCipher}
|
|
1835
|
+
*/
|
|
1836
|
+
static new_des_ctr(key, iv) {
|
|
1837
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1838
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1839
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1840
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1841
|
+
const ret = wasm.streamcipher_new_des_ctr(ptr0, len0, ptr1, len1);
|
|
1842
|
+
if (ret[2]) {
|
|
1843
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1844
|
+
}
|
|
1845
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1846
|
+
}
|
|
1847
|
+
/**
|
|
1848
|
+
* @param {Uint8Array} key
|
|
1849
|
+
* @param {Uint8Array} iv
|
|
1850
|
+
* @returns {StreamCipher}
|
|
1851
|
+
*/
|
|
1852
|
+
static new_des_ofb(key, iv) {
|
|
1853
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1854
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1855
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1856
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1857
|
+
const ret = wasm.streamcipher_new_des_ofb(ptr0, len0, ptr1, len1);
|
|
1858
|
+
if (ret[2]) {
|
|
1859
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1860
|
+
}
|
|
1861
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1862
|
+
}
|
|
1863
|
+
/**
|
|
1864
|
+
* @param {Uint8Array} key
|
|
1865
|
+
* @param {Uint8Array} iv
|
|
1866
|
+
* @returns {StreamCipher}
|
|
1867
|
+
*/
|
|
1868
|
+
static new_tripledes_cfb(key, iv) {
|
|
1869
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1870
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1871
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1872
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1873
|
+
const ret = wasm.streamcipher_new_tripledes_cfb(ptr0, len0, ptr1, len1);
|
|
1874
|
+
if (ret[2]) {
|
|
1875
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1876
|
+
}
|
|
1877
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1878
|
+
}
|
|
1879
|
+
/**
|
|
1880
|
+
* @param {Uint8Array} key
|
|
1881
|
+
* @param {Uint8Array} iv
|
|
1882
|
+
* @returns {StreamCipher}
|
|
1883
|
+
*/
|
|
1884
|
+
static new_tripledes_ctr(key, iv) {
|
|
1885
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1886
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1887
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1888
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1889
|
+
const ret = wasm.streamcipher_new_tripledes_ctr(ptr0, len0, ptr1, len1);
|
|
1890
|
+
if (ret[2]) {
|
|
1891
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1892
|
+
}
|
|
1893
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1894
|
+
}
|
|
1895
|
+
/**
|
|
1896
|
+
* @param {Uint8Array} key
|
|
1897
|
+
* @param {Uint8Array} iv
|
|
1898
|
+
* @returns {StreamCipher}
|
|
1899
|
+
*/
|
|
1900
|
+
static new_tripledes_ofb(key, iv) {
|
|
1901
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1902
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1903
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1904
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1905
|
+
const ret = wasm.streamcipher_new_tripledes_ofb(ptr0, len0, ptr1, len1);
|
|
1906
|
+
if (ret[2]) {
|
|
1907
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1908
|
+
}
|
|
1909
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1910
|
+
}
|
|
1911
|
+
/**
|
|
1912
|
+
* @param {Uint8Array} key
|
|
1913
|
+
* @param {Uint8Array} iv
|
|
1914
|
+
* @returns {StreamCipher}
|
|
1915
|
+
*/
|
|
1916
|
+
static new_tea_cfb(key, iv) {
|
|
1917
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1918
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1919
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1920
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1921
|
+
const ret = wasm.streamcipher_new_tea_cfb(ptr0, len0, ptr1, len1);
|
|
1922
|
+
if (ret[2]) {
|
|
1923
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1924
|
+
}
|
|
1925
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1926
|
+
}
|
|
1927
|
+
/**
|
|
1928
|
+
* @param {Uint8Array} key
|
|
1929
|
+
* @param {Uint8Array} iv
|
|
1930
|
+
* @returns {StreamCipher}
|
|
1931
|
+
*/
|
|
1932
|
+
static new_tea_ctr(key, iv) {
|
|
1933
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1934
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1935
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1936
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1937
|
+
const ret = wasm.streamcipher_new_tea_ctr(ptr0, len0, ptr1, len1);
|
|
1938
|
+
if (ret[2]) {
|
|
1939
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1940
|
+
}
|
|
1941
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1942
|
+
}
|
|
1943
|
+
/**
|
|
1944
|
+
* @param {Uint8Array} key
|
|
1945
|
+
* @param {Uint8Array} iv
|
|
1946
|
+
* @returns {StreamCipher}
|
|
1947
|
+
*/
|
|
1948
|
+
static new_tea_ofb(key, iv) {
|
|
1949
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1950
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1951
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1952
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1953
|
+
const ret = wasm.streamcipher_new_tea_ofb(ptr0, len0, ptr1, len1);
|
|
1954
|
+
if (ret[2]) {
|
|
1955
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1956
|
+
}
|
|
1957
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1958
|
+
}
|
|
1959
|
+
/**
|
|
1960
|
+
* @param {Uint8Array} key
|
|
1961
|
+
* @param {Uint8Array} iv
|
|
1962
|
+
* @returns {StreamCipher}
|
|
1963
|
+
*/
|
|
1964
|
+
static new_twofish_cfb(key, iv) {
|
|
1965
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1966
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1967
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1968
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1969
|
+
const ret = wasm.streamcipher_new_twofish_cfb(ptr0, len0, ptr1, len1);
|
|
1970
|
+
if (ret[2]) {
|
|
1971
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1972
|
+
}
|
|
1973
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1974
|
+
}
|
|
1975
|
+
/**
|
|
1976
|
+
* @param {Uint8Array} key
|
|
1977
|
+
* @param {Uint8Array} iv
|
|
1978
|
+
* @returns {StreamCipher}
|
|
1979
|
+
*/
|
|
1980
|
+
static new_twofish_ctr(key, iv) {
|
|
1981
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1982
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1983
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
1984
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1985
|
+
const ret = wasm.streamcipher_new_twofish_ctr(ptr0, len0, ptr1, len1);
|
|
1986
|
+
if (ret[2]) {
|
|
1987
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1988
|
+
}
|
|
1989
|
+
return StreamCipher.__wrap(ret[0]);
|
|
1990
|
+
}
|
|
1991
|
+
/**
|
|
1992
|
+
* @param {Uint8Array} key
|
|
1993
|
+
* @param {Uint8Array} iv
|
|
1994
|
+
* @returns {StreamCipher}
|
|
1995
|
+
*/
|
|
1996
|
+
static new_twofish_ofb(key, iv) {
|
|
1997
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1998
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1999
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2000
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2001
|
+
const ret = wasm.streamcipher_new_twofish_ofb(ptr0, len0, ptr1, len1);
|
|
2002
|
+
if (ret[2]) {
|
|
2003
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2004
|
+
}
|
|
2005
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2006
|
+
}
|
|
2007
|
+
/**
|
|
2008
|
+
* @param {Uint8Array} key
|
|
2009
|
+
* @param {Uint8Array} iv
|
|
2010
|
+
* @returns {StreamCipher}
|
|
2011
|
+
*/
|
|
2012
|
+
static new_xtea_cfb(key, iv) {
|
|
2013
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2014
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2015
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2016
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2017
|
+
const ret = wasm.streamcipher_new_xtea_cfb(ptr0, len0, ptr1, len1);
|
|
2018
|
+
if (ret[2]) {
|
|
2019
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2020
|
+
}
|
|
2021
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2022
|
+
}
|
|
2023
|
+
/**
|
|
2024
|
+
* @param {Uint8Array} key
|
|
2025
|
+
* @param {Uint8Array} iv
|
|
2026
|
+
* @returns {StreamCipher}
|
|
2027
|
+
*/
|
|
2028
|
+
static new_xtea_ctr(key, iv) {
|
|
2029
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2030
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2031
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2032
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2033
|
+
const ret = wasm.streamcipher_new_xtea_ctr(ptr0, len0, ptr1, len1);
|
|
2034
|
+
if (ret[2]) {
|
|
2035
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2036
|
+
}
|
|
2037
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2038
|
+
}
|
|
2039
|
+
/**
|
|
2040
|
+
* @param {Uint8Array} key
|
|
2041
|
+
* @param {Uint8Array} iv
|
|
2042
|
+
* @returns {StreamCipher}
|
|
2043
|
+
*/
|
|
2044
|
+
static new_xtea_ofb(key, iv) {
|
|
2045
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2046
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2047
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2048
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2049
|
+
const ret = wasm.streamcipher_new_xtea_ofb(ptr0, len0, ptr1, len1);
|
|
2050
|
+
if (ret[2]) {
|
|
2051
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2052
|
+
}
|
|
2053
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2054
|
+
}
|
|
2055
|
+
/**
|
|
2056
|
+
* @param {Uint8Array} key
|
|
2057
|
+
* @param {Uint8Array} iv
|
|
2058
|
+
* @returns {StreamCipher}
|
|
2059
|
+
*/
|
|
2060
|
+
static new_idea_cfb(key, iv) {
|
|
2061
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2062
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2063
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2064
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2065
|
+
const ret = wasm.streamcipher_new_idea_cfb(ptr0, len0, ptr1, len1);
|
|
2066
|
+
if (ret[2]) {
|
|
2067
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2068
|
+
}
|
|
2069
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2070
|
+
}
|
|
2071
|
+
/**
|
|
2072
|
+
* @param {Uint8Array} key
|
|
2073
|
+
* @param {Uint8Array} iv
|
|
2074
|
+
* @returns {StreamCipher}
|
|
2075
|
+
*/
|
|
2076
|
+
static new_idea_ctr(key, iv) {
|
|
2077
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2078
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2079
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2080
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2081
|
+
const ret = wasm.streamcipher_new_idea_ctr(ptr0, len0, ptr1, len1);
|
|
2082
|
+
if (ret[2]) {
|
|
2083
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2084
|
+
}
|
|
2085
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2086
|
+
}
|
|
2087
|
+
/**
|
|
2088
|
+
* @param {Uint8Array} key
|
|
2089
|
+
* @param {Uint8Array} iv
|
|
2090
|
+
* @returns {StreamCipher}
|
|
2091
|
+
*/
|
|
2092
|
+
static new_idea_ofb(key, iv) {
|
|
2093
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2094
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2095
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2096
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2097
|
+
const ret = wasm.streamcipher_new_idea_ofb(ptr0, len0, ptr1, len1);
|
|
2098
|
+
if (ret[2]) {
|
|
2099
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2100
|
+
}
|
|
2101
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2102
|
+
}
|
|
2103
|
+
/**
|
|
2104
|
+
* @param {Uint8Array} key
|
|
2105
|
+
* @param {Uint8Array} iv
|
|
2106
|
+
* @returns {StreamCipher}
|
|
2107
|
+
*/
|
|
2108
|
+
static new_rc6_cfb(key, iv) {
|
|
2109
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2110
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2111
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2112
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2113
|
+
const ret = wasm.streamcipher_new_rc6_cfb(ptr0, len0, ptr1, len1);
|
|
2114
|
+
if (ret[2]) {
|
|
2115
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2116
|
+
}
|
|
2117
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2118
|
+
}
|
|
2119
|
+
/**
|
|
2120
|
+
* @param {Uint8Array} key
|
|
2121
|
+
* @param {Uint8Array} iv
|
|
2122
|
+
* @returns {StreamCipher}
|
|
2123
|
+
*/
|
|
2124
|
+
static new_rc6_ctr(key, iv) {
|
|
2125
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2126
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2127
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2128
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2129
|
+
const ret = wasm.streamcipher_new_rc6_ctr(ptr0, len0, ptr1, len1);
|
|
2130
|
+
if (ret[2]) {
|
|
2131
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2132
|
+
}
|
|
2133
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2134
|
+
}
|
|
2135
|
+
/**
|
|
2136
|
+
* @param {Uint8Array} key
|
|
2137
|
+
* @param {Uint8Array} iv
|
|
2138
|
+
* @returns {StreamCipher}
|
|
2139
|
+
*/
|
|
2140
|
+
static new_rc6_ofb(key, iv) {
|
|
2141
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2142
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2143
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2144
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2145
|
+
const ret = wasm.streamcipher_new_rc6_ofb(ptr0, len0, ptr1, len1);
|
|
2146
|
+
if (ret[2]) {
|
|
2147
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2148
|
+
}
|
|
2149
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2150
|
+
}
|
|
2151
|
+
/**
|
|
2152
|
+
* @param {Uint8Array} key
|
|
2153
|
+
* @param {Uint8Array} iv
|
|
2154
|
+
* @returns {StreamCipher}
|
|
2155
|
+
*/
|
|
2156
|
+
static new_sm4_cfb(key, iv) {
|
|
2157
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2158
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2159
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2160
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2161
|
+
const ret = wasm.streamcipher_new_sm4_cfb(ptr0, len0, ptr1, len1);
|
|
2162
|
+
if (ret[2]) {
|
|
2163
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2164
|
+
}
|
|
2165
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2166
|
+
}
|
|
2167
|
+
/**
|
|
2168
|
+
* @param {Uint8Array} key
|
|
2169
|
+
* @param {Uint8Array} iv
|
|
2170
|
+
* @returns {StreamCipher}
|
|
2171
|
+
*/
|
|
2172
|
+
static new_sm4_ctr(key, iv) {
|
|
2173
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2174
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2175
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2176
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2177
|
+
const ret = wasm.streamcipher_new_sm4_ctr(ptr0, len0, ptr1, len1);
|
|
2178
|
+
if (ret[2]) {
|
|
2179
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2180
|
+
}
|
|
2181
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2182
|
+
}
|
|
2183
|
+
/**
|
|
2184
|
+
* @param {Uint8Array} key
|
|
2185
|
+
* @param {Uint8Array} iv
|
|
2186
|
+
* @returns {StreamCipher}
|
|
2187
|
+
*/
|
|
2188
|
+
static new_sm4_ofb(key, iv) {
|
|
2189
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2190
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2191
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2192
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2193
|
+
const ret = wasm.streamcipher_new_sm4_ofb(ptr0, len0, ptr1, len1);
|
|
2194
|
+
if (ret[2]) {
|
|
2195
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2196
|
+
}
|
|
2197
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2198
|
+
}
|
|
2199
|
+
/**
|
|
2200
|
+
* @param {Uint8Array} key
|
|
2201
|
+
* @param {Uint8Array} iv
|
|
2202
|
+
* @returns {StreamCipher}
|
|
2203
|
+
*/
|
|
2204
|
+
static new_skipjack_cfb(key, iv) {
|
|
2205
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2206
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2207
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2208
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2209
|
+
const ret = wasm.streamcipher_new_skipjack_cfb(ptr0, len0, ptr1, len1);
|
|
2210
|
+
if (ret[2]) {
|
|
2211
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2212
|
+
}
|
|
2213
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2214
|
+
}
|
|
2215
|
+
/**
|
|
2216
|
+
* @param {Uint8Array} key
|
|
2217
|
+
* @param {Uint8Array} iv
|
|
2218
|
+
* @returns {StreamCipher}
|
|
2219
|
+
*/
|
|
2220
|
+
static new_skipjack_ctr(key, iv) {
|
|
2221
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2222
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2223
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2224
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2225
|
+
const ret = wasm.streamcipher_new_skipjack_ctr(ptr0, len0, ptr1, len1);
|
|
2226
|
+
if (ret[2]) {
|
|
2227
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2228
|
+
}
|
|
2229
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2230
|
+
}
|
|
2231
|
+
/**
|
|
2232
|
+
* @param {Uint8Array} key
|
|
2233
|
+
* @param {Uint8Array} iv
|
|
2234
|
+
* @returns {StreamCipher}
|
|
2235
|
+
*/
|
|
2236
|
+
static new_skipjack_ofb(key, iv) {
|
|
2237
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2238
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2239
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2240
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2241
|
+
const ret = wasm.streamcipher_new_skipjack_ofb(ptr0, len0, ptr1, len1);
|
|
2242
|
+
if (ret[2]) {
|
|
2243
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2244
|
+
}
|
|
2245
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2246
|
+
}
|
|
2247
|
+
/**
|
|
2248
|
+
* @param {Uint8Array} key
|
|
2249
|
+
* @param {Uint8Array} iv
|
|
2250
|
+
* @returns {StreamCipher}
|
|
2251
|
+
*/
|
|
2252
|
+
static new_kasumi_cfb(key, iv) {
|
|
2253
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2254
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2255
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2256
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2257
|
+
const ret = wasm.streamcipher_new_kasumi_cfb(ptr0, len0, ptr1, len1);
|
|
2258
|
+
if (ret[2]) {
|
|
2259
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2260
|
+
}
|
|
2261
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2262
|
+
}
|
|
2263
|
+
/**
|
|
2264
|
+
* @param {Uint8Array} key
|
|
2265
|
+
* @param {Uint8Array} iv
|
|
2266
|
+
* @returns {StreamCipher}
|
|
2267
|
+
*/
|
|
2268
|
+
static new_kasumi_ctr(key, iv) {
|
|
2269
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2270
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2271
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2272
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2273
|
+
const ret = wasm.streamcipher_new_kasumi_ctr(ptr0, len0, ptr1, len1);
|
|
2274
|
+
if (ret[2]) {
|
|
2275
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2276
|
+
}
|
|
2277
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2278
|
+
}
|
|
2279
|
+
/**
|
|
2280
|
+
* @param {Uint8Array} key
|
|
2281
|
+
* @param {Uint8Array} iv
|
|
2282
|
+
* @returns {StreamCipher}
|
|
2283
|
+
*/
|
|
2284
|
+
static new_kasumi_ofb(key, iv) {
|
|
2285
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2286
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2287
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2288
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2289
|
+
const ret = wasm.streamcipher_new_kasumi_ofb(ptr0, len0, ptr1, len1);
|
|
2290
|
+
if (ret[2]) {
|
|
2291
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2292
|
+
}
|
|
2293
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2294
|
+
}
|
|
2295
|
+
/**
|
|
2296
|
+
* @param {Uint8Array} key
|
|
2297
|
+
* @param {Uint8Array} iv
|
|
2298
|
+
* @returns {StreamCipher}
|
|
2299
|
+
*/
|
|
2300
|
+
static new_kseed_cfb(key, iv) {
|
|
2301
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2302
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2303
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2304
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2305
|
+
const ret = wasm.streamcipher_new_kseed_cfb(ptr0, len0, ptr1, len1);
|
|
2306
|
+
if (ret[2]) {
|
|
2307
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2308
|
+
}
|
|
2309
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2310
|
+
}
|
|
2311
|
+
/**
|
|
2312
|
+
* @param {Uint8Array} key
|
|
2313
|
+
* @param {Uint8Array} iv
|
|
2314
|
+
* @returns {StreamCipher}
|
|
2315
|
+
*/
|
|
2316
|
+
static new_kseed_ctr(key, iv) {
|
|
2317
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2318
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2319
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2320
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2321
|
+
const ret = wasm.streamcipher_new_kseed_ctr(ptr0, len0, ptr1, len1);
|
|
2322
|
+
if (ret[2]) {
|
|
2323
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2324
|
+
}
|
|
2325
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2326
|
+
}
|
|
2327
|
+
/**
|
|
2328
|
+
* @param {Uint8Array} key
|
|
2329
|
+
* @param {Uint8Array} iv
|
|
2330
|
+
* @returns {StreamCipher}
|
|
2331
|
+
*/
|
|
2332
|
+
static new_kseed_ofb(key, iv) {
|
|
2333
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2334
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2335
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2336
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2337
|
+
const ret = wasm.streamcipher_new_kseed_ofb(ptr0, len0, ptr1, len1);
|
|
2338
|
+
if (ret[2]) {
|
|
2339
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2340
|
+
}
|
|
2341
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2342
|
+
}
|
|
2343
|
+
/**
|
|
2344
|
+
* @param {Uint8Array} key
|
|
2345
|
+
* @param {Uint8Array} iv
|
|
2346
|
+
* @returns {StreamCipher}
|
|
2347
|
+
*/
|
|
2348
|
+
static new_anubis_cfb(key, iv) {
|
|
2349
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2350
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2351
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2352
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2353
|
+
const ret = wasm.streamcipher_new_anubis_cfb(ptr0, len0, ptr1, len1);
|
|
2354
|
+
if (ret[2]) {
|
|
2355
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2356
|
+
}
|
|
2357
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2358
|
+
}
|
|
2359
|
+
/**
|
|
2360
|
+
* @param {Uint8Array} key
|
|
2361
|
+
* @param {Uint8Array} iv
|
|
2362
|
+
* @returns {StreamCipher}
|
|
2363
|
+
*/
|
|
2364
|
+
static new_anubis_ctr(key, iv) {
|
|
2365
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2366
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2367
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2368
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2369
|
+
const ret = wasm.streamcipher_new_anubis_ctr(ptr0, len0, ptr1, len1);
|
|
2370
|
+
if (ret[2]) {
|
|
2371
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2372
|
+
}
|
|
2373
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2374
|
+
}
|
|
2375
|
+
/**
|
|
2376
|
+
* @param {Uint8Array} key
|
|
2377
|
+
* @param {Uint8Array} iv
|
|
2378
|
+
* @returns {StreamCipher}
|
|
2379
|
+
*/
|
|
2380
|
+
static new_anubis_ofb(key, iv) {
|
|
2381
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2382
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2383
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2384
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2385
|
+
const ret = wasm.streamcipher_new_anubis_ofb(ptr0, len0, ptr1, len1);
|
|
2386
|
+
if (ret[2]) {
|
|
2387
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2388
|
+
}
|
|
2389
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2390
|
+
}
|
|
2391
|
+
/**
|
|
2392
|
+
* @param {Uint8Array} key
|
|
2393
|
+
* @param {Uint8Array} iv
|
|
2394
|
+
* @returns {StreamCipher}
|
|
2395
|
+
*/
|
|
2396
|
+
static new_noekeon_cfb(key, iv) {
|
|
2397
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2398
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2399
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2400
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2401
|
+
const ret = wasm.streamcipher_new_noekeon_cfb(ptr0, len0, ptr1, len1);
|
|
2402
|
+
if (ret[2]) {
|
|
2403
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2404
|
+
}
|
|
2405
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2406
|
+
}
|
|
2407
|
+
/**
|
|
2408
|
+
* @param {Uint8Array} key
|
|
2409
|
+
* @param {Uint8Array} iv
|
|
2410
|
+
* @returns {StreamCipher}
|
|
2411
|
+
*/
|
|
2412
|
+
static new_noekeon_ctr(key, iv) {
|
|
2413
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2414
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2415
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2416
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2417
|
+
const ret = wasm.streamcipher_new_noekeon_ctr(ptr0, len0, ptr1, len1);
|
|
2418
|
+
if (ret[2]) {
|
|
2419
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2420
|
+
}
|
|
2421
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2422
|
+
}
|
|
2423
|
+
/**
|
|
2424
|
+
* @param {Uint8Array} key
|
|
2425
|
+
* @param {Uint8Array} iv
|
|
2426
|
+
* @returns {StreamCipher}
|
|
2427
|
+
*/
|
|
2428
|
+
static new_noekeon_ofb(key, iv) {
|
|
2429
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2430
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2431
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2432
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2433
|
+
const ret = wasm.streamcipher_new_noekeon_ofb(ptr0, len0, ptr1, len1);
|
|
2434
|
+
if (ret[2]) {
|
|
2435
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2436
|
+
}
|
|
2437
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2438
|
+
}
|
|
2439
|
+
/**
|
|
2440
|
+
* @param {Uint8Array} key
|
|
2441
|
+
* @param {Uint8Array} iv
|
|
2442
|
+
* @returns {StreamCipher}
|
|
2443
|
+
*/
|
|
2444
|
+
static new_khazad_cfb(key, iv) {
|
|
2445
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2446
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2447
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2448
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2449
|
+
const ret = wasm.streamcipher_new_khazad_cfb(ptr0, len0, ptr1, len1);
|
|
2450
|
+
if (ret[2]) {
|
|
2451
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2452
|
+
}
|
|
2453
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2454
|
+
}
|
|
2455
|
+
/**
|
|
2456
|
+
* @param {Uint8Array} key
|
|
2457
|
+
* @param {Uint8Array} iv
|
|
2458
|
+
* @returns {StreamCipher}
|
|
2459
|
+
*/
|
|
2460
|
+
static new_khazad_ctr(key, iv) {
|
|
2461
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2462
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2463
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2464
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2465
|
+
const ret = wasm.streamcipher_new_khazad_ctr(ptr0, len0, ptr1, len1);
|
|
2466
|
+
if (ret[2]) {
|
|
2467
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2468
|
+
}
|
|
2469
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2470
|
+
}
|
|
2471
|
+
/**
|
|
2472
|
+
* @param {Uint8Array} key
|
|
2473
|
+
* @param {Uint8Array} iv
|
|
2474
|
+
* @returns {StreamCipher}
|
|
2475
|
+
*/
|
|
2476
|
+
static new_khazad_ofb(key, iv) {
|
|
2477
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2478
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2479
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2480
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2481
|
+
const ret = wasm.streamcipher_new_khazad_ofb(ptr0, len0, ptr1, len1);
|
|
2482
|
+
if (ret[2]) {
|
|
2483
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2484
|
+
}
|
|
2485
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2486
|
+
}
|
|
2487
|
+
/**
|
|
2488
|
+
* @param {Uint8Array} key
|
|
2489
|
+
* @param {Uint8Array} iv
|
|
2490
|
+
* @returns {StreamCipher}
|
|
2491
|
+
*/
|
|
2492
|
+
static new_serpent_cfb(key, iv) {
|
|
2493
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2494
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2495
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2496
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2497
|
+
const ret = wasm.streamcipher_new_serpent_cfb(ptr0, len0, ptr1, len1);
|
|
2498
|
+
if (ret[2]) {
|
|
2499
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2500
|
+
}
|
|
2501
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2502
|
+
}
|
|
2503
|
+
/**
|
|
2504
|
+
* @param {Uint8Array} key
|
|
2505
|
+
* @param {Uint8Array} iv
|
|
2506
|
+
* @returns {StreamCipher}
|
|
2507
|
+
*/
|
|
2508
|
+
static new_serpent_ctr(key, iv) {
|
|
2509
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2510
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2511
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2512
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2513
|
+
const ret = wasm.streamcipher_new_serpent_ctr(ptr0, len0, ptr1, len1);
|
|
2514
|
+
if (ret[2]) {
|
|
2515
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2516
|
+
}
|
|
2517
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2518
|
+
}
|
|
2519
|
+
/**
|
|
2520
|
+
* @param {Uint8Array} key
|
|
2521
|
+
* @param {Uint8Array} iv
|
|
2522
|
+
* @returns {StreamCipher}
|
|
2523
|
+
*/
|
|
2524
|
+
static new_serpent_ofb(key, iv) {
|
|
2525
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2526
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2527
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2528
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2529
|
+
const ret = wasm.streamcipher_new_serpent_ofb(ptr0, len0, ptr1, len1);
|
|
2530
|
+
if (ret[2]) {
|
|
2531
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2532
|
+
}
|
|
2533
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2534
|
+
}
|
|
2535
|
+
/**
|
|
2536
|
+
* @param {Uint8Array} key
|
|
2537
|
+
* @param {Uint8Array} iv
|
|
2538
|
+
* @param {number | null} [rounds]
|
|
2539
|
+
* @returns {StreamCipher}
|
|
2540
|
+
*/
|
|
2541
|
+
static new_rc2_cfb(key, iv, rounds) {
|
|
2542
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2543
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2544
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2545
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2546
|
+
const ret = wasm.streamcipher_new_rc2_cfb(ptr0, len0, ptr1, len1, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
2547
|
+
if (ret[2]) {
|
|
2548
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2549
|
+
}
|
|
2550
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2551
|
+
}
|
|
2552
|
+
/**
|
|
2553
|
+
* @param {Uint8Array} key
|
|
2554
|
+
* @param {Uint8Array} iv
|
|
2555
|
+
* @param {number | null} [rounds]
|
|
2556
|
+
* @returns {StreamCipher}
|
|
2557
|
+
*/
|
|
2558
|
+
static new_rc2_ctr(key, iv, rounds) {
|
|
2559
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2560
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2561
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2562
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2563
|
+
const ret = wasm.streamcipher_new_rc2_ctr(ptr0, len0, ptr1, len1, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
2564
|
+
if (ret[2]) {
|
|
2565
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2566
|
+
}
|
|
2567
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2568
|
+
}
|
|
2569
|
+
/**
|
|
2570
|
+
* @param {Uint8Array} key
|
|
2571
|
+
* @param {Uint8Array} iv
|
|
2572
|
+
* @param {number | null} [rounds]
|
|
2573
|
+
* @returns {StreamCipher}
|
|
2574
|
+
*/
|
|
2575
|
+
static new_rc2_ofb(key, iv, rounds) {
|
|
2576
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2577
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2578
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2579
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2580
|
+
const ret = wasm.streamcipher_new_rc2_ofb(ptr0, len0, ptr1, len1, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
2581
|
+
if (ret[2]) {
|
|
2582
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2583
|
+
}
|
|
2584
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2585
|
+
}
|
|
2586
|
+
/**
|
|
2587
|
+
* @param {Uint8Array} key
|
|
2588
|
+
* @param {Uint8Array} iv
|
|
2589
|
+
* @param {number | null} [rounds]
|
|
2590
|
+
* @returns {StreamCipher}
|
|
2591
|
+
*/
|
|
2592
|
+
static new_rc5_cfb(key, iv, rounds) {
|
|
2593
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2594
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2595
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2596
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2597
|
+
const ret = wasm.streamcipher_new_rc5_cfb(ptr0, len0, ptr1, len1, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
2598
|
+
if (ret[2]) {
|
|
2599
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2600
|
+
}
|
|
2601
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2602
|
+
}
|
|
2603
|
+
/**
|
|
2604
|
+
* @param {Uint8Array} key
|
|
2605
|
+
* @param {Uint8Array} iv
|
|
2606
|
+
* @param {number | null} [rounds]
|
|
2607
|
+
* @returns {StreamCipher}
|
|
2608
|
+
*/
|
|
2609
|
+
static new_rc5_ctr(key, iv, rounds) {
|
|
2610
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2611
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2612
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2613
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2614
|
+
const ret = wasm.streamcipher_new_rc5_ctr(ptr0, len0, ptr1, len1, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
2615
|
+
if (ret[2]) {
|
|
2616
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2617
|
+
}
|
|
2618
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2619
|
+
}
|
|
2620
|
+
/**
|
|
2621
|
+
* @param {Uint8Array} key
|
|
2622
|
+
* @param {Uint8Array} iv
|
|
2623
|
+
* @param {number | null} [rounds]
|
|
2624
|
+
* @returns {StreamCipher}
|
|
2625
|
+
*/
|
|
2626
|
+
static new_rc5_ofb(key, iv, rounds) {
|
|
2627
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2628
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2629
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2630
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2631
|
+
const ret = wasm.streamcipher_new_rc5_ofb(ptr0, len0, ptr1, len1, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
2632
|
+
if (ret[2]) {
|
|
2633
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2634
|
+
}
|
|
2635
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2636
|
+
}
|
|
2637
|
+
/**
|
|
2638
|
+
* @param {Uint8Array} key
|
|
2639
|
+
* @param {Uint8Array} iv
|
|
2640
|
+
* @param {number | null} [rounds]
|
|
2641
|
+
* @returns {StreamCipher}
|
|
2642
|
+
*/
|
|
2643
|
+
static new_camellia_cfb(key, iv, rounds) {
|
|
2644
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2645
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2646
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2647
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2648
|
+
const ret = wasm.streamcipher_new_camellia_cfb(ptr0, len0, ptr1, len1, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
2649
|
+
if (ret[2]) {
|
|
2650
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2651
|
+
}
|
|
2652
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2653
|
+
}
|
|
2654
|
+
/**
|
|
2655
|
+
* @param {Uint8Array} key
|
|
2656
|
+
* @param {Uint8Array} iv
|
|
2657
|
+
* @param {number | null} [rounds]
|
|
2658
|
+
* @returns {StreamCipher}
|
|
2659
|
+
*/
|
|
2660
|
+
static new_camellia_ctr(key, iv, rounds) {
|
|
2661
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2662
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2663
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2664
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2665
|
+
const ret = wasm.streamcipher_new_camellia_ctr(ptr0, len0, ptr1, len1, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
2666
|
+
if (ret[2]) {
|
|
2667
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2668
|
+
}
|
|
2669
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2670
|
+
}
|
|
2671
|
+
/**
|
|
2672
|
+
* @param {Uint8Array} key
|
|
2673
|
+
* @param {Uint8Array} iv
|
|
2674
|
+
* @param {number | null} [rounds]
|
|
2675
|
+
* @returns {StreamCipher}
|
|
2676
|
+
*/
|
|
2677
|
+
static new_camellia_ofb(key, iv, rounds) {
|
|
2678
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2679
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2680
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2681
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2682
|
+
const ret = wasm.streamcipher_new_camellia_ofb(ptr0, len0, ptr1, len1, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
2683
|
+
if (ret[2]) {
|
|
2684
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2685
|
+
}
|
|
2686
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2687
|
+
}
|
|
2688
|
+
/**
|
|
2689
|
+
* @param {Uint8Array} key
|
|
2690
|
+
* @param {Uint8Array} iv
|
|
2691
|
+
* @param {number | null} [rounds]
|
|
2692
|
+
* @returns {StreamCipher}
|
|
2693
|
+
*/
|
|
2694
|
+
static new_multi2_cfb(key, iv, rounds) {
|
|
2695
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2696
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2697
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2698
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2699
|
+
const ret = wasm.streamcipher_new_multi2_cfb(ptr0, len0, ptr1, len1, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
2700
|
+
if (ret[2]) {
|
|
2701
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2702
|
+
}
|
|
2703
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2704
|
+
}
|
|
2705
|
+
/**
|
|
2706
|
+
* @param {Uint8Array} key
|
|
2707
|
+
* @param {Uint8Array} iv
|
|
2708
|
+
* @param {number | null} [rounds]
|
|
2709
|
+
* @returns {StreamCipher}
|
|
2710
|
+
*/
|
|
2711
|
+
static new_multi2_ctr(key, iv, rounds) {
|
|
2712
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2713
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2714
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2715
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2716
|
+
const ret = wasm.streamcipher_new_multi2_ctr(ptr0, len0, ptr1, len1, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
2717
|
+
if (ret[2]) {
|
|
2718
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2719
|
+
}
|
|
2720
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2721
|
+
}
|
|
2722
|
+
/**
|
|
2723
|
+
* @param {Uint8Array} key
|
|
2724
|
+
* @param {Uint8Array} iv
|
|
2725
|
+
* @param {number | null} [rounds]
|
|
2726
|
+
* @returns {StreamCipher}
|
|
2727
|
+
*/
|
|
2728
|
+
static new_multi2_ofb(key, iv, rounds) {
|
|
2729
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2730
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2731
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2732
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2733
|
+
const ret = wasm.streamcipher_new_multi2_ofb(ptr0, len0, ptr1, len1, isLikeNone(rounds) ? 0x100000001 : (rounds) >>> 0);
|
|
2734
|
+
if (ret[2]) {
|
|
2735
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2736
|
+
}
|
|
2737
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2738
|
+
}
|
|
2739
|
+
/**
|
|
2740
|
+
* @param {Uint8Array} key
|
|
2741
|
+
* @returns {StreamCipher}
|
|
2742
|
+
*/
|
|
2743
|
+
static new_rc4(key) {
|
|
2744
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2745
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2746
|
+
const ret = wasm.streamcipher_new_rc4(ptr0, len0);
|
|
2747
|
+
if (ret[2]) {
|
|
2748
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2749
|
+
}
|
|
2750
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2751
|
+
}
|
|
2752
|
+
/**
|
|
2753
|
+
* @param {Uint8Array} key
|
|
2754
|
+
* @param {Uint8Array} iv
|
|
2755
|
+
* @returns {StreamCipher}
|
|
2756
|
+
*/
|
|
2757
|
+
static new_salsa20(key, iv) {
|
|
2758
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2759
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2760
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2761
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2762
|
+
const ret = wasm.streamcipher_new_salsa20(ptr0, len0, ptr1, len1);
|
|
2763
|
+
if (ret[2]) {
|
|
2764
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2765
|
+
}
|
|
2766
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2767
|
+
}
|
|
2768
|
+
/**
|
|
2769
|
+
* @param {Uint8Array} key
|
|
2770
|
+
* @param {Uint8Array} iv
|
|
2771
|
+
* @returns {StreamCipher}
|
|
2772
|
+
*/
|
|
2773
|
+
static new_chacha20(key, iv) {
|
|
2774
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2775
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2776
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2777
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2778
|
+
const ret = wasm.streamcipher_new_chacha20(ptr0, len0, ptr1, len1);
|
|
2779
|
+
if (ret[2]) {
|
|
2780
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2781
|
+
}
|
|
2782
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2783
|
+
}
|
|
2784
|
+
/**
|
|
2785
|
+
* @param {Uint8Array} key
|
|
2786
|
+
* @param {Uint8Array} iv
|
|
2787
|
+
* @returns {StreamCipher}
|
|
2788
|
+
*/
|
|
2789
|
+
static new_rabbit(key, iv) {
|
|
2790
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2791
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2792
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2793
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2794
|
+
const ret = wasm.streamcipher_new_rabbit(ptr0, len0, ptr1, len1);
|
|
2795
|
+
if (ret[2]) {
|
|
2796
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2797
|
+
}
|
|
2798
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2799
|
+
}
|
|
2800
|
+
/**
|
|
2801
|
+
* @param {Uint8Array} key
|
|
2802
|
+
* @param {Uint8Array} iv
|
|
2803
|
+
* @returns {StreamCipher}
|
|
2804
|
+
*/
|
|
2805
|
+
static new_sosemanuk(key, iv) {
|
|
2806
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2807
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2808
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2809
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2810
|
+
const ret = wasm.streamcipher_new_sosemanuk(ptr0, len0, ptr1, len1);
|
|
2811
|
+
if (ret[2]) {
|
|
2812
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2813
|
+
}
|
|
2814
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2815
|
+
}
|
|
2816
|
+
/**
|
|
2817
|
+
* @param {Uint8Array} key
|
|
2818
|
+
* @param {Uint8Array} iv
|
|
2819
|
+
* @returns {StreamCipher}
|
|
2820
|
+
*/
|
|
2821
|
+
static new_sober128(key, iv) {
|
|
2822
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
2823
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2824
|
+
const ptr1 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
2825
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2826
|
+
const ret = wasm.streamcipher_new_sober128(ptr0, len0, ptr1, len1);
|
|
2827
|
+
if (ret[2]) {
|
|
2828
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2829
|
+
}
|
|
2830
|
+
return StreamCipher.__wrap(ret[0]);
|
|
2831
|
+
}
|
|
2832
|
+
/**
|
|
2833
|
+
* @param {Uint8Array} data
|
|
2834
|
+
*/
|
|
2835
|
+
encrypt(data) {
|
|
2836
|
+
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
2837
|
+
var len0 = WASM_VECTOR_LEN;
|
|
2838
|
+
const ret = wasm.streamcipher_encrypt(this.__wbg_ptr, ptr0, len0, data);
|
|
2839
|
+
if (ret[1]) {
|
|
2840
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2843
|
+
/**
|
|
2844
|
+
* @param {Uint8Array} data
|
|
2845
|
+
*/
|
|
2846
|
+
decrypt(data) {
|
|
2847
|
+
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
2848
|
+
var len0 = WASM_VECTOR_LEN;
|
|
2849
|
+
const ret = wasm.streamcipher_decrypt(this.__wbg_ptr, ptr0, len0, data);
|
|
2850
|
+
if (ret[1]) {
|
|
2851
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
if (Symbol.dispose) StreamCipher.prototype[Symbol.dispose] = StreamCipher.prototype.free;
|
|
2856
|
+
|
|
2857
|
+
export function __wbg_wbindgencopytotypedarray_d105febdb9374ca3(arg0, arg1, arg2) {
|
|
2858
|
+
new Uint8Array(arg2.buffer, arg2.byteOffset, arg2.byteLength).set(getArrayU8FromWasm0(arg0, arg1));
|
|
2859
|
+
};
|
|
2860
|
+
|
|
2861
|
+
export function __wbg_wbindgenthrow_451ec1a8469d7eb6(arg0, arg1) {
|
|
2862
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
2863
|
+
};
|
|
2864
|
+
|
|
2865
|
+
export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
|
|
2866
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
2867
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
2868
|
+
return ret;
|
|
2869
|
+
};
|
|
2870
|
+
|
|
2871
|
+
export function __wbindgen_init_externref_table() {
|
|
2872
|
+
const table = wasm.__wbindgen_export_0;
|
|
2873
|
+
const offset = table.grow(4);
|
|
2874
|
+
table.set(0, undefined);
|
|
2875
|
+
table.set(offset + 0, undefined);
|
|
2876
|
+
table.set(offset + 1, null);
|
|
2877
|
+
table.set(offset + 2, true);
|
|
2878
|
+
table.set(offset + 3, false);
|
|
2879
|
+
;
|
|
2880
|
+
};
|
|
2881
|
+
|