Spore:HashVal
From SimsWiki
copied from: http://www.customsims3.com/forum1/YaBB.pl?num=1214408105
The following was originally written by Jongware.
This "C" routine will calculate the hash for a Spore item. In my version, the strcpy() and temporary buffer exist to avoid modifying the original string when converting to lower case with _strlwr(). If the original need not be saved, this could be further optimized.
unsigned long TheHash(char *strptr) {
char oname[STRMAX];
unsigned int hash;
char *p;
strcpy(&oname[0], strptr);
_strlwr(&oname[0]);
hash = 0x811C9DC5;
p=&oname[0];
while(*p) {
hash *= 0x1000193;
hash ^= (*p);
p++;
}
return(hash);
}