@sindresorhus/string-hash
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

string-hash

Get the hash of a string

Uses the non-cryptographic hash function FNV-1a.

Similar to Java's String#hashCode().

Install

$ npm install @sindresorhus/string-hash

Usage

import stringHash from '@sindresorhus/string-hash';

stringHash('🦄🌈');
//=> 2868248295

stringHash('👌😎');
//=> 2903279002

It returns the hash as a positive integer.

Package Sidebar

Install

npm i @sindresorhus/string-hash

Weekly Downloads

4,254

Version

2.0.0

License

MIT

Unpacked Size

2.84 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus