@alwatr/cyrb53 1.0.17 โ 2.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.
- package/dist/main.js +5 -0
- package/dist/main.js.map +10 -0
- package/package.json +38 -41
- package/src/main.ts +41 -0
- package/CHANGELOG.md +0 -114
- package/dist/main.cjs +0 -3
- package/dist/main.cjs.map +0 -7
- package/dist/main.mjs +0 -3
- package/dist/main.mjs.map +0 -7
package/dist/main.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* ๐ฆ @alwatr/cyrb53 v2.0.1 */
|
|
2
|
+
function F(C,D=0){let j=3735928559^D,k=1103547991^D;for(let z=0,B;z<C.length;z++)B=C.charCodeAt(z),j=Math.imul(j^B,2654435761),k=Math.imul(k^B,1597334677);return j=Math.imul(j^j>>>16,2246822507),j^=Math.imul(k^k>>>13,3266489909),k=Math.imul(k^k>>>16,2246822507),k^=Math.imul(j^j>>>13,3266489909),4294967296*(2097151&k)+(j>>>0)}export{F as cyrb53};
|
|
3
|
+
|
|
4
|
+
//# debugId=B37B993A93747D7F64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/main.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"const H1_SEED = 0xdeadbeef;\nconst H2_SEED = 0x41c6ce57;\nconst M_K1 = 2654435761;\nconst M_K2 = 1597334677;\nconst F_K1 = 2246822507;\nconst F_K2 = 3266489909;\nconst P_K1 = 4294967296; // 2^32\nconst P_K2 = 2097151; // 2^21 - 1\n\n/**\n * cyrb53: A modern, high-quality, and fast 53-bit string hash function.\n *\n * Excellent collision resistance due to its large output space.\n * The best choice for new general-purpose hashing needs in JS/TS.\n *\n * @param str The input string.\n * @param seed An optional seed value.\n * @returns A 53-bit hash number.\n *\n * @example\n * ```ts\n * const hash = cyrb53('some string');\n * ```\n */\nexport function cyrb53(str: string, seed = 0): number {\n let h1 = H1_SEED ^ seed;\n let h2 = H2_SEED ^ seed;\n\n for (let i = 0, ch; i < str.length; i++) {\n ch = str.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, M_K1);\n h2 = Math.imul(h2 ^ ch, M_K2);\n }\n\n h1 = Math.imul(h1 ^ (h1 >>> 16), F_K1);\n h1 ^= Math.imul(h2 ^ (h2 >>> 13), F_K2);\n h2 = Math.imul(h2 ^ (h2 >>> 16), F_K1);\n h2 ^= Math.imul(h1 ^ (h1 >>> 13), F_K2);\n\n return P_K1 * (P_K2 & h2) + (h1 >>> 0);\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AAwBO,SAAS,CAAM,CAAC,EAAa,EAAO,EAAW,CACpD,IAAI,EAzBU,WAyBK,EACf,EAzBU,WAyBK,EAEnB,QAAS,EAAI,EAAG,EAAI,EAAI,EAAI,OAAQ,IAClC,EAAK,EAAI,WAAW,CAAC,EACrB,EAAK,KAAK,KAAK,EAAK,EA5BX,UA4BmB,EAC5B,EAAK,KAAK,KAAK,EAAK,EA5BX,UA4BmB,EAQ9B,OALA,EAAK,KAAK,KAAK,EAAM,IAAO,GA9BjB,UA8B0B,EACrC,GAAM,KAAK,KAAK,EAAM,IAAO,GA9BlB,UA8B2B,EACtC,EAAK,KAAK,KAAK,EAAM,IAAO,GAhCjB,UAgC0B,EACrC,GAAM,KAAK,KAAK,EAAM,IAAO,GAhClB,UAgC2B,EA/B3B,YACA,QAgCW,IAAO,IAAO",
|
|
8
|
+
"debugId": "B37B993A93747D7F64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,65 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwatr/cyrb53",
|
|
3
|
+
"version": "2.0.1",
|
|
3
4
|
"description": "A modern, high-quality, and fast 53-bit string hash function.",
|
|
4
|
-
"
|
|
5
|
+
"license": "MPL-2.0",
|
|
5
6
|
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"@alwatr/type-helper": "7.0.2",
|
|
12
|
-
"typescript": "^5.9.3"
|
|
7
|
+
"type": "module",
|
|
8
|
+
"repository": {
|
|
9
|
+
"directory": "packages/cyrb53",
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/Alwatr/nanolib"
|
|
13
12
|
},
|
|
13
|
+
"homepage": "https://github.com/Alwatr/nanolib/tree/next/packages/cyrb53#readme",
|
|
14
|
+
"bugs": "https://github.com/Alwatr/nanolib/issues",
|
|
14
15
|
"exports": {
|
|
15
16
|
".": {
|
|
16
17
|
"types": "./dist/main.d.ts",
|
|
17
|
-
"
|
|
18
|
-
"require": "./dist/main.cjs"
|
|
18
|
+
"default": "./dist/main.js"
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"keywords": [
|
|
29
|
-
"alwatr",
|
|
30
|
-
"cyrb53",
|
|
31
|
-
"hash",
|
|
32
|
-
"nanolib",
|
|
33
|
-
"string"
|
|
34
|
-
],
|
|
35
|
-
"license": "MPL-2.0",
|
|
36
|
-
"main": "./dist/main.cjs",
|
|
37
|
-
"module": "./dist/main.mjs",
|
|
38
|
-
"prettier": "@alwatr/prettier-config",
|
|
39
|
-
"publishConfig": {
|
|
40
|
-
"access": "public"
|
|
41
|
-
},
|
|
42
|
-
"repository": {
|
|
43
|
-
"type": "git",
|
|
44
|
-
"url": "https://github.com/Alwatr/nanolib",
|
|
45
|
-
"directory": "packages/cyrb53"
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@alwatr/nano-build": "7.0.1",
|
|
24
|
+
"@alwatr/prettier-config": "7.0.1",
|
|
25
|
+
"@alwatr/tsconfig-base": "8.0.0",
|
|
26
|
+
"@alwatr/type-helper": "8.0.1",
|
|
27
|
+
"typescript": "^5.9.3"
|
|
46
28
|
},
|
|
47
29
|
"scripts": {
|
|
48
30
|
"b": "bun run build",
|
|
49
31
|
"build": "bun run build:ts && bun run build:es",
|
|
50
|
-
"build:es": "nano-build --preset=module",
|
|
32
|
+
"build:es": "nano-build --preset=module src/main.ts",
|
|
51
33
|
"build:ts": "tsc --build",
|
|
52
34
|
"c": "bun run clean",
|
|
53
35
|
"cb": "bun run clean && bun run build",
|
|
54
36
|
"clean": "rm -rfv dist *.tsbuildinfo",
|
|
55
|
-
"d": "bun run build:es && bun
|
|
37
|
+
"d": "bun run build:es && bun",
|
|
56
38
|
"w": "bun run watch",
|
|
57
39
|
"watch": "bun run watch:ts & bun run watch:es",
|
|
58
40
|
"watch:es": "bun run build:es --watch",
|
|
59
41
|
"watch:ts": "bun run build:ts --watch --preserveWatchOutput"
|
|
60
42
|
},
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
43
|
+
"files": [
|
|
44
|
+
"**/*.{js,mjs,cjs,ts,map,d.ts,html,LEGAL.txt}",
|
|
45
|
+
"README.md",
|
|
46
|
+
"LICENSE",
|
|
47
|
+
"!demo/**/*",
|
|
48
|
+
"!**/*.test.js"
|
|
49
|
+
],
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
53
|
+
"keywords": [
|
|
54
|
+
"alwatr",
|
|
55
|
+
"cyrb53",
|
|
56
|
+
"hash",
|
|
57
|
+
"nanolib",
|
|
58
|
+
"string"
|
|
59
|
+
],
|
|
60
|
+
"prettier": "@alwatr/prettier-config",
|
|
61
|
+
"gitHead": "f843742e94d6ebed3921d57b624d9deb35c2c102"
|
|
65
62
|
}
|
package/src/main.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const H1_SEED = 0xdeadbeef;
|
|
2
|
+
const H2_SEED = 0x41c6ce57;
|
|
3
|
+
const M_K1 = 2654435761;
|
|
4
|
+
const M_K2 = 1597334677;
|
|
5
|
+
const F_K1 = 2246822507;
|
|
6
|
+
const F_K2 = 3266489909;
|
|
7
|
+
const P_K1 = 4294967296; // 2^32
|
|
8
|
+
const P_K2 = 2097151; // 2^21 - 1
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* cyrb53: A modern, high-quality, and fast 53-bit string hash function.
|
|
12
|
+
*
|
|
13
|
+
* Excellent collision resistance due to its large output space.
|
|
14
|
+
* The best choice for new general-purpose hashing needs in JS/TS.
|
|
15
|
+
*
|
|
16
|
+
* @param str The input string.
|
|
17
|
+
* @param seed An optional seed value.
|
|
18
|
+
* @returns A 53-bit hash number.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const hash = cyrb53('some string');
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export function cyrb53(str: string, seed = 0): number {
|
|
26
|
+
let h1 = H1_SEED ^ seed;
|
|
27
|
+
let h2 = H2_SEED ^ seed;
|
|
28
|
+
|
|
29
|
+
for (let i = 0, ch; i < str.length; i++) {
|
|
30
|
+
ch = str.charCodeAt(i);
|
|
31
|
+
h1 = Math.imul(h1 ^ ch, M_K1);
|
|
32
|
+
h2 = Math.imul(h2 ^ ch, M_K2);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
h1 = Math.imul(h1 ^ (h1 >>> 16), F_K1);
|
|
36
|
+
h1 ^= Math.imul(h2 ^ (h2 >>> 13), F_K2);
|
|
37
|
+
h2 = Math.imul(h2 ^ (h2 >>> 16), F_K1);
|
|
38
|
+
h2 ^= Math.imul(h1 ^ (h1 >>> 13), F_K2);
|
|
39
|
+
|
|
40
|
+
return P_K1 * (P_K2 & h2) + (h1 >>> 0);
|
|
41
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
## [1.0.17](https://github.com/Alwatr/nanolib/compare/@alwatr/cyrb53@1.0.16...@alwatr/cyrb53@1.0.17) (2026-03-16)
|
|
7
|
-
|
|
8
|
-
### ๐จ Code Refactoring
|
|
9
|
-
|
|
10
|
-
* migrate build scripts from yarn to bun across multiple packages ([d90e962](https://github.com/Alwatr/nanolib/commit/d90e962f15e5c951e191d5f02341279b6472abc3))
|
|
11
|
-
|
|
12
|
-
## [1.0.16](https://github.com/Alwatr/nanolib/compare/@alwatr/cyrb53@1.0.15...@alwatr/cyrb53@1.0.16) (2026-02-18)
|
|
13
|
-
|
|
14
|
-
**Note:** Version bump only for package @alwatr/cyrb53
|
|
15
|
-
|
|
16
|
-
## [1.0.15](https://github.com/Alwatr/nanolib/compare/@alwatr/cyrb53@1.0.14...@alwatr/cyrb53@1.0.15) (2025-12-23)
|
|
17
|
-
|
|
18
|
-
**Note:** Version bump only for package @alwatr/cyrb53
|
|
19
|
-
|
|
20
|
-
## [1.0.14](https://github.com/Alwatr/nanolib/compare/@alwatr/cyrb53@1.0.13...@alwatr/cyrb53@1.0.14) (2025-12-13)
|
|
21
|
-
|
|
22
|
-
**Note:** Version bump only for package @alwatr/cyrb53
|
|
23
|
-
|
|
24
|
-
## [1.0.13](https://github.com/Alwatr/nanolib/compare/@alwatr/cyrb53@1.0.12...@alwatr/cyrb53@1.0.13) (2025-12-10)
|
|
25
|
-
|
|
26
|
-
**Note:** Version bump only for package @alwatr/cyrb53
|
|
27
|
-
|
|
28
|
-
## [1.0.12](https://github.com/Alwatr/nanolib/compare/@alwatr/cyrb53@1.0.11...@alwatr/cyrb53@1.0.12) (2025-11-18)
|
|
29
|
-
|
|
30
|
-
### ๐จ Code Refactoring
|
|
31
|
-
|
|
32
|
-
* remove unnecessary type declarations from tsconfig.json files ([89bcc7d](https://github.com/Alwatr/nanolib/commit/89bcc7db839807110b80f8ba34414ea9734d9c75))
|
|
33
|
-
|
|
34
|
-
## [1.0.11](https://github.com/Alwatr/nanolib/compare/@alwatr/cyrb53@1.0.10...@alwatr/cyrb53@1.0.11) (2025-11-15)
|
|
35
|
-
|
|
36
|
-
**Note:** Version bump only for package @alwatr/cyrb53
|
|
37
|
-
|
|
38
|
-
## [1.0.10](https://github.com/Alwatr/nanolib/compare/@alwatr/cyrb53@1.0.9...@alwatr/cyrb53@1.0.10) (2025-11-15)
|
|
39
|
-
|
|
40
|
-
**Note:** Version bump only for package @alwatr/cyrb53
|
|
41
|
-
|
|
42
|
-
## [1.0.9](https://github.com/Alwatr/nanolib/compare/@alwatr/cyrb53@1.0.8...@alwatr/cyrb53@1.0.9) (2025-11-04)
|
|
43
|
-
|
|
44
|
-
**Note:** Version bump only for package @alwatr/cyrb53
|
|
45
|
-
|
|
46
|
-
## [1.0.8](https://github.com/Alwatr/nanolib/compare/@alwatr/cyrb53@1.0.7...@alwatr/cyrb53@1.0.8) (2025-10-06)
|
|
47
|
-
|
|
48
|
-
### ๐ Dependencies update
|
|
49
|
-
|
|
50
|
-
* bump the npm-dependencies group with 4 updates ([9825815](https://github.com/Alwatr/nanolib/commit/982581552bbb4b97dca52af5e93a80937f0c3109))
|
|
51
|
-
|
|
52
|
-
## [1.0.7](https://github.com/Alwatr/nanolib/compare/@alwatr/cyrb53@1.0.6...@alwatr/cyrb53@1.0.7) (2025-09-27)
|
|
53
|
-
|
|
54
|
-
### ๐งน Miscellaneous Chores
|
|
55
|
-
|
|
56
|
-
* exclude test files from package distribution ([86f4f2f](https://github.com/Alwatr/nanolib/commit/86f4f2f5985845c5cf3a3a9398de7b2f98ce53e7))
|
|
57
|
-
|
|
58
|
-
## [1.0.6](https://github.com/Alwatr/nanolib/compare/@alwatr/cyrb53@1.0.5...@alwatr/cyrb53@1.0.6) (2025-09-22)
|
|
59
|
-
|
|
60
|
-
**Note:** Version bump only for package @alwatr/cyrb53
|
|
61
|
-
|
|
62
|
-
## [1.0.5](https://github.com/Alwatr/nanolib/compare/@alwatr/cyrb53@1.0.4...@alwatr/cyrb53@1.0.5) (2025-09-22)
|
|
63
|
-
|
|
64
|
-
**Note:** Version bump only for package @alwatr/cyrb53
|
|
65
|
-
|
|
66
|
-
## [1.0.4](https://github.com/Alwatr/nanolib/compare/@alwatr/cyrb53@1.0.3...@alwatr/cyrb53@1.0.4) (2025-09-21)
|
|
67
|
-
|
|
68
|
-
**Note:** Version bump only for package @alwatr/cyrb53
|
|
69
|
-
|
|
70
|
-
## [1.0.3](https://github.com/Alwatr/nanolib/compare/@alwatr/cyrb53@1.0.2...@alwatr/cyrb53@1.0.3) (2025-09-20)
|
|
71
|
-
|
|
72
|
-
### ๐ Bug Fixes
|
|
73
|
-
|
|
74
|
-
* add sideEffects property to package.json files for better tree-shaking ([c7b9e74](https://github.com/Alwatr/nanolib/commit/c7b9e74e1920c8e35b438742de61883ca62da58c))
|
|
75
|
-
* add sideEffects property to package.json files for better tree-shaking ([e8402c4](https://github.com/Alwatr/nanolib/commit/e8402c481a14a1f807a37aaa862a936713d26176))
|
|
76
|
-
|
|
77
|
-
### ๐งน Miscellaneous Chores
|
|
78
|
-
|
|
79
|
-
* remove duplicate sideEffects property from multiple package.json files ([b123f86](https://github.com/Alwatr/nanolib/commit/b123f86be81481de2314aae9bb2eeb629743d24c))
|
|
80
|
-
|
|
81
|
-
## [1.0.2](https://github.com/Alwatr/nanolib/compare/@alwatr/cyrb53@1.0.1...@alwatr/cyrb53@1.0.2) (2025-09-19)
|
|
82
|
-
|
|
83
|
-
**Note:** Version bump only for package @alwatr/cyrb53
|
|
84
|
-
|
|
85
|
-
## [1.0.1](https://github.com/Alwatr/nanolib/compare/@alwatr/cyrb53@1.0.0...@alwatr/cyrb53@1.0.1) (2025-09-15)
|
|
86
|
-
|
|
87
|
-
**Note:** Version bump only for package @alwatr/cyrb53
|
|
88
|
-
|
|
89
|
-
## 1.0.0 (2025-09-14)
|
|
90
|
-
|
|
91
|
-
### โจ Features
|
|
92
|
-
|
|
93
|
-
* **cyrb53:** add new package for cyrb53 hash function ([59d2096](https://github.com/Alwatr/nanolib/commit/59d2096409ac143d42f8b4d8bb38efeaf9d3ce06))
|
|
94
|
-
|
|
95
|
-
### ๐จ Code Refactoring
|
|
96
|
-
|
|
97
|
-
* replace magic numbers with constants in cyrb53 function ([943c79d](https://github.com/Alwatr/nanolib/commit/943c79d64733ca2d1a4ce4a729bf99481eaf6773))
|
|
98
|
-
|
|
99
|
-
### ๐งน Miscellaneous Chores
|
|
100
|
-
|
|
101
|
-
* **package:** fix version to 1.0.0-rc and reorder keywords in package.json ([e9c4802](https://github.com/Alwatr/nanolib/commit/e9c4802e1b735eae245122353d1197ec00cad865))
|
|
102
|
-
|
|
103
|
-
# Changelog
|
|
104
|
-
|
|
105
|
-
All notable changes to this project will be documented in this file.
|
|
106
|
-
|
|
107
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
108
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
109
|
-
|
|
110
|
-
## [1.0.0](https://github.com/Alwatr/nanolib/compare/v0.0.0...v1.0.0) (2024-03-08)
|
|
111
|
-
|
|
112
|
-
### Features
|
|
113
|
-
|
|
114
|
-
- **cyrb53:** initial implementation and package structure.
|
package/dist/main.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/** ๐ฆ @alwatr/cyrb53 v1.0.17 */
|
|
2
|
-
"use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from==="object"||typeof from==="function"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod);var main_exports={};__export(main_exports,{cyrb53:()=>cyrb53});module.exports=__toCommonJS(main_exports);var H1_SEED=3735928559;var H2_SEED=1103547991;var M_K1=2654435761;var M_K2=1597334677;var F_K1=2246822507;var F_K2=3266489909;var P_K1=4294967296;var P_K2=2097151;function cyrb53(str,seed=0){let h1=H1_SEED^seed;let h2=H2_SEED^seed;for(let i=0,ch;i<str.length;i++){ch=str.charCodeAt(i);h1=Math.imul(h1^ch,M_K1);h2=Math.imul(h2^ch,M_K2)}h1=Math.imul(h1^h1>>>16,F_K1);h1^=Math.imul(h2^h2>>>13,F_K2);h2=Math.imul(h2^h2>>>16,F_K1);h2^=Math.imul(h1^h1>>>13,F_K2);return P_K1*(P_K2&h2)+(h1>>>0)}0&&(module.exports={cyrb53});
|
|
3
|
-
//# sourceMappingURL=main.cjs.map
|
package/dist/main.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/main.ts"],
|
|
4
|
-
"sourcesContent": ["const H1_SEED = 0xdeadbeef;\nconst H2_SEED = 0x41c6ce57;\nconst M_K1 = 2654435761;\nconst M_K2 = 1597334677;\nconst F_K1 = 2246822507;\nconst F_K2 = 3266489909;\nconst P_K1 = 4294967296; // 2^32\nconst P_K2 = 2097151; // 2^21 - 1\n\n/**\n * cyrb53: A modern, high-quality, and fast 53-bit string hash function.\n *\n * Excellent collision resistance due to its large output space.\n * The best choice for new general-purpose hashing needs in JS/TS.\n *\n * @param str The input string.\n * @param seed An optional seed value.\n * @returns A 53-bit hash number.\n *\n * @example\n * ```ts\n * const hash = cyrb53('some string');\n * ```\n */\nexport function cyrb53(str: string, seed = 0): number {\n let h1 = H1_SEED ^ seed;\n let h2 = H2_SEED ^ seed;\n\n for (let i = 0, ch; i < str.length; i++) {\n ch = str.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, M_K1);\n h2 = Math.imul(h2 ^ ch, M_K2);\n }\n\n h1 = Math.imul(h1 ^ (h1 >>> 16), F_K1);\n h1 ^= Math.imul(h2 ^ (h2 >>> 13), F_K2);\n h2 = Math.imul(h2 ^ (h2 >>> 16), F_K1);\n h2 ^= Math.imul(h1 ^ (h1 >>> 13), F_K2);\n\n return P_K1 * (P_K2 & h2) + (h1 >>> 0);\n}\n"],
|
|
5
|
-
"mappings": ";qqBAAA,6GAAM,QAAU,WAChB,IAAM,QAAU,WAChB,IAAM,KAAO,WACb,IAAM,KAAO,WACb,IAAM,KAAO,WACb,IAAM,KAAO,WACb,IAAM,KAAO,WACb,IAAM,KAAO,QAiBN,SAAS,OAAO,IAAa,KAAO,EAAW,CACpD,IAAI,GAAK,QAAU,KACnB,IAAI,GAAK,QAAU,KAEnB,QAAS,EAAI,EAAG,GAAI,EAAI,IAAI,OAAQ,IAAK,CACvC,GAAK,IAAI,WAAW,CAAC,EACrB,GAAK,KAAK,KAAK,GAAK,GAAI,IAAI,EAC5B,GAAK,KAAK,KAAK,GAAK,GAAI,IAAI,CAC9B,CAEA,GAAK,KAAK,KAAK,GAAM,KAAO,GAAK,IAAI,EACrC,IAAM,KAAK,KAAK,GAAM,KAAO,GAAK,IAAI,EACtC,GAAK,KAAK,KAAK,GAAM,KAAO,GAAK,IAAI,EACrC,IAAM,KAAK,KAAK,GAAM,KAAO,GAAK,IAAI,EAEtC,OAAO,MAAQ,KAAO,KAAO,KAAO,EACtC",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/main.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/** ๐ฆ @alwatr/cyrb53 v1.0.17 */
|
|
2
|
-
var H1_SEED=3735928559;var H2_SEED=1103547991;var M_K1=2654435761;var M_K2=1597334677;var F_K1=2246822507;var F_K2=3266489909;var P_K1=4294967296;var P_K2=2097151;function cyrb53(str,seed=0){let h1=H1_SEED^seed;let h2=H2_SEED^seed;for(let i=0,ch;i<str.length;i++){ch=str.charCodeAt(i);h1=Math.imul(h1^ch,M_K1);h2=Math.imul(h2^ch,M_K2)}h1=Math.imul(h1^h1>>>16,F_K1);h1^=Math.imul(h2^h2>>>13,F_K2);h2=Math.imul(h2^h2>>>16,F_K1);h2^=Math.imul(h1^h1>>>13,F_K2);return P_K1*(P_K2&h2)+(h1>>>0)}export{cyrb53};
|
|
3
|
-
//# sourceMappingURL=main.mjs.map
|
package/dist/main.mjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/main.ts"],
|
|
4
|
-
"sourcesContent": ["const H1_SEED = 0xdeadbeef;\nconst H2_SEED = 0x41c6ce57;\nconst M_K1 = 2654435761;\nconst M_K2 = 1597334677;\nconst F_K1 = 2246822507;\nconst F_K2 = 3266489909;\nconst P_K1 = 4294967296; // 2^32\nconst P_K2 = 2097151; // 2^21 - 1\n\n/**\n * cyrb53: A modern, high-quality, and fast 53-bit string hash function.\n *\n * Excellent collision resistance due to its large output space.\n * The best choice for new general-purpose hashing needs in JS/TS.\n *\n * @param str The input string.\n * @param seed An optional seed value.\n * @returns A 53-bit hash number.\n *\n * @example\n * ```ts\n * const hash = cyrb53('some string');\n * ```\n */\nexport function cyrb53(str: string, seed = 0): number {\n let h1 = H1_SEED ^ seed;\n let h2 = H2_SEED ^ seed;\n\n for (let i = 0, ch; i < str.length; i++) {\n ch = str.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, M_K1);\n h2 = Math.imul(h2 ^ ch, M_K2);\n }\n\n h1 = Math.imul(h1 ^ (h1 >>> 16), F_K1);\n h1 ^= Math.imul(h2 ^ (h2 >>> 13), F_K2);\n h2 = Math.imul(h2 ^ (h2 >>> 16), F_K1);\n h2 ^= Math.imul(h1 ^ (h1 >>> 13), F_K2);\n\n return P_K1 * (P_K2 & h2) + (h1 >>> 0);\n}\n"],
|
|
5
|
-
"mappings": ";AAAA,IAAM,QAAU,WAChB,IAAM,QAAU,WAChB,IAAM,KAAO,WACb,IAAM,KAAO,WACb,IAAM,KAAO,WACb,IAAM,KAAO,WACb,IAAM,KAAO,WACb,IAAM,KAAO,QAiBN,SAAS,OAAO,IAAa,KAAO,EAAW,CACpD,IAAI,GAAK,QAAU,KACnB,IAAI,GAAK,QAAU,KAEnB,QAAS,EAAI,EAAG,GAAI,EAAI,IAAI,OAAQ,IAAK,CACvC,GAAK,IAAI,WAAW,CAAC,EACrB,GAAK,KAAK,KAAK,GAAK,GAAI,IAAI,EAC5B,GAAK,KAAK,KAAK,GAAK,GAAI,IAAI,CAC9B,CAEA,GAAK,KAAK,KAAK,GAAM,KAAO,GAAK,IAAI,EACrC,IAAM,KAAK,KAAK,GAAM,KAAO,GAAK,IAAI,EACtC,GAAK,KAAK,KAAK,GAAM,KAAO,GAAK,IAAI,EACrC,IAAM,KAAK,KAAK,GAAM,KAAO,GAAK,IAAI,EAEtC,OAAO,MAAQ,KAAO,KAAO,KAAO,EACtC",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|