Content to Hash

Resulting Hash

Q&A
Why do we need to know this?
This demo of a hash, shows how a lot of data can be stored in a smaller string, and how each change in the text will result in a completely unique hash being generated, and that this is a one-way example. That is: if I know the Input, I can generate the Hash. If I know the Hash, I cant figure out the Input.
This is how transactions are identified.
For example:

AAA hashes to: cb1ad2119d8fafb69566510ee712661f9f14b83385006ef92aec47f523a38358
but
AAAA hashes to: 63c1dd951ffedf6f7fd968ad4efa39b8ed584f162f46e715114ee184f8de9201


Notice that the resulting hashes are completely unique, and dont look like they follow a pattern?
If someone knows the hash, there is no way to guess the content of the original string.
Additionally, if someone wanted to reproduce a specific hash, one that starts with: 12345 for example,
there would have to be a lot of guesses for the original text, in order to match the hash pattern.
This is the main principle in bitcoin mining, supporting the "Proof of Work" strategy for validating blockchain transactions.


Wait just a minute - you mean that any amount of text can be crunched into a hash?!
Yep.

Ok well I wasnt born yesterday, surely at some point the hashed result will equal to another hash, after all, there is only a finite number of characters that can be put into a string thats only 32 characters long.
So this is true, this would result in a collision - different inputs create the same output. Theoretically this would happen once every combination of letters and numbers are exhausted in the resulting hash.
Consider that the hash is 64 characters long, in Hexadecimal format: 16 options (0-9 and a-f) for each place in the string.
Applying some simple combinatoric math, this shows that we have 16^64 different combinations available as hash results.
This is a really big freakin number: 1.157920892373162e+77
Its hard to imagine this, but for reference, the number of cells in the human body are about 10^14.
So - YES, a collision is possible, but relatively improbable.