It seems that we don’t take hash collsion into account when we use StringHash. It’s a dummy quesion but StringHash is not 100% collision safe, right?
unsigned StringHash::Calculate(const char* str, unsigned hash)
{
if (!str)
return hash;
while (*str)
{
// Perform the actual hashing as case-insensitive
char c = *str;
hash = SDBMHash(hash, (unsigned char)tolower(c));
++str;
}
return hash;
}
I’m not sure how many places there are having the risk of hash collision of other data types besides String.