rapidhash-wasm-vn 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundler/rapidhash_wasm_vn.d.ts +141 -127
- package/bundler/rapidhash_wasm_vn.js +5 -1
- package/bundler/rapidhash_wasm_vn_bg.js +519 -541
- package/bundler/rapidhash_wasm_vn_bg.wasm +0 -0
- package/bundler/rapidhash_wasm_vn_bg.wasm.d.ts +31 -31
- package/deno/rapidhash_wasm_vn.d.ts +141 -127
- package/deno/rapidhash_wasm_vn.js +446 -459
- package/deno/rapidhash_wasm_vn_bg.wasm +0 -0
- package/deno/rapidhash_wasm_vn_bg.wasm.d.ts +31 -31
- package/esm/rapidhash_wasm_vn.d.ts +141 -127
- package/esm/rapidhash_wasm_vn.js +655 -10
- package/esm/rapidhash_wasm_vn_bg.wasm +0 -0
- package/esm/rapidhash_wasm_vn_bg.wasm.d.ts +31 -31
- package/module/rapidhash_wasm_vn.d.ts +141 -127
- package/module/rapidhash_wasm_vn.js +446 -460
- package/module/rapidhash_wasm_vn_bg.wasm +0 -0
- package/module/rapidhash_wasm_vn_bg.wasm.d.ts +31 -31
- package/no-modules/rapidhash_wasm_vn.d.ts +265 -252
- package/no-modules/rapidhash_wasm_vn.js +540 -564
- package/no-modules/rapidhash_wasm_vn_bg.wasm +0 -0
- package/no-modules/rapidhash_wasm_vn_bg.wasm.d.ts +31 -31
- package/nodejs/rapidhash_wasm_vn.d.ts +141 -127
- package/nodejs/rapidhash_wasm_vn.js +406 -416
- package/nodejs/rapidhash_wasm_vn_bg.wasm +0 -0
- package/nodejs/rapidhash_wasm_vn_bg.wasm.d.ts +31 -31
- package/package.json +1 -1
- package/web/rapidhash_wasm_vn.d.ts +217 -202
- package/web/rapidhash_wasm_vn.js +518 -543
- package/web/rapidhash_wasm_vn_bg.wasm +0 -0
- package/web/rapidhash_wasm_vn_bg.wasm.d.ts +31 -31
- package/esm/rapidhash_wasm_vn_bg.js +0 -672
package/esm/rapidhash_wasm_vn.js
CHANGED
|
@@ -1,17 +1,662 @@
|
|
|
1
|
+
/* @ts-self-types="./rapidhash_wasm_vn.d.ts" */
|
|
1
2
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
export class FastHasher {
|
|
4
|
+
__destroy_into_raw() {
|
|
5
|
+
const ptr = this.__wbg_ptr;
|
|
6
|
+
this.__wbg_ptr = 0;
|
|
7
|
+
FastHasherFinalization.unregister(this);
|
|
8
|
+
return ptr;
|
|
9
|
+
}
|
|
10
|
+
free() {
|
|
11
|
+
const ptr = this.__destroy_into_raw();
|
|
12
|
+
wasm.__wbg_fasthasher_free(ptr, 0);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Finalizes the hash and returns the result
|
|
16
|
+
* @returns {bigint}
|
|
17
|
+
*/
|
|
18
|
+
digest() {
|
|
19
|
+
const ret = wasm.fasthasher_digest(this.__wbg_ptr);
|
|
20
|
+
return BigInt.asUintN(64, ret);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @param {bigint | null} [seed]
|
|
24
|
+
*/
|
|
25
|
+
constructor(seed) {
|
|
26
|
+
const ret = wasm.fasthasher_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
|
|
27
|
+
this.__wbg_ptr = ret >>> 0;
|
|
28
|
+
FastHasherFinalization.register(this, this.__wbg_ptr, this);
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Resets the hasher
|
|
33
|
+
*/
|
|
34
|
+
reset() {
|
|
35
|
+
wasm.fasthasher_reset(this.__wbg_ptr);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Updates the hash with new data
|
|
39
|
+
* @param {Uint8Array} data
|
|
40
|
+
*/
|
|
41
|
+
update(data) {
|
|
42
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
43
|
+
const len0 = WASM_VECTOR_LEN;
|
|
44
|
+
wasm.fasthasher_update(this.__wbg_ptr, ptr0, len0);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @param {bigint} data
|
|
48
|
+
*/
|
|
49
|
+
update_i128(data) {
|
|
50
|
+
wasm.fasthasher_update_i128(this.__wbg_ptr, data, data >> BigInt(64));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @param {number} data
|
|
54
|
+
*/
|
|
55
|
+
update_i16(data) {
|
|
56
|
+
wasm.fasthasher_update_i16(this.__wbg_ptr, data);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @param {number} data
|
|
60
|
+
*/
|
|
61
|
+
update_i32(data) {
|
|
62
|
+
wasm.fasthasher_update_i32(this.__wbg_ptr, data);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @param {bigint} data
|
|
66
|
+
*/
|
|
67
|
+
update_i64(data) {
|
|
68
|
+
wasm.fasthasher_update_i64(this.__wbg_ptr, data);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @param {number} data
|
|
72
|
+
*/
|
|
73
|
+
update_i8(data) {
|
|
74
|
+
wasm.fasthasher_update_i8(this.__wbg_ptr, data);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @param {bigint} data
|
|
78
|
+
*/
|
|
79
|
+
update_u128(data) {
|
|
80
|
+
wasm.fasthasher_update_i128(this.__wbg_ptr, data, data >> BigInt(64));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* @param {number} data
|
|
84
|
+
*/
|
|
85
|
+
update_u16(data) {
|
|
86
|
+
wasm.fasthasher_update_i16(this.__wbg_ptr, data);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @param {number} data
|
|
90
|
+
*/
|
|
91
|
+
update_u32(data) {
|
|
92
|
+
wasm.fasthasher_update_i32(this.__wbg_ptr, data);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* @param {bigint} data
|
|
96
|
+
*/
|
|
97
|
+
update_u64(data) {
|
|
98
|
+
wasm.fasthasher_update_i64(this.__wbg_ptr, data);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @param {number} data
|
|
102
|
+
*/
|
|
103
|
+
update_u8(data) {
|
|
104
|
+
wasm.fasthasher_update_i8(this.__wbg_ptr, data);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (Symbol.dispose) FastHasher.prototype[Symbol.dispose] = FastHasher.prototype.free;
|
|
5
108
|
|
|
6
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Streaming PortableHashV1
|
|
111
|
+
*/
|
|
112
|
+
export class PortableHashV1 {
|
|
113
|
+
__destroy_into_raw() {
|
|
114
|
+
const ptr = this.__wbg_ptr;
|
|
115
|
+
this.__wbg_ptr = 0;
|
|
116
|
+
PortableHashV1Finalization.unregister(this);
|
|
117
|
+
return ptr;
|
|
118
|
+
}
|
|
119
|
+
free() {
|
|
120
|
+
const ptr = this.__destroy_into_raw();
|
|
121
|
+
wasm.__wbg_portablehashv1_free(ptr, 0);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Finalizes the hash and returns the result
|
|
125
|
+
* @returns {bigint}
|
|
126
|
+
*/
|
|
127
|
+
digest() {
|
|
128
|
+
const ret = wasm.portablehashv1_digest(this.__wbg_ptr);
|
|
129
|
+
return BigInt.asUintN(64, ret);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* @param {bigint | null} [seed]
|
|
133
|
+
*/
|
|
134
|
+
constructor(seed) {
|
|
135
|
+
const ret = wasm.portablehashv1_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
|
|
136
|
+
this.__wbg_ptr = ret >>> 0;
|
|
137
|
+
PortableHashV1Finalization.register(this, this.__wbg_ptr, this);
|
|
138
|
+
return this;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Resets the hasher with optional new seed
|
|
142
|
+
*/
|
|
143
|
+
reset() {
|
|
144
|
+
wasm.portablehashv1_reset(this.__wbg_ptr);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Updates the hash with new data
|
|
148
|
+
* @param {Uint8Array} data
|
|
149
|
+
*/
|
|
150
|
+
update(data) {
|
|
151
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
152
|
+
const len0 = WASM_VECTOR_LEN;
|
|
153
|
+
wasm.portablehashv1_update(this.__wbg_ptr, ptr0, len0);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (Symbol.dispose) PortableHashV1.prototype[Symbol.dispose] = PortableHashV1.prototype.free;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Streaming PortableHashV2
|
|
160
|
+
*/
|
|
161
|
+
export class PortableHashV2 {
|
|
162
|
+
__destroy_into_raw() {
|
|
163
|
+
const ptr = this.__wbg_ptr;
|
|
164
|
+
this.__wbg_ptr = 0;
|
|
165
|
+
PortableHashV2Finalization.unregister(this);
|
|
166
|
+
return ptr;
|
|
167
|
+
}
|
|
168
|
+
free() {
|
|
169
|
+
const ptr = this.__destroy_into_raw();
|
|
170
|
+
wasm.__wbg_portablehashv2_free(ptr, 0);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Finalizes the hash and returns the result
|
|
174
|
+
* @returns {bigint}
|
|
175
|
+
*/
|
|
176
|
+
digest() {
|
|
177
|
+
const ret = wasm.portablehashv2_digest(this.__wbg_ptr);
|
|
178
|
+
return BigInt.asUintN(64, ret);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* @param {bigint | null} [seed]
|
|
182
|
+
*/
|
|
183
|
+
constructor(seed) {
|
|
184
|
+
const ret = wasm.portablehashv2_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
|
|
185
|
+
this.__wbg_ptr = ret >>> 0;
|
|
186
|
+
PortableHashV2Finalization.register(this, this.__wbg_ptr, this);
|
|
187
|
+
return this;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Resets the hasher with optional new seed
|
|
191
|
+
*/
|
|
192
|
+
reset() {
|
|
193
|
+
wasm.portablehashv2_reset(this.__wbg_ptr);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Updates the hash with new data
|
|
197
|
+
* @param {Uint8Array} data
|
|
198
|
+
*/
|
|
199
|
+
update(data) {
|
|
200
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
201
|
+
const len0 = WASM_VECTOR_LEN;
|
|
202
|
+
wasm.portablehashv2_update(this.__wbg_ptr, ptr0, len0);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (Symbol.dispose) PortableHashV2.prototype[Symbol.dispose] = PortableHashV2.prototype.free;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Streaming PortableHashV3
|
|
209
|
+
*/
|
|
210
|
+
export class PortableHashV3 {
|
|
211
|
+
__destroy_into_raw() {
|
|
212
|
+
const ptr = this.__wbg_ptr;
|
|
213
|
+
this.__wbg_ptr = 0;
|
|
214
|
+
PortableHashV3Finalization.unregister(this);
|
|
215
|
+
return ptr;
|
|
216
|
+
}
|
|
217
|
+
free() {
|
|
218
|
+
const ptr = this.__destroy_into_raw();
|
|
219
|
+
wasm.__wbg_portablehashv3_free(ptr, 0);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Finalizes the hash and returns the result
|
|
223
|
+
* @returns {bigint}
|
|
224
|
+
*/
|
|
225
|
+
digest() {
|
|
226
|
+
const ret = wasm.portablehashv3_digest(this.__wbg_ptr);
|
|
227
|
+
return BigInt.asUintN(64, ret);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* @param {bigint | null} [seed]
|
|
231
|
+
*/
|
|
232
|
+
constructor(seed) {
|
|
233
|
+
const ret = wasm.portablehashv2_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
|
|
234
|
+
this.__wbg_ptr = ret >>> 0;
|
|
235
|
+
PortableHashV3Finalization.register(this, this.__wbg_ptr, this);
|
|
236
|
+
return this;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Resets the hasher with optional new seed
|
|
240
|
+
*/
|
|
241
|
+
reset() {
|
|
242
|
+
wasm.portablehashv2_reset(this.__wbg_ptr);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Updates the hash with new data
|
|
246
|
+
* @param {Uint8Array} data
|
|
247
|
+
*/
|
|
248
|
+
update(data) {
|
|
249
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
250
|
+
const len0 = WASM_VECTOR_LEN;
|
|
251
|
+
wasm.portablehashv2_update(this.__wbg_ptr, ptr0, len0);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (Symbol.dispose) PortableHashV3.prototype[Symbol.dispose] = PortableHashV3.prototype.free;
|
|
255
|
+
|
|
256
|
+
export class QualityHasher {
|
|
257
|
+
__destroy_into_raw() {
|
|
258
|
+
const ptr = this.__wbg_ptr;
|
|
259
|
+
this.__wbg_ptr = 0;
|
|
260
|
+
QualityHasherFinalization.unregister(this);
|
|
261
|
+
return ptr;
|
|
262
|
+
}
|
|
263
|
+
free() {
|
|
264
|
+
const ptr = this.__destroy_into_raw();
|
|
265
|
+
wasm.__wbg_qualityhasher_free(ptr, 0);
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Finalizes the hash and returns the result
|
|
269
|
+
* @returns {bigint}
|
|
270
|
+
*/
|
|
271
|
+
digest() {
|
|
272
|
+
const ret = wasm.qualityhasher_digest(this.__wbg_ptr);
|
|
273
|
+
return BigInt.asUintN(64, ret);
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* @param {bigint | null} [seed]
|
|
277
|
+
*/
|
|
278
|
+
constructor(seed) {
|
|
279
|
+
const ret = wasm.fasthasher_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
|
|
280
|
+
this.__wbg_ptr = ret >>> 0;
|
|
281
|
+
QualityHasherFinalization.register(this, this.__wbg_ptr, this);
|
|
282
|
+
return this;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Resets the hasher
|
|
286
|
+
*/
|
|
287
|
+
reset() {
|
|
288
|
+
wasm.fasthasher_reset(this.__wbg_ptr);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Updates the hash with new data
|
|
292
|
+
* @param {Uint8Array} data
|
|
293
|
+
*/
|
|
294
|
+
update(data) {
|
|
295
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
296
|
+
const len0 = WASM_VECTOR_LEN;
|
|
297
|
+
wasm.qualityhasher_update(this.__wbg_ptr, ptr0, len0);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* @param {bigint} data
|
|
301
|
+
*/
|
|
302
|
+
update_i128(data) {
|
|
303
|
+
wasm.fasthasher_update_i128(this.__wbg_ptr, data, data >> BigInt(64));
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* @param {number} data
|
|
307
|
+
*/
|
|
308
|
+
update_i16(data) {
|
|
309
|
+
wasm.fasthasher_update_i16(this.__wbg_ptr, data);
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* @param {number} data
|
|
313
|
+
*/
|
|
314
|
+
update_i32(data) {
|
|
315
|
+
wasm.fasthasher_update_i32(this.__wbg_ptr, data);
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* @param {bigint} data
|
|
319
|
+
*/
|
|
320
|
+
update_i64(data) {
|
|
321
|
+
wasm.fasthasher_update_i64(this.__wbg_ptr, data);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* @param {number} data
|
|
325
|
+
*/
|
|
326
|
+
update_i8(data) {
|
|
327
|
+
wasm.fasthasher_update_i8(this.__wbg_ptr, data);
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* @param {bigint} data
|
|
331
|
+
*/
|
|
332
|
+
update_u128(data) {
|
|
333
|
+
wasm.fasthasher_update_i128(this.__wbg_ptr, data, data >> BigInt(64));
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* @param {number} data
|
|
337
|
+
*/
|
|
338
|
+
update_u16(data) {
|
|
339
|
+
wasm.fasthasher_update_i16(this.__wbg_ptr, data);
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* @param {number} data
|
|
343
|
+
*/
|
|
344
|
+
update_u32(data) {
|
|
345
|
+
wasm.fasthasher_update_i32(this.__wbg_ptr, data);
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* @param {bigint} data
|
|
349
|
+
*/
|
|
350
|
+
update_u64(data) {
|
|
351
|
+
wasm.fasthasher_update_i64(this.__wbg_ptr, data);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* @param {number} data
|
|
355
|
+
*/
|
|
356
|
+
update_u8(data) {
|
|
357
|
+
wasm.fasthasher_update_i8(this.__wbg_ptr, data);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if (Symbol.dispose) QualityHasher.prototype[Symbol.dispose] = QualityHasher.prototype.free;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* RapidHash V3 - (64-bit) hash file
|
|
364
|
+
*
|
|
365
|
+
* # Arguments
|
|
366
|
+
*
|
|
367
|
+
* * `input` - Input data to hash
|
|
368
|
+
* * `seed` - Seed value for hash (default: 0)
|
|
369
|
+
* @param {Uint8Array} input
|
|
370
|
+
* @param {bigint | null} [seed]
|
|
371
|
+
* @returns {bigint}
|
|
372
|
+
*/
|
|
373
|
+
export function hash_file_v3(input, seed) {
|
|
374
|
+
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
|
|
375
|
+
const len0 = WASM_VECTOR_LEN;
|
|
376
|
+
const ret = wasm.hash_file_v3(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
|
|
377
|
+
if (ret[2]) {
|
|
378
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
379
|
+
}
|
|
380
|
+
return BigInt.asUintN(64, ret[0]);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Computes RapidHash V1 (64-bit) hash
|
|
385
|
+
*
|
|
386
|
+
* # Arguments
|
|
387
|
+
*
|
|
388
|
+
* * `input` - Input data to hash
|
|
389
|
+
* * `seed` - Seed value for hash (default: 0)
|
|
390
|
+
* @param {Uint8Array} input
|
|
391
|
+
* @param {bigint | null} [seed]
|
|
392
|
+
* @returns {bigint}
|
|
393
|
+
*/
|
|
394
|
+
export function hash_v1(input, seed) {
|
|
395
|
+
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
|
|
396
|
+
const len0 = WASM_VECTOR_LEN;
|
|
397
|
+
const ret = wasm.hash_v1(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
|
|
398
|
+
return BigInt.asUintN(64, ret);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Computes multiple RapidHash V1 (64-bit) hashes in batch
|
|
403
|
+
* @param {Uint8Array[]} chunks
|
|
404
|
+
* @param {bigint | null} [seed]
|
|
405
|
+
* @returns {BigUint64Array}
|
|
406
|
+
*/
|
|
407
|
+
export function hash_v1_batch(chunks, seed) {
|
|
408
|
+
const ptr0 = passArrayJsValueToWasm0(chunks, wasm.__wbindgen_malloc);
|
|
409
|
+
const len0 = WASM_VECTOR_LEN;
|
|
410
|
+
const ret = wasm.hash_v1_batch(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
|
|
411
|
+
if (ret[3]) {
|
|
412
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
413
|
+
}
|
|
414
|
+
var v2 = getArrayU64FromWasm0(ret[0], ret[1]).slice();
|
|
415
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
416
|
+
return v2;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Computes RapidHash V2 (64-bit) hash
|
|
421
|
+
*
|
|
422
|
+
* # Arguments
|
|
423
|
+
*
|
|
424
|
+
* * `input` - Input data to hash
|
|
425
|
+
* * `seed` - Seed value for hash (default: 0)
|
|
426
|
+
* @param {Uint8Array} input
|
|
427
|
+
* @param {bigint | null} [seed]
|
|
428
|
+
* @returns {bigint}
|
|
429
|
+
*/
|
|
430
|
+
export function hash_v2(input, seed) {
|
|
431
|
+
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
|
|
432
|
+
const len0 = WASM_VECTOR_LEN;
|
|
433
|
+
const ret = wasm.hash_v2(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
|
|
434
|
+
return BigInt.asUintN(64, ret);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Computes multiple RapidHash V2 (64-bit) hashes in batch
|
|
439
|
+
* @param {Uint8Array[]} chunks
|
|
440
|
+
* @param {bigint | null} [seed]
|
|
441
|
+
* @returns {BigUint64Array}
|
|
442
|
+
*/
|
|
443
|
+
export function hash_v2_batch(chunks, seed) {
|
|
444
|
+
const ptr0 = passArrayJsValueToWasm0(chunks, wasm.__wbindgen_malloc);
|
|
445
|
+
const len0 = WASM_VECTOR_LEN;
|
|
446
|
+
const ret = wasm.hash_v2_batch(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
|
|
447
|
+
if (ret[3]) {
|
|
448
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
449
|
+
}
|
|
450
|
+
var v2 = getArrayU64FromWasm0(ret[0], ret[1]).slice();
|
|
451
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
452
|
+
return v2;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Computes RapidHash V3 (64-bit) hash
|
|
457
|
+
*
|
|
458
|
+
* # Arguments
|
|
459
|
+
*
|
|
460
|
+
* * `input` - Input data to hash
|
|
461
|
+
* * `seed` - Seed value for hash (default: 0)
|
|
462
|
+
* @param {Uint8Array} input
|
|
463
|
+
* @param {bigint | null} [seed]
|
|
464
|
+
* @returns {bigint}
|
|
465
|
+
*/
|
|
466
|
+
export function hash_v3(input, seed) {
|
|
467
|
+
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
|
|
468
|
+
const len0 = WASM_VECTOR_LEN;
|
|
469
|
+
const ret = wasm.hash_v3(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
|
|
470
|
+
return BigInt.asUintN(64, ret);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Computes multiple RapidHash V3 (64-bit) hashes in batch
|
|
475
|
+
* @param {Uint8Array[]} chunks
|
|
476
|
+
* @param {bigint | null} [seed]
|
|
477
|
+
* @returns {BigUint64Array}
|
|
478
|
+
*/
|
|
479
|
+
export function hash_v3_batch(chunks, seed) {
|
|
480
|
+
const ptr0 = passArrayJsValueToWasm0(chunks, wasm.__wbindgen_malloc);
|
|
481
|
+
const len0 = WASM_VECTOR_LEN;
|
|
482
|
+
const ret = wasm.hash_v3_batch(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
|
|
483
|
+
if (ret[3]) {
|
|
484
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
485
|
+
}
|
|
486
|
+
var v2 = getArrayU64FromWasm0(ret[0], ret[1]).slice();
|
|
487
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
488
|
+
return v2;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Computes RapidHash V3 (64-bit) micro hash
|
|
493
|
+
*
|
|
494
|
+
* # Arguments
|
|
495
|
+
*
|
|
496
|
+
* * `input` - Input data to hash
|
|
497
|
+
* * `seed` - Seed value for hash (default: 0)
|
|
498
|
+
* @param {Uint8Array} input
|
|
499
|
+
* @param {bigint | null} [seed]
|
|
500
|
+
* @returns {bigint}
|
|
501
|
+
*/
|
|
502
|
+
export function hash_v3_micro(input, seed) {
|
|
503
|
+
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
|
|
504
|
+
const len0 = WASM_VECTOR_LEN;
|
|
505
|
+
const ret = wasm.hash_v3_micro(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
|
|
506
|
+
return BigInt.asUintN(64, ret);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Computes RapidHash V3 (64-bit) nano hash
|
|
511
|
+
*
|
|
512
|
+
* # Arguments
|
|
513
|
+
*
|
|
514
|
+
* * `input` - Input data to hash
|
|
515
|
+
* * `seed` - Seed value for hash (default: 0)
|
|
516
|
+
* @param {Uint8Array} input
|
|
517
|
+
* @param {bigint | null} [seed]
|
|
518
|
+
* @returns {bigint}
|
|
519
|
+
*/
|
|
520
|
+
export function hash_v3_nano(input, seed) {
|
|
521
|
+
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
|
|
522
|
+
const len0 = WASM_VECTOR_LEN;
|
|
523
|
+
const ret = wasm.hash_v3_nano(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
|
|
524
|
+
return BigInt.asUintN(64, ret);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
function __wbg_get_imports() {
|
|
528
|
+
const import0 = {
|
|
529
|
+
__proto__: null,
|
|
530
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
531
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
532
|
+
},
|
|
533
|
+
__wbg_length_32ed9a279acd054c: function(arg0) {
|
|
534
|
+
const ret = arg0.length;
|
|
535
|
+
return ret;
|
|
536
|
+
},
|
|
537
|
+
__wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
|
|
538
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
539
|
+
},
|
|
540
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
541
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
542
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
543
|
+
return ret;
|
|
544
|
+
},
|
|
545
|
+
__wbindgen_init_externref_table: function() {
|
|
546
|
+
const table = wasm.__wbindgen_externrefs;
|
|
547
|
+
const offset = table.grow(4);
|
|
548
|
+
table.set(0, undefined);
|
|
549
|
+
table.set(offset + 0, undefined);
|
|
550
|
+
table.set(offset + 1, null);
|
|
551
|
+
table.set(offset + 2, true);
|
|
552
|
+
table.set(offset + 3, false);
|
|
553
|
+
},
|
|
554
|
+
};
|
|
555
|
+
return {
|
|
556
|
+
__proto__: null,
|
|
557
|
+
"./rapidhash_wasm_vn_bg.js": import0,
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
const FastHasherFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
562
|
+
? { register: () => {}, unregister: () => {} }
|
|
563
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_fasthasher_free(ptr >>> 0, 1));
|
|
564
|
+
const PortableHashV1Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
565
|
+
? { register: () => {}, unregister: () => {} }
|
|
566
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_portablehashv1_free(ptr >>> 0, 1));
|
|
567
|
+
const PortableHashV2Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
568
|
+
? { register: () => {}, unregister: () => {} }
|
|
569
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_portablehashv2_free(ptr >>> 0, 1));
|
|
570
|
+
const PortableHashV3Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
571
|
+
? { register: () => {}, unregister: () => {} }
|
|
572
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_portablehashv3_free(ptr >>> 0, 1));
|
|
573
|
+
const QualityHasherFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
574
|
+
? { register: () => {}, unregister: () => {} }
|
|
575
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_qualityhasher_free(ptr >>> 0, 1));
|
|
576
|
+
|
|
577
|
+
function addToExternrefTable0(obj) {
|
|
578
|
+
const idx = wasm.__externref_table_alloc();
|
|
579
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
580
|
+
return idx;
|
|
581
|
+
}
|
|
7
582
|
|
|
583
|
+
function getArrayU64FromWasm0(ptr, len) {
|
|
584
|
+
ptr = ptr >>> 0;
|
|
585
|
+
return getBigUint64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
589
|
+
ptr = ptr >>> 0;
|
|
590
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
let cachedBigUint64ArrayMemory0 = null;
|
|
594
|
+
function getBigUint64ArrayMemory0() {
|
|
595
|
+
if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
|
|
596
|
+
cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
|
|
597
|
+
}
|
|
598
|
+
return cachedBigUint64ArrayMemory0;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
let cachedDataViewMemory0 = null;
|
|
602
|
+
function getDataViewMemory0() {
|
|
603
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
604
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
605
|
+
}
|
|
606
|
+
return cachedDataViewMemory0;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
function getStringFromWasm0(ptr, len) {
|
|
610
|
+
ptr = ptr >>> 0;
|
|
611
|
+
return decodeText(ptr, len);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
let cachedUint8ArrayMemory0 = null;
|
|
615
|
+
function getUint8ArrayMemory0() {
|
|
616
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
617
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
618
|
+
}
|
|
619
|
+
return cachedUint8ArrayMemory0;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
function isLikeNone(x) {
|
|
623
|
+
return x === undefined || x === null;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
627
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
628
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
629
|
+
WASM_VECTOR_LEN = arg.length;
|
|
630
|
+
return ptr;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
634
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
635
|
+
for (let i = 0; i < array.length; i++) {
|
|
636
|
+
const add = addToExternrefTable0(array[i]);
|
|
637
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
638
|
+
}
|
|
639
|
+
WASM_VECTOR_LEN = array.length;
|
|
640
|
+
return ptr;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
function takeFromExternrefTable0(idx) {
|
|
644
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
645
|
+
wasm.__externref_table_dealloc(idx);
|
|
646
|
+
return value;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
650
|
+
cachedTextDecoder.decode();
|
|
651
|
+
function decodeText(ptr, len) {
|
|
652
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
let WASM_VECTOR_LEN = 0;
|
|
656
|
+
|
|
657
|
+
import { readFileSync } from 'node:fs';
|
|
8
658
|
const wasmUrl = new URL('rapidhash_wasm_vn_bg.wasm', import.meta.url);
|
|
9
659
|
const wasmBytes = readFileSync(wasmUrl);
|
|
10
660
|
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
11
|
-
const wasm = new WebAssembly.Instance(wasmModule,
|
|
12
|
-
export { wasm as __wasm };
|
|
13
|
-
|
|
14
|
-
imports["./rapidhash_wasm_vn_bg.js"].__wbg_set_wasm(wasm, wasmModule);
|
|
661
|
+
const wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
|
|
15
662
|
wasm.__wbindgen_start();
|
|
16
|
-
|
|
17
|
-
export * from "./rapidhash_wasm_vn_bg.js";
|
|
Binary file
|