IFCCI

Hashing and Cryptography

What Is Hashing Used For?

3 min bacaanPelajaran 8 dari 12
67%

Objektif Pembelajaran

  1. 1Understand the primary purpose of hashing: ensuring data integrity
  2. 2Explain how hashing can verify that data has not been tampered with during transmission
  3. 3Describe how password hashing protects user credentials from being stolen
  4. 4Recognize real-world applications of hashing beyond cryptocurrency

What's the Purpose of Hashing?

The main purpose of hashing is to ensure data integrity—to verify that data hasn't been tampered with.

Every piece of data, when hashed, produces a unique string known as a hash value or digest. This acts like a digital fingerprint. Even the smallest change in the data will create a completely different hash.

This makes hashing incredibly useful when sending data over insecure networks like the internet. By comparing the original hash to the received hash, we can confirm whether the data has been altered during transmission.

A Simple (and Slightly Awkward) Example

Let's say we're about to meet for lunch. Before I leave, I suddenly recall... last time, things were great—but your body odor wasn't.

So I decide to send you a friendly reminder:

Message: "Please wear deodorant."

Before sending it, I run this sentence through the SHA-256 hash function. The result:

33ebb528eab107766343d0ac591952bb68ee959d45b7a8b399628e662f3bc1ef

I send you the hash first, and then the actual message.

When you receive the message, you might think:

"Wait... Did they really send this? Or was the message intercepted and changed on the way?"

To find out, you run the message you received through the same hash function.

If the hash you get matches the one I sent earlier, then:

  • The message hasn't been altered.
  • It's legit (and yes, maybe your armpits need some love).
  • The hash confirms the message's integrity.

Note: In real applications, hashes are typically protected during transmission—but we'll cover that in a later lesson.

Real-Life Use Case: Email Passwords

You may not realize it, but you encounter hashing every day—like when you log into your email.

Most email providers don't store your actual password. Instead, they store a hashed version of it.

Here's how it works:

  1. You create an account and enter your password.
  2. That password is hashed and stored—not the plain text.
  3. When you log in later, your entered password is hashed again.
  4. If the new hash matches the stored one, access is granted.

Why Not Store Actual Passwords?

If companies stored your password in plain text, and a hacker broke into the system, your real password could be stolen—especially dangerous if you use that password on multiple sites.

By storing only the hashed password, even if a hacker accesses the database, all they get are unreadable hashes.

Since hash functions are one-way and irreversible, the hacker can't figure out the original password from the hash alone.

Recap: Why Hashing Matters

  • Verifies data integrity by detecting changes.
  • Protects sensitive info, like passwords.
  • Produces a fixed-length output, no matter the size of the input.
  • Cannot be reversed, keeping your data safe.

Hashing ensures that even if someone gains access to stored information, it's scrambled and useless without the original input.

Poin Utama

  1. 1The main purpose of hashing is to ensure data integrity—verifying that data has not been tampered with by comparing hash values
  2. 2Hashing is used in everyday applications like password storage, where services store hashed versions of passwords rather than plain text
  3. 3If a hacker accesses a database of hashed passwords, they cannot reverse-engineer the original passwords because hashing is a one-way process
  4. 4By comparing the hash of received data with the original hash, you can instantly detect whether the data was altered during transmission

Knowledge Check

1. How does Bitcoin use hashing to maintain blockchain integrity?