node package manager

@sindresorhus/string-hash

string-hash Build Status

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

const stringHash = require('@sindresorhus/string-hash');
 
stringHash('🦄🌈');
//=> 582881315
 
stringHash('👌😎');
//=> 879086135

It returns a positive integer.

License

MIT © Sindre Sorhus