32-bit checksum algorithm better quality than CRC32?

£可爱£侵袭症+ 提交于 2020-02-02 03:05:10

问题


Are there any 32-bit checksum algorithm with either:

  • Smaller hash collision probability for input data sizes < 1 KB ?
  • Collision hits with more uniform distribution.

These relative to CRC32. I'm practically not counting on first property, because of limitation of storage space of 32 bits. But for the second ... seems there could be improvements.

Any ideas ? Thanks. (I need concrete implementation, better in C, but C++/ C# or anything to start with is also OK).


回答1:


How about MurmurHash? It is said, that this hash has good distribution (passes chi-square tests) and good avalanche effect. Also very good computing speed.




回答2:


Not for the first criteria. Any well designed hash function with a 32 bit output has a 1 in 2^32 chance of a collision for any pair of inputs. The second criteria is not very well defined, although there are surely some statistical tests that could be used, and I'm sure someone has done it (chi-square for collision intervals?). As for needing an implementation, I strongly recommend that you not accept any proposed code for a hash function that is not an implementation of a well known hash, as there is a high risk of security problems or poor performance when rolling your own hash or encryption. A well known but bad hash function is better than one you designed yourself, even if the latter one tests well and has a 'good' collision distribution, simply because the former has more eyeballs on it.



来源:https://stackoverflow.com/questions/8397438/32-bit-checksum-algorithm-better-quality-than-crc32

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!