@alwatr/hash-string 5.2.28 → 5.2.29
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 +6 -0
- package/dist/main.cjs +1 -2
- package/dist/main.cjs.map +1 -1
- package/dist/main.mjs +1 -2
- package/dist/main.mjs.map +1 -1
- package/package.json +14 -15
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
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
|
+
|
|
6
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)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @alwatr/hash-string
|
package/dist/main.cjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** 📦 @alwatr/hash-string v5.2.
|
|
2
|
-
__dev_mode__: console.debug("📦 @alwatr/hash-string v5.2.28");
|
|
1
|
+
/** 📦 @alwatr/hash-string v5.2.29 */
|
|
3
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});
|
|
4
3
|
//# sourceMappingURL=main.cjs.map
|
package/dist/main.cjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
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": "
|
|
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
6
|
"names": []
|
|
7
7
|
}
|
package/dist/main.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** 📦 @alwatr/hash-string v5.2.
|
|
2
|
-
__dev_mode__: console.debug("📦 @alwatr/hash-string v5.2.28");
|
|
1
|
+
/** 📦 @alwatr/hash-string v5.2.29 */
|
|
3
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};
|
|
4
3
|
//# sourceMappingURL=main.mjs.map
|
package/dist/main.mjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
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": "
|
|
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
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwatr/hash-string",
|
|
3
3
|
"description": "A simple utility to generate a hash string.",
|
|
4
|
-
"version": "5.2.
|
|
4
|
+
"version": "5.2.29",
|
|
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.
|
|
8
|
+
"@alwatr/nano-build": "6.4.2",
|
|
9
9
|
"@alwatr/prettier-config": "6.0.2",
|
|
10
10
|
"@alwatr/tsconfig-base": "6.0.4",
|
|
11
|
-
"jest": "^30.2.0",
|
|
12
11
|
"typescript": "^5.9.3"
|
|
13
12
|
},
|
|
14
13
|
"exports": {
|
|
@@ -56,23 +55,23 @@
|
|
|
56
55
|
"directory": "packages/hash-string"
|
|
57
56
|
},
|
|
58
57
|
"scripts": {
|
|
59
|
-
"b": "
|
|
60
|
-
"build": "
|
|
58
|
+
"b": "bun run build",
|
|
59
|
+
"build": "bun run build:ts && bun run build:es",
|
|
61
60
|
"build:es": "nano-build --preset=module",
|
|
62
61
|
"build:ts": "tsc --build",
|
|
63
|
-
"c": "
|
|
64
|
-
"cb": "
|
|
62
|
+
"c": "bun run clean",
|
|
63
|
+
"cb": "bun run clean && bun run build",
|
|
65
64
|
"clean": "rm -rfv dist *.tsbuildinfo",
|
|
66
|
-
"d": "
|
|
67
|
-
"t": "
|
|
68
|
-
"test": "
|
|
69
|
-
"w": "
|
|
70
|
-
"watch": "
|
|
71
|
-
"watch:es": "
|
|
72
|
-
"watch:ts": "
|
|
65
|
+
"d": "bun run build:es && bun --enable-source-maps --trace-warnings",
|
|
66
|
+
"t": "bun run test",
|
|
67
|
+
"test": "echo test-skipped",
|
|
68
|
+
"w": "bun run watch",
|
|
69
|
+
"watch": "bun run watch:ts & bun run watch:es",
|
|
70
|
+
"watch:es": "bun run build:es --watch",
|
|
71
|
+
"watch:ts": "bun run build:ts --watch --preserveWatchOutput"
|
|
73
72
|
},
|
|
74
73
|
"sideEffects": false,
|
|
75
74
|
"type": "module",
|
|
76
75
|
"types": "./dist/main.d.ts",
|
|
77
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "c3889e3756b0a0f9b935a1b702a1373ac52cb379"
|
|
78
77
|
}
|