How can a sdbm
hash function (such as this) be implemented in C# ?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
The result from the hash differs between the C++ and C# implementation. I figured out that str parameter needs to be passed as a byte array.
Call the method by converting the value to be hashed with the BitConverter.GetBytes method.
I don't have a C compiler set up so I can't test to see if it performs the same, but I think the following is correct:
If you just need to get a hash of the string and it doesn't matter too much what the implementation is you can always do theString.GetHashCode();
You can take the C code almost without changes:
Or did you think of something more sophisticated?