unsigned int hash = 0; while (*s) /* s is pointer to string */ hash = hash * 33 + *s++; return hash;