mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-01-14 08:58:02 -05:00
10 lines
261 B
TypeScript
10 lines
261 B
TypeScript
export const hashCode = (str: string): string => {
|
|
let hash = 0;
|
|
for (let i = 0; i < str.length; i++) {
|
|
const char = str.charCodeAt(i);
|
|
hash = (hash << 5) - hash + char;
|
|
hash &= hash; // Convert to 32bit integer
|
|
}
|
|
return hash.toString();
|
|
};
|