Table of Contents
The Three Pillars of Digital Trust: Encoding, Hashing, and Encryption
Author

Date

Book a call
In today’s digital economy, trust is the real currency. Every application we build — whether it’s a consumer app, an enterprise workflow, or an internet-scale platform — depends on how we handle data. Yet even among seasoned engineers, there’s persistent confusion between encoding, hashing, and encryption.
As someone who has led architecture reviews across large-scale systems, I’ve seen this confusion surface everywhere: in design documents, security audits, and even senior-level interviews. A simple misstatement like “we encrypt passwords using bcrypt” isn’t just a slip of terminology — it signals a gap that can cascade into design flaws, compliance failures, and security vulnerabilities.
What is Encoding?
Encoding transforms data into a format that's safe to transmit or store — especially across systems that expect text, not raw binary.
Why Do We Encode?
Key Traits:
- Reversible: Anyone can decode it — no secrets involved
- Not secure: Base64 is not protection; it’s just translation
- Used for compatibility: Across systems, platforms, and protocols
Purpose: Format compatibility, not confidentiality
Code Example
Base64 inflates the data by ~33%, but makes it safe to transmit over text-based channels.
Real-World Use Cases
- Emails: Attachments are encoded in Base64 so they don’t break email formatting
- URLs: Query strings need URL encoding so special characters don’t confuse browsers
- HTML Pages: Displaying <script> without it executing? Use <script>
- APIs: Some APIs require encoded payloads to ensure safe transmission
Encoding ≠ Security
Many developers confuse Base64 with encryption. That’s dangerous.
Here’s what anyone can do:
No key, no secret — just a simple tool. That’s why encoding should never be used to store or protect sensitive information.
Analogy: The Universal Translator
- Encoding is like using Google Translate so their email system understands your text.
- It’s not private — the mailman, post office, or anyone in-between can read it.
- But it ensures the message doesn’t get corrupted in transit.
Common Mistakes to Avoid
We store the API token in Base64 so it’s safe.”
✅ It’s compatible. ❌ It’s not secure.

What is Hashing?
Hashing is the process of turning any data — a password, a file, or a string — into a fixed-length, irreversible fingerprint.
Why Do We Hash?
Key Traits
Purpose: Verify identity or detect change
Common Hash Algorithms
Algorithm Output Length Use Case
MD5 128 bits Legacy checksums (not secure)
SHA-1 160 bits Git commits (deprecated)
SHA-256 256 bits File integrity, blockchain
bcrypt Variable Password hashing (with salt)
scrypt Variable Password hashing (slower, safer)
argon2 Variable Modern password hashing standard
You can compare hashes, but you can’t go backward.

Hashing Passwords (with Salt)
Hashing alone isn’t enough for passwords. You also need salt — a unique random value added to the input to prevent dictionary and rainbow table attacks.
Salting ensures that even if two users have the same password, their hashes will be completely different — defeating precomputed attacks.
Real-World Use Cases
- Password storage (with bcrypt, scrypt, or argon2)
- Git commits: Each commit has a SHA-1 hash
- File checksums: Validate downloaded files
- Cache keys: Quickly compare request payloads
Analogy: The Fingerprint Scanner
Hashing is like scanning your fingerprint:
- It’s unique to you
- It doesn’t store your actual finger
- If someone tampers with it, it won’t match again
What is Encryption?
Encryption is the process of locking data so only the right person can unlock it. It's the cornerstone of confidentiality in digital systems.
Why Do We Encrypt?
- Only the right person can read it
- Even if intercepted, it’s meaningless without the key
- You stay compliant with regulations (GDPR, HIPAA, PCI-DSS)
Key Properties of Encryption
- Reversible: Data can be decrypted using the correct key
- Key-based: Requires either a single key (symmetric) or key pair (asymmetric)
- Confidential: Protects the contents of data from unauthorized access
Types of Encryption
Symmetric Encryption
- One key used for both encryption and decryption
- Fast & efficient, best for large data
- Examples: AES, DES, ChaCha20
- Use Cases: Disk encryption (BitLocker, FileVault)
- Uses a key pair:
- Enables secure communication over public networks
- Examples: RSA, ECC
- Use Cases: TLS handshakes (HTTPS)
- Combines both types:
- Gets the best of both: security + speed
- Examples: TLS (HTTPS), Signal Protocol
- Use Cases: Secure web traffic
Protecting Your Keys
Encryption is only as strong as key management. Here’s how to do it right:
- Never hardcode keys in your source code
- Use a Key Management Service (KMS) like:
- Rotate keys regularly (e.g., every 90 days)
- Use environment variables (as a baseline)
- Encrypt your config files
- Don’t log secrets (even in dev!)
Authenticated Encryption (AEAD)
- AES-GCM
- ChaCha20-Poly1305
- The data is unreadable and
- Any modifications are detected and rejected
Common Encryption Mistakes
- Using ECB mode (Electronic Codebook) with AES ➤ This mode always encrypts the same input the same way — so patterns in your data become visible. Think of it like using the same lock for every box: an attacker can spot repeated patterns.
- Reusing IVs (Initialization Vectors) ➤ An IV is like a random “starting point” for encryption. If you reuse it, attackers can start guessing how your encryption works. Always use a new IV for each encryption operation — most libraries can do this automatically.
- Writing your own encryption code ➤ Cryptography is notoriously tricky — even small mistakes can break your entire system. Stick to well-vetted libraries unless you're a cryptographer. Always use trusted libraries that are battle-tested and audited.
- Storing encryption keys in plain files or GitHub ➤ Never save your secret keys in .env, .js, .txt, or GitHub. If someone finds the key, your encryption is useless — they can read everything. Use a secure key storage tool like AWS KMS, HashiCorp Vault, or environment secrets managers.
Better Way to Say It
- Symmetric: You and the recipient share the same key to lock/unlock
- Asymmetric: You send the recipient a locked box (using their public key), and only they can open it (with their private key)
- Hybrid: You mail them a box with a padlock key inside, and only they can open the box (asymmetric), then both use that key to send more stuff (symmetric)
Common Mistakes We As Developers Make
- Use Encoding when you want to make data compatible
- Use Hashing when you want to verify or fingerprint
- Use Encryption when you want to protect and hide data
Final Thoughts
- Encoding makes systems talk.
- Hashing verifies integrity.
- Encryption protects secrets.
Dive deep into our research and insights. In our articles and blogs, we explore topics on design, how it relates to development, and impact of various trends to businesses.