MD5 在加密散列函数中应该是最快的。但是任何给定的实现都可能做出在特定机器上意味着次优性能的选择。你使用什么样的硬件?处理器类型和 L1 缓存大小非常重要。
您可能想看看sphlib:这是一个在 C(优化但可移植)和 Java 中实现许多加密哈希函数的库。C 代码可以使用额外的“占用空间小”标志编译,这有助于小型嵌入式平台(主要是由于 L1 缓存大小问题)。此外,该代码还带有一个类似 md5sum 的命令行实用程序和一个速度基准测试工具。
在哈希函数中,MD4 通常是最快的,但在某些平台上,Panama、Radiogatun[32] 和 Radiogatun[64] 可以达到相似或更好的性能。您可能还想查看一些 SHA-3 候选,尤其是 Shabal,它在小型 32 位系统上相当快。
Important note: some hash functions are "broken", in that it is possible to create collisions: two distinct input files, which hash to the same value (exactly what you want to avoid). MD4 and MD5 are thus "broken". However, a collision must be done on purpose; you will not hit one out of (bad) luck (probabilities are smaller than having a "collision" due to a hardware error during the computation). If you are in a security-related situation (someone may want to actively provoke a collision) then things are more difficult. Among those I cite, the Radiogatun and Shabal functions are currently unbroken.