
Incomputer science, ahash collision orhash clash[1] is when two distinct pieces of data in ahash table share the same hash value. The hash value in this case is derived from ahash function which takes a data input and returns a fixed length of bits.[2]
Although hash algorithms, especially cryptographic hash algorithms, have been created with the intent of beingcollision resistant, they can still sometimes map different data to the same hash (by virtue of thepigeonhole principle). Malicious users can take advantage of this to mimic, access, or alter data.[3]
Due to the possible negative applications of hash collisions indata management andcomputer security (in particular,cryptographic hash functions), collision avoidance has become an important topic in computer security.
Hash collisions can be unavoidable depending on the number of objects in a set and whether or not the bit string they are mapped to is long enough in length. When there is a set of objects, if is greater than, which in this case is the set of the hash values, a hash collision is guaranteed to occur.[4]
Another reason hash collisions are likely at some point in time stems from the idea of thebirthday paradox in mathematics. This problem looks at the probability of a set of two randomly chosen people having the same birthday out of number of people.[5] This idea has led to what has been called thebirthday attack. The premise of this attack is that it is difficult to find a birthday that specifically matches your birthday or a specific birthday, but the probability of finding a set ofany two people with matching birthdays increases the probability greatly. Bad actors can use this approach to make it simpler for them to find hash values that collide with any other hash value – rather than searching for a specific value.[6]
The impact of collisions depends on the application. When hash functions and fingerprints are used to identify similar data, such ashomologousDNA sequences or similar audio files, the functions are designed so as tomaximize the probability of collision between distinct but similar data, using techniques likelocality-sensitive hashing.[7]Checksums, on the other hand, are designed to minimize the probability of collisions between similar inputs, without regard for collisions between very different inputs.[8] Instances where bad actors attempt to create or find hash collisions are known ascollision attacks.[9]
In practice, security-related applications use cryptographic hash algorithms, which are designed to be long enough for random matches to be unlikely, fast enough that they can be used anywhere, and safe enough that it would be extremely hard to find collisions.[8]
In hash tables, since hash collisions are inevitable, hash tables have mechanisms of dealing with them, known as collision resolutions. Two of the most common strategies areopen addressing andseparate chaining. The cache-conscious collision resolution is another strategy that has been discussed in the past for string hash tables.

Cells in the hash table are assigned one of three states in this method – occupied, empty, or deleted. If a hash collision occurs, the table will be probed to move the record to an alternate cell that is stated as empty. There are different types of probing that take place when a hash collision happens and this method is implemented. Some types of probing arelinear probing,double hashing, andquadratic probing.[10] Open Addressing is also known as closed hashing.[11]
This strategy allows more than one record to be "chained" to the cells of a hash table. If two records are being directed to the same cell, both would go into that cell as a linked list. This efficiently prevents a hash collision from occurring since records with the same hash values can go into the same cell, but it has its disadvantages. Keeping track of so many lists is difficult and can cause whatever tool that is being used to become very slow.[10] Separate chaining is also known as open hashing.[12]
Although much less used than the previous two,Askitis & Zobel (2005) has proposed thecache-conscious collision resolution method in 2005.[13] It is a similar idea to the separate chaining methods, although it does not technically involve the chained lists. In this case, instead of chained lists, the hash values are represented in a contiguous list of items. This is better suited for string hash tables and the use for numeric values is still unknown.[10]
{{citation}}: CS1 maint: work parameter with ISBN (link)Much more than encryption algorithms, one-way hash functions are the workhorses of modern cryptography.
{{citation}}: CS1 maint: work parameter with ISBN (link)