A fast hash function for string in C#

后端 未结 4 1472
后悔当初
后悔当初 2020-12-02 21:03

I want to hash a string of length up-to 30. What will be the best idea to do that if time is my concern. The function will be called over 100 million times. currently I am u

4条回答
  •  爱一瞬间的悲伤
    2020-12-02 21:29

    static UInt64 CalculateHash(string read)
    {
        UInt64 hashedValue = 3074457345618258791ul;
        for(int i=0; i

    This is a Knuth hash. You can also use Jenkins.

提交回复
热议问题