Skip to content

Instantly share code, notes, and snippets.

View florianfrey1's full-sized avatar
Creating amazing stuff!

Florian Frey florianfrey1

Creating amazing stuff!
  • Viastore Software GmbH
  • Stuttgart
View GitHub Profile
@iperelivskiy
iperelivskiy / hash.js
Created November 19, 2012 14:39
JS simple hash function
var hash = function(s) {
/* Simple hash function. */
var a = 1, c = 0, h, o;
if (s) {
a = 0;
/*jshint plusplus:false bitwise:false*/
for (h = s.length - 1; h >= 0; h--) {
o = s.charCodeAt(h);
a = (a<<6&268435455) + o + (o<<14);
c = a & 266338304;