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