View Single Post
Sitat av Sussex Vis innlegg
Du skriver "Filene man deler blir hashet," hva betyr dette?
Vis hele sitatet...
Fra google:

A hash is much smaller than a typical file. It contains less information. Two different files can result in the same hash (this is an inevitable consequence of the hash being smaller). Therefore you cannot recover the file from the hash.

To loosely illustrate the principle, here is a list of numbers:

25 376 21 498 475 320 5 823

This is our “file”. To generate our “hash”, we will add them all up and take the remainder when divided by 11, and the remainder when divided by 19.

Hash = 2 16

Now there are 11×19 = 209 possible hash values using this method. But the number of possible files is infinite, as they can be any length.

Pick any other random set of numbers, and there's something like a 1 in 209 chance that will have the same hash as the “file” above. For example:

28 386 36 294 575 375 8 632

Hash = 2 16

So given our hash, we can't tell which of these two “files” (or any of the other infinite possible files) it was generated from. When two different inputs generate the same hash, this is called a hash collision.

Now obviously in real life hashes are much bigger (typically at least16 bytes, allowing over 340 billion billion billion billion values), but that's still tiny compared to a modest text file (a few thousand bytes), a Word doc (hundreds of thousands of bytes) or a Jpeg image (3+ million bytes).