IFCCI

Hashing and Cryptography

Examples of Hashing

2 分钟阅读第 7 课,共 12 课
58%

学习目标

  1. 1See SHA-256 hashing demonstrated with real-world examples
  2. 2Observe how even a single-letter change in input produces a completely different hash output
  3. 3Reinforce understanding of hashing properties: sensitivity, fixed length, irreversibility, and tamper detection
  4. 4Learn how to experiment with hashing using online SHA-256 generators

Now Let's See Hashing in Action

So far, you've learned what hashing is and how it works. Now it's time to bring it to life with some real examples.

Let's take a look at how the SHA-256 hash function—used by Bitcoin—works in practice.

Example 1: Original Input

Let's start with this sentence:

"IFCCI.com is cool as ice."

When we pass this through the SHA-256 hash function, we get the following hash (also called a "digest"):

A58E12FAC905B8F84EA2F64F888191A4B66A67CC45F8E7B7B0F94C37A134CB57

As you can see, the result is a 64-character combination of numbers and letters.

At first glance, it just looks like random gibberish. But that's the point! The hash tells you nothing about the original input—it's designed to conceal it.

And here's the cool part:

The same input will always produce the same hash.

Example 2: Small Change, Big Difference

Now, let's make a tiny change to the original sentence.

We'll change the word "ice" to "lice":

"IFCCI.com is cool as lice."

And here's the new hash:

B8784EAEB1FC50719B2041FB1AEE30FF91516529CCB65B4B446CC4D5F6B4EB95

Even though only one letter changed, the new hash is completely different from the original one.

InputHash (SHA-256)
IFCCI.com is cool as ice.A58E12FAC905B8F84EA2F64F888191A4B66A67CC45F8E7B7B0F94C37A134CB57
IFCCI.com is cool as lice.B8784EAEB1FC50719B2041FB1AEE30FF91516529CCB65B4B446CC4D5F6B4EB95

Example 3: Another Small Change

Let's swap "lice" for "rice":

"IFCCI.com is cool as rice."

The new hash:

FCA7032BE8CF7F3C0DD75B8DEB77412E452EA5E2275BAA4125123CD639ED2C9A

Once again, a tiny change leads to a completely different hash.

InputHash (SHA-256)
IFCCI.com is cool as ice.A58E12FAC905B8F84EA2F64F888191A4B66A67CC45F8E7B7B0F94C37A134CB57
IFCCI.com is cool as lice.B8784EAEB1FC50719B2041FB1AEE30FF91516529CCB65B4B446CC4D5F6B4EB95
IFCCI.com is cool as rice.FCA7032BE8CF7F3C0DD75B8DEB77412E452EA5E2275BAA4125123CD639ED2C9A

Key Takeaways

  • Hashing is sensitive: Even a minor change in input produces a totally different hash.
  • Fixed output length: No matter the size of the input, the SHA-256 hash is always 64 characters long.
  • Irreversible: You can't figure out the original message from the hash.
  • Tamper detection: Any changes to input will be instantly detectable thanks to the changed hash.

This is why hashing is so useful in cryptocurrency. It helps detect tampering and ensures data integrity.

Try It Yourself!

Want to see hashing in action? Try using a SHA-256 hash generator online. Type in any message and see what hash you get. Then, make just a tiny change—add a letter, punctuation, or space—and watch how the entire hash changes.

Give it a try and see how powerful hashing really is!

核心要点

  1. 1SHA-256 always produces a 64-character hash output regardless of the input, and the same input always produces the exact same hash
  2. 2Changing even a single letter in the input (e.g., "ice" to "lice") produces a completely different and unrelated hash output
  3. 3Hashing is irreversible—looking at a hash reveals nothing about the original input data
  4. 4These properties make hashing essential for cryptocurrency security: it detects any tampering and ensures data integrity

Knowledge Check

1. Which of the following is a common real-world application of hashing?