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.
- package/LICENSE +21 -0
- package/README.md +26 -0
- package/bundler/rapidhash_wasm_vn.d.ts +161 -0
- package/bundler/rapidhash_wasm_vn.js +5 -0
- package/bundler/rapidhash_wasm_vn_bg.js +539 -0
- package/bundler/rapidhash_wasm_vn_bg.wasm +0 -0
- package/bundler/rapidhash_wasm_vn_bg.wasm.d.ts +56 -0
- package/deno/rapidhash_wasm_vn.d.ts +161 -0
- package/deno/rapidhash_wasm_vn.js +537 -0
- package/deno/rapidhash_wasm_vn_bg.wasm +0 -0
- package/deno/rapidhash_wasm_vn_bg.wasm.d.ts +56 -0
- package/esm/package.json +4 -0
- package/esm/rapidhash_wasm_vn.d.ts +161 -0
- package/esm/rapidhash_wasm_vn.js +17 -0
- package/esm/rapidhash_wasm_vn_bg.js +533 -0
- package/esm/rapidhash_wasm_vn_bg.wasm +0 -0
- package/esm/rapidhash_wasm_vn_bg.wasm.d.ts +56 -0
- package/module/rapidhash_wasm_vn.d.ts +161 -0
- package/module/rapidhash_wasm_vn.js +538 -0
- package/module/rapidhash_wasm_vn_bg.wasm +0 -0
- package/module/rapidhash_wasm_vn_bg.wasm.d.ts +56 -0
- package/no-modules/rapidhash_wasm_vn.d.ts +233 -0
- package/no-modules/rapidhash_wasm_vn.js +654 -0
- package/no-modules/rapidhash_wasm_vn_bg.wasm +0 -0
- package/no-modules/rapidhash_wasm_vn_bg.wasm.d.ts +56 -0
- package/nodejs/rapidhash_wasm_vn.d.ts +161 -0
- package/nodejs/rapidhash_wasm_vn.js +546 -0
- package/nodejs/rapidhash_wasm_vn_bg.wasm +0 -0
- package/nodejs/rapidhash_wasm_vn_bg.wasm.d.ts +56 -0
- package/package.json +79 -0
- package/web/rapidhash_wasm_vn.d.ts +241 -0
- package/web/rapidhash_wasm_vn.js +644 -0
- package/web/rapidhash_wasm_vn_bg.wasm +0 -0
- package/web/rapidhash_wasm_vn_bg.wasm.d.ts +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Nguyễn Đình Tạo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# rapidhash-wasm-vn
|
|
2
|
+
[](https://www.npmjs.com/package/rapidhash-wasm-vn)
|
|
3
|
+
|
|
4
|
+
## Node.js
|
|
5
|
+
|
|
6
|
+
```js
|
|
7
|
+
const { hash_v1, hash_v2, hash_v3, hash_v3_micro, hash_v3_nano } = require('rapidhash-wasm-vn/nodejs');
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Browser
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import init, { hash_v1, hash_v2, hash_v3, hash_v3_micro, hash_v3_nano } from 'rapidhash-wasm-vn/web';
|
|
15
|
+
|
|
16
|
+
await init();
|
|
17
|
+
|
|
18
|
+
// Classic XXHash
|
|
19
|
+
const data = new TextEncoder().encode("hello world");
|
|
20
|
+
|
|
21
|
+
console.log("hash_v1: ", hash_v1(data));
|
|
22
|
+
console.log("hash_v2: ", hash_v2(data));
|
|
23
|
+
console.log("hash_v3: ", hash_v3(data));
|
|
24
|
+
console.log("hash_v3_micro: ", hash_v3_micro(data));
|
|
25
|
+
console.log("hash_v3_nano: ", hash_v3_nano(data));
|
|
26
|
+
```
|
|
@@ -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
|
+
}
|