aboutsummaryrefslogtreecommitdiff
path: root/packages/bun-polyfills/lib/zighash/types.d.ts
blob: f0704ac943d0dd442b4c3e12f321d26a9a1f7774 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
type WasmHash32Function = (input_ptr: number, input_size: number) => number;
type WasmHash64Function = (input_ptr: number, input_size: number) => bigint;
type WasmSeededHash32Function = (input_ptr: number, input_size: number, seed: number) => number;
type WasmSeededHash64Function = (input_ptr: number, input_size: number, seed: bigint) => bigint;
type JSHash32Function = (input: string | ArrayBufferView | ArrayBuffer | SharedArrayBuffer) => number;
type JSHash64Function = (input: string | ArrayBufferView | ArrayBuffer | SharedArrayBuffer) => bigint;
type JSSeededHash32Function = (input: string | ArrayBufferView | ArrayBuffer | SharedArrayBuffer, seed?: number) => number;
type JSSeededHash64Function = (input: string | ArrayBufferView | ArrayBuffer | SharedArrayBuffer, seed?: bigint) => bigint;

type ZighashInstance = WebAssembly.WebAssemblyInstantiatedSource & {
    instance: {
        exports: {
            memory: WebAssembly.Memory,
            alloc(size: number): number,
            wyhash: WasmSeededHash64Function,
            adler32: WasmHash32Function,
            crc32: WasmHash32Function,
            cityhash32: WasmHash32Function,
            cityhash64: WasmSeededHash64Function,
            murmur32v3: WasmSeededHash32Function,
            murmur32v2: WasmSeededHash32Function,
            murmur64v2: WasmSeededHash64Function,
        };
    };
}