@alwatr/hash-string 5.2.29 โ†’ 6.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/dist/main.js ADDED
@@ -0,0 +1,5 @@
1
+ /* ๐Ÿ“ฆ @alwatr/hash-string v6.0.0 */
2
+ function u(r,i,a=1){if(a<1)throw Error("The repeat parameter must be greater than or equal to 1");let e=3735928559,t=1103547991;if(typeof r==="number")r=r.toString();let h=r.length;for(let n=0;n<h;n++){let o=r.charCodeAt(n);e=Math.imul(e^o,2654435761),t=Math.imul(t^o,1597334677)}e=Math.imul(e^e>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),t=Math.imul(t^t>>>16,2246822507)^Math.imul(e^e>>>13,3266489909);let s=i+(e>>>0).toString(36)+(t>>>0).toString(36);if(a===1)return s;else return u(s,i,a-1)}export{u as nanoHash};
3
+
4
+ //# debugId=E840E499B2BE04E964756E2164756E21
5
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/main.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * Simple hash string for fast hashing (like md5).\n * This function is not very secure and should not be used for security purposes.\n * But it cannot be reversed easily and brute force can take up to years for fast computers.\n *\n * @param str - The string or number to hash\n * @param prefix - A prefix to add to the beginning of the hash result\n * @param repeat - Number of times to repeat the hashing process for increased complexity (default: 3)\n * @returns A hashed string with the specified prefix\n */\nexport function nanoHash(str: string | number, prefix: string, repeat = 1): string {\n if (repeat < 1) {\n throw new Error('The repeat parameter must be greater than or equal to 1');\n }\n\n let hash1 = 0xdeadbeef;\n let hash2 = 0x41c6ce57;\n\n if (typeof str === 'number') {\n str = str.toString();\n }\n\n const len = str.length;\n for (let i = 0; i < len; i++) {\n const char = str.charCodeAt(i);\n hash1 = Math.imul(hash1 ^ char, 2654435761);\n hash2 = Math.imul(hash2 ^ char, 1597334677);\n }\n\n hash1 = Math.imul(hash1 ^ (hash1 >>> 16), 2246822507) ^ Math.imul(hash2 ^ (hash2 >>> 13), 3266489909);\n hash2 = Math.imul(hash2 ^ (hash2 >>> 16), 2246822507) ^ Math.imul(hash1 ^ (hash1 >>> 13), 3266489909);\n\n const result = prefix + (hash1 >>> 0).toString(36) + (hash2 >>> 0).toString(36);\n if (repeat === 1) {\n return result;\n }\n else {\n return nanoHash(result, prefix, repeat - 1);\n }\n}\n"
6
+ ],
7
+ "mappings": ";AAUO,SAAS,CAAQ,CAAC,EAAsB,EAAgB,EAAS,EAAW,CACjF,GAAI,EAAS,EACX,MAAU,MAAM,yDAAyD,EAG3E,IAAI,EAAQ,WACR,EAAQ,WAEZ,GAAI,OAAO,IAAQ,SACjB,EAAM,EAAI,SAAS,EAGrB,IAAM,EAAM,EAAI,OAChB,QAAS,EAAI,EAAG,EAAI,EAAK,IAAK,CAC5B,IAAM,EAAO,EAAI,WAAW,CAAC,EAC7B,EAAQ,KAAK,KAAK,EAAQ,EAAM,UAAU,EAC1C,EAAQ,KAAK,KAAK,EAAQ,EAAM,UAAU,EAG5C,EAAQ,KAAK,KAAK,EAAS,IAAU,GAAK,UAAU,EAAI,KAAK,KAAK,EAAS,IAAU,GAAK,UAAU,EACpG,EAAQ,KAAK,KAAK,EAAS,IAAU,GAAK,UAAU,EAAI,KAAK,KAAK,EAAS,IAAU,GAAK,UAAU,EAEpG,IAAM,EAAS,GAAU,IAAU,GAAG,SAAS,EAAE,GAAK,IAAU,GAAG,SAAS,EAAE,EAC9E,GAAI,IAAW,EACb,OAAO,EAGP,YAAO,EAAS,EAAQ,EAAQ,EAAS,CAAC",
8
+ "debugId": "E840E499B2BE04E964756E2164756E21",
9
+ "names": []
10
+ }
package/package.json CHANGED
@@ -1,24 +1,24 @@
1
1
  {
2
2
  "name": "@alwatr/hash-string",
3
3
  "description": "A simple utility to generate a hash string.",
4
- "version": "5.2.29",
4
+ "version": "6.0.0",
5
5
  "author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
6
6
  "bugs": "https://github.com/Alwatr/nanolib/issues",
7
7
  "devDependencies": {
8
- "@alwatr/nano-build": "6.4.2",
9
- "@alwatr/prettier-config": "6.0.2",
10
- "@alwatr/tsconfig-base": "6.0.4",
8
+ "@alwatr/nano-build": "7.0.0",
9
+ "@alwatr/prettier-config": "7.0.0",
10
+ "@alwatr/tsconfig-base": "7.0.0",
11
11
  "typescript": "^5.9.3"
12
12
  },
13
13
  "exports": {
14
14
  ".": {
15
15
  "types": "./dist/main.d.ts",
16
- "import": "./dist/main.mjs",
17
- "require": "./dist/main.cjs"
16
+ "default": "./dist/main.js"
18
17
  }
19
18
  },
20
19
  "files": [
21
- "**/*.{js,mjs,cjs,map,d.ts,html,md,LEGAL.txt}",
20
+ "**/*.{js,mjs,cjs,ts,map,d.ts,html,LEGAL.txt}",
21
+ "README.md",
22
22
  "LICENSE",
23
23
  "!demo/**/*",
24
24
  "!**/*.test.js"
@@ -43,8 +43,6 @@
43
43
  "utils"
44
44
  ],
45
45
  "license": "MPL-2.0",
46
- "main": "./dist/main.cjs",
47
- "module": "./dist/main.mjs",
48
46
  "prettier": "@alwatr/prettier-config",
49
47
  "publishConfig": {
50
48
  "access": "public"
@@ -57,14 +55,14 @@
57
55
  "scripts": {
58
56
  "b": "bun run build",
59
57
  "build": "bun run build:ts && bun run build:es",
60
- "build:es": "nano-build --preset=module",
58
+ "build:es": "nano-build --preset=module src/main.ts",
61
59
  "build:ts": "tsc --build",
62
60
  "c": "bun run clean",
63
61
  "cb": "bun run clean && bun run build",
64
62
  "clean": "rm -rfv dist *.tsbuildinfo",
65
- "d": "bun run build:es && bun --enable-source-maps --trace-warnings",
63
+ "d": "bun run build:es && bun",
66
64
  "t": "bun run test",
67
- "test": "echo test-skipped",
65
+ "test": "bun test",
68
66
  "w": "bun run watch",
69
67
  "watch": "bun run watch:ts & bun run watch:es",
70
68
  "watch:es": "bun run build:es --watch",
@@ -73,5 +71,5 @@
73
71
  "sideEffects": false,
74
72
  "type": "module",
75
73
  "types": "./dist/main.d.ts",
76
- "gitHead": "c3889e3756b0a0f9b935a1b702a1373ac52cb379"
74
+ "gitHead": "056102a1c8a563bbae8a290b6830450f467322a3"
77
75
  }
package/src/main.ts ADDED
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Simple hash string for fast hashing (like md5).
3
+ * This function is not very secure and should not be used for security purposes.
4
+ * But it cannot be reversed easily and brute force can take up to years for fast computers.
5
+ *
6
+ * @param str - The string or number to hash
7
+ * @param prefix - A prefix to add to the beginning of the hash result
8
+ * @param repeat - Number of times to repeat the hashing process for increased complexity (default: 3)
9
+ * @returns A hashed string with the specified prefix
10
+ */
11
+ export function nanoHash(str: string | number, prefix: string, repeat = 1): string {
12
+ if (repeat < 1) {
13
+ throw new Error('The repeat parameter must be greater than or equal to 1');
14
+ }
15
+
16
+ let hash1 = 0xdeadbeef;
17
+ let hash2 = 0x41c6ce57;
18
+
19
+ if (typeof str === 'number') {
20
+ str = str.toString();
21
+ }
22
+
23
+ const len = str.length;
24
+ for (let i = 0; i < len; i++) {
25
+ const char = str.charCodeAt(i);
26
+ hash1 = Math.imul(hash1 ^ char, 2654435761);
27
+ hash2 = Math.imul(hash2 ^ char, 1597334677);
28
+ }
29
+
30
+ hash1 = Math.imul(hash1 ^ (hash1 >>> 16), 2246822507) ^ Math.imul(hash2 ^ (hash2 >>> 13), 3266489909);
31
+ hash2 = Math.imul(hash2 ^ (hash2 >>> 16), 2246822507) ^ Math.imul(hash1 ^ (hash1 >>> 13), 3266489909);
32
+
33
+ const result = prefix + (hash1 >>> 0).toString(36) + (hash2 >>> 0).toString(36);
34
+ if (repeat === 1) {
35
+ return result;
36
+ }
37
+ else {
38
+ return nanoHash(result, prefix, repeat - 1);
39
+ }
40
+ }
package/CHANGELOG.md DELETED
@@ -1,195 +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
- ## [5.2.29](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.28...@alwatr/hash-string@5.2.29) (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
- ## [5.2.28](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.27...@alwatr/hash-string@5.2.28) (2026-02-18)
13
-
14
- **Note:** Version bump only for package @alwatr/hash-string
15
-
16
- ## [5.2.27](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.26...@alwatr/hash-string@5.2.27) (2025-12-23)
17
-
18
- **Note:** Version bump only for package @alwatr/hash-string
19
-
20
- ## [5.2.26](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.25...@alwatr/hash-string@5.2.26) (2025-12-13)
21
-
22
- **Note:** Version bump only for package @alwatr/hash-string
23
-
24
- ## [5.2.25](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.24...@alwatr/hash-string@5.2.25) (2025-12-10)
25
-
26
- **Note:** Version bump only for package @alwatr/hash-string
27
-
28
- ## [5.2.24](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.23...@alwatr/hash-string@5.2.24) (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
- ## [5.2.23](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.22...@alwatr/hash-string@5.2.23) (2025-11-15)
35
-
36
- **Note:** Version bump only for package @alwatr/hash-string
37
-
38
- ## [5.2.22](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.21...@alwatr/hash-string@5.2.22) (2025-11-15)
39
-
40
- **Note:** Version bump only for package @alwatr/hash-string
41
-
42
- ## [5.2.21](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.20...@alwatr/hash-string@5.2.21) (2025-11-06)
43
-
44
- ### ๐Ÿ› Bug Fixes
45
-
46
- * remove unnecessary types reference from tsconfig.json ([c981379](https://github.com/Alwatr/nanolib/commit/c981379bce24874f878c5413eeec2da767f5ac4e))
47
-
48
- ## [5.2.20](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.19...@alwatr/hash-string@5.2.20) (2025-11-04)
49
-
50
- **Note:** Version bump only for package @alwatr/hash-string
51
-
52
- ## [5.2.19](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.18...@alwatr/hash-string@5.2.19) (2025-10-06)
53
-
54
- ### ๐Ÿ”— Dependencies update
55
-
56
- * bump the npm-dependencies group with 4 updates ([9825815](https://github.com/Alwatr/nanolib/commit/982581552bbb4b97dca52af5e93a80937f0c3109))
57
-
58
- ## [5.2.18](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.17...@alwatr/hash-string@5.2.18) (2025-09-27)
59
-
60
- ### ๐Ÿงน Miscellaneous Chores
61
-
62
- * exclude test files from package distribution ([86f4f2f](https://github.com/Alwatr/nanolib/commit/86f4f2f5985845c5cf3a3a9398de7b2f98ce53e7))
63
-
64
- ## [5.2.17](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.16...@alwatr/hash-string@5.2.17) (2025-09-22)
65
-
66
- **Note:** Version bump only for package @alwatr/hash-string
67
-
68
- ## [5.2.16](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.15...@alwatr/hash-string@5.2.16) (2025-09-22)
69
-
70
- **Note:** Version bump only for package @alwatr/hash-string
71
-
72
- ## [5.2.15](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.14...@alwatr/hash-string@5.2.15) (2025-09-21)
73
-
74
- **Note:** Version bump only for package @alwatr/hash-string
75
-
76
- ## [5.2.14](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.13...@alwatr/hash-string@5.2.14) (2025-09-20)
77
-
78
- ### ๐Ÿ› Bug Fixes
79
-
80
- * add sideEffects property to package.json files for better tree-shaking ([c7b9e74](https://github.com/Alwatr/nanolib/commit/c7b9e74e1920c8e35b438742de61883ca62da58c))
81
- * add sideEffects property to package.json files for better tree-shaking ([e8402c4](https://github.com/Alwatr/nanolib/commit/e8402c481a14a1f807a37aaa862a936713d26176))
82
-
83
- ### ๐Ÿงน Miscellaneous Chores
84
-
85
- * remove duplicate sideEffects property from multiple package.json files ([b123f86](https://github.com/Alwatr/nanolib/commit/b123f86be81481de2314aae9bb2eeb629743d24c))
86
-
87
- ## [5.2.13](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.12...@alwatr/hash-string@5.2.13) (2025-09-19)
88
-
89
- **Note:** Version bump only for package @alwatr/hash-string
90
-
91
- ## [5.2.12](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.11...@alwatr/hash-string@5.2.12) (2025-09-15)
92
-
93
- **Note:** Version bump only for package @alwatr/hash-string
94
-
95
- ## [5.2.11](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.10...@alwatr/hash-string@5.2.11) (2025-09-14)
96
-
97
- ### ๐Ÿ”จ Code Refactoring
98
-
99
- * **hash:** remove djb2Hash implementation and tests ([140a1e1](https://github.com/Alwatr/nanolib/commit/140a1e191bbe864379e2621919f7fbc37f403afa))
100
-
101
- ## [5.2.10](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.9...@alwatr/hash-string@5.2.10) (2025-09-13)
102
-
103
- **Note:** Version bump only for package @alwatr/hash-string
104
-
105
- ## [5.2.9](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.8...@alwatr/hash-string@5.2.9) (2025-09-13)
106
-
107
- ### ๐Ÿงน Miscellaneous Chores
108
-
109
- * remove package-tracer dependency and related code from fetch package ([96fe4e9](https://github.com/Alwatr/nanolib/commit/96fe4e9552a205f218ceed187c55e4e904a07089))
110
-
111
- ## [5.2.8](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.7...@alwatr/hash-string@5.2.8) (2025-09-09)
112
-
113
- ### ๐Ÿงน Miscellaneous Chores
114
-
115
- * remove trailing newlines from contributing sections in README files ([e8ab1bc](https://github.com/Alwatr/nanolib/commit/e8ab1bc43e0addea5ccd4c897c2cec597cb9e15f))
116
-
117
- ## [5.2.7](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.6...@alwatr/hash-string@5.2.7) (2025-09-06)
118
-
119
- **Note:** Version bump only for package @alwatr/hash-string
120
-
121
- ## [5.2.6](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.5...@alwatr/hash-string@5.2.6) (2025-09-05)
122
-
123
- ### ๐Ÿ”— Dependencies update
124
-
125
- * update jest to version 30.1.3 and @types/node to version 22.18.1 ([754212b](https://github.com/Alwatr/nanolib/commit/754212b1523cfc4cfe26c9e9f6d634aa8311e0b7))
126
-
127
- ## [5.2.5](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.4...@alwatr/hash-string@5.2.5) (2025-09-01)
128
-
129
- ### ๐Ÿ”— Dependencies update
130
-
131
- * update lerna-lite dependencies to version 4.7.3 and jest to 30.1.2 ([95d7870](https://github.com/Alwatr/nanolib/commit/95d7870ec7ad1e6ed2688bafddcabf46857f6981))
132
-
133
- ## [5.2.4](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.3...@alwatr/hash-string@5.2.4) (2025-08-23)
134
-
135
- **Note:** Version bump only for package @alwatr/hash-string
136
-
137
- ## [5.2.3](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.1...@alwatr/hash-string@5.2.3) (2025-08-23)
138
-
139
- ### ๐Ÿ› Bug Fixes
140
-
141
- * update license from AGPL-3.0-only to MPL-2.0 ([d20968e](https://github.com/Alwatr/nanolib/commit/d20968e60cc89b1dcdf9b96507178da6ed562f55))
142
- * update package versions in multiple package.json files ([7638b1c](https://github.com/Alwatr/nanolib/commit/7638b1cafee2b4e0f97db7a89ac9fba6384b9b10))
143
-
144
- ### ๐Ÿ”จ Code Refactoring
145
-
146
- * Updated all package.json files in the project to change dependency version specifiers from "workspace:^" to "workspace:*" for consistency and to allow for more flexible version resolution. ([db6a4f7](https://github.com/Alwatr/nanolib/commit/db6a4f76deec2d1d8039978144e4bc51b6f1a0e3))
147
-
148
- ### ๐Ÿงน Miscellaneous Chores
149
-
150
- * reformat all package.json files ([ceda45d](https://github.com/Alwatr/nanolib/commit/ceda45de186667790474f729cb4b161a5148ce19))
151
- * remove duplicate keywords from package.json ([3125526](https://github.com/Alwatr/nanolib/commit/3125526b5ed8284d461055bf6ea925fad8fa8fb0))
152
-
153
- ### ๐Ÿ”— Dependencies update
154
-
155
- * update TypeScript and Jest versions across all packages to improve compatibility and performance ([31baf36](https://github.com/Alwatr/nanolib/commit/31baf366101e92e27db66a21c849fb101f19be47))
156
-
157
- ## [5.2.2](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.2.1...@alwatr/hash-string@5.2.2) (2025-08-23)
158
-
159
- ### Code Refactoring
160
-
161
- * Updated all package.json files in the project to change dependency version specifiers from "workspace:^" to "workspace:*" for consistency and to allow for more flexible version resolution. ([db6a4f7](https://github.com/Alwatr/nanolib/commit/db6a4f76deec2d1d8039978144e4bc51b6f1a0e3)) by @alimd
162
-
163
- ## <small>5.2.1 (2025-04-15)</small>
164
-
165
- **Note:** Version bump only for package @alwatr/hash-string
166
-
167
- ## [5.2.0](https://github.com/Alwatr/nanolib/compare/@alwatr/hash-string@5.1.0...@alwatr/hash-string@5.2.0) (2025-04-01)
168
-
169
- ### Features
170
-
171
- * implement DJB2 hash algorithm for efficient string hashing ([d505181](https://github.com/Alwatr/nanolib/commit/d505181fed1f85cf067ea5499b3de692b84385b0)) by @alimd
172
-
173
- ### Bug Fixes
174
-
175
- * change default repeat value in hashString function from 3 to 1 ([e5c373f](https://github.com/Alwatr/nanolib/commit/e5c373f2a18ce1933f234a6f8dafeda181df1f14)) by @alimd
176
-
177
- ### Code Refactoring
178
-
179
- * replace hashString function with nanoHash and export new hashing methods ([3651b0c](https://github.com/Alwatr/nanolib/commit/3651b0cf254a044f7eb4cfc0a52a9b645e1c26d3)) by @alimd
180
-
181
- ## 5.1.0 (2025-03-18)
182
-
183
- ### Features
184
-
185
- * add `hash-string` package ([a30b18f](https://github.com/Alwatr/nanolib/commit/a30b18f64f6d308697c39792bd886df921763808)) by @mohammadhonarvar
186
-
187
- ### Bug Fixes
188
-
189
- * downgrade version of hash-string and random packages to 5.0.0 ([176fc5c](https://github.com/Alwatr/nanolib/commit/176fc5c6a5af37d8b7cb7f41336910f0e8fcd0a9)) by @
190
- * **hash-string:** validate repeat parameter in hashString function ([248da9f](https://github.com/Alwatr/nanolib/commit/248da9f9e705aab37fa4f3db0fbc605a4a16c86c)) by @alimd
191
-
192
- ### Miscellaneous Chores
193
-
194
- * **hash-string:** update TypeScript configuration to remove unused types and add package reference ([371072e](https://github.com/Alwatr/nanolib/commit/371072eba0c676a96b65c1a4ec4663ca017f9553)) by @alimd
195
- * **hash-string:** update version and improve package description and keywords ([defb816](https://github.com/Alwatr/nanolib/commit/defb816f86cf5c53b5e01118c7d9ecdcd2db3900)) by @alimd
package/dist/main.cjs DELETED
@@ -1,3 +0,0 @@
1
- /** ๐Ÿ“ฆ @alwatr/hash-string v5.2.29 */
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,{nanoHash:()=>nanoHash});module.exports=__toCommonJS(main_exports);function nanoHash(str,prefix,repeat=1){if(repeat<1){throw new Error("The repeat parameter must be greater than or equal to 1")}let hash1=3735928559;let hash2=1103547991;if(typeof str==="number"){str=str.toString()}const len=str.length;for(let i=0;i<len;i++){const char=str.charCodeAt(i);hash1=Math.imul(hash1^char,2654435761);hash2=Math.imul(hash2^char,1597334677)}hash1=Math.imul(hash1^hash1>>>16,2246822507)^Math.imul(hash2^hash2>>>13,3266489909);hash2=Math.imul(hash2^hash2>>>16,2246822507)^Math.imul(hash1^hash1>>>13,3266489909);const result=prefix+(hash1>>>0).toString(36)+(hash2>>>0).toString(36);if(repeat===1){return result}else{return nanoHash(result,prefix,repeat-1)}}0&&(module.exports={nanoHash});
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": ["/**\n * Simple hash string for fast hashing (like md5).\n * This function is not very secure and should not be used for security purposes.\n * But it cannot be reversed easily and brute force can take up to years for fast computers.\n *\n * @param str - The string or number to hash\n * @param prefix - A prefix to add to the beginning of the hash result\n * @param repeat - Number of times to repeat the hashing process for increased complexity (default: 3)\n * @returns A hashed string with the specified prefix\n */\nexport function nanoHash(str: string | number, prefix: string, repeat = 1): string {\n if (repeat < 1) {\n throw new Error('The repeat parameter must be greater than or equal to 1');\n }\n\n let hash1 = 0xdeadbeef;\n let hash2 = 0x41c6ce57;\n\n if (typeof str === 'number') {\n str = str.toString();\n }\n\n const len = str.length;\n for (let i = 0; i < len; i++) {\n const char = str.charCodeAt(i);\n hash1 = Math.imul(hash1 ^ char, 2654435761);\n hash2 = Math.imul(hash2 ^ char, 1597334677);\n }\n\n hash1 = Math.imul(hash1 ^ (hash1 >>> 16), 2246822507) ^ Math.imul(hash2 ^ (hash2 >>> 13), 3266489909);\n hash2 = Math.imul(hash2 ^ (hash2 >>> 16), 2246822507) ^ Math.imul(hash1 ^ (hash1 >>> 13), 3266489909);\n\n const result = prefix + (hash1 >>> 0).toString(36) + (hash2 >>> 0).toString(36);\n if (repeat === 1) {\n return result;\n }\n else {\n return nanoHash(result, prefix, repeat - 1);\n }\n}\n"],
5
- "mappings": ";qqBAAA,6GAUO,SAAS,SAAS,IAAsB,OAAgB,OAAS,EAAW,CACjF,GAAI,OAAS,EAAG,CACd,MAAM,IAAI,MAAM,yDAAyD,CAC3E,CAEA,IAAI,MAAQ,WACZ,IAAI,MAAQ,WAEZ,GAAI,OAAO,MAAQ,SAAU,CAC3B,IAAM,IAAI,SAAS,CACrB,CAEA,MAAM,IAAM,IAAI,OAChB,QAAS,EAAI,EAAG,EAAI,IAAK,IAAK,CAC5B,MAAM,KAAO,IAAI,WAAW,CAAC,EAC7B,MAAQ,KAAK,KAAK,MAAQ,KAAM,UAAU,EAC1C,MAAQ,KAAK,KAAK,MAAQ,KAAM,UAAU,CAC5C,CAEA,MAAQ,KAAK,KAAK,MAAS,QAAU,GAAK,UAAU,EAAI,KAAK,KAAK,MAAS,QAAU,GAAK,UAAU,EACpG,MAAQ,KAAK,KAAK,MAAS,QAAU,GAAK,UAAU,EAAI,KAAK,KAAK,MAAS,QAAU,GAAK,UAAU,EAEpG,MAAM,OAAS,QAAU,QAAU,GAAG,SAAS,EAAE,GAAK,QAAU,GAAG,SAAS,EAAE,EAC9E,GAAI,SAAW,EAAG,CAChB,OAAO,MACT,KACK,CACH,OAAO,SAAS,OAAQ,OAAQ,OAAS,CAAC,CAC5C,CACF",
6
- "names": []
7
- }
package/dist/main.mjs DELETED
@@ -1,3 +0,0 @@
1
- /** ๐Ÿ“ฆ @alwatr/hash-string v5.2.29 */
2
- function nanoHash(str,prefix,repeat=1){if(repeat<1){throw new Error("The repeat parameter must be greater than or equal to 1")}let hash1=3735928559;let hash2=1103547991;if(typeof str==="number"){str=str.toString()}const len=str.length;for(let i=0;i<len;i++){const char=str.charCodeAt(i);hash1=Math.imul(hash1^char,2654435761);hash2=Math.imul(hash2^char,1597334677)}hash1=Math.imul(hash1^hash1>>>16,2246822507)^Math.imul(hash2^hash2>>>13,3266489909);hash2=Math.imul(hash2^hash2>>>16,2246822507)^Math.imul(hash1^hash1>>>13,3266489909);const result=prefix+(hash1>>>0).toString(36)+(hash2>>>0).toString(36);if(repeat===1){return result}else{return nanoHash(result,prefix,repeat-1)}}export{nanoHash};
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": ["/**\n * Simple hash string for fast hashing (like md5).\n * This function is not very secure and should not be used for security purposes.\n * But it cannot be reversed easily and brute force can take up to years for fast computers.\n *\n * @param str - The string or number to hash\n * @param prefix - A prefix to add to the beginning of the hash result\n * @param repeat - Number of times to repeat the hashing process for increased complexity (default: 3)\n * @returns A hashed string with the specified prefix\n */\nexport function nanoHash(str: string | number, prefix: string, repeat = 1): string {\n if (repeat < 1) {\n throw new Error('The repeat parameter must be greater than or equal to 1');\n }\n\n let hash1 = 0xdeadbeef;\n let hash2 = 0x41c6ce57;\n\n if (typeof str === 'number') {\n str = str.toString();\n }\n\n const len = str.length;\n for (let i = 0; i < len; i++) {\n const char = str.charCodeAt(i);\n hash1 = Math.imul(hash1 ^ char, 2654435761);\n hash2 = Math.imul(hash2 ^ char, 1597334677);\n }\n\n hash1 = Math.imul(hash1 ^ (hash1 >>> 16), 2246822507) ^ Math.imul(hash2 ^ (hash2 >>> 13), 3266489909);\n hash2 = Math.imul(hash2 ^ (hash2 >>> 16), 2246822507) ^ Math.imul(hash1 ^ (hash1 >>> 13), 3266489909);\n\n const result = prefix + (hash1 >>> 0).toString(36) + (hash2 >>> 0).toString(36);\n if (repeat === 1) {\n return result;\n }\n else {\n return nanoHash(result, prefix, repeat - 1);\n }\n}\n"],
5
- "mappings": ";AAUO,SAAS,SAAS,IAAsB,OAAgB,OAAS,EAAW,CACjF,GAAI,OAAS,EAAG,CACd,MAAM,IAAI,MAAM,yDAAyD,CAC3E,CAEA,IAAI,MAAQ,WACZ,IAAI,MAAQ,WAEZ,GAAI,OAAO,MAAQ,SAAU,CAC3B,IAAM,IAAI,SAAS,CACrB,CAEA,MAAM,IAAM,IAAI,OAChB,QAAS,EAAI,EAAG,EAAI,IAAK,IAAK,CAC5B,MAAM,KAAO,IAAI,WAAW,CAAC,EAC7B,MAAQ,KAAK,KAAK,MAAQ,KAAM,UAAU,EAC1C,MAAQ,KAAK,KAAK,MAAQ,KAAM,UAAU,CAC5C,CAEA,MAAQ,KAAK,KAAK,MAAS,QAAU,GAAK,UAAU,EAAI,KAAK,KAAK,MAAS,QAAU,GAAK,UAAU,EACpG,MAAQ,KAAK,KAAK,MAAS,QAAU,GAAK,UAAU,EAAI,KAAK,KAAK,MAAS,QAAU,GAAK,UAAU,EAEpG,MAAM,OAAS,QAAU,QAAU,GAAG,SAAS,EAAE,GAAK,QAAU,GAAG,SAAS,EAAE,EAC9E,GAAI,SAAW,EAAG,CAChB,OAAO,MACT,KACK,CACH,OAAO,SAAS,OAAQ,OAAQ,OAAS,CAAC,CAC5C,CACF",
6
- "names": []
7
- }