稳健和快速的校验算法?稳健、算法、快速

2023-09-11 01:54:24 作者:阿弥陀佛、湿主贫僧得罪了

这校验算法,可以在如下的用例建议?

Which checksum algorithm can you recommend in the following use case?

我要生成的小JPEG文件校验(〜每个8 KB),以检查的内容发生变化。用文件系统的的修改日期的是不幸的是没有一个选项。 校验的不需要是保密性强,但它应该稳健地表明任何规模的变化。

I want to generate checksums of small JPEG files (~8 kB each) to check if the content changed. Using the filesystem's date modified is unfortunately not an option. The checksum need not be cryptographically strong but it should robustly indicate changes of any size.

第二个标准是速度,因为它应该能够处理至少数百的每秒图像(在现代的CPU)。

The second criterion is speed since it should be possible to process at least hundreds of images per second (on a modern CPU).

计算将与多个客户做了服务器上。客户端发送了千兆TCP图像到服务器。因此,有否磁盘I / O 作为瓶颈。

The calculation will be done on a server with several clients. The clients send the images over Gigabit TCP to the server. So there's no disk I/O as bottleneck.

推荐答案

如果你有许多小文件,你的瓶颈将是文件I / O和可能不是一个校验和算法。

If you have many small files, your bottleneck is going to be file I/O and probably not a checksum algorithm.

的散列函数(可以看作是一个校验)的名单可以在这里找到 。

A list of hash functions (which can be thought of as a checksum) can be found here.

有没有什么原因,你不能使用修改文件系统的日期,以确定文件是否已经改变?这可能会更快。

Is there any reason you can't use the filesystem's date modified to determine if a file has changed? That would probably be faster.