rapidhash-wasm-vn 1.0.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.
Files changed (34) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +26 -0
  3. package/bundler/rapidhash_wasm_vn.d.ts +161 -0
  4. package/bundler/rapidhash_wasm_vn.js +5 -0
  5. package/bundler/rapidhash_wasm_vn_bg.js +539 -0
  6. package/bundler/rapidhash_wasm_vn_bg.wasm +0 -0
  7. package/bundler/rapidhash_wasm_vn_bg.wasm.d.ts +56 -0
  8. package/deno/rapidhash_wasm_vn.d.ts +161 -0
  9. package/deno/rapidhash_wasm_vn.js +537 -0
  10. package/deno/rapidhash_wasm_vn_bg.wasm +0 -0
  11. package/deno/rapidhash_wasm_vn_bg.wasm.d.ts +56 -0
  12. package/esm/package.json +4 -0
  13. package/esm/rapidhash_wasm_vn.d.ts +161 -0
  14. package/esm/rapidhash_wasm_vn.js +17 -0
  15. package/esm/rapidhash_wasm_vn_bg.js +533 -0
  16. package/esm/rapidhash_wasm_vn_bg.wasm +0 -0
  17. package/esm/rapidhash_wasm_vn_bg.wasm.d.ts +56 -0
  18. package/module/rapidhash_wasm_vn.d.ts +161 -0
  19. package/module/rapidhash_wasm_vn.js +538 -0
  20. package/module/rapidhash_wasm_vn_bg.wasm +0 -0
  21. package/module/rapidhash_wasm_vn_bg.wasm.d.ts +56 -0
  22. package/no-modules/rapidhash_wasm_vn.d.ts +233 -0
  23. package/no-modules/rapidhash_wasm_vn.js +654 -0
  24. package/no-modules/rapidhash_wasm_vn_bg.wasm +0 -0
  25. package/no-modules/rapidhash_wasm_vn_bg.wasm.d.ts +56 -0
  26. package/nodejs/rapidhash_wasm_vn.d.ts +161 -0
  27. package/nodejs/rapidhash_wasm_vn.js +546 -0
  28. package/nodejs/rapidhash_wasm_vn_bg.wasm +0 -0
  29. package/nodejs/rapidhash_wasm_vn_bg.wasm.d.ts +56 -0
  30. package/package.json +79 -0
  31. package/web/rapidhash_wasm_vn.d.ts +241 -0
  32. package/web/rapidhash_wasm_vn.js +644 -0
  33. package/web/rapidhash_wasm_vn_bg.wasm +0 -0
  34. package/web/rapidhash_wasm_vn_bg.wasm.d.ts +56 -0
