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,538 @@
1
+ import source wasmModule from "./rapidhash_wasm_vn_bg.wasm";
2
+
3
+ let wasm;
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
+ export function hash_v1(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
+ export function hash_v2(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
+ export function hash_v3(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
+ export function hash_v3_micro(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
+ export function hash_v3_nano(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
+ export 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
+ const PortableHashV1Finalization = (typeof FinalizationRegistry === 'undefined')
242
+ ? { register: () => {}, unregister: () => {} }
243
+ : new FinalizationRegistry(ptr => wasm.__wbg_portablehashv1_free(ptr >>> 0, 1));
244
+ /**
245
+ * Streaming PortableHashV1
246
+ */
247
+ export class PortableHashV1 {
248
+
249
+ __destroy_into_raw() {
250
+ const ptr = this.__wbg_ptr;
251
+ this.__wbg_ptr = 0;
252
+ PortableHashV1Finalization.unregister(this);
253
+ return ptr;
254
+ }
255
+
256
+ free() {
257
+ const ptr = this.__destroy_into_raw();
258
+ wasm.__wbg_portablehashv1_free(ptr, 0);
259
+ }
260
+ /**
261
+ * @param {bigint | null} [seed]
262
+ */
263
+ constructor(seed) {
264
+ const ret = wasm.portablehashv1_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
265
+ this.__wbg_ptr = ret >>> 0;
266
+ PortableHashV1Finalization.register(this, this.__wbg_ptr, this);
267
+ return this;
268
+ }
269
+ /**
270
+ * Updates the hash with new data
271
+ * @param {Uint8Array} data
272
+ */
273
+ update(data) {
274
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
275
+ const len0 = WASM_VECTOR_LEN;
276
+ wasm.portablehashv1_update(this.__wbg_ptr, ptr0, len0);
277
+ }
278
+ /**
279
+ * Finalizes the hash and returns the result
280
+ * @returns {bigint}
281
+ */
282
+ digest() {
283
+ const ret = wasm.portablehashv1_digest(this.__wbg_ptr);
284
+ return BigInt.asUintN(64, ret);
285
+ }
286
+ /**
287
+ * Resets the hasher with optional new seed
288
+ */
289
+ reset() {
290
+ wasm.portablehashv1_reset(this.__wbg_ptr);
291
+ }
292
+ }
293
+ if (Symbol.dispose) PortableHashV1.prototype[Symbol.dispose] = PortableHashV1.prototype.free;
294
+
295
+ const PortableHashV2Finalization = (typeof FinalizationRegistry === 'undefined')
296
+ ? { register: () => {}, unregister: () => {} }
297
+ : new FinalizationRegistry(ptr => wasm.__wbg_portablehashv2_free(ptr >>> 0, 1));
298
+ /**
299
+ * Streaming PortableHashV2
300
+ */
301
+ export class PortableHashV2 {
302
+
303
+ __destroy_into_raw() {
304
+ const ptr = this.__wbg_ptr;
305
+ this.__wbg_ptr = 0;
306
+ PortableHashV2Finalization.unregister(this);
307
+ return ptr;
308
+ }
309
+
310
+ free() {
311
+ const ptr = this.__destroy_into_raw();
312
+ wasm.__wbg_portablehashv2_free(ptr, 0);
313
+ }
314
+ /**
315
+ * @param {bigint | null} [seed]
316
+ */
317
+ constructor(seed) {
318
+ const ret = wasm.portablehashv2_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
319
+ this.__wbg_ptr = ret >>> 0;
320
+ PortableHashV2Finalization.register(this, this.__wbg_ptr, this);
321
+ return this;
322
+ }
323
+ /**
324
+ * Updates the hash with new data
325
+ * @param {Uint8Array} data
326
+ */
327
+ update(data) {
328
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
329
+ const len0 = WASM_VECTOR_LEN;
330
+ wasm.portablehashv2_update(this.__wbg_ptr, ptr0, len0);
331
+ }
332
+ /**
333
+ * Finalizes the hash and returns the result
334
+ * @returns {bigint}
335
+ */
336
+ digest() {
337
+ const ret = wasm.portablehashv2_digest(this.__wbg_ptr);
338
+ return BigInt.asUintN(64, ret);
339
+ }
340
+ /**
341
+ * Resets the hasher with optional new seed
342
+ */
343
+ reset() {
344
+ wasm.portablehashv2_reset(this.__wbg_ptr);
345
+ }
346
+ }
347
+ if (Symbol.dispose) PortableHashV2.prototype[Symbol.dispose] = PortableHashV2.prototype.free;
348
+
349
+ const PortableHashV3Finalization = (typeof FinalizationRegistry === 'undefined')
350
+ ? { register: () => {}, unregister: () => {} }
351
+ : new FinalizationRegistry(ptr => wasm.__wbg_portablehashv3_free(ptr >>> 0, 1));
352
+ /**
353
+ * Streaming PortableHashV3
354
+ */
355
+ export class PortableHashV3 {
356
+
357
+ __destroy_into_raw() {
358
+ const ptr = this.__wbg_ptr;
359
+ this.__wbg_ptr = 0;
360
+ PortableHashV3Finalization.unregister(this);
361
+ return ptr;
362
+ }
363
+
364
+ free() {
365
+ const ptr = this.__destroy_into_raw();
366
+ wasm.__wbg_portablehashv3_free(ptr, 0);
367
+ }
368
+ /**
369
+ * @param {bigint | null} [seed]
370
+ */
371
+ constructor(seed) {
372
+ const ret = wasm.portablehashv2_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
373
+ this.__wbg_ptr = ret >>> 0;
374
+ PortableHashV3Finalization.register(this, this.__wbg_ptr, this);
375
+ return this;
376
+ }
377
+ /**
378
+ * Updates the hash with new data
379
+ * @param {Uint8Array} data
380
+ */
381
+ update(data) {
382
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
383
+ const len0 = WASM_VECTOR_LEN;
384
+ wasm.portablehashv2_update(this.__wbg_ptr, ptr0, len0);
385
+ }
386
+ /**
387
+ * Finalizes the hash and returns the result
388
+ * @returns {bigint}
389
+ */
390
+ digest() {
391
+ const ret = wasm.portablehashv3_digest(this.__wbg_ptr);
392
+ return BigInt.asUintN(64, ret);
393
+ }
394
+ /**
395
+ * Resets the hasher with optional new seed
396
+ */
397
+ reset() {
398
+ wasm.portablehashv2_reset(this.__wbg_ptr);
399
+ }
400
+ }
401
+ if (Symbol.dispose) PortableHashV3.prototype[Symbol.dispose] = PortableHashV3.prototype.free;
402
+
403
+ const QualityHasherFinalization = (typeof FinalizationRegistry === 'undefined')
404
+ ? { register: () => {}, unregister: () => {} }
405
+ : new FinalizationRegistry(ptr => wasm.__wbg_qualityhasher_free(ptr >>> 0, 1));
406
+
407
+ export class QualityHasher {
408
+
409
+ __destroy_into_raw() {
410
+ const ptr = this.__wbg_ptr;
411
+ this.__wbg_ptr = 0;
412
+ QualityHasherFinalization.unregister(this);
413
+ return ptr;
414
+ }
415
+
416
+ free() {
417
+ const ptr = this.__destroy_into_raw();
418
+ wasm.__wbg_qualityhasher_free(ptr, 0);
419
+ }
420
+ /**
421
+ * @param {bigint | null} [seed]
422
+ */
423
+ constructor(seed) {
424
+ const ret = wasm.fasthasher_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
425
+ this.__wbg_ptr = ret >>> 0;
426
+ QualityHasherFinalization.register(this, this.__wbg_ptr, this);
427
+ return this;
428
+ }
429
+ /**
430
+ * Updates the hash with new data
431
+ * @param {Uint8Array} data
432
+ */
433
+ update(data) {
434
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
435
+ const len0 = WASM_VECTOR_LEN;
436
+ wasm.qualityhasher_update(this.__wbg_ptr, ptr0, len0);
437
+ }
438
+ /**
439
+ * @param {number} data
440
+ */
441
+ update_u8(data) {
442
+ wasm.fasthasher_update_i8(this.__wbg_ptr, data);
443
+ }
444
+ /**
445
+ * @param {number} data
446
+ */
447
+ update_u16(data) {
448
+ wasm.fasthasher_update_i16(this.__wbg_ptr, data);
449
+ }
450
+ /**
451
+ * @param {number} data
452
+ */
453
+ update_u32(data) {
454
+ wasm.fasthasher_update_i32(this.__wbg_ptr, data);
455
+ }
456
+ /**
457
+ * @param {bigint} data
458
+ */
459
+ update_u64(data) {
460
+ wasm.fasthasher_update_i64(this.__wbg_ptr, data);
461
+ }
462
+ /**
463
+ * @param {bigint} data
464
+ */
465
+ update_u128(data) {
466
+ wasm.fasthasher_update_i128(this.__wbg_ptr, data, data >> BigInt(64));
467
+ }
468
+ /**
469
+ * @param {number} data
470
+ */
471
+ update_i8(data) {
472
+ wasm.fasthasher_update_i8(this.__wbg_ptr, data);
473
+ }
474
+ /**
475
+ * @param {number} data
476
+ */
477
+ update_i16(data) {
478
+ wasm.fasthasher_update_i16(this.__wbg_ptr, data);
479
+ }
480
+ /**
481
+ * @param {number} data
482
+ */
483
+ update_i32(data) {
484
+ wasm.fasthasher_update_i32(this.__wbg_ptr, data);
485
+ }
486
+ /**
487
+ * @param {bigint} data
488
+ */
489
+ update_i64(data) {
490
+ wasm.fasthasher_update_i64(this.__wbg_ptr, data);
491
+ }
492
+ /**
493
+ * @param {bigint} data
494
+ */
495
+ update_i128(data) {
496
+ wasm.fasthasher_update_i128(this.__wbg_ptr, data, data >> BigInt(64));
497
+ }
498
+ /**
499
+ * Finalizes the hash and returns the result
500
+ * @returns {bigint}
501
+ */
502
+ digest() {
503
+ const ret = wasm.qualityhasher_digest(this.__wbg_ptr);
504
+ return BigInt.asUintN(64, ret);
505
+ }
506
+ /**
507
+ * Resets the hasher
508
+ */
509
+ reset() {
510
+ wasm.fasthasher_reset(this.__wbg_ptr);
511
+ }
512
+ }
513
+ if (Symbol.dispose) QualityHasher.prototype[Symbol.dispose] = QualityHasher.prototype.free;
514
+
515
+ const imports = {
516
+ __wbindgen_placeholder__: {
517
+ __wbg_wbindgenthrow_451ec1a8469d7eb6: function(arg0, arg1) {
518
+ throw new Error(getStringFromWasm0(arg0, arg1));
519
+ },
520
+ __wbindgen_init_externref_table: function() {
521
+ const table = wasm.__wbindgen_export_0;
522
+ const offset = table.grow(4);
523
+ table.set(0, undefined);
524
+ table.set(offset + 0, undefined);
525
+ table.set(offset + 1, null);
526
+ table.set(offset + 2, true);
527
+ table.set(offset + 3, false);
528
+ ;
529
+ },
530
+ },
531
+
532
+ };
533
+
534
+ const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
535
+ wasm = wasmInstance.exports;
536
+
537
+ wasm.__wbindgen_start();
538
+
Binary file