/Hashing vs Encryption

Security
Hashing vs Encryption

Hashing and encryption both change data, but they solve different problems. The key difference is whether the original data can be recovered.

Hashing makes a one-way fingerprint

A hash function turns input into a fixed-length result called a hash. A good cryptographic hash is designed so you cannot work backwards to get the original input.

Example: a website should not need to read your password after you create it. It can store a protected password hash. At login, it hashes the password you typed and checks whether the result matches.

Password storage needs special protection. Apps should use a password-hashing tool such as Argon2id or bcrypt, with a unique salt and safe settings. A fast general-purpose hash alone is not enough.

Encryption can be reversed with a key

Encryption changes readable data into protected data. Someone with the correct key can decrypt it and read the original. For example, an app may encrypt a private file while it is stored.

Use the right tool

  • Use password hashing when the app only needs to check a password.
  • Use encryption when the app must later recover the original data.

Think of hashing as making a fingerprint you compare later. Encryption is like locking a letter in a box that can be opened with a key.

© 2026 Arif Islam. All rights reserved.
hello@arifislam.me