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

Package detail

djb2a

sindresorhus429.2kMIT2.0.0TypeScript support: included

DJB2a non-cryptographic hash function

djb2a, djb2, djb, algorithm, hash, hashing, string, function, bernstein

readme

djb2a

DJB2a non-cryptographic hash function

DJB2a has good distribution and collisions are rare.

Install

$ npm install djb2a

Usage

import djb2a from 'djb2a';

djb2a('🦄🌈');
//=> 1484783307

It returns the hash as a positive integer.

  • fnv1a - FNV-1a non-cryptographic hash function
  • sdbm - SDBM non-cryptographic hash function