Skip to content

sindresorhus/string-hash

Repository files navigation

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.

FAQ

Why is this just a small wrapper around the fnv1a package?

Answer.

About

Get the hash of a string

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •