Help for this page

Select Code to Download


  1. or download this
    unsigned int hash = 0;
    while (*s)  /* s is pointer to string */
        hash = hash * 33 + *s++;
    return hash;
    
  2. or download this
    /* hash a key */
    /* FYI: This is the "One-at-a-Time" algorithm by Bob Jenkins
    ...
            hash_PeRlHaSh ^= (hash_PeRlHaSh >> 11); \
            (hash) = (hash_PeRlHaSh + (hash_PeRlHaSh << 15)); \
        } STMT_END