The readme on the fnv hash page lists an example usage:
//For example to perform a 64 bit FNV-1 hash:
#include "fnv.h"
Fnv64_t hash_val;
hash_val = fnv_64_str("a string", FNV1_64_INIT);
hash_val = fnv_64_str("more string", hash_val);
// Produces the same final hash value as:
hash_val = fnv_64_str("a stringmore string", FNV1_64_INIT);
...
I have not encountered anything that explains why you would send the previous hash value to calculate the next.
I'm not familiar with the specifics of the FNV hash, but looking at the code you quoted, here's what Ithink is going on:
In your example code, the fnv_64_str function takes two parameters; first, the string to hash, and second, an initialization value. This appears to be representative of the internal state of the FNV hash function, which also the result that is returned from the hash.
The first call to fnv_64_str starts with an internal hash value of FNV1_64_INIT , which you can consider a sort of "null hash"--I would expect this value to be returned if you tried to hash the empty string ( "" ). Then for each character in the string to be hashed, it updates the internal hash value, until it reaches the end of the string, then it returns the internal hash value.
So the two-line example is just a way to show you can "interrupt" the hash and finish it later. This might be useful, for example, if you're hashing some sort of input stream as it comes across a network connection, and you only get a little bit at a time.How would I, once I have the hashed an element (say by a string) of my linked list, find an element based off of that string once it is already placed in the table.
Remember that your hash table is an associative array , using hash values as keys, and objects (or more likely pointers to objects) as values.
To get the object again, hash the string and look up its hash value in the table--the value associated with the string's hash should be the object you're looking for.