Hash function implementation

Hi,
I was trying to implement a hash function in c++. This is just for learning purposes and not for a class project or assignment question.

I had some questions before I started programming it:
1) Is it meaningful to have a hash function which maps string to string, string to int, int to int, float to int?
2) Can we have a template implementation which does element to element hashing?

I looked at several sources for a clear understanding of concepts and implementation technique but could not find a good source for reading about hashing. Can someone point me to one?

Thanks in advance for any help.
Are you trying to hash objects or are you trying to make a hash map? It's confusing because your questions are related to hash maps but your topic title is related to hashing objects.
@L B: I am trying to implement hash table for doing hash based look up.It sounds more like hash map to me, I am not sure what a hash object is :(

I also want to deal with collision occurrence by implementing bucketing or chaining technique.
funprogrammer wrote:
I am not sure what a hash object is
I didn't say "a hash object", I said "to hash objects".

A hash map is also known as a hash table, maybe a difference exists in some cases but most I have seen have been pretty much the same. AFAIK only Java makes them different by having a different class for a has table and a hash map.
Last edited on
Topic archived. No new replies allowed.