Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>One way to think of a hash is like a human fingerprint (hashes are also sometimes referred to as fingerprints)..</p> <p>You can "compress" any person in to a (pretty much) unique finger-print.. but, you cannot know who someone is by their fingerprint alone.. This is just like a hash, you can easily work out <code>hash("abcdef") -&gt; a1b2c3</code>, but given only <code>a1b2c3</code>, you cannot trivially tell the source data.</p> <p>To reverse a finger print, you need to compare the fingerprint to a database of known <code>people-&gt;finger-prints</code> (if the unknown fingerprint matches Person1, the unknown fingerprint belongs to them)</p> <p>With a hash, again you must do much the same thing - you have a database with all string->hash mappings (called a <a href="http://en.wikipedia.org/wiki/Rainbow_table" rel="nofollow noreferrer">rainbow table</a>). Then you lookup the row with the hash "a1b2c3" and it shows "abcdef" was hashed in order to get this. The other more common way is to simply try every combination of characters, hash them and compare (a <a href="http://en.wikipedia.org/wiki/Brute_force_attack" rel="nofollow noreferrer">brute force attack</a>)</p> <p>Finally, while human fingerprints are "unique", it's possible to have two the same, it's just incredibly unlikely - it's the same with hashing... Some hashing algorithms are more susceptible to <a href="http://en.wikipedia.org/wiki/Hash_collision" rel="nofollow noreferrer">collisions</a> than others.</p> <blockquote> <p>my question is if the hashes are all unique, wouldn't i be able to compress anything into a 40 char string?</p> </blockquote> <p>Theoretically hashing is a great compression method, but to decompress is incredibly impractical beyond (say) 10 ASCII characters of data.. You're right, you can compress anything to a 40 character string, but you cannot decompress it practically (even theoretically is a bit of a stretch..)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload