Skip to content

Instantly share code, notes, and snippets.

@reefwing
Created April 17, 2023 08:16
Show Gist options
  • Save reefwing/6781f8f547a21a7ced7afbd392377ba1 to your computer and use it in GitHub Desktop.
Save reefwing/6781f8f547a21a7ced7afbd392377ba1 to your computer and use it in GitHub Desktop.
unsigned long hash(unsigned char *str) {
unsigned long hash = 5381;
int c;
while (c = *str++)
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
return hash;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment