rapidhash-js 2.2.0 → 3.0.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +100 -53
  3. package/lib/common.d.mts +7 -0
  4. package/lib/common.d.ts +7 -0
  5. package/lib/common.js +167 -0
  6. package/lib/common.js.map +1 -0
  7. package/lib/common.mjs +96 -0
  8. package/lib/common.mjs.map +1 -0
  9. package/lib/common_v2.js +26 -0
  10. package/lib/common_v2.js.map +1 -0
  11. package/lib/common_v2.mjs +15 -0
  12. package/lib/common_v2.mjs.map +1 -0
  13. package/lib/index.d.mts +2 -91
  14. package/lib/index.d.ts +2 -91
  15. package/lib/index.js +11 -467
  16. package/lib/index.mjs +1 -429
  17. package/lib/v1.0/index.d.mts +30 -0
  18. package/lib/v1.0/index.d.ts +30 -0
  19. package/lib/v1.0/index.js +106 -0
  20. package/lib/v1.0/index.js.map +1 -0
  21. package/lib/v1.0/index.mjs +103 -0
  22. package/lib/v1.0/index.mjs.map +1 -0
  23. package/lib/v2.0/index.d.mts +30 -0
  24. package/lib/v2.0/index.d.ts +30 -0
  25. package/lib/v2.0/index.js +128 -0
  26. package/lib/v2.0/index.js.map +1 -0
  27. package/lib/v2.0/index.mjs +125 -0
  28. package/lib/v2.0/index.mjs.map +1 -0
  29. package/lib/v2.2/index.d.mts +30 -0
  30. package/lib/v2.2/index.d.ts +30 -0
  31. package/lib/v2.2/index.js +128 -0
  32. package/lib/v2.2/index.js.map +1 -0
  33. package/lib/v2.2/index.mjs +125 -0
  34. package/lib/v2.2/index.mjs.map +1 -0
  35. package/lib/v3.0/index.d.mts +86 -0
  36. package/lib/v3.0/index.d.ts +86 -0
  37. package/lib/v3.0/index.js +11 -0
  38. package/lib/v3.0/index.mjs +1 -0
  39. package/lib/v3.0.js +407 -0
  40. package/lib/v3.0.js.map +1 -0
  41. package/lib/v3.0.mjs +354 -0
  42. package/lib/v3.0.mjs.map +1 -0
  43. package/package.json +23 -15
  44. package/lib/index.js.map +0 -1
  45. package/lib/index.mjs.map +0 -1
