What is the best 32bit hash function for short strings (tag names)?

前端 未结 8 1462
傲寒
傲寒 2020-12-12 16:43

What is the best 32bit hash function for relatively short strings?

Strings are tag names that consist of English letters, numbers, spaces and some additional charact

8条回答
  •  旧时难觅i
    2020-12-12 16:49

    If performance isn't important, simply take a secure hash such as MD5 or SHA1, and truncate its output to 32 bits. This will give you a distribution of hash codes that's indistinguishable from random.

提交回复
热议问题