Coder Social home page Coder Social logo

string-hash's Introduction

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.

string-hash's People

Contributors

bendingbender avatar richienb avatar sindresorhus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

string-hash's Issues

Document relation to @sindresorhus/fnv1a

While looking for a package that generates FNV hashes, I came upon both @sindresorhus/string-hash and @sindresorhus/fnv1a. I got rather confused trying to find a relevant difference between them, so I fully read through both readme files, then finally the source code itself, where it turned out that this package is merely a one-line wrapper around the other one.

I'm not really sure what the rationale behind this is, but maybe you could add a short sentence to the readme files so that later visitors don't get confused in the same way I did.

Re-export?

Why is this module a re-export of @sindresorhus/fnv1a?

I would assume because of the understandable package name.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.