simpleHash
Generate a fast non-cryptographic hash of a string as a base-36 encoded value, handy for cache keys and lightweight fingerprints.
Usage
simpleHash generates a simple hash value for a string.
import { simpleHash } from '@movk/core'
const hash1 = simpleHash('hello world')
console.log(hash1) // 'nf5xd4'
const hash2 = simpleHash('hello world')
console.log(hash1 === hash2) // true — same string produces the same hash
const hash3 = simpleHash('hello world!')
console.log(hash1 === hash3) // false — different strings produce different hashes
API
simpleHash(str)
Generate a simple hash value for a string.
Parameters
str
string required
The string to hash.
Returns
returns
string
The 32-bit hash value encoded as a base-36 string.
Changelog
No recent changes