/** * hashfun.c * An implementation of hash functions, based on code from K&R 2nd, p. 144. */ // +---------+-------------------------------------------------------- // | Headers | // +---------+ #include "hashfun.h" // +-----------+------------------------------------------------------ // | Functions | // +-----------+ /** * Determine the hash value for a string. */ unsigned hash (char *str) { unsigned hashval; for (hashval = 0; *str != '\0'; str++) hashval = *str + 31 * hashval; return hashval; } // hash