@@ -0,0 +1,128 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_common = require("../common.js");
3
+ const require_common_v2 = require("../common_v2.js");
4
+ // src/v2.2/rapidhash_v2.2.ts
5
+ function rapidhash_v2_2_internal(key, seed, secret, rapid_mix, rapidhash_epilogue) {
6
+ const len = key.byteLength;
7
+ const lenBI = BigInt(key.byteLength);
8
+ seed ^= rapid_mix(seed ^ secret[2], secret[1]) ^ lenBI;
9
+ let a;
10
+ let b;
11
+ if (len <= 16) {
12
+ if (len >= 4) {
13
+ if (len >= 8) {
14
+ const last = len - 8;
15
+ a = require_common.rapid_read64(key, 0);
16
+ b = require_common.rapid_read64(key, last);
17
+ } else {
18
+ const last = len - 4;
19
+ a = require_common.rapid_read32(key, 0);
20
+ b = require_common.rapid_read32(key, last);
21
+ }
22
+ } else if (len > 0) {
23
+ a = require_common.rapid_readBytes(key, 0, len - 1);
24
+ b = BigInt(key.getUint8(len >> 1));
25
+ } else {
26
+ a = 0n;
27
+ b = 0n;
28
+ }
29
+ } else if (len <= 64) {
30
+ seed = rapid_mix(require_common.rapid_read64(key, 0) ^ secret[0], require_common.rapid_read64(key, 8) ^ seed);
31
+ if (len > 32) {
32
+ seed = rapid_mix(require_common.rapid_read64(key, 16) ^ secret[1], require_common.rapid_read64(key, 24) ^ seed);
33
+ if (len > 48) seed = rapid_mix(require_common.rapid_read64(key, 32) ^ secret[1], require_common.rapid_read64(key, 40) ^ seed);
34
+ }
35
+ a = require_common.rapid_read64(key, len - 16);
36
+ b = require_common.rapid_read64(key, len - 8);
37
+ } else {
38
+ let i = len;
39
+ let p = 0;
40
+ let see1 = seed;
41
+ let see2 = seed;
42
+ let see3456;
43
+ if (i >= 112) {
44
+ let see3 = seed;
45
+ let see4 = seed;
46
+ let see5 = seed;
47
+ let see6 = seed;
48
+ do {
49
+ seed = rapid_mix(require_common.rapid_read64(key, p) ^ secret[0], require_common.rapid_read64(key, p + 8) ^ seed);
50
+ see1 = rapid_mix(require_common.rapid_read64(key, p + 16) ^ secret[1], require_common.rapid_read64(key, p + 24) ^ see1);
51
+ see2 = rapid_mix(require_common.rapid_read64(key, p + 32) ^ secret[2], require_common.rapid_read64(key, p + 40) ^ see2);
52
+ see3 = rapid_mix(require_common.rapid_read64(key, p + 48) ^ secret[3], require_common.rapid_read64(key, p + 56) ^ see3);
53
+ see4 = rapid_mix(require_common.rapid_read64(key, p + 64) ^ secret[4], require_common.rapid_read64(key, p + 72) ^ see4);
54
+ see5 = rapid_mix(require_common.rapid_read64(key, p + 80) ^ secret[5], require_common.rapid_read64(key, p + 88) ^ see5);
55
+ see6 = rapid_mix(require_common.rapid_read64(key, p + 96) ^ secret[6], require_common.rapid_read64(key, p + 104) ^ see6);
56
+ p += 112;
57
+ i -= 112;
58
+ } while (i >= 112);
59
+ see3456 = see3 ^ see4 ^ see5 ^ see6;
60
+ } else see3456 = 0n;
61
+ if (i >= 48) {
62
+ seed = rapid_mix(require_common.rapid_read64(key, p) ^ secret[0], require_common.rapid_read64(key, p + 8) ^ seed);
63
+ see1 = rapid_mix(require_common.rapid_read64(key, p + 16) ^ secret[1], require_common.rapid_read64(key, p + 24) ^ see1);
64
+ see2 = rapid_mix(require_common.rapid_read64(key, p + 32) ^ secret[2], require_common.rapid_read64(key, p + 40) ^ see2);
65
+ p += 48;
66
+ i -= 48;
67
+ if (i >= 48) {
68
+ seed = rapid_mix(require_common.rapid_read64(key, p) ^ secret[0], require_common.rapid_read64(key, p + 8) ^ seed);
69
+ see1 = rapid_mix(require_common.rapid_read64(key, p + 16) ^ secret[1], require_common.rapid_read64(key, p + 24) ^ see1);
70
+ see2 = rapid_mix(require_common.rapid_read64(key, p + 32) ^ secret[2], require_common.rapid_read64(key, p + 40) ^ see2);
71
+ p += 48;
72
+ i -= 48;
73
+ }
74
+ }
75
+ seed ^= see1 ^ see2 ^ see3456;
76
+ if (i > 16) {
77
+ seed = rapid_mix(require_common.rapid_read64(key, p) ^ secret[2], require_common.rapid_read64(key, p + 8) ^ seed);
78
+ if (i > 32) seed = rapid_mix(require_common.rapid_read64(key, p + 16) ^ secret[2], require_common.rapid_read64(key, p + 24) ^ seed);
79
+ }
80
+ a = require_common.rapid_read64(key, p + i - 16);
81
+ b = require_common.rapid_read64(key, p + i - 8);
82
+ }
83
+ a ^= secret[1];
84
+ b ^= seed;
85
+ return rapidhash_epilogue(a, b, secret[7], secret[1], lenBI);
86
+ }
87
+ /**
88
+ * Calculate a 64-bit hash value of the given message.
89
+ *
90
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
91
+ * @param options Options for modifying the hash calculation.
92
+ * @param options.seed {bigint} 64-bit unsigned seed value.
93
+ * @param options.rapidMumBehaviour {'fast'|'protected'} Alters behaviour of the rapid_mum function. Defaults to 'fast'.
94
+ */
95
+ function rapidhash_v2_2(message, options) {
96
+ const { seed, rapidMumBehaviour } = require_common.validateOptions(options, require_common_v2.RAPID_SEED);
97
+ const { rapid_mix, rapidhash_epilogue } = require_common.rapidMumImplementations[rapidMumBehaviour];
98
+ return rapidhash_v2_2_internal(require_common.toDataView(message), seed, require_common_v2.rapid_secret, rapid_mix, rapidhash_epilogue);
99
+ }
100
+ /**
101
+ * Calculate a 64-bit hash value of the given message.
102
+ * This function is equivalent to rapidhash() with options.rapidMumBehaviour set to 'fast'.
103
+ *
104
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
105
+ * @param options Options for modifying the hash calculation.
106
+ * @param options.seed {bigint} 64-bit unsigned seed value.
107
+ */
108
+ function rapidhash_v2_2_fast(message, options) {
109
+ const { seed } = require_common.validateOptions(options, require_common_v2.RAPID_SEED);
110
+ return rapidhash_v2_2_internal(require_common.toDataView(message), seed, require_common_v2.rapid_secret, require_common.rapid_mix_fast, require_common.rapidhash_epilogue_fast);
111
+ }
112
+ /**
113
+ * Calculate a 64-bit hash value of the given message.
114
+ * This function is equivalent to rapidhash() with options.rapidMumBehaviour set to 'protected'.
115
+ *
116
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
117
+ * @param options Options for modifying the hash calculation.
118
+ * @param options.seed {bigint} 64-bit unsigned seed value.
119
+ */
120
+ function rapidhash_v2_2_protected(message, options) {
121
+ const { seed } = require_common.validateOptions(options, require_common_v2.RAPID_SEED);
122
+ return rapidhash_v2_2_internal(require_common.toDataView(message), seed, require_common_v2.rapid_secret, require_common.rapid_mix_protected, require_common.rapidhash_epilogue_protected);
123
+ }
124
+ exports.rapidhash = rapidhash_v2_2;
125
+ exports.rapidhash_fast = rapidhash_v2_2_fast;
126
+ exports.rapidhash_protected = rapidhash_v2_2_protected;
127
+
128
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["rapid_read64","rapid_read32","rapid_readBytes","validateOptions","RAPID_SEED","rapidMumImplementations","toDataView","rapid_secret","rapid_mix_fast","rapidhash_epilogue_fast","rapid_mix_protected","rapidhash_epilogue_protected"],"sources":["../../src/v2.2/rapidhash_v2.2.ts"],"sourcesContent":["import {\n type RapidhashEpilogue,\n type RapidhashOptions,\n type RapidMix,\n rapid_mix_fast,\n rapid_mix_protected,\n rapid_read32,\n rapid_read64,\n rapid_readBytes,\n rapidhash_epilogue_fast,\n rapidhash_epilogue_protected,\n rapidMumImplementations,\n toDataView,\n validateOptions,\n} from '../common';\nimport {RAPID_SEED, type RapidSecret, rapid_secret} from '../common_v2';\n\n// ---\n\nfunction rapidhash_v2_2_internal(\n key: DataView,\n seed: bigint,\n secret: RapidSecret,\n rapid_mix: RapidMix,\n rapidhash_epilogue: RapidhashEpilogue,\n): bigint {\n const len = key.byteLength;\n const lenBI = BigInt(key.byteLength);\n\n seed ^= rapid_mix(seed ^ secret[2], secret[1]) ^ lenBI;\n\n let a: bigint;\n let b: bigint;\n\n if (len <= 16) {\n if (len >= 4) {\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_readSmall(key, 0, len);\n a = rapid_readBytes(key, 0, len - 1);\n b = BigInt(key.getUint8(len >> 1));\n } else {\n a = 0n;\n b = 0n;\n }\n } else if (len <= 64) {\n seed = rapid_mix(rapid_read64(key, 0) ^ secret[0], rapid_read64(key, 8) ^ seed);\n if (len > 32) {\n seed = rapid_mix(rapid_read64(key, 16) ^ secret[1], rapid_read64(key, 24) ^ seed);\n if (len > 48) {\n seed = rapid_mix(rapid_read64(key, 32) ^ secret[1], rapid_read64(key, 40) ^ seed);\n }\n }\n a = rapid_read64(key, len - 16);\n b = rapid_read64(key, len - 8);\n } else {\n let i = len;\n let p = 0;\n let see1 = seed;\n let see2 = seed;\n let see3456: bigint; // = 0n;\n\n if (i >= 112) {\n let see3 = seed;\n let see4 = seed;\n let see5 = seed;\n let see6 = seed;\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 see3456 = see3 ^ see4 ^ see5 ^ see6;\n } else {\n see3456 = 0n;\n }\n\n if (i >= 48) {\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 if (i >= 48) {\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 }\n }\n\n seed ^= see1 ^ see2 ^ see3456;\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);\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[7], secret[1], lenBI);\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_v2_2(message: string | Uint8Array | DataView, options?: Partial<RapidhashOptions>): bigint {\n const {seed, rapidMumBehaviour} = validateOptions(options, RAPID_SEED);\n const {rapid_mix, rapidhash_epilogue} = rapidMumImplementations[rapidMumBehaviour];\n\n return rapidhash_v2_2_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_v2_2_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_v2_2_internal(toDataView(message), seed, rapid_secret, rapid_mix_fast, rapidhash_epilogue_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_v2_2_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_v2_2_internal(\n toDataView(message),\n seed,\n rapid_secret,\n rapid_mix_protected,\n rapidhash_epilogue_protected,\n );\n}\n"],"mappings":";;;;AAmBA,SAAS,wBACP,KACA,MACA,QACA,WACA,oBACQ;CACR,MAAM,MAAM,IAAI;CAChB,MAAM,QAAQ,OAAO,IAAI,UAAU;CAEnC,QAAQ,UAAU,OAAO,OAAO,IAAI,OAAO,EAAE,IAAI;CAEjD,IAAI;CACJ,IAAI;CAEJ,IAAI,OAAO,IAAI;EACb,IAAI,OAAO,GAAG;GACZ,IAAI,OAAO,GAAG;IACZ,MAAM,OAAO,MAAM;IACnB,IAAIA,eAAAA,aAAa,KAAK,CAAC;IACvB,IAAIA,eAAAA,aAAa,KAAK,IAAI;GAC5B,OAAO;IACL,MAAM,OAAO,MAAM;IACnB,IAAIC,eAAAA,aAAa,KAAK,CAAC;IACvB,IAAIA,eAAAA,aAAa,KAAK,IAAI;GAC5B;EACF,OAAO,IAAI,MAAM,GAAG;GAElB,IAAIC,eAAAA,gBAAgB,KAAK,G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,OAAO,UAAUA,eAAAA,aAAa,KAAK,CAAC,IAAI,OAAO,IAAIA,eAAAA,aAAa,KAAK,IAAI,CAAC,IAAI,IAAI;GAClF,IAAI,IAAI,IACN,OAAO,UAAUA,eAAAA,aAAa,KAAK,IAAI,EAAE,IAAI,OAAO,IAAIA,eAAAA,aAAa,KAAK,IAAI,EAAE,IAAI,IAAI;EAE5F;EAEA,IAAIA,eAAAA,aAAa,KAAK,IAAI,IAAI,EAAE;EAChC,IAAIA,eAAAA,aAAa,KAAK,IAAI,IAAI,CAAC;CACjC;CAEA,KAAK,OAAO;CACZ,KAAK;CAEL,OAAO,mBAAmB,GAAG,GAAG,OAAO,IAAI,OAAO,IAAI,KAAK;AAC7D;;;;;;;;;AAYA,SAAgB,eAAe,SAAyC,SAA6C;CACnH,MAAM,EAAC,MAAM,sBAAqBG,eAAAA,gBAAgB,SAASC,kBAAAA,UAAU;CACrE,MAAM,EAAC,WAAW,uBAAsBC,eAAAA,wBAAwB;CAEhE,OAAO,wBAAwBC,eAAAA,WAAW,OAAO,GAAG,MAAMC,kBAAAA,cAAc,WAAW,kBAAkB;AACvG;;;;;;;;;AAUA,SAAgB,oBACd,SACA,SACQ;CACR,MAAM,EAAC,SAAQJ,eAAAA,gBAAgB,SAASC,kBAAAA,UAAU;CAElD,OAAO,wBAAwBE,eAAAA,WAAW,OAAO,GAAG,MAAMC,kBAAAA,cAAcC,eAAAA,gBAAgBC,eAAAA,uBAAuB;AACjH;;;;;;;;;AAUA,SAAgB,yBACd,SACA,SACQ;CACR,MAAM,EAAC,SAAQN,eAAAA,gBAAgB,SAASC,kBAAAA,UAAU;CAElD,OAAO,wBACLE,eAAAA,WAAW,OAAO,GAClB,MACAC,kBAAAA,cACAG,eAAAA,qBACAC,eAAAA,4BACF;AACF"}
@@ -0,0 +1,125 @@
1
+ import { d as toDataView, f as validateOptions, i as rapid_read32, l as rapidhash_epilogue_fast, n as rapid_mix_fast, o as rapid_read64, r as rapid_mix_protected, s as rapid_readBytes, t as rapidMumImplementations, u as rapidhash_epilogue_protected } from "../common.mjs";
2
+ import { n as rapid_secret, t as RAPID_SEED } from "../common_v2.mjs";
3
+ // src/v2.2/rapidhash_v2.2.ts
4
+ function rapidhash_v2_2_internal(key, seed, secret, rapid_mix, rapidhash_epilogue) {
5
+ const len = key.byteLength;
6
+ const lenBI = BigInt(key.byteLength);
7
+ seed ^= rapid_mix(seed ^ secret[2], secret[1]) ^ lenBI;
8
+ let a;
9
+ let b;
10
+ if (len <= 16) {
11
+ if (len >= 4) {
12
+ if (len >= 8) {
13
+ const last = len - 8;
14
+ a = rapid_read64(key, 0);
15
+ b = rapid_read64(key, last);
16
+ } else {
17
+ const last = len - 4;
18
+ a = rapid_read32(key, 0);
19
+ b = rapid_read32(key, last);
20
+ }
21
+ } else if (len > 0) {
22
+ a = rapid_readBytes(key, 0, len - 1);
23
+ b = BigInt(key.getUint8(len >> 1));
24
+ } else {
25
+ a = 0n;
26
+ b = 0n;
27
+ }
28
+ } else if (len <= 64) {
29
+ seed = rapid_mix(rapid_read64(key, 0) ^ secret[0], rapid_read64(key, 8) ^ seed);
30
+ if (len > 32) {
31
+ seed = rapid_mix(rapid_read64(key, 16) ^ secret[1], rapid_read64(key, 24) ^ seed);
32
+ if (len > 48) seed = rapid_mix(rapid_read64(key, 32) ^ secret[1], rapid_read64(key, 40) ^ seed);
33
+ }
34
+ a = rapid_read64(key, len - 16);
35
+ b = rapid_read64(key, len - 8);
36
+ } else {
37
+ let i = len;
38
+ let p = 0;
39
+ let see1 = seed;
40
+ let see2 = seed;
41
+ let see3456;
42
+ if (i >= 112) {
43
+ let see3 = seed;
44
+ let see4 = seed;
45
+ let see5 = seed;
46
+ let see6 = seed;
47
+ do {
48
+ seed = rapid_mix(rapid_read64(key, p) ^ secret[0], rapid_read64(key, p + 8) ^ seed);
49
+ see1 = rapid_mix(rapid_read64(key, p + 16) ^ secret[1], rapid_read64(key, p + 24) ^ see1);
50
+ see2 = rapid_mix(rapid_read64(key, p + 32) ^ secret[2], rapid_read64(key, p + 40) ^ see2);
51
+ see3 = rapid_mix(rapid_read64(key, p + 48) ^ secret[3], rapid_read64(key, p + 56) ^ see3);
52
+ see4 = rapid_mix(rapid_read64(key, p + 64) ^ secret[4], rapid_read64(key, p + 72) ^ see4);
53
+ see5 = rapid_mix(rapid_read64(key, p + 80) ^ secret[5], rapid_read64(key, p + 88) ^ see5);
54
+ see6 = rapid_mix(rapid_read64(key, p + 96) ^ secret[6], rapid_read64(key, p + 104) ^ see6);
55
+ p += 112;
56
+ i -= 112;
57
+ } while (i >= 112);
58
+ see3456 = see3 ^ see4 ^ see5 ^ see6;
59
+ } else see3456 = 0n;
60
+ if (i >= 48) {
61
+ seed = rapid_mix(rapid_read64(key, p) ^ secret[0], rapid_read64(key, p + 8) ^ seed);
62
+ see1 = rapid_mix(rapid_read64(key, p + 16) ^ secret[1], rapid_read64(key, p + 24) ^ see1);
63
+ see2 = rapid_mix(rapid_read64(key, p + 32) ^ secret[2], rapid_read64(key, p + 40) ^ see2);
64
+ p += 48;
65
+ i -= 48;
66
+ if (i >= 48) {
67
+ seed = rapid_mix(rapid_read64(key, p) ^ secret[0], rapid_read64(key, p + 8) ^ seed);
68
+ see1 = rapid_mix(rapid_read64(key, p + 16) ^ secret[1], rapid_read64(key, p + 24) ^ see1);
69
+ see2 = rapid_mix(rapid_read64(key, p + 32) ^ secret[2], rapid_read64(key, p + 40) ^ see2);
70
+ p += 48;
71
+ i -= 48;
72
+ }
73
+ }
74
+ seed ^= see1 ^ see2 ^ see3456;
75
+ if (i > 16) {
76
+ seed = rapid_mix(rapid_read64(key, p) ^ secret[2], rapid_read64(key, p + 8) ^ seed);
77
+ if (i > 32) seed = rapid_mix(rapid_read64(key, p + 16) ^ secret[2], rapid_read64(key, p + 24) ^ seed);
78
+ }
79
+ a = rapid_read64(key, p + i - 16);
80
+ b = rapid_read64(key, p + i - 8);
81
+ }
82
+ a ^= secret[1];
83
+ b ^= seed;
84
+ return rapidhash_epilogue(a, b, secret[7], secret[1], lenBI);
85
+ }
86
+ /**
87
+ * Calculate a 64-bit hash value of the given message.
88
+ *
89
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
90
+ * @param options Options for modifying the hash calculation.
91
+ * @param options.seed {bigint} 64-bit unsigned seed value.
92
+ * @param options.rapidMumBehaviour {'fast'|'protected'} Alters behaviour of the rapid_mum function. Defaults to 'fast'.
93
+ */
94
+ function rapidhash_v2_2(message, options) {
95
+ const { seed, rapidMumBehaviour } = validateOptions(options, RAPID_SEED);
96
+ const { rapid_mix, rapidhash_epilogue } = rapidMumImplementations[rapidMumBehaviour];
97
+ return rapidhash_v2_2_internal(toDataView(message), seed, rapid_secret, rapid_mix, rapidhash_epilogue);
98
+ }
99
+ /**
100
+ * Calculate a 64-bit hash value of the given message.
101
+ * This function is equivalent to rapidhash() with options.rapidMumBehaviour set to 'fast'.
102
+ *
103
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
104
+ * @param options Options for modifying the hash calculation.
105
+ * @param options.seed {bigint} 64-bit unsigned seed value.
106
+ */
107
+ function rapidhash_v2_2_fast(message, options) {
108
+ const { seed } = validateOptions(options, RAPID_SEED);
109
+ return rapidhash_v2_2_internal(toDataView(message), seed, rapid_secret, rapid_mix_fast, rapidhash_epilogue_fast);
110
+ }
111
+ /**
112
+ * Calculate a 64-bit hash value of the given message.
113
+ * This function is equivalent to rapidhash() with options.rapidMumBehaviour set to 'protected'.
114
+ *
115
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
116
+ * @param options Options for modifying the hash calculation.
117
+ * @param options.seed {bigint} 64-bit unsigned seed value.
118
+ */
119
+ function rapidhash_v2_2_protected(message, options) {
120
+ const { seed } = validateOptions(options, RAPID_SEED);
121
+ return rapidhash_v2_2_internal(toDataView(message), seed, rapid_secret, rapid_mix_protected, rapidhash_epilogue_protected);
122
+ }
123
+ export { rapidhash_v2_2 as rapidhash, rapidhash_v2_2_fast as rapidhash_fast, rapidhash_v2_2_protected as rapidhash_protected };
124
+
125
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/v2.2/rapidhash_v2.2.ts"],"sourcesContent":["import {\n type RapidhashEpilogue,\n type RapidhashOptions,\n type RapidMix,\n rapid_mix_fast,\n rapid_mix_protected,\n rapid_read32,\n rapid_read64,\n rapid_readBytes,\n rapidhash_epilogue_fast,\n rapidhash_epilogue_protected,\n rapidMumImplementations,\n toDataView,\n validateOptions,\n} from '../common';\nimport {RAPID_SEED, type RapidSecret, rapid_secret} from '../common_v2';\n\n// ---\n\nfunction rapidhash_v2_2_internal(\n key: DataView,\n seed: bigint,\n secret: RapidSecret,\n rapid_mix: RapidMix,\n rapidhash_epilogue: RapidhashEpilogue,\n): bigint {\n const len = key.byteLength;\n const lenBI = BigInt(key.byteLength);\n\n seed ^= rapid_mix(seed ^ secret[2], secret[1]) ^ lenBI;\n\n let a: bigint;\n let b: bigint;\n\n if (len <= 16) {\n if (len >= 4) {\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_readSmall(key, 0, len);\n a = rapid_readBytes(key, 0, len - 1);\n b = BigInt(key.getUint8(len >> 1));\n } else {\n a = 0n;\n b = 0n;\n }\n } else if (len <= 64) {\n seed = rapid_mix(rapid_read64(key, 0) ^ secret[0], rapid_read64(key, 8) ^ seed);\n if (len > 32) {\n seed = rapid_mix(rapid_read64(key, 16) ^ secret[1], rapid_read64(key, 24) ^ seed);\n if (len > 48) {\n seed = rapid_mix(rapid_read64(key, 32) ^ secret[1], rapid_read64(key, 40) ^ seed);\n }\n }\n a = rapid_read64(key, len - 16);\n b = rapid_read64(key, len - 8);\n } else {\n let i = len;\n let p = 0;\n let see1 = seed;\n let see2 = seed;\n let see3456: bigint; // = 0n;\n\n if (i >= 112) {\n let see3 = seed;\n let see4 = seed;\n let see5 = seed;\n let see6 = seed;\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 see3456 = see3 ^ see4 ^ see5 ^ see6;\n } else {\n see3456 = 0n;\n }\n\n if (i >= 48) {\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 if (i >= 48) {\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 }\n }\n\n seed ^= see1 ^ see2 ^ see3456;\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);\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[7], secret[1], lenBI);\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_v2_2(message: string | Uint8Array | DataView, options?: Partial<RapidhashOptions>): bigint {\n const {seed, rapidMumBehaviour} = validateOptions(options, RAPID_SEED);\n const {rapid_mix, rapidhash_epilogue} = rapidMumImplementations[rapidMumBehaviour];\n\n return rapidhash_v2_2_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_v2_2_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_v2_2_internal(toDataView(message), seed, rapid_secret, rapid_mix_fast, rapidhash_epilogue_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_v2_2_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_v2_2_internal(\n toDataView(message),\n seed,\n rapid_secret,\n rapid_mix_protected,\n rapidhash_epilogue_protected,\n );\n}\n"],"mappings":";;;AAmBA,SAAS,wBACP,KACA,MACA,QACA,WACA,oBACQ;CACR,MAAM,MAAM,IAAI;CAChB,MAAM,QAAQ,OAAO,IAAI,UAAU;CAEnC,QAAQ,UAAU,OAAO,OAAO,IAAI,OAAO,EAAE,IAAI;CAEjD,IAAI;CACJ,IAAI;CAEJ,IAAI,OAAO,IAAI;EACb,IAAI,OAAO,GAAG;GACZ,IAAI,OAAO,GAAG;IACZ,MAAM,OAAO,MAAM;IACnB,IAAI,aAAa,KAAK,CAAC;IACvB,IAAI,aAAa,KAAK,IAAI;GAC5B,OAAO;IACL,MAAM,OAAO,MAAM;IACnB,IAAI,aAAa,KAAK,CAAC;IACvB,IAAI,aAAa,KAAK,IAAI;GAC5B;EACF,OAAO,IAAI,MAAM,GAAG;GAElB,IAAI,gBAAgB,KAAK,GAAG,MAAM,CAAC;GACnC,IAAI,OAAO,IAAI,SAAS,OAAO,CAAC,CAAC;EACnC,OAAO;GACL,IAAI;GACJ,IAAI;EACN;CACF,OAAO,IAAI,OAAO,IAAI;EACpB,OAAO,UAAU,aAAa,KAAK,CAAC,IAAI,OAAO,IAAI,aAAa,KAAK,CAAC,IAAI,IAAI;EAC9E,IAAI,MAAM,IAAI;GACZ,OAAO,UAAU,aAAa,KAAK,EAAE,IAAI,OAAO,IAAI,aAAa,KAAK,EAAE,IAAI,IAAI;GAChF,IAAI,MAAM,IACR,OAAO,UAAU,aAAa,KAAK,EAAE,IAAI,OAAO,IAAI,aAAa,KAAK,EAAE,IAAI,IAAI;EAEpF;EACA,IAAI,aAAa,KAAK,MAAM,EAAE;EAC9B,IAAI,aAAa,KAAK,MAAM,CAAC;CAC/B,OAAO;EACL,IAAI,IAAI;EACR,IAAI,IAAI;EACR,IAAI,OAAO;EACX,IAAI,OAAO;EACX,IAAI;EAEJ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,qBACA,4BACF;AACF"}
@@ -0,0 +1,86 @@
1
+ import { t as RapidhashOptions } from "../common.mjs";
2
+ /**
3
+ * Calculate a 64-bit hash value of the given message.
4
+ *
5
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
6
+ * @param options Options for modifying the hash calculation.
7
+ * @param options.seed {bigint} 64-bit unsigned seed value.
8
+ * @param options.rapidMumBehaviour {"fast"|"protected"} Alters behaviour of the rapid_mum function. Defaults to 'fast'.
9
+ */
10
+ declare function rapidhash(message: string | Uint8Array | DataView, options?: Partial<RapidhashOptions>): bigint;
11
+ /**
12
+ * Calculate a 64-bit hash value of the given message.
13
+ * This function is equivalent to rapidhash() with options.rapidMumBehaviour set to 'fast'.
14
+ *
15
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
16
+ * @param options Options for modifying the hash calculation.
17
+ * @param options.seed {bigint} 64-bit unsigned seed value.
18
+ */
19
+ declare function rapidhash_fast(message: string | Uint8Array | DataView, options?: Partial<Omit<RapidhashOptions, 'rapidMumBehaviour'>>): bigint;
20
+ /**
21
+ * Calculate a 64-bit hash value of the given message.
22
+ * This function is equivalent to rapidhash() with options.rapidMumBehaviour set to 'protected'.
23
+ *
24
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
25
+ * @param options Options for modifying the hash calculation.
26
+ * @param options.seed {bigint} 64-bit unsigned seed value.
27
+ */
28
+ declare function rapidhash_protected(message: string | Uint8Array | DataView, options?: Partial<Omit<RapidhashOptions, 'rapidMumBehaviour'>>): bigint;
29
+ /**
30
+ * Calculate a 64-bit hash value of the given message using the Micro variant.
31
+ * This variant uses 80-byte loop blocks for optimized performance characteristics.
32
+ *
33
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
34
+ * @param options Options for modifying the hash calculation.
35
+ * @param options.seed {bigint} 64-bit unsigned seed value.
36
+ * @param options.rapidMumBehaviour {"fast"|"protected"} Alters behaviour of the rapid_mum function. Defaults to 'fast'.
37
+ */
38
+ declare function rapidhashMicro(message: string | Uint8Array | DataView, options?: Partial<RapidhashOptions>): bigint;
39
+ /**
40
+ * Calculate a 64-bit hash value of the given message using the Micro variant.
41
+ * This function is equivalent to rapidhashMicro() with options.rapidMumBehaviour set to 'fast'.
42
+ *
43
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
44
+ * @param options Options for modifying the hash calculation.
45
+ * @param options.seed {bigint} 64-bit unsigned seed value.
46
+ */
47
+ declare function rapidhashMicro_fast(message: string | Uint8Array | DataView, options?: Partial<Omit<RapidhashOptions, 'rapidMumBehaviour'>>): bigint;
48
+ /**
49
+ * Calculate a 64-bit hash value of the given message using the Micro variant.
50
+ * This function is equivalent to rapidhashMicro() with options.rapidMumBehaviour set to 'protected'.
51
+ *
52
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
53
+ * @param options Options for modifying the hash calculation.
54
+ * @param options.seed {bigint} 64-bit unsigned seed value.
55
+ */
56
+ declare function rapidhashMicro_protected(message: string | Uint8Array | DataView, options?: Partial<Omit<RapidhashOptions, 'rapidMumBehaviour'>>): bigint;
57
+ /**
58
+ * Calculate a 64-bit hash value of the given message using the Nano variant.
59
+ * This variant uses 48-byte loop blocks for optimized performance characteristics.
60
+ *
61
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
62
+ * @param options Options for modifying the hash calculation.
63
+ * @param options.seed {bigint} 64-bit unsigned seed value.
64
+ * @param options.rapidMumBehaviour {"fast"|"protected"} Alters behaviour of the rapid_mum function. Defaults to 'fast'.
65
+ */
66
+ declare function rapidhashNano(message: string | Uint8Array | DataView, options?: Partial<RapidhashOptions>): bigint;
67
+ /**
68
+ * Calculate a 64-bit hash value of the given message using the Nano variant.
69
+ * This function is equivalent to rapidhashNano() with options.rapidMumBehaviour set to 'fast'.
70
+ *
71
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
72
+ * @param options Options for modifying the hash calculation.
73
+ * @param options.seed {bigint} 64-bit unsigned seed value.
74
+ */
75
+ declare function rapidhashNano_fast(message: string | Uint8Array | DataView, options?: Partial<Omit<RapidhashOptions, 'rapidMumBehaviour'>>): bigint;
76
+ /**
77
+ * Calculate a 64-bit hash value of the given message using the Nano variant.
78
+ * This function is equivalent to rapidhashNano() with options.rapidMumBehaviour set to 'protected'.
79
+ *
80
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
81
+ * @param options Options for modifying the hash calculation.
82
+ * @param options.seed {bigint} 64-bit unsigned seed value.
83
+ */
84
+ declare function rapidhashNano_protected(message: string | Uint8Array | DataView, options?: Partial<Omit<RapidhashOptions, 'rapidMumBehaviour'>>): bigint;
85
+ export { rapidhash, rapidhashMicro, rapidhashMicro_fast, rapidhashMicro_protected, rapidhashNano, rapidhashNano_fast, rapidhashNano_protected, rapidhash_fast, rapidhash_protected };
86
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1,86 @@
1
+ import { t as RapidhashOptions } from "../common.js";
2
+ /**
3
+ * Calculate a 64-bit hash value of the given message.
4
+ *
5
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
6
+ * @param options Options for modifying the hash calculation.
7
+ * @param options.seed {bigint} 64-bit unsigned seed value.
8
+ * @param options.rapidMumBehaviour {"fast"|"protected"} Alters behaviour of the rapid_mum function. Defaults to 'fast'.
9
+ */
10
+ declare function rapidhash(message: string | Uint8Array | DataView, options?: Partial<RapidhashOptions>): bigint;
11
+ /**
12
+ * Calculate a 64-bit hash value of the given message.
13
+ * This function is equivalent to rapidhash() with options.rapidMumBehaviour set to 'fast'.
14
+ *
15
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
16
+ * @param options Options for modifying the hash calculation.
17
+ * @param options.seed {bigint} 64-bit unsigned seed value.
18
+ */
19
+ declare function rapidhash_fast(message: string | Uint8Array | DataView, options?: Partial<Omit<RapidhashOptions, 'rapidMumBehaviour'>>): bigint;
20
+ /**
21
+ * Calculate a 64-bit hash value of the given message.
22
+ * This function is equivalent to rapidhash() with options.rapidMumBehaviour set to 'protected'.
23
+ *
24
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
25
+ * @param options Options for modifying the hash calculation.
26
+ * @param options.seed {bigint} 64-bit unsigned seed value.
27
+ */
28
+ declare function rapidhash_protected(message: string | Uint8Array | DataView, options?: Partial<Omit<RapidhashOptions, 'rapidMumBehaviour'>>): bigint;
29
+ /**
30
+ * Calculate a 64-bit hash value of the given message using the Micro variant.
31
+ * This variant uses 80-byte loop blocks for optimized performance characteristics.
32
+ *
33
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
34
+ * @param options Options for modifying the hash calculation.
35
+ * @param options.seed {bigint} 64-bit unsigned seed value.
36
+ * @param options.rapidMumBehaviour {"fast"|"protected"} Alters behaviour of the rapid_mum function. Defaults to 'fast'.
37
+ */
38
+ declare function rapidhashMicro(message: string | Uint8Array | DataView, options?: Partial<RapidhashOptions>): bigint;
39
+ /**
40
+ * Calculate a 64-bit hash value of the given message using the Micro variant.
41
+ * This function is equivalent to rapidhashMicro() with options.rapidMumBehaviour set to 'fast'.
42
+ *
43
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
44
+ * @param options Options for modifying the hash calculation.
45
+ * @param options.seed {bigint} 64-bit unsigned seed value.
46
+ */
47
+ declare function rapidhashMicro_fast(message: string | Uint8Array | DataView, options?: Partial<Omit<RapidhashOptions, 'rapidMumBehaviour'>>): bigint;
48
+ /**
49
+ * Calculate a 64-bit hash value of the given message using the Micro variant.
50
+ * This function is equivalent to rapidhashMicro() with options.rapidMumBehaviour set to 'protected'.
51
+ *
52
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
53
+ * @param options Options for modifying the hash calculation.
54
+ * @param options.seed {bigint} 64-bit unsigned seed value.
55
+ */
56
+ declare function rapidhashMicro_protected(message: string | Uint8Array | DataView, options?: Partial<Omit<RapidhashOptions, 'rapidMumBehaviour'>>): bigint;
57
+ /**
58
+ * Calculate a 64-bit hash value of the given message using the Nano variant.
59
+ * This variant uses 48-byte loop blocks for optimized performance characteristics.
60
+ *
61
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
62
+ * @param options Options for modifying the hash calculation.
63
+ * @param options.seed {bigint} 64-bit unsigned seed value.
64
+ * @param options.rapidMumBehaviour {"fast"|"protected"} Alters behaviour of the rapid_mum function. Defaults to 'fast'.
65
+ */
66
+ declare function rapidhashNano(message: string | Uint8Array | DataView, options?: Partial<RapidhashOptions>): bigint;
67
+ /**
68
+ * Calculate a 64-bit hash value of the given message using the Nano variant.
69
+ * This function is equivalent to rapidhashNano() with options.rapidMumBehaviour set to 'fast'.
70
+ *
71
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
72
+ * @param options Options for modifying the hash calculation.
73
+ * @param options.seed {bigint} 64-bit unsigned seed value.
74
+ */
75
+ declare function rapidhashNano_fast(message: string | Uint8Array | DataView, options?: Partial<Omit<RapidhashOptions, 'rapidMumBehaviour'>>): bigint;
76
+ /**
77
+ * Calculate a 64-bit hash value of the given message using the Nano variant.
78
+ * This function is equivalent to rapidhashNano() with options.rapidMumBehaviour set to 'protected'.
79
+ *
80
+ * @param message {string|Uint8Array|DataView} The message to be hashed.
81
+ * @param options Options for modifying the hash calculation.
82
+ * @param options.seed {bigint} 64-bit unsigned seed value.
83
+ */
84
+ declare function rapidhashNano_protected(message: string | Uint8Array | DataView, options?: Partial<Omit<RapidhashOptions, 'rapidMumBehaviour'>>): bigint;
85
+ export { rapidhash, rapidhashMicro, rapidhashMicro_fast, rapidhashMicro_protected, rapidhashNano, rapidhashNano_fast, rapidhashNano_protected, rapidhash_fast, rapidhash_protected };
86
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,11 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_v3_0 = require("../v3.0.js");
3
+ exports.rapidhash = require_v3_0.rapidhash;
4
+ exports.rapidhashMicro = require_v3_0.rapidhashMicro;
5
+ exports.rapidhashMicro_fast = require_v3_0.rapidhashMicro_fast;
6
+ exports.rapidhashMicro_protected = require_v3_0.rapidhashMicro_protected;
7
+ exports.rapidhashNano = require_v3_0.rapidhashNano;
8
+ exports.rapidhashNano_fast = require_v3_0.rapidhashNano_fast;
9
+ exports.rapidhashNano_protected = require_v3_0.rapidhashNano_protected;
10
+ exports.rapidhash_fast = require_v3_0.rapidhash_fast;
11
+ exports.rapidhash_protected = require_v3_0.rapidhash_protected;
@@ -0,0 +1 @@
1
+ export { s as rapidhash, i as rapidhashMicro, a as rapidhashMicro_fast, o as rapidhashMicro_protected, t as rapidhashNano, n as rapidhashNano_fast, r as rapidhashNano_protected, c as rapidhash_fast, l as rapidhash_protected } from "../v3.0.mjs";