creating a hash code form a string in c++
I have a very long string that I need to compare for equality. Since
comparing them char by char is very time consuming, I like to create a
hash for the string.
I like the generated hash code be unique ( or the chance that two string
with the same hash generated, be very small). I think creating an int from
a string as hash is not strong enough to eliminate of having two different
string with the same hash code, so I am looking for a string hash code.
Am I right that the above assumption?
To clarify, assume that I have a string of say 1K length and I create a
hash code of 10 char, then comparison hash codes speed up by 100 times.
The question that I have is how to create such hash code in c++?
I am developing on windows using visual studio 2012.
No comments:
Post a Comment