@@ -0,0 +1,161 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Computes RapidHash V1 (64-bit) hash
5
+ *
6
+ * # Arguments
7
+ *
8
+ * * `input` - Input data to hash
9
+ * * `seed` - Seed value for hash (default: 0)
10
+ */
11
+ export function hash_v1(input: Uint8Array, seed?: bigint | null): bigint;
12
+ /**
13
+ * Computes RapidHash V2 (64-bit) hash
14
+ *
15
+ * # Arguments
16
+ *
17
+ * * `input` - Input data to hash
18
+ * * `seed` - Seed value for hash (default: 0)
19
+ */
20
+ export function hash_v2(input: Uint8Array, seed?: bigint | null): bigint;
21
+ /**
22
+ * Computes RapidHash V3 (64-bit) hash
23
+ *
24
+ * # Arguments
25
+ *
26
+ * * `input` - Input data to hash
27
+ * * `seed` - Seed value for hash (default: 0)
28
+ */
29
+ export function hash_v3(input: Uint8Array, seed?: bigint | null): bigint;
30
+ /**
31
+ * Computes RapidHash V3 (64-bit) micro hash
32
+ *
33
+ * # Arguments
34
+ *
35
+ * * `input` - Input data to hash
36
+ * * `seed` - Seed value for hash (default: 0)
37
+ */
38
+ export function hash_v3_micro(input: Uint8Array, seed?: bigint | null): bigint;
39
+ /**
40
+ * Computes RapidHash V3 (64-bit) nano hash
41
+ *
42
+ * # Arguments
43
+ *
44
+ * * `input` - Input data to hash
45
+ * * `seed` - Seed value for hash (default: 0)
46
+ */
47
+ export function hash_v3_nano(input: Uint8Array, seed?: bigint | null): bigint;
48
+ export class FastHasher {
49
+ free(): void;
50
+ [Symbol.dispose](): void;
51
+ constructor(seed?: bigint | null);
52
+ /**
53
+ * Updates the hash with new data
54
+ */
55
+ update(data: Uint8Array): void;
56
+ update_u8(data: number): void;
57
+ update_u16(data: number): void;
58
+ update_u32(data: number): void;
59
+ update_u64(data: bigint): void;
60
+ update_u128(data: bigint): void;
61
+ update_i8(data: number): void;
62
+ update_i16(data: number): void;
63
+ update_i32(data: number): void;
64
+ update_i64(data: bigint): void;
65
+ update_i128(data: bigint): void;
66
+ /**
67
+ * Finalizes the hash and returns the result
68
+ */
69
+ digest(): bigint;
70
+ /**
71
+ * Resets the hasher
72
+ */
73
+ reset(): void;
74
+ }
75
+ /**
76
+ * Streaming PortableHashV1
77
+ */
78
+ export class PortableHashV1 {
79
+ free(): void;
80
+ [Symbol.dispose](): void;
81
+ constructor(seed?: bigint | null);
82
+ /**
83
+ * Updates the hash with new data
84
+ */
85
+ update(data: Uint8Array): void;
86
+ /**
87
+ * Finalizes the hash and returns the result
88
+ */
89
+ digest(): bigint;
90
+ /**
91
+ * Resets the hasher with optional new seed
92
+ */
93
+ reset(): void;
94
+ }
95
+ /**
96
+ * Streaming PortableHashV2
97
+ */
98
+ export class PortableHashV2 {
99
+ free(): void;
100
+ [Symbol.dispose](): void;
101
+ constructor(seed?: bigint | null);
102
+ /**
103
+ * Updates the hash with new data
104
+ */
105
+ update(data: Uint8Array): void;
106
+ /**
107
+ * Finalizes the hash and returns the result
108
+ */
109
+ digest(): bigint;
110
+ /**
111
+ * Resets the hasher with optional new seed
112
+ */
113
+ reset(): void;
114
+ }
115
+ /**
116
+ * Streaming PortableHashV3
117
+ */
118
+ export class PortableHashV3 {
119
+ free(): void;
120
+ [Symbol.dispose](): void;
121
+ constructor(seed?: bigint | null);
122
+ /**
123
+ * Updates the hash with new data
124
+ */
125
+ update(data: Uint8Array): void;
126
+ /**
127
+ * Finalizes the hash and returns the result
128
+ */
129
+ digest(): bigint;
130
+ /**
131
+ * Resets the hasher with optional new seed
132
+ */
133
+ reset(): void;
134
+ }
135
+ export class QualityHasher {
136
+ free(): void;
137
+ [Symbol.dispose](): void;
138
+ constructor(seed?: bigint | null);
139
+ /**
140
+ * Updates the hash with new data
141
+ */
142
+ update(data: Uint8Array): void;
143
+ update_u8(data: number): void;
144
+ update_u16(data: number): void;
145
+ update_u32(data: number): void;
146
+ update_u64(data: bigint): void;
147
+ update_u128(data: bigint): void;
148
+ update_i8(data: number): void;
149
+ update_i16(data: number): void;
150
+ update_i32(data: number): void;
151
+ update_i64(data: bigint): void;
152
+ update_i128(data: bigint): void;
153
+ /**
154
+ * Finalizes the hash and returns the result
155
+ */
156
+ digest(): bigint;
157
+ /**
158
+ * Resets the hasher
159
+ */
160
+ reset(): void;
161
+ }
@@ -0,0 +1,546 @@
1
+
2
+ let imports = {};
3
+ imports['__wbindgen_placeholder__'] = module.exports;
4
+
5
+ let cachedUint8ArrayMemory0 = null;
6
+
7
+ function getUint8ArrayMemory0() {
8
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
9
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
10
+ }
11
+ return cachedUint8ArrayMemory0;
12
+ }
13
+
14
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
15
+
16
+ cachedTextDecoder.decode();
17
+
18
+ function decodeText(ptr, len) {
19
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
20
+ }
21
+
22
+ function getStringFromWasm0(ptr, len) {
23
+ ptr = ptr >>> 0;
24
+ return decodeText(ptr, len);
25
+ }
26
+
27
+ let WASM_VECTOR_LEN = 0;
28
+
29
+ function passArray8ToWasm0(arg, malloc) {
30
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
31
+ getUint8ArrayMemory0().set(arg, ptr / 1);
32
+ WASM_VECTOR_LEN = arg.length;
33
+ return ptr;
34
+ }
35
+
36
+ function isLikeNone(x) {
37
+ return x === undefined || x === null;
38
+ }
39
+ /**
40
+ * Computes RapidHash V1 (64-bit) hash
41
+ *
42
+ * # Arguments
43
+ *
44
+ * * `input` - Input data to hash
45
+ * * `seed` - Seed value for hash (default: 0)
46
+ * @param {Uint8Array} input
47
+ * @param {bigint | null} [seed]
48
+ * @returns {bigint}
49
+ */
50
+ exports.hash_v1 = function(input, seed) {
51
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
52
+ const len0 = WASM_VECTOR_LEN;
53
+ const ret = wasm.hash_v1(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
54
+ return BigInt.asUintN(64, ret);
55
+ };
56
+
57
+ /**
58
+ * Computes RapidHash V2 (64-bit) hash
59
+ *
60
+ * # Arguments
61
+ *
62
+ * * `input` - Input data to hash
63
+ * * `seed` - Seed value for hash (default: 0)
64
+ * @param {Uint8Array} input
65
+ * @param {bigint | null} [seed]
66
+ * @returns {bigint}
67
+ */
68
+ exports.hash_v2 = function(input, seed) {
69
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
70
+ const len0 = WASM_VECTOR_LEN;
71
+ const ret = wasm.hash_v2(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
72
+ return BigInt.asUintN(64, ret);
73
+ };
74
+
75
+ /**
76
+ * Computes RapidHash V3 (64-bit) hash
77
+ *
78
+ * # Arguments
79
+ *
80
+ * * `input` - Input data to hash
81
+ * * `seed` - Seed value for hash (default: 0)
82
+ * @param {Uint8Array} input
83
+ * @param {bigint | null} [seed]
84
+ * @returns {bigint}
85
+ */
86
+ exports.hash_v3 = function(input, seed) {
87
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
88
+ const len0 = WASM_VECTOR_LEN;
89
+ const ret = wasm.hash_v3(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
90
+ return BigInt.asUintN(64, ret);
91
+ };
92
+
93
+ /**
94
+ * Computes RapidHash V3 (64-bit) micro hash
95
+ *
96
+ * # Arguments
97
+ *
98
+ * * `input` - Input data to hash
99
+ * * `seed` - Seed value for hash (default: 0)
100
+ * @param {Uint8Array} input
101
+ * @param {bigint | null} [seed]
102
+ * @returns {bigint}
103
+ */
104
+ exports.hash_v3_micro = function(input, seed) {
105
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
106
+ const len0 = WASM_VECTOR_LEN;
107
+ const ret = wasm.hash_v3_micro(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
108
+ return BigInt.asUintN(64, ret);
109
+ };
110
+
111
+ /**
112
+ * Computes RapidHash V3 (64-bit) nano hash
113
+ *
114
+ * # Arguments
115
+ *
116
+ * * `input` - Input data to hash
117
+ * * `seed` - Seed value for hash (default: 0)
118
+ * @param {Uint8Array} input
119
+ * @param {bigint | null} [seed]
120
+ * @returns {bigint}
121
+ */
122
+ exports.hash_v3_nano = function(input, seed) {
123
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
124
+ const len0 = WASM_VECTOR_LEN;
125
+ const ret = wasm.hash_v3_nano(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
126
+ return BigInt.asUintN(64, ret);
127
+ };
128
+
129
+ const FastHasherFinalization = (typeof FinalizationRegistry === 'undefined')
130
+ ? { register: () => {}, unregister: () => {} }
131
+ : new FinalizationRegistry(ptr => wasm.__wbg_fasthasher_free(ptr >>> 0, 1));
132
+
133
+ class FastHasher {
134
+
135
+ __destroy_into_raw() {
136
+ const ptr = this.__wbg_ptr;
137
+ this.__wbg_ptr = 0;
138
+ FastHasherFinalization.unregister(this);
139
+ return ptr;
140
+ }
141
+
142
+ free() {
143
+ const ptr = this.__destroy_into_raw();
144
+ wasm.__wbg_fasthasher_free(ptr, 0);
145
+ }
146
+ /**
147
+ * @param {bigint | null} [seed]
148
+ */
149
+ constructor(seed) {
150
+ const ret = wasm.fasthasher_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
151
+ this.__wbg_ptr = ret >>> 0;
152
+ FastHasherFinalization.register(this, this.__wbg_ptr, this);
153
+ return this;
154
+ }
155
+ /**
156
+ * Updates the hash with new data
157
+ * @param {Uint8Array} data
158
+ */
159
+ update(data) {
160
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
161
+ const len0 = WASM_VECTOR_LEN;
162
+ wasm.fasthasher_update(this.__wbg_ptr, ptr0, len0);
163
+ }
164
+ /**
165
+ * @param {number} data
166
+ */
167
+ update_u8(data) {
168
+ wasm.fasthasher_update_i8(this.__wbg_ptr, data);
169
+ }
170
+ /**
171
+ * @param {number} data
172
+ */
173
+ update_u16(data) {
174
+ wasm.fasthasher_update_i16(this.__wbg_ptr, data);
175
+ }
176
+ /**
177
+ * @param {number} data
178
+ */
179
+ update_u32(data) {
180
+ wasm.fasthasher_update_i32(this.__wbg_ptr, data);
181
+ }
182
+ /**
183
+ * @param {bigint} data
184
+ */
185
+ update_u64(data) {
186
+ wasm.fasthasher_update_i64(this.__wbg_ptr, data);
187
+ }
188
+ /**
189
+ * @param {bigint} data
190
+ */
191
+ update_u128(data) {
192
+ wasm.fasthasher_update_i128(this.__wbg_ptr, data, data >> BigInt(64));
193
+ }
194
+ /**
195
+ * @param {number} data
196
+ */
197
+ update_i8(data) {
198
+ wasm.fasthasher_update_i8(this.__wbg_ptr, data);
199
+ }
200
+ /**
201
+ * @param {number} data
202
+ */
203
+ update_i16(data) {
204
+ wasm.fasthasher_update_i16(this.__wbg_ptr, data);
205
+ }
206
+ /**
207
+ * @param {number} data
208
+ */
209
+ update_i32(data) {
210
+ wasm.fasthasher_update_i32(this.__wbg_ptr, data);
211
+ }
212
+ /**
213
+ * @param {bigint} data
214
+ */
215
+ update_i64(data) {
216
+ wasm.fasthasher_update_i64(this.__wbg_ptr, data);
217
+ }
218
+ /**
219
+ * @param {bigint} data
220
+ */
221
+ update_i128(data) {
222
+ wasm.fasthasher_update_i128(this.__wbg_ptr, data, data >> BigInt(64));
223
+ }
224
+ /**
225
+ * Finalizes the hash and returns the result
226
+ * @returns {bigint}
227
+ */
228
+ digest() {
229
+ const ret = wasm.fasthasher_digest(this.__wbg_ptr);
230
+ return BigInt.asUintN(64, ret);
231
+ }
232
+ /**
233
+ * Resets the hasher
234
+ */
235
+ reset() {
236
+ wasm.fasthasher_reset(this.__wbg_ptr);
237
+ }
238
+ }
239
+ if (Symbol.dispose) FastHasher.prototype[Symbol.dispose] = FastHasher.prototype.free;
240
+
241
+ exports.FastHasher = FastHasher;
242
+
243
+ const PortableHashV1Finalization = (typeof FinalizationRegistry === 'undefined')
244
+ ? { register: () => {}, unregister: () => {} }
245
+ : new FinalizationRegistry(ptr => wasm.__wbg_portablehashv1_free(ptr >>> 0, 1));
246
+ /**
247
+ * Streaming PortableHashV1
248
+ */
249
+ class PortableHashV1 {
250
+
251
+ __destroy_into_raw() {
252
+ const ptr = this.__wbg_ptr;
253
+ this.__wbg_ptr = 0;
254
+ PortableHashV1Finalization.unregister(this);
255
+ return ptr;
256
+ }
257
+
258
+ free() {
259
+ const ptr = this.__destroy_into_raw();
260
+ wasm.__wbg_portablehashv1_free(ptr, 0);
261
+ }
262
+ /**
263
+ * @param {bigint | null} [seed]
264
+ */
265
+ constructor(seed) {
266
+ const ret = wasm.portablehashv1_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
267
+ this.__wbg_ptr = ret >>> 0;
268
+ PortableHashV1Finalization.register(this, this.__wbg_ptr, this);
269
+ return this;
270
+ }
271
+ /**
272
+ * Updates the hash with new data
273
+ * @param {Uint8Array} data
274
+ */
275
+ update(data) {
276
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
277
+ const len0 = WASM_VECTOR_LEN;
278
+ wasm.portablehashv1_update(this.__wbg_ptr, ptr0, len0);
279
+ }
280
+ /**
281
+ * Finalizes the hash and returns the result
282
+ * @returns {bigint}
283
+ */
284
+ digest() {
285
+ const ret = wasm.portablehashv1_digest(this.__wbg_ptr);
286
+ return BigInt.asUintN(64, ret);
287
+ }
288
+ /**
289
+ * Resets the hasher with optional new seed
290
+ */
291
+ reset() {
292
+ wasm.portablehashv1_reset(this.__wbg_ptr);
293
+ }
294
+ }
295
+ if (Symbol.dispose) PortableHashV1.prototype[Symbol.dispose] = PortableHashV1.prototype.free;
296
+
297
+ exports.PortableHashV1 = PortableHashV1;
298
+
299
+ const PortableHashV2Finalization = (typeof FinalizationRegistry === 'undefined')
300
+ ? { register: () => {}, unregister: () => {} }
301
+ : new FinalizationRegistry(ptr => wasm.__wbg_portablehashv2_free(ptr >>> 0, 1));
302
+ /**
303
+ * Streaming PortableHashV2
304
+ */
305
+ class PortableHashV2 {
306
+
307
+ __destroy_into_raw() {
308
+ const ptr = this.__wbg_ptr;
309
+ this.__wbg_ptr = 0;
310
+ PortableHashV2Finalization.unregister(this);
311
+ return ptr;
312
+ }
313
+
314
+ free() {
315
+ const ptr = this.__destroy_into_raw();
316
+ wasm.__wbg_portablehashv2_free(ptr, 0);
317
+ }
318
+ /**
319
+ * @param {bigint | null} [seed]
320
+ */
321
+ constructor(seed) {
322
+ const ret = wasm.portablehashv2_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
323
+ this.__wbg_ptr = ret >>> 0;
324
+ PortableHashV2Finalization.register(this, this.__wbg_ptr, this);
325
+ return this;
326
+ }
327
+ /**
328
+ * Updates the hash with new data
329
+ * @param {Uint8Array} data
330
+ */
331
+ update(data) {
332
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
333
+ const len0 = WASM_VECTOR_LEN;
334
+ wasm.portablehashv2_update(this.__wbg_ptr, ptr0, len0);
335
+ }
336
+ /**
337
+ * Finalizes the hash and returns the result
338
+ * @returns {bigint}
339
+ */
340
+ digest() {
341
+ const ret = wasm.portablehashv2_digest(this.__wbg_ptr);
342
+ return BigInt.asUintN(64, ret);
343
+ }
344
+ /**
345
+ * Resets the hasher with optional new seed
346
+ */
347
+ reset() {
348
+ wasm.portablehashv2_reset(this.__wbg_ptr);
349
+ }
350
+ }
351
+ if (Symbol.dispose) PortableHashV2.prototype[Symbol.dispose] = PortableHashV2.prototype.free;
352
+
353
+ exports.PortableHashV2 = PortableHashV2;
354
+
355
+ const PortableHashV3Finalization = (typeof FinalizationRegistry === 'undefined')
356
+ ? { register: () => {}, unregister: () => {} }
357
+ : new FinalizationRegistry(ptr => wasm.__wbg_portablehashv3_free(ptr >>> 0, 1));
358
+ /**
359
+ * Streaming PortableHashV3
360
+ */
361
+ class PortableHashV3 {
362
+
363
+ __destroy_into_raw() {
364
+ const ptr = this.__wbg_ptr;
365
+ this.__wbg_ptr = 0;
366
+ PortableHashV3Finalization.unregister(this);
367
+ return ptr;
368
+ }
369
+
370
+ free() {
371
+ const ptr = this.__destroy_into_raw();
372
+ wasm.__wbg_portablehashv3_free(ptr, 0);
373
+ }
374
+ /**
375
+ * @param {bigint | null} [seed]
376
+ */
377
+ constructor(seed) {
378
+ const ret = wasm.portablehashv2_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
379
+ this.__wbg_ptr = ret >>> 0;
380
+ PortableHashV3Finalization.register(this, this.__wbg_ptr, this);
381
+ return this;
382
+ }
383
+ /**
384
+ * Updates the hash with new data
385
+ * @param {Uint8Array} data
386
+ */
387
+ update(data) {
388
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
389
+ const len0 = WASM_VECTOR_LEN;
390
+ wasm.portablehashv2_update(this.__wbg_ptr, ptr0, len0);
391
+ }
392
+ /**
393
+ * Finalizes the hash and returns the result
394
+ * @returns {bigint}
395
+ */
396
+ digest() {
397
+ const ret = wasm.portablehashv3_digest(this.__wbg_ptr);
398
+ return BigInt.asUintN(64, ret);
399
+ }
400
+ /**
401
+ * Resets the hasher with optional new seed
402
+ */
403
+ reset() {
404
+ wasm.portablehashv2_reset(this.__wbg_ptr);
405
+ }
406
+ }
407
+ if (Symbol.dispose) PortableHashV3.prototype[Symbol.dispose] = PortableHashV3.prototype.free;
408
+
409
+ exports.PortableHashV3 = PortableHashV3;
410
+
411
+ const QualityHasherFinalization = (typeof FinalizationRegistry === 'undefined')
412
+ ? { register: () => {}, unregister: () => {} }
413
+ : new FinalizationRegistry(ptr => wasm.__wbg_qualityhasher_free(ptr >>> 0, 1));
414
+
415
+ class QualityHasher {
416
+
417
+ __destroy_into_raw() {
418
+ const ptr = this.__wbg_ptr;
419
+ this.__wbg_ptr = 0;
420
+ QualityHasherFinalization.unregister(this);
421
+ return ptr;
422
+ }
423
+
424
+ free() {
425
+ const ptr = this.__destroy_into_raw();
426
+ wasm.__wbg_qualityhasher_free(ptr, 0);
427
+ }
428
+ /**
429
+ * @param {bigint | null} [seed]
430
+ */
431
+ constructor(seed) {
432
+ const ret = wasm.fasthasher_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
433
+ this.__wbg_ptr = ret >>> 0;
434
+ QualityHasherFinalization.register(this, this.__wbg_ptr, this);
435
+ return this;
436
+ }
437
+ /**
438
+ * Updates the hash with new data
439
+ * @param {Uint8Array} data
440
+ */
441
+ update(data) {
442
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
443
+ const len0 = WASM_VECTOR_LEN;
444
+ wasm.qualityhasher_update(this.__wbg_ptr, ptr0, len0);
445
+ }
446
+ /**
447
+ * @param {number} data
448
+ */
449
+ update_u8(data) {
450
+ wasm.fasthasher_update_i8(this.__wbg_ptr, data);
451
+ }
452
+ /**
453
+ * @param {number} data
454
+ */
455
+ update_u16(data) {
456
+ wasm.fasthasher_update_i16(this.__wbg_ptr, data);
457
+ }
458
+ /**
459
+ * @param {number} data
460
+ */
461
+ update_u32(data) {
462
+ wasm.fasthasher_update_i32(this.__wbg_ptr, data);
463
+ }
464
+ /**
465
+ * @param {bigint} data
466
+ */
467
+ update_u64(data) {
468
+ wasm.fasthasher_update_i64(this.__wbg_ptr, data);
469
+ }
470
+ /**
471
+ * @param {bigint} data
472
+ */
473
+ update_u128(data) {
474
+ wasm.fasthasher_update_i128(this.__wbg_ptr, data, data >> BigInt(64));
475
+ }
476
+ /**
477
+ * @param {number} data
478
+ */
479
+ update_i8(data) {
480
+ wasm.fasthasher_update_i8(this.__wbg_ptr, data);
481
+ }
482
+ /**
483
+ * @param {number} data
484
+ */
485
+ update_i16(data) {
486
+ wasm.fasthasher_update_i16(this.__wbg_ptr, data);
487
+ }
488
+ /**
489
+ * @param {number} data
490
+ */
491
+ update_i32(data) {
492
+ wasm.fasthasher_update_i32(this.__wbg_ptr, data);
493
+ }
494
+ /**
495
+ * @param {bigint} data
496
+ */
497
+ update_i64(data) {
498
+ wasm.fasthasher_update_i64(this.__wbg_ptr, data);
499
+ }
500
+ /**
501
+ * @param {bigint} data
502
+ */
503
+ update_i128(data) {
504
+ wasm.fasthasher_update_i128(this.__wbg_ptr, data, data >> BigInt(64));
505
+ }
506
+ /**
507
+ * Finalizes the hash and returns the result
508
+ * @returns {bigint}
509
+ */
510
+ digest() {
511
+ const ret = wasm.qualityhasher_digest(this.__wbg_ptr);
512
+ return BigInt.asUintN(64, ret);
513
+ }
514
+ /**
515
+ * Resets the hasher
516
+ */
517
+ reset() {
518
+ wasm.fasthasher_reset(this.__wbg_ptr);
519
+ }
520
+ }
521
+ if (Symbol.dispose) QualityHasher.prototype[Symbol.dispose] = QualityHasher.prototype.free;
522
+
523
+ exports.QualityHasher = QualityHasher;
524
+
525
+ exports.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
526
+ throw new Error(getStringFromWasm0(arg0, arg1));
527
+ };
528
+
529
+ exports.__wbindgen_init_externref_table = function() {
530
+ const table = wasm.__wbindgen_export_0;
531
+ const offset = table.grow(4);
532
+ table.set(0, undefined);
533
+ table.set(offset + 0, undefined);
534
+ table.set(offset + 1, null);
535
+ table.set(offset + 2, true);
536
+ table.set(offset + 3, false);
537
+ ;
538
+ };
539
+
540
+ const wasmPath = `${__dirname}/rapidhash_wasm_vn_bg.wasm`;
541
+ const wasmBytes = require('fs').readFileSync(wasmPath);
542
+ const wasmModule = new WebAssembly.Module(wasmBytes);
543
+ const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports;
544
+
545
+ wasm.__wbindgen_start();
546
+
Binary file