Skip to main content
Home

Built and signed on GitHub Actions

Quick non-cryptographic hash functions for strings

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
70%
Published
4 months ago (0.0.7)

dumbjs/quick-hash

Why?

Tired of copying them around

Usage

The library exports a few quick string hashing functions that are widely used for proper bit distribution and short hashes for longer strings, (with the exception of the BigInt implementation of sdbm)

djb2

Details →

import { djb2 as hash } from '@dumbjs/quick-hash'
// or
// import { djb2 as hash } from '@dumbjs/quick-hash/djb2'

hash('hello') //=>261238937

sdbm

Details →

Original Version

import { sdbm as hash } from '@dumbjs/quick-hash'
// or
// import { sdbm as hash } from '@dumbjs/quick-hash/sdbm'

hash('hello') //=>31334377934759990

GAWK Version

import { sdbmGawk as hash } from '@dumbjs/quick-hash'
// or
// import { sdbmGawk as hash } from '@dumbjs/quick-hash/sdbm'

hash('hello') //=>1925877435333486942514

License

MIT

Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@dumbjs/quick-hash

Import symbol

import * as quick_hash from "@dumbjs/quick-hash";
or

Import directly with a jsr specifier

import * as quick_hash from "jsr:@dumbjs/quick-hash";

Add Package

pnpm i jsr:@dumbjs/quick-hash
or (using pnpm 10.8 or older)
pnpm dlx jsr add @dumbjs/quick-hash

Import symbol

import * as quick_hash from "@dumbjs/quick-hash";

Add Package

yarn add jsr:@dumbjs/quick-hash
or (using Yarn 4.8 or older)
yarn dlx jsr add @dumbjs/quick-hash

Import symbol

import * as quick_hash from "@dumbjs/quick-hash";

Add Package

vlt install jsr:@dumbjs/quick-hash

Import symbol

import * as quick_hash from "@dumbjs/quick-hash";

Add Package

npx jsr add @dumbjs/quick-hash

Import symbol

import * as quick_hash from "@dumbjs/quick-hash";

Add Package

bunx jsr add @dumbjs/quick-hash

Import symbol

import * as quick_hash from "@dumbjs/quick-hash";