Socket
Book a DemoInstallSign in
Socket

@broofa/fnv1a

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@broofa/fnv1a

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

latest
npmnpm
Version
1.0.1
Version published
Weekly downloads
7
250%
Maintainers
1
Weekly downloads
 
Created
Source

@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

Keywords

string

FAQs

Package last updated on 12 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts