Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@broofa/fnv1a

broofa24ISC1.0.1

A robust, tiny, string hash implementation for JS, based on FNV-1a

string, hash, FNV, FNV-1a

readme

@broofa/fnv1a

Drop-in replacment for the fnv1a module, with support for unicode and incremental hashing.

See fnv1a module for details

Installation

npm i @broofa/fnv1a

Example: One-time hash

const fnv1a = require('@broofa/fnv1a');

fnv1a('hello world'); // => 2166136261

Example: Incremental hash

const fnv1a = require('@broofa/fnv1a');

const digest = fnv1a.digest();
digest.update('hello');
digest.hash;   // => 1335831723
digest.update(' world');
digest.hash;  // => 2166136261

// Or, more concisely
fnv1a.digest()
  .update('hello');
  .update(' world');
  .hash;  // => 2166136261