Encryption, Hashing
& Encoding
Understand the three pillars of data transformation in cybersecurity: when to use each, how they differ, and why confusing them creates vulnerabilities.
Why Data Transformation Matters
Every time you log in, send a message, or store a password, your data undergoes a transformation. The wrong transformation choice can expose sensitive information or break an application entirely.
What is Encoding?
Encoding transforms data into a different format using a publicly known scheme. It is not a security mechanism: anyone who knows the scheme can reverse it. Its purpose is data compatibility and transport.
What is Hashing?
Hashing is a one-way function that converts any input into a fixed-length digest. It is not reversible: you cannot recover the original data from the hash. Its purpose is integrity verification and password storage.
What is Encryption?
Encryption transforms data into an unreadable format using a key. Unlike hashing, it is reversible: anyone with the correct key can decrypt the data. Its purpose is confidentiality.
The Core Rule of Data Transformation
Key Distinction: Reversibility
Symmetric vs Asymmetric Encryption
Properties of a Secure Hash
How to Choose the Right Technique
Example: Password Storage
A user signs up with password "MyP@ss123". How should the application store this password?
Example: Secure Messaging
Alice wants to send a confidential message to Bob over the internet. Which technique should she use?
Example: File Integrity Verification
You download an installer from the internet. The website provides a SHA-256 checksum. How do you verify the file has not been tampered with?
Why Salting Matters for Hashes
Without a salt, identical passwords produce identical hashes. Attackers use precomputed rainbow tables to look up common hashes. A salt is random data appended to each password before hashing, making every stored hash unique.
Common Mistakes to Avoid
Comparison Summary Table
| Property | Encoding | Encryption | Hashing |
|---|---|---|---|
| Purpose | Data format compatibility | Confidentiality | Integrity / verification |
| Reversible? | Yes, always | Yes, with key | No |
| Key required? | No | Yes | No |
| Output length | Variable | Variable | Fixed |
| Security tool? | ✕ No | ✓ Yes | ✓ Yes |
| Examples | Base64, URL, UTF-8 | AES, RSA, ChaCha20 | SHA-256, bcrypt, Argon2 |
Question 1 of 5
A web application stores user passwords by converting them to Base64. What is the primary security issue with this approach?
Question 2 of 5
Which of the following best describes the avalanche effect in hashing?
Question 3 of 5
Alice needs to send a confidential document to Bob, and Bob must be able to read the original content. Which technique should Alice use?
Question 4 of 5
A company stores password hashes without salting. What specific attack does this make feasible?
Question 5 of 5
You download software and want to verify the file was not corrupted or tampered with during download. The developer provides a SHA-256 checksum. What should you do?