简体   繁体   English

搜索快速哈希算法

[英]Searching for a Fast Hash Algorithm

I am searching for a fast hash algorithm. 我正在寻找一种快速哈希算法。 Actually, I am trying to build a hash table whose keys are URL's. 实际上,我正在尝试构建一个键为URL的哈希表。 I have used MD5 to hash the URL's, however it is too slow (I have used java's built in function). 我已经使用MD5来对URL进行散列,但是它太慢了(我已经使用了Java的内置函数)。 Can anybody help me by informing about some fast hash algorithm. 任何人都可以通过告知一些快速哈希算法来帮助我。

Java's String class already implements .hashCode() . Java的String类已经实现了.hashCode() This is likely going to be the fastest, 32bit hash, for Java, as its heavily optimized at the core. 对于Java,这可能是最快的32位哈希,因为它在核心上进行了优化。 This is also the hash in use when using the built-in collections, such as java.util.HashMap . 这也是使用内置集合(例如java.util.HashMap时使用的java.util.HashMap

谷歌开源了一个非常快速的哈希算法: CityHash

MD5 is a cryptographic hash, so it will be slow compared to non-cryptographic hashes. MD5是加密哈希,因此与非加密哈希相比,它的速度较慢。 As Yann says, the Java hash is likely to be fastest if you want a 64 bit hash. 正如Yann所说,如果您想要64位哈希,则Java哈希可能最快。

If that doesn't suit then there are other fast non-cryptographic hashes available in various sizes, such as Fowler–Noll–Vo . 如果那不合适,那么还有其他各种大小的快速非加密哈希,例如Fowler–Noll–Vo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM