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