rapidhash-js 2.0.0 → 3.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/CHANGELOG.md +12 -0
- package/README.md +115 -49
- package/lib/common-FK5Aq1u9.d.mts +7 -0
- package/lib/common-FK5Aq1u9.d.ts +7 -0
- package/lib/index.d.mts +6 -38
- package/lib/index.d.ts +6 -38
- package/lib/index.js +101 -223
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +100 -216
- package/lib/index.mjs.map +1 -1
- package/lib/v1.0/index.d.mts +31 -0
- package/lib/v1.0/index.d.ts +31 -0
- package/lib/v1.0/index.js +209 -0
- package/lib/v1.0/index.js.map +1 -0
- package/lib/v1.0/index.mjs +180 -0
- package/lib/v1.0/index.mjs.map +1 -0
- package/lib/v2.0/index.d.mts +31 -0
- package/lib/v2.0/index.d.ts +31 -0
- package/lib/v2.0/index.js +250 -0
- package/lib/v2.0/index.js.map +1 -0
- package/lib/v2.0/index.mjs +221 -0
- package/lib/v2.0/index.mjs.map +1 -0
- package/lib/v2.2/index.d.mts +31 -0
- package/lib/v2.2/index.d.ts +31 -0
- package/lib/v2.2/index.js +249 -0
- package/lib/v2.2/index.js.map +1 -0
- package/lib/v2.2/index.mjs +220 -0
- package/lib/v2.2/index.mjs.map +1 -0
- package/lib/v3.0/index.d.mts +62 -0
- package/lib/v3.0/index.d.ts +62 -0
- package/lib/v3.0/index.js +440 -0
- package/lib/v3.0/index.js.map +1 -0
- package/lib/v3.0/index.mjs +405 -0
- package/lib/v3.0/index.mjs.map +1 -0
- package/package.json +21 -12
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
// src/common.ts
|
|
2
|
+
function rapid_mix_fast(a, b) {
|
|
3
|
+
const m = a * b;
|
|
4
|
+
return BigInt.asUintN(64, m) ^ m >> 64n;
|
|
5
|
+
}
|
|
6
|
+
function rapid_mix_protected(a, b) {
|
|
7
|
+
const m = a * b;
|
|
8
|
+
return BigInt.asUintN(64, m) ^ m >> 64n ^ a ^ b;
|
|
9
|
+
}
|
|
10
|
+
var read32x2Buffer = new Uint8Array(8);
|
|
11
|
+
var read32x2View = new DataView(read32x2Buffer.buffer);
|
|
12
|
+
var read32Buffer = new Uint8Array(8);
|
|
13
|
+
var read32View = new DataView(read32Buffer.buffer);
|
|
14
|
+
function rapid_read32(buf, offset) {
|
|
15
|
+
read32View.setUint32(0, buf.getUint32(offset, true), true);
|
|
16
|
+
return read32View.getBigUint64(0, true);
|
|
17
|
+
}
|
|
18
|
+
function rapid_read64(buf, offset) {
|
|
19
|
+
return buf.getBigUint64(offset, true);
|
|
20
|
+
}
|
|
21
|
+
var readSmallBuffer = new Uint8Array(8);
|
|
22
|
+
var readSmallView = new DataView(readSmallBuffer.buffer);
|
|
23
|
+
var readBytesBuffer = new Uint8Array(8);
|
|
24
|
+
var readBytesView = new DataView(readBytesBuffer.buffer);
|
|
25
|
+
var textEncoder = new TextEncoder();
|
|
26
|
+
var utf8BufferSize = 2048;
|
|
27
|
+
var stringLengthThresholdToUseBuffer = utf8BufferSize / 3;
|
|
28
|
+
var utf8Buffer = new Uint8Array(utf8BufferSize);
|
|
29
|
+
function toDataView(message) {
|
|
30
|
+
if (typeof message === "string") {
|
|
31
|
+
if (message.length <= stringLengthThresholdToUseBuffer) {
|
|
32
|
+
const { written } = textEncoder.encodeInto(message, utf8Buffer);
|
|
33
|
+
return new DataView(utf8Buffer.buffer, 0, written);
|
|
34
|
+
}
|
|
35
|
+
const utf8bytes = textEncoder.encode(message);
|
|
36
|
+
return new DataView(utf8bytes.buffer, utf8bytes.byteOffset, utf8bytes.byteLength);
|
|
37
|
+
}
|
|
38
|
+
if (message instanceof Uint8Array) {
|
|
39
|
+
return new DataView(message.buffer, message.byteOffset, message.byteLength);
|
|
40
|
+
}
|
|
41
|
+
return message;
|
|
42
|
+
}
|
|
43
|
+
var defaultRapidMumBehaviour = "fast";
|
|
44
|
+
function isBigUint64(value) {
|
|
45
|
+
return value >= 0n && value <= 0xffffffffffffffffn;
|
|
46
|
+
}
|
|
47
|
+
function validateOptions(options, defaultSeed) {
|
|
48
|
+
const result = {
|
|
49
|
+
seed: defaultSeed,
|
|
50
|
+
rapidMumBehaviour: defaultRapidMumBehaviour
|
|
51
|
+
};
|
|
52
|
+
if (options === void 0) {
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
if (options.seed !== void 0) {
|
|
56
|
+
if (!isBigUint64(options.seed)) {
|
|
57
|
+
throw new Error(`seed must be a 64-bit unsigned bigint value: ${options.seed}`);
|
|
58
|
+
}
|
|
59
|
+
result.seed = options.seed;
|
|
60
|
+
}
|
|
61
|
+
if (options.rapidMumBehaviour !== void 0) {
|
|
62
|
+
result.rapidMumBehaviour = options.rapidMumBehaviour;
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// src/common_v2.ts
|
|
68
|
+
var RAPID_SEED = 0n;
|
|
69
|
+
var rapid_secret = [
|
|
70
|
+
0x2d358dccaa6c78a5n,
|
|
71
|
+
0x8bb84b93962eacc9n,
|
|
72
|
+
0x4b33a62ed433d4a3n,
|
|
73
|
+
0x4d5a2da51de1aa47n,
|
|
74
|
+
0xa0761d6478bd642fn,
|
|
75
|
+
0xe7037ed1a0b428dbn,
|
|
76
|
+
0x90ed1765281c388cn,
|
|
77
|
+
0xaaaaaaaaaaaaaaaan
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
// src/v3.0/common_v3.ts
|
|
81
|
+
var readSmallV3Buffer = new Uint8Array(8);
|
|
82
|
+
var readSmallV3View = new DataView(readSmallV3Buffer.buffer);
|
|
83
|
+
function rapid_readSmallV3(input, len) {
|
|
84
|
+
const v = input.getUint8(0);
|
|
85
|
+
readSmallV3Buffer[6] = v >> 3;
|
|
86
|
+
readSmallV3Buffer[5] = v << 5;
|
|
87
|
+
readSmallV3Buffer[0] = input.getUint8(len - 1);
|
|
88
|
+
return readSmallV3View.getBigUint64(0, true);
|
|
89
|
+
}
|
|
90
|
+
function rapidhash_epilogueV3_fast(a, b, secret, i) {
|
|
91
|
+
const m0 = a * b;
|
|
92
|
+
const m1 = (BigInt.asUintN(64, m0) ^ secret[7]) * (m0 >> 64n ^ secret[1] ^ i);
|
|
93
|
+
return BigInt.asUintN(64, m1) ^ m1 >> 64n;
|
|
94
|
+
}
|
|
95
|
+
function rapidhash_epilogueV3_protected(a0, b0, secret, i) {
|
|
96
|
+
const m0 = a0 * b0;
|
|
97
|
+
const a1 = BigInt.asUintN(64, m0) ^ secret[7] ^ a0;
|
|
98
|
+
const b1 = m0 >> 64n ^ secret[1] ^ i ^ b0;
|
|
99
|
+
const m1 = a1 * b1;
|
|
100
|
+
return BigInt.asUintN(64, m1) ^ m1 >> 64n ^ a1 ^ b1;
|
|
101
|
+
}
|
|
102
|
+
var rapidMumImplementationsV3 = {
|
|
103
|
+
fast: {
|
|
104
|
+
rapid_mix: rapid_mix_fast,
|
|
105
|
+
rapidhash_epilogue: rapidhash_epilogueV3_fast
|
|
106
|
+
},
|
|
107
|
+
protected: {
|
|
108
|
+
rapid_mix: rapid_mix_protected,
|
|
109
|
+
rapidhash_epilogue: rapidhash_epilogueV3_protected
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// src/v3.0/rapidhash_v3.0.ts
|
|
114
|
+
function rapidhash_v3_0_internal(key, seed, secret, rapid_mix, rapidhash_epilogue) {
|
|
115
|
+
const len = key.byteLength;
|
|
116
|
+
const lenBI = BigInt(key.byteLength);
|
|
117
|
+
seed ^= rapid_mix(seed ^ secret[2], secret[1]);
|
|
118
|
+
let a;
|
|
119
|
+
let b;
|
|
120
|
+
let i = len;
|
|
121
|
+
let bi;
|
|
122
|
+
if (len <= 16) {
|
|
123
|
+
bi = lenBI;
|
|
124
|
+
if (len >= 4) {
|
|
125
|
+
seed ^= lenBI;
|
|
126
|
+
if (len >= 8) {
|
|
127
|
+
const last = len - 8;
|
|
128
|
+
a = rapid_read64(key, 0);
|
|
129
|
+
b = rapid_read64(key, last);
|
|
130
|
+
} else {
|
|
131
|
+
const last = len - 4;
|
|
132
|
+
a = rapid_read32(key, 0);
|
|
133
|
+
b = rapid_read32(key, last);
|
|
134
|
+
}
|
|
135
|
+
} else if (len > 0) {
|
|
136
|
+
a = rapid_readSmallV3(key, len);
|
|
137
|
+
b = BigInt(key.getUint8(len >> 1));
|
|
138
|
+
} else {
|
|
139
|
+
a = 0n;
|
|
140
|
+
b = 0n;
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
let p = 0;
|
|
144
|
+
if (i > 112) {
|
|
145
|
+
let see1 = seed;
|
|
146
|
+
let see2 = seed;
|
|
147
|
+
let see3 = seed;
|
|
148
|
+
let see4 = seed;
|
|
149
|
+
let see5 = seed;
|
|
150
|
+
let see6 = seed;
|
|
151
|
+
do {
|
|
152
|
+
seed = rapid_mix(rapid_read64(key, p) ^ secret[0], rapid_read64(key, p + 8) ^ seed);
|
|
153
|
+
see1 = rapid_mix(rapid_read64(key, p + 16) ^ secret[1], rapid_read64(key, p + 24) ^ see1);
|
|
154
|
+
see2 = rapid_mix(rapid_read64(key, p + 32) ^ secret[2], rapid_read64(key, p + 40) ^ see2);
|
|
155
|
+
see3 = rapid_mix(rapid_read64(key, p + 48) ^ secret[3], rapid_read64(key, p + 56) ^ see3);
|
|
156
|
+
see4 = rapid_mix(rapid_read64(key, p + 64) ^ secret[4], rapid_read64(key, p + 72) ^ see4);
|
|
157
|
+
see5 = rapid_mix(rapid_read64(key, p + 80) ^ secret[5], rapid_read64(key, p + 88) ^ see5);
|
|
158
|
+
see6 = rapid_mix(rapid_read64(key, p + 96) ^ secret[6], rapid_read64(key, p + 104) ^ see6);
|
|
159
|
+
p += 112;
|
|
160
|
+
i -= 112;
|
|
161
|
+
} while (i > 112);
|
|
162
|
+
seed ^= see1;
|
|
163
|
+
see2 ^= see3;
|
|
164
|
+
see4 ^= see5;
|
|
165
|
+
seed ^= see6;
|
|
166
|
+
see2 ^= see4;
|
|
167
|
+
seed ^= see2;
|
|
168
|
+
}
|
|
169
|
+
bi = BigInt(i);
|
|
170
|
+
if (i > 16) {
|
|
171
|
+
seed = rapid_mix(rapid_read64(key, p) ^ secret[2], rapid_read64(key, p + 8) ^ seed);
|
|
172
|
+
if (i > 32) {
|
|
173
|
+
seed = rapid_mix(rapid_read64(key, p + 16) ^ secret[2], rapid_read64(key, p + 24) ^ seed);
|
|
174
|
+
if (i > 48) {
|
|
175
|
+
seed = rapid_mix(rapid_read64(key, p + 32) ^ secret[1], rapid_read64(key, p + 40) ^ seed);
|
|
176
|
+
if (i > 64) {
|
|
177
|
+
seed = rapid_mix(rapid_read64(key, p + 48) ^ secret[1], rapid_read64(key, p + 56) ^ seed);
|
|
178
|
+
if (i > 80) {
|
|
179
|
+
seed = rapid_mix(rapid_read64(key, p + 64) ^ secret[2], rapid_read64(key, p + 72) ^ seed);
|
|
180
|
+
if (i > 96) {
|
|
181
|
+
seed = rapid_mix(rapid_read64(key, p + 80) ^ secret[1], rapid_read64(key, p + 88) ^ seed);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
a = rapid_read64(key, p + i - 16) ^ bi;
|
|
189
|
+
b = rapid_read64(key, p + i - 8);
|
|
190
|
+
}
|
|
191
|
+
a ^= secret[1];
|
|
192
|
+
b ^= seed;
|
|
193
|
+
return rapidhash_epilogue(a, b, secret, bi);
|
|
194
|
+
}
|
|
195
|
+
function rapidhash(message, options) {
|
|
196
|
+
const { seed, rapidMumBehaviour } = validateOptions(options, RAPID_SEED);
|
|
197
|
+
const { rapid_mix, rapidhash_epilogue } = rapidMumImplementationsV3[rapidMumBehaviour];
|
|
198
|
+
return rapidhash_v3_0_internal(toDataView(message), seed, rapid_secret, rapid_mix, rapidhash_epilogue);
|
|
199
|
+
}
|
|
200
|
+
function rapidhash_fast(message, options) {
|
|
201
|
+
const { seed } = validateOptions(options, RAPID_SEED);
|
|
202
|
+
return rapidhash_v3_0_internal(toDataView(message), seed, rapid_secret, rapid_mix_fast, rapidhash_epilogueV3_fast);
|
|
203
|
+
}
|
|
204
|
+
function rapidhash_protected(message, options) {
|
|
205
|
+
const { seed } = validateOptions(options, RAPID_SEED);
|
|
206
|
+
return rapidhash_v3_0_internal(
|
|
207
|
+
toDataView(message),
|
|
208
|
+
seed,
|
|
209
|
+
rapid_secret,
|
|
210
|
+
rapid_mix_protected,
|
|
211
|
+
rapidhash_epilogueV3_protected
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// src/v3.0/rapidhashMicro_v3.0.ts
|
|
216
|
+
function rapidhashMicro_v3_0_internal(key, seed, secret, rapid_mix, rapidhash_epilogue) {
|
|
217
|
+
const len = key.byteLength;
|
|
218
|
+
const lenBI = BigInt(key.byteLength);
|
|
219
|
+
seed ^= rapid_mix(seed ^ secret[2], secret[1]);
|
|
220
|
+
let a;
|
|
221
|
+
let b;
|
|
222
|
+
let i = len;
|
|
223
|
+
let bi;
|
|
224
|
+
if (len <= 16) {
|
|
225
|
+
bi = lenBI;
|
|
226
|
+
if (len >= 4) {
|
|
227
|
+
seed ^= lenBI;
|
|
228
|
+
if (len >= 8) {
|
|
229
|
+
const last = len - 8;
|
|
230
|
+
a = rapid_read64(key, 0);
|
|
231
|
+
b = rapid_read64(key, last);
|
|
232
|
+
} else {
|
|
233
|
+
const last = len - 4;
|
|
234
|
+
a = rapid_read32(key, 0);
|
|
235
|
+
b = rapid_read32(key, last);
|
|
236
|
+
}
|
|
237
|
+
} else if (len > 0) {
|
|
238
|
+
a = rapid_readSmallV3(key, len);
|
|
239
|
+
b = BigInt(key.getUint8(len >> 1));
|
|
240
|
+
} else {
|
|
241
|
+
a = 0n;
|
|
242
|
+
b = 0n;
|
|
243
|
+
}
|
|
244
|
+
} else {
|
|
245
|
+
let p = 0;
|
|
246
|
+
if (i > 80) {
|
|
247
|
+
let see1 = seed;
|
|
248
|
+
let see2 = seed;
|
|
249
|
+
let see3 = seed;
|
|
250
|
+
let see4 = seed;
|
|
251
|
+
do {
|
|
252
|
+
seed = rapid_mix(rapid_read64(key, p) ^ secret[0], rapid_read64(key, p + 8) ^ seed);
|
|
253
|
+
see1 = rapid_mix(rapid_read64(key, p + 16) ^ secret[1], rapid_read64(key, p + 24) ^ see1);
|
|
254
|
+
see2 = rapid_mix(rapid_read64(key, p + 32) ^ secret[2], rapid_read64(key, p + 40) ^ see2);
|
|
255
|
+
see3 = rapid_mix(rapid_read64(key, p + 48) ^ secret[3], rapid_read64(key, p + 56) ^ see3);
|
|
256
|
+
see4 = rapid_mix(rapid_read64(key, p + 64) ^ secret[4], rapid_read64(key, p + 72) ^ see4);
|
|
257
|
+
p += 80;
|
|
258
|
+
i -= 80;
|
|
259
|
+
} while (i > 80);
|
|
260
|
+
seed ^= see1;
|
|
261
|
+
see2 ^= see3;
|
|
262
|
+
seed ^= see4;
|
|
263
|
+
seed ^= see2;
|
|
264
|
+
}
|
|
265
|
+
bi = BigInt(i);
|
|
266
|
+
if (i > 16) {
|
|
267
|
+
seed = rapid_mix(rapid_read64(key, p) ^ secret[2], rapid_read64(key, p + 8) ^ seed);
|
|
268
|
+
if (i > 32) {
|
|
269
|
+
seed = rapid_mix(rapid_read64(key, p + 16) ^ secret[2], rapid_read64(key, p + 24) ^ seed);
|
|
270
|
+
if (i > 48) {
|
|
271
|
+
seed = rapid_mix(rapid_read64(key, p + 32) ^ secret[1], rapid_read64(key, p + 40) ^ seed);
|
|
272
|
+
if (i > 64) {
|
|
273
|
+
seed = rapid_mix(rapid_read64(key, p + 48) ^ secret[1], rapid_read64(key, p + 56) ^ seed);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
a = rapid_read64(key, p + i - 16) ^ bi;
|
|
279
|
+
b = rapid_read64(key, p + i - 8);
|
|
280
|
+
}
|
|
281
|
+
a ^= secret[1];
|
|
282
|
+
b ^= seed;
|
|
283
|
+
return rapidhash_epilogue(a, b, secret, bi);
|
|
284
|
+
}
|
|
285
|
+
function rapidhashMicro(message, options) {
|
|
286
|
+
const { seed, rapidMumBehaviour } = validateOptions(options, RAPID_SEED);
|
|
287
|
+
const { rapid_mix, rapidhash_epilogue } = rapidMumImplementationsV3[rapidMumBehaviour];
|
|
288
|
+
return rapidhashMicro_v3_0_internal(toDataView(message), seed, rapid_secret, rapid_mix, rapidhash_epilogue);
|
|
289
|
+
}
|
|
290
|
+
function rapidhashMicro_fast(message, options) {
|
|
291
|
+
const { seed } = validateOptions(options, RAPID_SEED);
|
|
292
|
+
return rapidhashMicro_v3_0_internal(
|
|
293
|
+
toDataView(message),
|
|
294
|
+
seed,
|
|
295
|
+
rapid_secret,
|
|
296
|
+
rapid_mix_fast,
|
|
297
|
+
rapidhash_epilogueV3_fast
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
function rapidhashMicro_protected(message, options) {
|
|
301
|
+
const { seed } = validateOptions(options, RAPID_SEED);
|
|
302
|
+
return rapidhashMicro_v3_0_internal(
|
|
303
|
+
toDataView(message),
|
|
304
|
+
seed,
|
|
305
|
+
rapid_secret,
|
|
306
|
+
rapid_mix_protected,
|
|
307
|
+
rapidhash_epilogueV3_protected
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// src/v3.0/rapidhashNano_v3.0.ts
|
|
312
|
+
function rapidhashNano_v3_0_internal(key, seed, secret, rapid_mix, rapidhash_epilogue) {
|
|
313
|
+
const len = key.byteLength;
|
|
314
|
+
const lenBI = BigInt(key.byteLength);
|
|
315
|
+
seed ^= rapid_mix(seed ^ secret[2], secret[1]);
|
|
316
|
+
let a;
|
|
317
|
+
let b;
|
|
318
|
+
let i = len;
|
|
319
|
+
let bi;
|
|
320
|
+
if (len <= 16) {
|
|
321
|
+
bi = lenBI;
|
|
322
|
+
if (len >= 4) {
|
|
323
|
+
seed ^= lenBI;
|
|
324
|
+
if (len >= 8) {
|
|
325
|
+
const last = len - 8;
|
|
326
|
+
a = rapid_read64(key, 0);
|
|
327
|
+
b = rapid_read64(key, last);
|
|
328
|
+
} else {
|
|
329
|
+
const last = len - 4;
|
|
330
|
+
a = rapid_read32(key, 0);
|
|
331
|
+
b = rapid_read32(key, last);
|
|
332
|
+
}
|
|
333
|
+
} else if (len > 0) {
|
|
334
|
+
a = rapid_readSmallV3(key, len);
|
|
335
|
+
b = BigInt(key.getUint8(len >> 1));
|
|
336
|
+
} else {
|
|
337
|
+
a = 0n;
|
|
338
|
+
b = 0n;
|
|
339
|
+
}
|
|
340
|
+
} else {
|
|
341
|
+
let p = 0;
|
|
342
|
+
if (i > 48) {
|
|
343
|
+
let see1 = seed;
|
|
344
|
+
let see2 = seed;
|
|
345
|
+
do {
|
|
346
|
+
seed = rapid_mix(rapid_read64(key, p) ^ secret[0], rapid_read64(key, p + 8) ^ seed);
|
|
347
|
+
see1 = rapid_mix(rapid_read64(key, p + 16) ^ secret[1], rapid_read64(key, p + 24) ^ see1);
|
|
348
|
+
see2 = rapid_mix(rapid_read64(key, p + 32) ^ secret[2], rapid_read64(key, p + 40) ^ see2);
|
|
349
|
+
p += 48;
|
|
350
|
+
i -= 48;
|
|
351
|
+
} while (i > 48);
|
|
352
|
+
seed ^= see1;
|
|
353
|
+
seed ^= see2;
|
|
354
|
+
}
|
|
355
|
+
bi = BigInt(i);
|
|
356
|
+
if (i > 16) {
|
|
357
|
+
seed = rapid_mix(rapid_read64(key, p) ^ secret[2], rapid_read64(key, p + 8) ^ seed);
|
|
358
|
+
if (i > 32) {
|
|
359
|
+
seed = rapid_mix(rapid_read64(key, p + 16) ^ secret[2], rapid_read64(key, p + 24) ^ seed);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
a = rapid_read64(key, p + i - 16) ^ bi;
|
|
363
|
+
b = rapid_read64(key, p + i - 8);
|
|
364
|
+
}
|
|
365
|
+
a ^= secret[1];
|
|
366
|
+
b ^= seed;
|
|
367
|
+
return rapidhash_epilogue(a, b, secret, bi);
|
|
368
|
+
}
|
|
369
|
+
function rapidhashNano(message, options) {
|
|
370
|
+
const { seed, rapidMumBehaviour } = validateOptions(options, RAPID_SEED);
|
|
371
|
+
const { rapid_mix, rapidhash_epilogue } = rapidMumImplementationsV3[rapidMumBehaviour];
|
|
372
|
+
return rapidhashNano_v3_0_internal(toDataView(message), seed, rapid_secret, rapid_mix, rapidhash_epilogue);
|
|
373
|
+
}
|
|
374
|
+
function rapidhashNano_fast(message, options) {
|
|
375
|
+
const { seed } = validateOptions(options, RAPID_SEED);
|
|
376
|
+
return rapidhashNano_v3_0_internal(
|
|
377
|
+
toDataView(message),
|
|
378
|
+
seed,
|
|
379
|
+
rapid_secret,
|
|
380
|
+
rapid_mix_fast,
|
|
381
|
+
rapidhash_epilogueV3_fast
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
function rapidhashNano_protected(message, options) {
|
|
385
|
+
const { seed } = validateOptions(options, RAPID_SEED);
|
|
386
|
+
return rapidhashNano_v3_0_internal(
|
|
387
|
+
toDataView(message),
|
|
388
|
+
seed,
|
|
389
|
+
rapid_secret,
|
|
390
|
+
rapid_mix_protected,
|
|
391
|
+
rapidhash_epilogueV3_protected
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
export {
|
|
395
|
+
rapidhash,
|
|
396
|
+
rapidhashMicro,
|
|
397
|
+
rapidhashMicro_fast,
|
|
398
|
+
rapidhashMicro_protected,
|
|
399
|
+
rapidhashNano,
|
|
400
|
+
rapidhashNano_fast,
|
|
401
|
+
rapidhashNano_protected,
|
|
402
|
+
rapidhash_fast,
|
|
403
|
+
rapidhash_protected
|
|
404
|
+
};
|
|
405
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/common.ts","../../src/common_v2.ts","../../src/v3.0/common_v3.ts","../../src/v3.0/rapidhash_v3.0.ts","../../src/v3.0/rapidhashMicro_v3.0.ts","../../src/v3.0/rapidhashNano_v3.0.ts"],"sourcesContent":["export type RapidMix = (a: bigint, b: bigint) => bigint;\nexport type RapidhashEpilogue = (a: bigint, b: bigint, secretA: bigint, secretB: bigint, len: bigint) => bigint;\n\nexport function rapid_mix_fast(a: bigint, b: bigint): bigint {\n const m = a * b;\n return BigInt.asUintN(64, m) ^ (m >> 64n);\n}\n\nexport function rapidhash_epilogue_fast(a: bigint, b: bigint, secretA: bigint, secretB: bigint, len: bigint): bigint {\n const m0 = a * b;\n const m1 = (BigInt.asUintN(64, m0) ^ secretA ^ len) * ((m0 >> 64n) ^ secretB);\n return BigInt.asUintN(64, m1) ^ (m1 >> 64n);\n}\n\nexport function rapid_mix_protected(a: bigint, b: bigint): bigint {\n const m = a * b;\n return BigInt.asUintN(64, m) ^ (m >> 64n) ^ a ^ b;\n}\n\nexport function rapidhash_epilogue_protected(\n a0: bigint,\n b0: bigint,\n secretA: bigint,\n secretB: bigint,\n len: bigint,\n): bigint {\n const m0 = a0 * b0;\n const a1 = BigInt.asUintN(64, m0) ^ secretA ^ len ^ a0;\n const b1 = (m0 >> 64n) ^ secretB ^ b0;\n const m1 = a1 * b1;\n return BigInt.asUintN(64, m1) ^ (m1 >> 64n) ^ a1 ^ b1;\n}\n\n// ---\n\nconst read32x2Buffer = new Uint8Array(8);\nconst read32x2View = new DataView(read32x2Buffer.buffer);\n\nexport function rapid_read32x2(buf: DataView, offset1: number, offset2: number): bigint {\n read32x2View.setUint32(4, buf.getUint32(offset1, true), true);\n read32x2View.setUint32(0, buf.getUint32(offset2, true), true);\n return read32x2View.getBigUint64(0, true);\n}\n\nconst read32Buffer = new Uint8Array(8);\nconst read32View = new DataView(read32Buffer.buffer);\n\nexport function rapid_read32(buf: DataView, offset: number): bigint {\n read32View.setUint32(0, buf.getUint32(offset, true), true);\n return read32View.getBigUint64(0, true);\n}\n\nexport function rapid_read64(buf: DataView, offset: number): bigint {\n return buf.getBigUint64(offset, true);\n}\n\nconst readSmallBuffer = new Uint8Array(8);\nconst readSmallView = new DataView(readSmallBuffer.buffer);\n\nexport function rapid_readSmall(buf: DataView, offset: number, k: number): bigint {\n readSmallBuffer[7] = buf.getUint8(offset);\n readSmallBuffer[4] = buf.getUint8(offset + (k >> 1));\n readSmallBuffer[0] = buf.getUint8(offset + k - 1);\n return readSmallView.getBigUint64(0, true);\n}\n\nconst readBytesBuffer = new Uint8Array(8);\nconst readBytesView = new DataView(readBytesBuffer.buffer);\n\nexport function rapid_readBytes(buf: DataView, offset1: number, offset2: number): bigint {\n readBytesBuffer[0] = buf.getUint8(offset2);\n readBytesBuffer[7] = buf.getUint8(offset1);\n return readBytesView.getBigUint64(0, true);\n}\n\n// ---\n\nconst textEncoder = new TextEncoder();\nconst utf8BufferSize = 2048;\nconst stringLengthThresholdToUseBuffer = utf8BufferSize / 3;\nconst utf8Buffer = new Uint8Array(utf8BufferSize);\n\nexport function toDataView(message: string | Uint8Array | DataView): DataView {\n if (typeof message === 'string') {\n if (message.length <= stringLengthThresholdToUseBuffer) {\n const {written} = textEncoder.encodeInto(message, utf8Buffer);\n return new DataView(utf8Buffer.buffer, 0, written);\n }\n\n const utf8bytes = textEncoder.encode(message);\n return new DataView(utf8bytes.buffer, utf8bytes.byteOffset, utf8bytes.byteLength);\n }\n\n if (message instanceof Uint8Array) {\n return new DataView(message.buffer, message.byteOffset, message.byteLength);\n }\n\n return message;\n}\n\n// ---\n\nexport type RapidMumBehaviour = 'fast' | 'protected';\nconst defaultRapidMumBehaviour: RapidMumBehaviour = 'fast';\n\nexport interface RapidhashOptions {\n seed: bigint;\n rapidMumBehaviour: RapidMumBehaviour;\n}\n\nexport const rapidMumImplementations: {\n [behaviour in RapidMumBehaviour]: {\n rapid_mix: RapidMix;\n rapidhash_epilogue: RapidhashEpilogue;\n };\n} = {\n fast: {\n rapid_mix: rapid_mix_fast,\n rapidhash_epilogue: rapidhash_epilogue_fast,\n },\n protected: {\n rapid_mix: rapid_mix_protected,\n rapidhash_epilogue: rapidhash_epilogue_protected,\n },\n};\n\nfunction isBigUint64(value: bigint): boolean {\n return value >= 0n && value <= 0xffff_ffff_ffff_ffffn;\n}\n\nexport function validateOptions(options: Partial<RapidhashOptions> | undefined, defaultSeed: bigint): RapidhashOptions {\n const result: RapidhashOptions = {\n seed: defaultSeed,\n rapidMumBehaviour: defaultRapidMumBehaviour,\n };\n\n if (options === undefined) {\n return result;\n }\n\n if (options.seed !== undefined) {\n if (!isBigUint64(options.seed)) {\n throw new Error(`seed must be a 64-bit unsigned bigint value: ${options.seed}`);\n }\n result.seed = options.seed;\n }\n\n if (options.rapidMumBehaviour !== undefined) {\n result.rapidMumBehaviour = options.rapidMumBehaviour;\n }\n\n return result;\n}\n","export type RapidSecret = [bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint];\n\nexport const RAPID_SEED = 0n;\nexport const rapid_secret: RapidSecret = [\n 0x2d358dccaa6c78a5n,\n 0x8bb84b93962eacc9n,\n 0x4b33a62ed433d4a3n,\n 0x4d5a2da51de1aa47n,\n 0xa0761d6478bd642fn,\n 0xe7037ed1a0b428dbn,\n 0x90ed1765281c388cn,\n 0xaaaaaaaaaaaaaaaan,\n];\n","import {rapid_mix_fast, rapid_mix_protected} from '../common';\nimport {RAPID_SEED, type RapidSecret, rapid_secret} from '../common_v2';\n\n// Default seed and secret parameters are the same as Rapidhash V2\nexport {RAPID_SEED, type RapidSecret, rapid_secret};\n\n// ---\n\nconst readSmallV3Buffer = new Uint8Array(8);\nconst readSmallV3View = new DataView(readSmallV3Buffer.buffer);\n\nexport function rapid_readSmallV3(input: DataView, len: number): bigint {\n const v = input.getUint8(0);\n readSmallV3Buffer[6] = v >> 3;\n readSmallV3Buffer[5] = v << 5;\n readSmallV3Buffer[0] = input.getUint8(len - 1);\n return readSmallV3View.getBigUint64(0, true);\n}\n\n// ---\n\nexport type RapidhashEpilogueV3 = (a: bigint, b: bigint, secret: RapidSecret, i: bigint) => bigint;\n\nexport function rapidhash_epilogueV3_fast(a: bigint, b: bigint, secret: RapidSecret, i: bigint): bigint {\n const m0 = a * b;\n const m1 = (BigInt.asUintN(64, m0) ^ secret[7]) * ((m0 >> 64n) ^ secret[1] ^ i);\n return BigInt.asUintN(64, m1) ^ (m1 >> 64n);\n}\n\nexport function rapidhash_epilogueV3_protected(a0: bigint, b0: bigint, secret: RapidSecret, i: bigint): bigint {\n const m0 = a0 * b0;\n const a1 = BigInt.asUintN(64, m0) ^ secret[7] ^ a0;\n const b1 = (m0 >> 64n) ^ secret[1] ^ i ^ b0;\n const m1 = a1 * b1;\n return BigInt.asUintN(64, m1) ^ (m1 >> 64n) ^ a1 ^ b1;\n}\n\n// ---\n\nexport const rapidMumImplementationsV3 = {\n fast: {\n rapid_mix: rapid_mix_fast,\n rapidhash_epilogue: rapidhash_epilogueV3_fast,\n },\n protected: {\n rapid_mix: rapid_mix_protected,\n rapidhash_epilogue: rapidhash_epilogueV3_protected,\n },\n};\n","import {\n type RapidhashOptions,\n type RapidMix,\n rapid_mix_fast,\n rapid_mix_protected,\n rapid_read32,\n rapid_read64,\n toDataView,\n validateOptions,\n} from '../common';\nimport {\n RAPID_SEED,\n type RapidhashEpilogueV3,\n type RapidSecret,\n rapid_readSmallV3,\n rapid_secret,\n rapidhash_epilogueV3_fast,\n rapidhash_epilogueV3_protected,\n rapidMumImplementationsV3,\n} from './common_v3';\n\nfunction rapidhash_v3_0_internal(\n key: DataView,\n seed: bigint,\n secret: RapidSecret,\n rapid_mix: RapidMix,\n rapidhash_epilogue: RapidhashEpilogueV3,\n): bigint {\n const len = key.byteLength;\n const lenBI = BigInt(key.byteLength);\n\n seed ^= rapid_mix(seed ^ secret[2], secret[1]);\n\n let a: bigint;\n let b: bigint;\n let i = len;\n let bi: bigint | undefined;\n\n if (len <= 16) {\n bi = lenBI;\n if (len >= 4) {\n seed ^= lenBI;\n if (len >= 8) {\n const last = len - 8;\n a = rapid_read64(key, 0);\n b = rapid_read64(key, last);\n } else {\n const last = len - 4;\n a = rapid_read32(key, 0);\n b = rapid_read32(key, last);\n }\n } else if (len > 0) {\n a = rapid_readSmallV3(key, len);\n b = BigInt(key.getUint8(len >> 1));\n } else {\n a = 0n;\n b = 0n;\n }\n } else {\n let p = 0;\n\n if (i > 112) {\n let see1 = seed;\n let see2 = seed;\n let see3 = seed;\n let see4 = seed;\n let see5 = seed;\n let see6 = seed;\n\n do {\n seed = rapid_mix(rapid_read64(key, p) ^ secret[0], rapid_read64(key, p + 8) ^ seed);\n see1 = rapid_mix(rapid_read64(key, p + 16) ^ secret[1], rapid_read64(key, p + 24) ^ see1);\n see2 = rapid_mix(rapid_read64(key, p + 32) ^ secret[2], rapid_read64(key, p + 40) ^ see2);\n see3 = rapid_mix(rapid_read64(key, p + 48) ^ secret[3], rapid_read64(key, p + 56) ^ see3);\n see4 = rapid_mix(rapid_read64(key, p + 64) ^ secret[4], rapid_read64(key, p + 72) ^ see4);\n see5 = rapid_mix(rapid_read64(key, p + 80) ^ secret[5], rapid_read64(key, p + 88) ^ see5);\n see6 = rapid_mix(rapid_read64(key, p + 96) ^ secret[6], rapid_read64(key, p + 104) ^ see6);\n p += 112;\n i -= 112;\n } while (i > 112);\n\n seed ^= see1;\n see2 ^= see3;\n see4 ^= see5;\n seed ^= see6;\n see2 ^= see4;\n seed ^= see2;\n }\n\n bi = BigInt(i);\n\n if (i > 16) {\n seed = rapid_mix(rapid_read64(key, p) ^ secret[2], rapid_read64(key, p + 8) ^ seed);\n if (i > 32) {\n seed = rapid_mix(rapid_read64(key, p + 16) ^ secret[2], rapid_read64(key, p + 24) ^ seed);\n if (i > 48) {\n seed = rapid_mix(rapid_read64(key, p + 32) ^ secret[1], rapid_read64(key, p + 40) ^ seed);\n if (i > 64) {\n seed = rapid_mix(rapid_read64(key, p + 48) ^ secret[1], rapid_read64(key, p + 56) ^ seed);\n if (i > 80) {\n seed = rapid_mix(rapid_read64(key, p + 64) ^ secret[2], rapid_read64(key, p + 72) ^ seed);\n if (i > 96) {\n seed = rapid_mix(rapid_read64(key, p + 80) ^ secret[1], rapid_read64(key, p + 88) ^ seed);\n }\n }\n }\n }\n }\n }\n\n a = rapid_read64(key, p + i - 16) ^ bi;\n b = rapid_read64(key, p + i - 8);\n }\n\n a ^= secret[1];\n b ^= seed;\n\n return rapidhash_epilogue(a, b, secret, bi);\n}\n\n// ---\n\n/**\n * Calculate a 64-bit hash value of the given message.\n *\n * @param message {string|Uint8Array|DataView} The message to be hashed.\n * @param options Options for modifying the hash calculation.\n * @param options.seed {bigint} 64-bit unsigned seed value.\n * @param options.rapidMumBehaviour {\"fast\"|\"protected\"} Alters behaviour of the rapid_mum function. Defaults to 'fast'.\n */\nexport function rapidhash(message: string | Uint8Array | DataView, options?: Partial<RapidhashOptions>): bigint {\n const {seed, rapidMumBehaviour} = validateOptions(options, RAPID_SEED);\n const {rapid_mix, rapidhash_epilogue} = rapidMumImplementationsV3[rapidMumBehaviour];\n\n return rapidhash_v3_0_internal(toDataView(message), seed, rapid_secret, rapid_mix, rapidhash_epilogue);\n}\n\n/**\n * Calculate a 64-bit hash value of the given message.\n * This function is equivalent to rapidhash() with options.rapidMumBehaviour set to 'fast'.\n *\n * @param message {string|Uint8Array|DataView} The message to be hashed.\n * @param options Options for modifying the hash calculation.\n * @param options.seed {bigint} 64-bit unsigned seed value.\n */\nexport function rapidhash_fast(\n message: string | Uint8Array | DataView,\n options?: Partial<Omit<RapidhashOptions, 'rapidMumBehaviour'>>,\n): bigint {\n const {seed} = validateOptions(options, RAPID_SEED);\n\n return rapidhash_v3_0_internal(toDataView(message), seed, rapid_secret, rapid_mix_fast, rapidhash_epilogueV3_fast);\n}\n\n/**\n * Calculate a 64-bit hash value of the given message.\n * This function is equivalent to rapidhash() with options.rapidMumBehaviour set to 'protected'.\n *\n * @param message {string|Uint8Array|DataView} The message to be hashed.\n * @param options Options for modifying the hash calculation.\n * @param options.seed {bigint} 64-bit unsigned seed value.\n */\nexport function rapidhash_protected(\n message: string | Uint8Array | DataView,\n options?: Partial<Omit<RapidhashOptions, 'rapidMumBehaviour'>>,\n): bigint {\n const {seed} = validateOptions(options, RAPID_SEED);\n\n return rapidhash_v3_0_internal(\n toDataView(message),\n seed,\n rapid_secret,\n rapid_mix_protected,\n rapidhash_epilogueV3_protected,\n );\n}\n","import {\n type RapidhashOptions,\n type RapidMix,\n rapid_mix_fast,\n rapid_mix_protected,\n rapid_read32,\n rapid_read64,\n toDataView,\n validateOptions,\n} from '../common';\nimport {\n RAPID_SEED,\n type RapidhashEpilogueV3,\n type RapidSecret,\n rapid_readSmallV3,\n rapid_secret,\n rapidhash_epilogueV3_fast,\n rapidhash_epilogueV3_protected,\n rapidMumImplementationsV3,\n} from './common_v3';\n\nfunction rapidhashMicro_v3_0_internal(\n key: DataView,\n seed: bigint,\n secret: RapidSecret,\n rapid_mix: RapidMix,\n rapidhash_epilogue: RapidhashEpilogueV3,\n): bigint {\n const len = key.byteLength;\n const lenBI = BigInt(key.byteLength);\n\n seed ^= rapid_mix(seed ^ secret[2], secret[1]);\n\n let a: bigint;\n let b: bigint;\n let i = len;\n let bi: bigint | undefined;\n\n if (len <= 16) {\n bi = lenBI;\n if (len >= 4) {\n seed ^= lenBI;\n if (len >= 8) {\n const last = len - 8;\n a = rapid_read64(key, 0);\n b = rapid_read64(key, last);\n } else {\n const last = len - 4;\n a = rapid_read32(key, 0);\n b = rapid_read32(key, last);\n }\n } else if (len > 0) {\n a = rapid_readSmallV3(key, len);\n b = BigInt(key.getUint8(len >> 1));\n } else {\n a = 0n;\n b = 0n;\n }\n } else {\n let p = 0;\n\n if (i > 80) {\n let see1 = seed;\n let see2 = seed;\n let see3 = seed;\n let see4 = seed;\n\n do {\n seed = rapid_mix(rapid_read64(key, p) ^ secret[0], rapid_read64(key, p + 8) ^ seed);\n see1 = rapid_mix(rapid_read64(key, p + 16) ^ secret[1], rapid_read64(key, p + 24) ^ see1);\n see2 = rapid_mix(rapid_read64(key, p + 32) ^ secret[2], rapid_read64(key, p + 40) ^ see2);\n see3 = rapid_mix(rapid_read64(key, p + 48) ^ secret[3], rapid_read64(key, p + 56) ^ see3);\n see4 = rapid_mix(rapid_read64(key, p + 64) ^ secret[4], rapid_read64(key, p + 72) ^ see4);\n p += 80;\n i -= 80;\n } while (i > 80);\n\n seed ^= see1;\n see2 ^= see3;\n seed ^= see4;\n seed ^= see2;\n }\n\n bi = BigInt(i);\n\n if (i > 16) {\n seed = rapid_mix(rapid_read64(key, p) ^ secret[2], rapid_read64(key, p + 8) ^ seed);\n if (i > 32) {\n seed = rapid_mix(rapid_read64(key, p + 16) ^ secret[2], rapid_read64(key, p + 24) ^ seed);\n if (i > 48) {\n seed = rapid_mix(rapid_read64(key, p + 32) ^ secret[1], rapid_read64(key, p + 40) ^ seed);\n if (i > 64) {\n seed = rapid_mix(rapid_read64(key, p + 48) ^ secret[1], rapid_read64(key, p + 56) ^ seed);\n }\n }\n }\n }\n\n a = rapid_read64(key, p + i - 16) ^ bi;\n b = rapid_read64(key, p + i - 8);\n }\n\n a ^= secret[1];\n b ^= seed;\n\n return rapidhash_epilogue(a, b, secret, bi);\n}\n\n/**\n * Calculate a 64-bit hash value of the given message using the Micro variant.\n * This variant uses 80-byte loop blocks for optimized performance characteristics.\n *\n * @param message {string|Uint8Array|DataView} The message to be hashed.\n * @param options Options for modifying the hash calculation.\n * @param options.seed {bigint} 64-bit unsigned seed value.\n * @param options.rapidMumBehaviour {\"fast\"|\"protected\"} Alters behaviour of the rapid_mum function. Defaults to 'fast'.\n */\nexport function rapidhashMicro(message: string | Uint8Array | DataView, options?: Partial<RapidhashOptions>): bigint {\n const {seed, rapidMumBehaviour} = validateOptions(options, RAPID_SEED);\n const {rapid_mix, rapidhash_epilogue} = rapidMumImplementationsV3[rapidMumBehaviour];\n\n return rapidhashMicro_v3_0_internal(toDataView(message), seed, rapid_secret, rapid_mix, rapidhash_epilogue);\n}\n\n/**\n * Calculate a 64-bit hash value of the given message using the Micro variant.\n * This function is equivalent to rapidhashMicro() with options.rapidMumBehaviour set to 'fast'.\n *\n * @param message {string|Uint8Array|DataView} The message to be hashed.\n * @param options Options for modifying the hash calculation.\n * @param options.seed {bigint} 64-bit unsigned seed value.\n */\nexport function rapidhashMicro_fast(\n message: string | Uint8Array | DataView,\n options?: Partial<Omit<RapidhashOptions, 'rapidMumBehaviour'>>,\n): bigint {\n const {seed} = validateOptions(options, RAPID_SEED);\n\n return rapidhashMicro_v3_0_internal(\n toDataView(message),\n seed,\n rapid_secret,\n rapid_mix_fast,\n rapidhash_epilogueV3_fast,\n );\n}\n\n/**\n * Calculate a 64-bit hash value of the given message using the Micro variant.\n * This function is equivalent to rapidhashMicro() with options.rapidMumBehaviour set to 'protected'.\n *\n * @param message {string|Uint8Array|DataView} The message to be hashed.\n * @param options Options for modifying the hash calculation.\n * @param options.seed {bigint} 64-bit unsigned seed value.\n */\nexport function rapidhashMicro_protected(\n message: string | Uint8Array | DataView,\n options?: Partial<Omit<RapidhashOptions, 'rapidMumBehaviour'>>,\n): bigint {\n const {seed} = validateOptions(options, RAPID_SEED);\n\n return rapidhashMicro_v3_0_internal(\n toDataView(message),\n seed,\n rapid_secret,\n rapid_mix_protected,\n rapidhash_epilogueV3_protected,\n );\n}\n","import {\n type RapidhashOptions,\n type RapidMix,\n rapid_mix_fast,\n rapid_mix_protected,\n rapid_read32,\n rapid_read64,\n toDataView,\n validateOptions,\n} from '../common';\nimport {\n RAPID_SEED,\n type RapidhashEpilogueV3,\n type RapidSecret,\n rapid_readSmallV3,\n rapid_secret,\n rapidhash_epilogueV3_fast,\n rapidhash_epilogueV3_protected,\n rapidMumImplementationsV3,\n} from './common_v3';\n\nfunction rapidhashNano_v3_0_internal(\n key: DataView,\n seed: bigint,\n secret: RapidSecret,\n rapid_mix: RapidMix,\n rapidhash_epilogue: RapidhashEpilogueV3,\n): bigint {\n const len = key.byteLength;\n const lenBI = BigInt(key.byteLength);\n\n seed ^= rapid_mix(seed ^ secret[2], secret[1]);\n\n let a: bigint;\n let b: bigint;\n let i = len;\n let bi: bigint | undefined;\n\n if (len <= 16) {\n bi = lenBI;\n if (len >= 4) {\n seed ^= lenBI;\n if (len >= 8) {\n const last = len - 8;\n a = rapid_read64(key, 0);\n b = rapid_read64(key, last);\n } else {\n const last = len - 4;\n a = rapid_read32(key, 0);\n b = rapid_read32(key, last);\n }\n } else if (len > 0) {\n a = rapid_readSmallV3(key, len);\n b = BigInt(key.getUint8(len >> 1));\n } else {\n a = 0n;\n b = 0n;\n }\n } else {\n let p = 0;\n\n if (i > 48) {\n let see1 = seed;\n let see2 = seed;\n\n do {\n seed = rapid_mix(rapid_read64(key, p) ^ secret[0], rapid_read64(key, p + 8) ^ seed);\n see1 = rapid_mix(rapid_read64(key, p + 16) ^ secret[1], rapid_read64(key, p + 24) ^ see1);\n see2 = rapid_mix(rapid_read64(key, p + 32) ^ secret[2], rapid_read64(key, p + 40) ^ see2);\n p += 48;\n i -= 48;\n } while (i > 48);\n\n seed ^= see1;\n seed ^= see2;\n }\n\n bi = BigInt(i);\n\n if (i > 16) {\n seed = rapid_mix(rapid_read64(key, p) ^ secret[2], rapid_read64(key, p + 8) ^ seed);\n if (i > 32) {\n seed = rapid_mix(rapid_read64(key, p + 16) ^ secret[2], rapid_read64(key, p + 24) ^ seed);\n }\n }\n\n a = rapid_read64(key, p + i - 16) ^ bi;\n b = rapid_read64(key, p + i - 8);\n }\n\n a ^= secret[1];\n b ^= seed;\n\n return rapidhash_epilogue(a, b, secret, bi);\n}\n\n/**\n * Calculate a 64-bit hash value of the given message using the Nano variant.\n * This variant uses 48-byte loop blocks for optimized performance characteristics.\n *\n * @param message {string|Uint8Array|DataView} The message to be hashed.\n * @param options Options for modifying the hash calculation.\n * @param options.seed {bigint} 64-bit unsigned seed value.\n * @param options.rapidMumBehaviour {\"fast\"|\"protected\"} Alters behaviour of the rapid_mum function. Defaults to 'fast'.\n */\nexport function rapidhashNano(message: string | Uint8Array | DataView, options?: Partial<RapidhashOptions>): bigint {\n const {seed, rapidMumBehaviour} = validateOptions(options, RAPID_SEED);\n const {rapid_mix, rapidhash_epilogue} = rapidMumImplementationsV3[rapidMumBehaviour];\n\n return rapidhashNano_v3_0_internal(toDataView(message), seed, rapid_secret, rapid_mix, rapidhash_epilogue);\n}\n\n/**\n * Calculate a 64-bit hash value of the given message using the Nano variant.\n * This function is equivalent to rapidhashNano() with options.rapidMumBehaviour set to 'fast'.\n *\n * @param message {string|Uint8Array|DataView} The message to be hashed.\n * @param options Options for modifying the hash calculation.\n * @param options.seed {bigint} 64-bit unsigned seed value.\n */\nexport function rapidhashNano_fast(\n message: string | Uint8Array | DataView,\n options?: Partial<Omit<RapidhashOptions, 'rapidMumBehaviour'>>,\n): bigint {\n const {seed} = validateOptions(options, RAPID_SEED);\n\n return rapidhashNano_v3_0_internal(\n toDataView(message),\n seed,\n rapid_secret,\n rapid_mix_fast,\n rapidhash_epilogueV3_fast,\n );\n}\n\n/**\n * Calculate a 64-bit hash value of the given message using the Nano variant.\n * This function is equivalent to rapidhashNano() with options.rapidMumBehaviour set to 'protected'.\n *\n * @param message {string|Uint8Array|DataView} The message to be hashed.\n * @param options Options for modifying the hash calculation.\n * @param options.seed {bigint} 64-bit unsigned seed value.\n */\nexport function rapidhashNano_protected(\n message: string | Uint8Array | DataView,\n options?: Partial<Omit<RapidhashOptions, 'rapidMumBehaviour'>>,\n): bigint {\n const {seed} = validateOptions(options, RAPID_SEED);\n\n return rapidhashNano_v3_0_internal(\n toDataView(message),\n seed,\n rapid_secret,\n rapid_mix_protected,\n rapidhash_epilogueV3_protected,\n );\n}\n"],"mappings":";AAGO,SAAS,eAAe,GAAW,GAAmB;AAC3D,QAAM,IAAI,IAAI;AACd,SAAO,OAAO,QAAQ,IAAI,CAAC,IAAK,KAAK;AACvC;AAQO,SAAS,oBAAoB,GAAW,GAAmB;AAChE,QAAM,IAAI,IAAI;AACd,SAAO,OAAO,QAAQ,IAAI,CAAC,IAAK,KAAK,MAAO,IAAI;AAClD;AAkBA,IAAM,iBAAiB,IAAI,WAAW,CAAC;AACvC,IAAM,eAA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AA,IACV;AAEA,SAAK,OAAO,CAAC;AAEb,QAAI,IAAI,IAAI;AACV,aAAO,UAAU,aAAa,KAAK,CAAC,IAAI,OAAO,CAAC,GAAG,aAAa,KAAK,IAAI,CAAC,IAAI,IAAI;AAClF,UAAI,IAAI,IAAI;AACV,eAAO,UAAU,aAAa,KAAK,IAAI,EAAE,IAAI,OAAO,CAAC,GAAG,aAAa,KAAK,IAAI,EAAE,IAAI,IAAI;AAAA,MAC1F;AAAA,IACF;AAEA,QAAI,aAAa,KAAK,IAAI,IAAI,EAAE,IAAI;AACpC,QAAI,aAAa,KAAK,IAAI,IAAI,CAAC;AAAA,EACjC;AAEA,OAAK,OAAO,CAAC;AACb,OAAK;AAEL,SAAO,mBAAmB,GAAG,GAAG,QAAQ,EAAE;AAC5C;AAWO,SAAS,cAAc,SAAyC,SAA6C;AAClH,QAAM,EAAC,MAAM,kBAAiB,IAAI,gBAAgB,SAAS,UAAU;AACrE,QAAM,EAAC,WAAW,mBAAkB,IAAI,0BAA0B,iBAAiB;AAEnF,SAAO,4BAA4B,WAAW,OAAO,GAAG,MAAM,cAAc,WAAW,kBAAkB;AAC3G;AAUO,SAAS,mBACd,SACA,SACQ;AACR,QAAM,EAAC,KAAI,IAAI,gBAAgB,SAAS,UAAU;AAElD,SAAO;AAAA,IACL,WAAW,OAAO;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAUO,SAAS,wBACd,SACA,SACQ;AACR,QAAM,EAAC,KAAI,IAAI,gBAAgB,SAAS,UAAU;AAElD,SAAO;AAAA,IACL,WAAW,OAAO;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rapidhash-js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "A TypeScript implementation of Rapidhash",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hash",
|
|
@@ -22,24 +22,33 @@
|
|
|
22
22
|
"node": ">=18"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
|
-
"build": "tsup
|
|
25
|
+
"build": "tsup",
|
|
26
26
|
"test": "npm run test:jest && npm run test:attw",
|
|
27
27
|
"test:jest": "vitest --run",
|
|
28
|
-
"test:attw": "attw --pack .",
|
|
28
|
+
"test:attw": "attw --profile node16 --format table-flipped --pack .",
|
|
29
29
|
"pretest": "npm run build"
|
|
30
30
|
},
|
|
31
31
|
"main": "lib/index.js",
|
|
32
|
-
"types": "lib/index.d.ts",
|
|
33
32
|
"exports": {
|
|
34
33
|
".": {
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"import":
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
"import": "./lib/index.mjs",
|
|
35
|
+
"default": "./lib/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./v1.0": {
|
|
38
|
+
"import": "./lib/v1.0/index.mjs",
|
|
39
|
+
"default": "./lib/v1.0/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./v2.0": {
|
|
42
|
+
"import": "./lib/v2.0/index.mjs",
|
|
43
|
+
"default": "./lib/v2.0/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./v2.2": {
|
|
46
|
+
"import": "./lib/v2.2/index.mjs",
|
|
47
|
+
"default": "./lib/v2.2/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./v3.0": {
|
|
50
|
+
"import": "./lib/v3.0/index.mjs",
|
|
51
|
+
"default": "./lib/v3.0/index.js"
|
|
43
52
|
}
|
|
44
53
|
},
|
|
45
54
|
"files": [
|