smchash
v0.1.0
Published
High-performance hash function passing all 188 SMHasher3 tests
Maintainers
Readme
smchash
High-performance hash function passing all 188 SMHasher3 quality tests.
Features
- Fast: Passes all 188 SMHasher3 quality tests
- Built-in PRNG:
smcRand()passes BigCrush and PractRand - TypeScript: Full type definitions included
- Zero dependencies
Installation
npm install smchashUsage
import { smchash, smchashSeeded, smcRand, stringToBytes } from 'smchash';
// Basic hashing
const hash = smchash(stringToBytes("Hello, World!"));
// Seeded hashing
const hash = smchashSeeded(stringToBytes("Hello"), 12345n);
// PRNG (passes BigCrush/PractRand)
const seed = { value: 42n };
const random = smcRand(seed);API
smchash(data: Uint8Array): bigint- Hash with default seedsmchashSeeded(data: Uint8Array, seed: bigint): bigint- Hash with custom seedsmcRand(seed: { value: bigint }): bigint- PRNGstringToBytes(str: string): Uint8Array- Helper to convert strings
Requirements
- ES2020+ (for BigInt support)
- Node.js 12+ or modern browsers
License
MIT License - Copyright 2025 ScaleCode Solutions
