1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298 |
x1
x1
x1
x1
x1
x24
x24
x46
x46
x1
x24
x24
x24
x1
x24
x24
x24
x24
x1
x24
x1
x24
x1
x2025998
x2025998
x2025998
x2025998
x2026011
x2026011
x2025998
x2025998
x1
x1295
x1295
x1295
x1295
x1295
x1295
x1
x24
x1
x24
x24
x24
x1
x24
x1
x24
x1
x1013043
x1
x1013043
x1013043
x1
x1013043
x1
x1013043
x1
x1013043
x7066294
x7066294
x7066294
x1
x1
x1
x1013043
x1013043
x1013043
x1
x1012979
x1012979
x1012979
x1
x1295
x1295
x1295
x1295
x1295
x1
x1011708
x1011708
x1011708
x1011708
x1
x1
x1
x1
x1
x1
x1
x1
x1
x1
x1
x1
x1
x1
x24
x1010645
x1010645
x1010645
x1010645
x1010645
x1010645
x1010645
x1010645
x1010645
x1010645
x1010645
x1010645
x1010645
x1010694
x1010694
x2021217
x2021217
x2021217
x1010645
x1
x24
x24
x80
x24
x1
x1
x1
x24
x24
x2358
x2358
x2358
x2358
x2358
x1
x24
x1
x1
x1
x1
x1
x1
x24
x2422
x2422
x2422
x2422
x2422
x2422
x2422
x2422
x2422
x2422
x2422
x24
x1
x1
x1
x1
x1
x1
x1
x24
x3325
x3325
x24
x1
x1
x1
x1
x1
x1
x1
x1
x1
x1
x1
x1
x1
x24
x2358
x2358
x2358
x2358
x2358
x2358
x3580
x3580
x3470
x3470
x3470
x2358
x24
x1
x24
x1013945
x1013945
x1013945
x1
x24
x1023955
x1023955
x1023955
x1
x24
x1013945
x1013945
x1013945
x1
x24
x1013945
x1013945
x1013945
x1
x24
x2047886
x2047886
x2047886
x1
x24
x1023955
x1023955
x1023955
x1
x24
x1295
x1295
x1295
x1
x24
x10669
x10669
x10669
x10669
x10669
x10669
x10669
x1
x24
x1023955
x1023955
x1
x24
x46
x46
x46
x46
x46
x46
x46
x46
x1
x24
x1023957
x1023957
x1023957
x1
|
I
I
I
I
I
|
// @generated file from wasmbuild -- do not edit
// @ts-nocheck: generated
// deno-lint-ignore-file
// deno-fmt-ignore-file
let wasm;
export function __wbg_set_wasm(val) {
wasm = val;
}
const lTextDecoder = typeof TextDecoder === "undefined"
? (0, module.require)("util").TextDecoder
: TextDecoder;
let cachedTextDecoder = new lTextDecoder("utf-8", {
ignoreBOM: true,
fatal: true,
});
cachedTextDecoder.decode();
let cachedUint8ArrayMemory0 = null;
function getUint8ArrayMemory0() {
if (
cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0
) {
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
}
return cachedUint8ArrayMemory0;
}
function getStringFromWasm0(ptr, len) {
ptr = ptr >>> 0;
return cachedTextDecoder.decode(
getUint8ArrayMemory0().subarray(ptr, ptr + len),
);
}
let WASM_VECTOR_LEN = 0;
const lTextEncoder = typeof TextEncoder === "undefined"
? (0, module.require)("util").TextEncoder
: TextEncoder;
let cachedTextEncoder = new lTextEncoder("utf-8");
const encodeString = typeof cachedTextEncoder.encodeInto === "function"
? function (arg, view) {
return cachedTextEncoder.encodeInto(arg, view);
}
: function (arg, view) {
const buf = cachedTextEncoder.encode(arg);
view.set(buf);
return {
read: arg.length,
written: buf.length,
};
};
function passStringToWasm0(arg, malloc, realloc) {
if (realloc === undefined) {
const buf = cachedTextEncoder.encode(arg);
const ptr = malloc(buf.length, 1) >>> 0;
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
WASM_VECTOR_LEN = buf.length;
return ptr;
}
let len = arg.length;
let ptr = malloc(len, 1) >>> 0;
const mem = getUint8ArrayMemory0();
let offset = 0;
for (; offset < len; offset++) {
const code = arg.charCodeAt(offset);
if (code > 0x7F) break;
mem[ptr + offset] = code;
}
if (offset !== len) {
if (offset !== 0) {
arg = arg.slice(offset);
}
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
const ret = encodeString(arg, view);
offset += ret.written;
ptr = realloc(ptr, len, offset, 1) >>> 0;
}
WASM_VECTOR_LEN = offset;
return ptr;
}
function isLikeNone(x) {
return x === undefined || x === null;
}
function takeFromExternrefTable0(idx) {
const value = wasm.__wbindgen_export_0.get(idx);
wasm.__externref_table_dealloc(idx);
return value;
}
function getArrayU8FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
}
/**
* Returns the digest of the given `data` using the given hash `algorithm`.
*
* `length` will usually be left `undefined` to use the default length for
* the algorithm. For algorithms with variable-length output, it can be used
* to specify a non-negative integer number of bytes.
*
* An error will be thrown if `algorithm` is not a supported hash algorithm or
* `length` is not a supported length for the algorithm.
* @param {string} algorithm
* @param {Uint8Array} data
* @param {number | null} [length]
* @returns {Uint8Array}
*/
export function digest(algorithm, data, length) {
const ptr0 = passStringToWasm0(
algorithm,
wasm.__wbindgen_malloc,
wasm.__wbindgen_realloc,
);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.digest(
ptr0,
len0,
data,
isLikeNone(length) ? 0x100000001 : length >>> 0,
);
if (ret[3]) {
throw takeFromExternrefTable0(ret[2]);
}
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
return v2;
}
const DigestContextFinalization = (typeof FinalizationRegistry === "undefined")
? { register: () => {}, unregister: () => {} }
: new FinalizationRegistry((ptr) =>
wasm.__wbg_digestcontext_free(ptr >>> 0, 1)
);
/**
* A context for incrementally computing a digest using a given hash algorithm.
*/
export class DigestContext {
__destroy_into_raw() {
const ptr = this.__wbg_ptr;
this.__wbg_ptr = 0;
DigestContextFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_digestcontext_free(ptr, 0);
}
/**
* Creates a new context incrementally computing a digest using the given
* hash algorithm.
*
* An error will be thrown if `algorithm` is not a supported hash algorithm.
* @param {string} algorithm
*/
constructor(algorithm) {
const ptr0 = passStringToWasm0(
algorithm,
wasm.__wbindgen_malloc,
wasm.__wbindgen_realloc,
);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.digestcontext_new(ptr0, len0);
if (ret[2]) {
throw takeFromExternrefTable0(ret[1]);
}
this.__wbg_ptr = ret[0] >>> 0;
DigestContextFinalization.register(this, this.__wbg_ptr, this);
return this;
}
/**
* Update the digest's internal state with the additional input `data`.
*
* If the `data` array view is large, it will be split into subarrays (via
* JavaScript bindings) which will be processed sequentially in order to
* limit the amount of memory that needs to be allocated in the Wasm heap.
* @param {Uint8Array} data
*/
update(data) {
const ret = wasm.digestcontext_update(this.__wbg_ptr, data);
if (ret[1]) {
throw takeFromExternrefTable0(ret[0]);
}
}
/**
* Returns the digest of the input data so far, and then drops the context
* from memory on the Wasm side. This context must no longer be used, and any
* further method calls will result in null pointer errors being thrown.
* https://github.com/rustwasm/wasm-bindgen/blob/bf39cfd8/crates/backend/src/codegen.rs#L186
*
* `length` will usually be left `undefined` to use the default length for
* the algorithm. For algorithms with variable-length output, it can be used
* to specify a non-negative integer number of bytes.
*
* An error will be thrown if `length` is not a supported length for the algorithm.
* @param {number | null} [length]
* @returns {Uint8Array}
*/
digestAndDrop(length) {
const ptr = this.__destroy_into_raw();
const ret = wasm.digestcontext_digestAndDrop(
ptr,
isLikeNone(length) ? 0x100000001 : length >>> 0,
);
if (ret[3]) {
throw takeFromExternrefTable0(ret[2]);
}
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
return v1;
}
}
export function __wbg_buffer_09165b52af8c5237(arg0) {
const ret = arg0.buffer;
return ret;
}
export function __wbg_buffer_609cc3eee51ed158(arg0) {
const ret = arg0.buffer;
return ret;
}
export function __wbg_byteLength_e674b853d9c77e1d(arg0) {
const ret = arg0.byteLength;
return ret;
}
export function __wbg_byteOffset_fd862df290ef848d(arg0) {
const ret = arg0.byteOffset;
return ret;
}
export function __wbg_length_a446193dc22c12f8(arg0) {
const ret = arg0.length;
return ret;
}
export function __wbg_new_a12002a7f91c75be(arg0) {
const ret = new Uint8Array(arg0);
return ret;
}
export function __wbg_new_b08a00743b8ae2f3(arg0, arg1) {
const ret = new TypeError(getStringFromWasm0(arg0, arg1));
return ret;
}
export function __wbg_newwithbyteoffsetandlength_d97e637ebe145a9a(
arg0,
arg1,
arg2,
) {
const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
return ret;
}
export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
arg0.set(arg1, arg2 >>> 0);
}
export function __wbindgen_init_externref_table() {
const table = wasm.__wbindgen_export_0;
const offset = table.grow(4);
table.set(0, undefined);
table.set(offset + 0, undefined);
table.set(offset + 1, null);
table.set(offset + 2, true);
table.set(offset + 3, false);
}
export function __wbindgen_memory() {
const ret = wasm.memory;
return ret;
}
export function __wbindgen_throw(arg0, arg1) {
throw new Error(getStringFromWasm0(arg0, arg1));
}
|