Is it possible to have a perfect hash function from strings to integers, when the number of elements to be hashed is known? By perfect hash function I mean that there is no chance of collision.
Basically I am reading the signatures of multiple tables from a file (e.g. id, name, address). Different tables might have common attributes (e.g. name), but on different positions (i.e. columns). I would like to be able to ask something like: what is table1["name"]? or table2["name"].
UPDATE: I would prefer learning to do it myself than using something already out there.