Not supporting the newfag. just pointing out the fact that it could easily be done.
hash from string
djb2
unsigned long hashstring(unsigned char *str)
{
unsigned long hash = 5381;
int c;
while (c = *str++)
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
return hash;
}
super easy. I use this exact code in one of my programs.
Not supporting the newfag. just pointing out the fact that it could easily be done.
hash from string
**djb2**
```
unsigned long hashstring(unsigned char *str)
{
unsigned long hash = 5381;
int c;
while (c = *str++)
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
return hash;
}
```
super easy. I use this exact code in one of my programs.
(post is archived)