开发者

Searching for a Fast Hash Algorithm

开发者 https://www.devze.com 2023-03-23 23:34 出处:网络
I am searching for a fast hash algorithm. Actually, I am trying to build a hash table whose keys are URL\'s. I have used MD5 to hash the U开发者_开发技巧RL\'s, however it is too slow (I have used java

I am searching for a fast hash algorithm. Actually, I am trying to build a hash table whose keys are URL's. I have used MD5 to hash the U开发者_开发技巧RL's, however it is too slow (I have used java's built in function). Can anybody help me by informing about some fast hash algorithm.


Java's String class already implements .hashCode(). This is likely going to be the fastest, 32bit hash, for Java, as its heavily optimized at the core. This is also the hash in use when using the built-in collections, such as java.util.HashMap.


Google open-sourced a very fast hashing algo: CityHash


MD5 is a cryptographic hash, so it will be slow compared to non-cryptographic hashes. As Yann says, the Java hash is likely to be fastest if you want a 64 bit hash.

If that doesn't suit then there are other fast non-cryptographic hashes available in various sizes, such as Fowler–Noll–Vo.

0

精彩评论

暂无评论...
验证码 换一张
取 消