If not much bother, in the book of Kernighan and Pike's "Practice of programming" is a fairly simple algorithm:

enum { MULTIPLIER = 31 };

/* hash: compute

the hash function of the string */

unsigned int hash(char *str)

{

unsigned int h;

unsigned char *p;

h = 0;

for (p = (unsigned char *)

str; *p != '\\0'; p++)

h = MULTIPLIER * h +

*p; return h % table nhash; }