A lightweight, high-performance hashing library for TypeScript.
npm install zulhashA high-performance, zero-dependency, lightweight hashing library for TypeScript and JavaScript.



ZulHash provides an extremely fast non-cryptographic hashing implementation (FNV-1a) designed for speed and simplicity. It is perfect for hash tables, cache keys, and generating short unique identifiers.
---
* 🚀 Fast: Uses 32-bit bitwise operations (Math.imul) for maximum performance.
* 📦 Tiny Footprint: Zero dependencies. Less than 1KB gzipped.
* 🛡️ TypeScript Native: Fully typed with .d.ts declarations included.
* 🔄 Stable Object Hashing: Includes a utility to hash objects regardless of key order.
* 🌐 Universal: Works in Node.js, Browsers, and Edge environments.
---
``bash`
npm install zulhashor
yarn add zulhashor
pnpm add zulhash
`ts
import { hash } from 'zulhash';
const hashString = hash('Hello World');
console.log(hashString); // 78013340
`
`ts
import { shortId } from 'zulhash';
const id = shortId('user_session_99');
console.log(id); // "1W5K9A"
`
ts
import { hashObject } from 'zulhash';const obj1 = { name: 'Zul', role: 'admin' };
const obj2 = { role: 'admin', name: 'Zul' };
console.log(hashObject(obj1) === hashObject(obj2)); // true
`
API Reference
`ts
hash(input: string): number
`
The primary hashing function based on the FNV-1a algorithm. Returns a 32-bit positive integer.`ts
shortId(input: string): string
`
Takes a string and returns a short, uppercase alphanumeric string. Ideal for UI keys or DOM IDs.`ts
hashObject(obj: object): number
``