npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jadujoel/siphash-napi

v0.1.5

Published

SipHash-2-4 via Rust napi-rs bindings

Readme

siphash-napi

Fast SipHash-2-4 for Node.js and Bun, backed by a native Rust extension via napi-rs.

Installation

# npm
npm install siphash-napi

# bun
bun add siphash-napi

Pre-built native binaries are bundled for the following targets:

| Platform | Architecture | |---|---| | macOS | x64, arm64 | | Linux (glibc) | x64, arm64 | | Linux (musl) | x64, arm64 | | Windows | x64, arm64 |

API

// Hash a Buffer with the default key (0, 0)
function siphash(data: Buffer): bigint

// Hash a Buffer with a custom 128-bit key supplied as two 64-bit BigInt halves
function siphashWithKey(data: Buffer, key0: bigint, key1: bigint): bigint

// Hash a file by path, reading in 8 KiB chunks (no full file load into memory)
function siphashFile(path: string): bigint

All functions return a bigint representing the unsigned 64-bit hash value.

Usage

Node.js (CommonJS)

const { siphash, siphashWithKey, siphashFile } = require('siphash-napi')

const hash = siphash(Buffer.from('hello'))
console.log(hash) // 7659893686435503compute (bigint)

// Custom key
const keyed = siphashWithKey(Buffer.from('hello'), 1n, 2n)

// Hash a file
const fileHash = siphashFile('/path/to/file.bin')

Node.js (ESM)

import { siphash, siphashWithKey, siphashFile } from 'siphash-napi'

const hash = siphash(Buffer.from('hello'))

const keyed = siphashWithKey(Buffer.from('hello'), 1n, 2n)

const fileHash = siphashFile('/path/to/file.bin')

TypeScript

import { siphash, siphashWithKey, siphashFile } from 'siphash-napi'

const hash: bigint = siphash(Buffer.from('hello'))

const keyed: bigint = siphashWithKey(Buffer.from('hello'), 1n, 2n)

const fileHash: bigint = siphashFile('/path/to/file.bin')

Bun

import { siphash, siphashWithKey, siphashFile } from 'siphash-napi'

const hash = siphash(Buffer.from('hello'))

// Use as a map/cache key
const cache = new Map<bigint, string>()
cache.set(siphash(Buffer.from('key')), 'value')

Notes

  • Default key: siphash() uses the zero key (0, 0). This is suitable for non-cryptographic use cases such as hash tables and content deduplication. Do not rely on SipHash for cryptographic security.
  • Custom key: Use siphashWithKey(data, key0, key1) when you need a secret or per-instance key to prevent hash-flooding attacks.
  • File hashing: siphashFile() streams the file in 8 KiB chunks, so arbitrarily large files can be hashed without loading them fully into memory.
  • Return type: All functions return a bigint. Use .toString() or .toString(16) if you need a string representation.

Building from source

Requires Rust and the napi-rs CLI.

npm install
npm run build

For a debug build:

npm run build:debug