• This repository has been archived on 17/Jul/2020
  • Stars
    star
    309
  • Rank 135,306 (Top 3 %)
  • Language
    JavaScript
  • Created about 12 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fast string hashing function for Node.JS.

string-hash

A fast string hashing function for Node.JS. The particular algorithm is quite similar to djb2, by Dan Bernstein and available here. Differences include iterating over the string backwards (as that is faster in JavaScript) and using the XOR operator instead of the addition operator (as described at that page and because it obviates the need for modular arithmetic in JavaScript).

The hashing function returns a number between 0 and 4294967295 (inclusive).

Thanks to cscott for reminding us how integers work in JavaScript.

Example

npm install string-hash or yarn add string-hash, then:

const stringHash = require("string-hash");
console.log(stringHash("foo")); // prints "193420387"

Note that the return value is always an unsigned, 32-bit integer.

License

To the extend possible by law, The Dark Sky Company, LLC has waived all copyright and related or neighboring rights to this library.

More Repositories

1

skycons

JavaScript
1,249
star
2

delaunay-fast

Fast Delaunay Triangulation in JavaScript.
JavaScript
778
star
3

forecast-ruby

Ruby gem for retrieving data from the Forecast Weather API.
Ruby
240
star
4

tz-lookup-oss

JavaScript Library for Timezone Lookup by Location
JavaScript
208
star
5

translations

translate Dark Sky API summaries into any language
JavaScript
139
star
6

sphere-knn

Find the k nearest neighbors for points on a sphere.
JavaScript
121
star
7

binary-search

Tiny binary search library for Node.JS.
JavaScript
85
star
8

pngparse

100%-JavaScript PNG Parser for Node.JS
JavaScript
78
star
9

darksky-ruby

Ruby gem for retrieving data from the Dark Sky API
Ruby
48
star
10

astro

JavaScript
30
star
11

delaunay

Delaunay triangulation in arbitrary dimensions.
JavaScript
23
star
12

inhabited

quickly determine if a lat/lon may be inhabited or not
JavaScript
18
star
13

node-sarra

consume data from Environment and Climate Change Canada
JavaScript
13
star
14

metaregexp

A simple way to keep long regexes organized.
JavaScript
9
star
15

lowres-rgeo

low resolution reverse geocoder for Node.JS
JavaScript
9
star
16

elevation

Finds the elevation of a lat/lon with low-to-moderate resolution
JavaScript
7
star
17

pbj

tiny, stupid bitmap image format
JavaScript
6
star
18

cache

An in-memory, promise-backed cache
JavaScript
5
star
19

bounding

calculate bounding areas of points
JavaScript
4
star
20

zqueue

A little redis-backed queue dingus.
JavaScript
4
star
21

cache-helpers

Caching helper functions for Node.JS.
JavaScript
4
star
22

regression

A tiny Javascript toolkit for regression analysis.
JavaScript
4
star
23

shape

spherical geometry library
JavaScript
1
star