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

farmhashjs

v1.0.1

Published

Pure JavaScript implementation of Google's FarmHash - compatible with farmhash v3.x and v5.x

Readme

farmhashjs

Test and Build NPM Downloads

Pure JavaScript implementation of Google's FarmHash algorithm. No native dependencies, works in Node.js and browsers.

😘 Maintainer: @baptistejamin

Why?

The native farmhash npm package requires C++ compilation, which can be problematic:

  • Fails on some platforms (Windows, Alpine Linux, etc.)
  • Requires node-gyp and build tools
  • Doesn't work in browsers or edge runtimes

farmhashjs provides the same hash outputs with zero native dependencies.

Installation

npm install farmhashjs

Usage

import { 
  fingerprint64, fingerprint32,
  legacyHash64_arm, legacyHash64_x86,
  legacyHash32_arm, legacyHash32_x86
} from 'farmhashjs';

// Modern stable fingerprints (recommended - same on all platforms)
fingerprint64('hello world');  // "6381520714923946011"
fingerprint32('hello world');  // 430397466

// Legacy hashes (compatible with [email protected])
// Use _arm or _x86 suffix based on your target platform
legacyHash64_arm('hello world');  // "16022978042064026561"
legacyHash64_x86('hello world');  // "16022978042064026561" (same for <512 bytes)

legacyHash32_arm('hello world');  // 3314386015
legacyHash32_x86('hello world');  // 1955099599

API

Modern Functions (Stable Fingerprints)

These produce stable hashes guaranteed to be consistent across all platforms and versions.

| Function | Returns | Description | |----------|---------|-------------| | fingerprint64(input) | string | 64-bit hash as decimal string | | fingerprint64BigInt(input) | bigint | 64-bit hash as BigInt | | fingerprint32(input) | number | 32-bit hash as number |

Legacy Functions (farmhash v3.x Compatible)

These are compatible with [email protected] which was compiled with FARMHASH_DEBUG=1.

Important: The native [email protected] produces different outputs on ARM64 vs x86_64 architectures. Choose the _arm or _x86 variant based on your target platform.

| Function | Returns | Description | |----------|---------|-------------| | legacyHash64_arm(input) | string | 64-bit hash (ARM64) | | legacyHash64_x86(input) | string | 64-bit hash (x86_64, <512 bytes) | | legacyHash64BigInt_arm(input) | bigint | 64-bit hash as BigInt (ARM64) | | legacyHash64BigInt_x86(input) | bigint | 64-bit hash as BigInt (x86_64, <512 bytes) | | legacyHash32_arm(input) | number | 32-bit hash (ARM64) | | legacyHash32_x86(input) | number | 32-bit hash (x86_64, <512 bytes) |

Notes:

  • For hash64: ARM64 and x86_64 produce the same output for strings <512 bytes. For ≥512 bytes, different algorithms are used.
  • For hash32: ARM64 and x86_64 produce different outputs for ALL strings (different algorithms).
  • The x86_64 SIMD algorithm (farmhashte) is fully implemented in pure JavaScript.

Aliases

import { hash64, hash32 } from 'farmhashjs';

// hash64 = fingerprint64
// hash32 = fingerprint32

Compatibility

Tested against native implementations:

| Function | Compared Against | |----------|------------------| | fingerprint64 | [email protected] fingerprint64 | | fingerprint32 | [email protected] fingerprint32 | | legacyHash64_arm | [email protected] hash64 on ARM64 | | legacyHash64_x86 | [email protected] hash64 on x86_64 (<512 bytes) | | legacyHash32_arm | [email protected] hash32 on ARM64 | | legacyHash32_x86 | [email protected] hash32 on x86_64 (<512 bytes) |

Performance

Benchmarked on Apple M1:

| Function | 44 bytes | 500 bytes | 5 KB | |----------|----------|-----------|------| | fingerprint32 | 251 ns/op | 903 ns/op | 9 µs/op | | fingerprint64 | 843 ns/op | 7 µs/op | 65 µs/op | | legacyHash32_arm | 302 ns/op | 974 ns/op | 9 µs/op | | legacyHash64_arm | 1.1 µs/op | 6.8 µs/op | 58 µs/op |

32-bit functions are faster because they use native number operations. 64-bit functions use BigInt which has more overhead.

For comparison, native C++ ([email protected]) is ~2-10x faster depending on input size.

When to Use

Use farmhashjs when:

  • You need cross-platform compatibility
  • You're running in browsers, Cloudflare Workers, or edge runtimes
  • You can't compile native modules
  • You're hashing moderate volumes (< 100K hashes/second)

Use native farmhash when:

  • Maximum performance is critical
  • You're in a Node.js environment that supports native modules
  • You're hashing millions of strings per second

License

Apache-2.0

This is a port of Google's FarmHash. Original FarmHash is Copyright 2014 Google Inc.