function hash(s) {
    var h = 0, i, c;

    var l = s.length;
    if (l === 0)
        return (h);
    for (i = 0; i < l; i++) {
        c = s.charCodeAt(i);
        h = ((h << 5) - h) + c;
        h |= 0; // Convert to 32bit integer
    }
    return (Math.abs(h));
}
function hash(s) {
    var h = 0, i, c;

    var l = s.length;
    if (l === 0)
        return (h);
    for (i = 0; i < l; i++) {
        c = s.charCodeAt(i);
        h = ((h << 5) - h) + c;
        h |= 0; 
    }
    return (Math.abs(h));
}
function hash ( s ) { var h = 0 , i , c ; var l = s . length ; if ( l === 0 ) return ( h ) ; for ( i = 0 ; i < l ; i ++ ) { c = s . charCodeAt ( i ) ; h = ( ( h << 5 ) - h ) + c ; h |= 0 ; // Convert to 32bit integer } return ( Math . abs ( h ) ) ; }
based on http://stackoverflow.com/a/7616484
based on http : // stackoverflow . com / a / 7616484