Doing proper hashing in a hash table?
A question to those experienced with hash tables.
Suppose I have a hash table of dynamic size (eg, the size is not static).
Now the problem comes with hashing the key and putting it in the table. Since the hash of the key will likely be higher than the current size of my hash table, how do I properly fix that so it can fit inside the current table?
Example:
Say my size of the table is 100 elements.
I take some key, eg "html". I has this, and get some value 0x12345678.
This obviously cannot fit into a table with 100 elements, so I must fix this somehow. I can't just resize the table to that size. That would be ridiculous.
I have a hash function that I took off the web (I am not designing my own, mind you). Most of them, from what I see at least, do not take the size of the table into account.
Wrapping the hash value with the tables size seems like a bad idea since then I can't find the value again if the size of the table increases.
So what is the usual way of doing it?