问题描述
我的理解是哈希码和校验和是相似的东西 - 一个数值,是为一块数据计算的,它是相对唯一的。即产生相同数字哈希/校验和值的两个数据块的概率足够低,以至于应用程序可以忽略它。
那么我们有两个或者在哈希码和校验和之间有重要的区别? 我会说a 必然 a 。但是,并不是所有的hashcode都会产生很好的校验和。
校验和有一个特殊的用途 - 校验或检查数据的完整性(某些可以通过允许来超越这一点)。 良好的校验和很容易计算,并且可以检测到许多类型的数据损坏(例如一个,两个,三个错误位)。
哈希码简单地描述了一个将数据映射到某个值。当用作数据结构索引的方法(例如散列表)时,低碰撞概率是可取的。
My understanding is that a hash code and checksum are similar things - a numeric value, computed for a block of data, that is relatively unique.
i.e. The probability of two blocks of data yielding the same numeric hash/checksum value is low enough that it can be ignored for the purposes of the application.
So do we have two words for the same thing, or are there important differences between hash codes and checksums?
I would say that a checksum is necessarily a hashcode. However, not all hashcodes make good checksums.
A checksum has a special purpose --- it verifies or checks the integrity of data (some can go beyond that by allowing for error-correction). "Good" checksums are easy to compute, and can detect many types of data corruptions (e.g. one, two, three erroneous bits).
A hashcode simply describes a mathematical function that maps data to some value. When used as a means of indexing in data structures (e.g. a hash table), a low collision probability is desirable.
这篇关于哈希码和校验和 - 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!