Skip to content

Instantly share code, notes, and snippets.

@Corgan
Created August 29, 2011 03:12
Show Gist options
  • Save Corgan/1177706 to your computer and use it in GitHub Desktop.
Save Corgan/1177706 to your computer and use it in GitHub Desktop.
unsigned long HashString(const char *pName)
{
const char* pStr = 0;
unsigned long hash = 0;
unsigned long temp = 0;
for(pStr = pName; *pStr; ++pStr)
{
hash = (hash << 4) + tolower(*pStr);
if (0 != (temp = hash & 0xf0000000))
{
hash = hash ^ (temp >> 24);
hash = hash ^ temp;
}
}
return hash;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment