Are hash fragments resistant to collisions?

If you use only the first 4 bytes of the MD5 hash, will this theoretically mean only 1 out of 2554 chance of collision? That is, hashes are designed in such a way that you only need to use a small portion of the returned hash (say, the hash has a file of some size)?

+3
source share
5 answers

Remember that without even looking at a smart attacker intentionally trying to cause collisions, you need to start worrying about random collisions as soon as the number of objects you have hash is comparable to the square root of the hash space ... just a few tens of thousands of objects for 32- bit hash key. This comes from the so-called birthday of the paradox .

+6
source

This is 256, not 255.

, MD5 - (, , , , , ), , , , "" , .

. , 32 , 1 2 ^ 32 (.. 1 256 ^ 4).

, , , 2 ^ 16 , 2 ^ 16 .

MD5, , - , , . SHA-2 ( 224, 256, 384 512 ). () SHA-3. ; 2012 . ( 14 51) , SHA-2, MD5 , . , SHA-2 .

+2

, 1. hash1 = md5 (message1)

2 hash2 = md5 (message2).

1/255 ^ 4, 2 1.

, message1, 2, . . MD5 , .

MD5 . , ( ) ( ). , . . .

+1

, UUID. , .

, , , 255 , . :

fdadda221fd71619e6c0139730b012577dd4de90

fdadda221fd71619e6c/0139730b012577dd4de90

fdad/da22/1fd7/1619/e6c0/1397/30b0/1257/7dd4/de90
+1

.

Hash functions for use in hash tables tend to have more β€œrandomness” in the lower bits (which are used to find the index of the array) than in higher bits. The checksum and cryptographic hash functions are distributed more evenly.

0
source

Source: https://habr.com/ru/post/1743598/


All Articles