🔒 Hashing vs Encryption: Why They’re Not the Same


When I started learning about security, I used to think hashing and encryption were basically the same thing—just different names for scrambling data.
Still today, I see people don't have clarity why they’re completely different concepts, and why mixing them up can be a serious security risk.
Sharing a simple breakdown in my own words, plus a few notes I made for myself.
🟢 What is Hashing?
✅ One-way function: When you hash something, you can’t get it back. You take input x and get an output y. There is no way to “unhash” it.
Example: x → [hash] → y || But never: y → [unhash] → x
✅ Deterministic: The same input always hashes to the same output. If you hash “guraaseesIsOG” you’ll get the exact same hash every time.
âś… Fast computation: Hashing functions are designed to be quick to compute.
âś… Avalanche Effect: Even a small change in the input creates a large, unpredictable change in the output.
âś… Collision resistance: Since the hashed output length is finite, in theory you could have different inputs that hash to the same output (called a collision). But a good hash function makes finding such collisions practically impossible.
🟡 What is Encryption?
âś… Two-way function: Encryption is reversible. You can encrypt data and then decrypt it back to the original.
Example: x → [encrypt] → y || y → [decrypt] → x
✅ Purpose: Encryption is about confidentiality—protecting data so only authorized people with the right key can access it.
đź”´ Why This Matters for Security
Many people confuse these two, thinking they can be swapped. But this confusion is actually dangerous.
Example: If you store passwords using encryption instead of hashing, and your decryption key gets stolen, all your passwords are exposed in plain text.
This is why passwords are always hashed (and salted) instead of encrypted. Hashing ensures that even if someone gets access to your database, they can’t reverse the hashes into real passwords.
📝 Quick Recap (How I Remember It)
Hashing: One-way, deterministic, fast, irreversible and storing passwords securely.
Encryption: Two-way, reversible with a key i.e we can retrieve original data later.
Final Thoughts
Understanding this difference helped me clear up a lot of confusion. It also made me appreciate how important it is to learn the fundamentals properly, especially if you want to build secure systems.
If you’re also exploring topics like this, I’d love to connect and exchange insights.
Thanks for reading—more learning notes coming soon.
Subscribe to my newsletter
Read articles from Guraasees Singh Taneja directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Guraasees Singh Taneja
Guraasees Singh Taneja
Hi there! I'm Guraasees Singh, you can call me Aasees ,I'm a passionate developer focused on building applications which solves some problem. Currently exploring Web3 and AI, I love sharing my journey and insights on technology, web development, and the latest trends in Web3 & AI.