So far, in earlier lessons, you’ve learned what hashing is and how hashing works.

But in order to truly understand just what these specialized programs do, it’s helpful to see actual examples in action!

See how hashing works!

Let’s see how the hashing process works using an actual hash function.

Since SHA-256 is the chosen hash function of Bitcoin, let’s use it for our example.

This is our first example input:

BabyPips.com is cool as ice.

When put through the SHA-256 hash function, this sentence creates the following hash value, also known as a “digest” or simply as a “hash”:

A58E12FAC905B8F84EA2F64F888191A4B66A67CC45F8E7B7B0F94C37A134CB57

You can see that the digest is a combination of letters and numbers. And it is exactly 64 characters in length.

Aside from that, there’s really not much else you can learn from looking at this digest. There are no patterns or clues as to what the input is. It just looks like a bunch of gibberish.

The output may seem random. But there’s no way you could guess the input just by looking at the output.

If you run the input through the SHA-256 hash function again, you will get the exact same output (“hash”) again.

The same input will ALWAYS produce the same output.

Now, let’s make one subtle change to the first example’s input and see what happens:

BabyPips.com is cool as lice.

Notice that the letter “l” has been added to the beginning of the word “ice” to spell “lice”. have been

Here’s the new digest:

B8784EAEB1FC50719B2041FB1AEE30FF91516529CCB65B4B446CC4D5F6B4EB95

Now let’s compare the two:

Input Digest
BabyPips.com is cool as ice. A58E12FAC905B8F84EA2F64F888191A4B66A67CC45F8E7B7B0F94C37A134CB57
BabyPips.com is cool as lice. B8784EAEB1FC50719B2041FB1AEE30FF91516529CCB65B4B446CC4D5F6B4EB95

You can see that this is a radically different result from the first digest!

Even though the inputs were practically identical, changing a single character generated a completely different output.

Lice is so cool

Lice are pretty disgusting so let’s make one more change to the input:

BabyPips.com is cool as rice.

Now let’s see what happens:

FCA7032BE8CF7F3C0DD75B8DEB77412E452EA5E2275BAA4125123CD639ED2C9A

A totally different input once again!

Now let’s compare all three:

Input Digest
BabyPips.com is cool as ice. A58E12FAC905B8F84EA2F64F888191A4B66A67CC45F8E7B7B0F94C37A134CB57
BabyPips.com is cool as lice. B8784EAEB1FC50719B2041FB1AEE30FF91516529CCB65B4B446CC4D5F6B4EB95
BabyPips.com is cool as rice. FCA7032BE8CF7F3C0DD75B8DEB77412E452EA5E2275BAA4125123CD639ED2C9A

It’s worth emphasizing that literally any input can be put into a hash function.

Regardless of the length of the input, the output will always be the same fixed length and it will always appear completely random.

Play around with this tool to see for yourself:

Try making one tiny change to what you type in and notice how vastly different the hash is.

Isn’t that neat?! 🤓

Congratulations! You’ve created your own hashes! 👏