Understanding Base64, Hashing, and Encryption: The Most Misunderstood Concepts in IT

Understanding Base64, Hashing, and Encryption: The Most Misunderstood Concepts in IT
Photo by Jason Dent / Unsplash

In the world of software development and cybersecurity, a lot of confusion arises between encoding, hashing, and encryption. They all transform data in some way — yet each has a completely different purpose. Understanding these distinctions is crucial for anyone dealing with data transmission, storage, or security.

Let’s clarify what each term truly means, why it exists, and where people often get it wrong.


🔡 Base64 Is Encoding, Not Encryption

Base64 is an encoding scheme, not a security measure. Its purpose is simple: represent binary data using printable characters. This is especially useful when you need to send binary content (like images or files) through systems that only support text, such as JSON, email, or URLs.

Here’s what happens:

  • Binary data is split into 6-bit groups.
  • Each group is mapped to one of 64 characters (A–Z, a–z, 0–9, +, /).
  • The result is a clean, readable string — but still easily reversible.

Example:

"Hello" → SGVsbG8=

Anyone who knows Base64 can decode this back to the original message. No key, no secrecy, no protection.

Purpose: Data transport and safe text representation
Not for: Protecting sensitive information

You’ll often find Base64 used in:

  • JWT (JSON Web Tokens) payloads
  • Email attachments (MIME encoding)
  • Basic Authentication headers (Authorization: Basic ...)
  • Embedded images in HTML/CSS (data:image/png;base64,...)

If you’re thinking of “encoding passwords in Base64,” stop — that’s as insecure as writing them in plain text.


🔒 SHA and Others Are Hashing Algorithms, Not Encryption

While Base64 can be reversed, hashing is designed to go only one way.

A hash function takes any input (of any size) and produces a fixed-length fingerprint. For example:

SHA-256("hello")
= 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824

No matter how long your input is, the hash length is always the same.
But here’s the key property: it’s irreversible. You cannot turn that hash back into “hello.”

Why Hashing Exists

Hashing serves several critical purposes:

  • Integrity verification: Detect changes in files or messages (e.g., comparing checksums).
  • Password storage: Store hashes instead of raw passwords (preferably with salt and pepper).
  • Digital signatures: Used to verify the integrity of signed data.
  • Data indexing: For fast lookups in hash tables.

Common Algorithms

  • MD5 — fast, but broken and insecure.
  • SHA-1 — obsolete; known collision attacks.
  • SHA-256 / SHA-3 — modern, strong, and still widely trusted.
  • bcrypt / scrypt / Argon2 — specifically designed for password hashing, with adjustable computational cost.
Purpose: Integrity and identity
Not for: Confidentiality or reversible protection

If someone says they “encrypted a password with SHA,” that’s incorrect.
They hashed it — and once hashed, you can’t decrypt it back.


🔐 Encryption: The Real Security Mechanism

Unlike encoding or hashing, encryption is reversiblebut only with the correct key.

The goal of encryption is confidentiality: making sure that only authorized parties can read the information.

Two Main Types of Encryption

  1. Symmetric Encryption (e.g., AES)
    • Same key for encryption and decryption.
    • Fast, suitable for bulk data (e.g., AES-256).
    • Needs secure key exchange.
  2. Asymmetric Encryption (e.g., RSA, ECC)
    • Two keys: public key (encrypt) and private key (decrypt).
    • Commonly used in HTTPS, SSH, and digital certificates.
Purpose: Confidentiality and secure communication
Reversible with key
⚠️ Security depends on algorithm strength and key secrecy

When you encrypt data, you’re not changing its format (like Base64) or generating a fingerprint (like SHA).
You’re scrambling it mathematically — and without the right key, it’s computationally infeasible to recover.


🧠 Being “Binary” Doesn’t Make Something Secure

It’s a common misconception that “because it’s in binary, it’s secure.”
Every file on your computer is binary — your .docx, .jpg, or .exe files — but that doesn’t make them encrypted.

Binary is just a format. Security doesn’t come from the form; it comes from cryptography and access control.


📜 “Plain Text” Is a Human Agreement

In computing, everything is numbers. “Plain text” is not a special kind of data — it’s simply data we can read and interpret.

The reason 'A' equals 65 in binary (01000001) is because of an agreed standard called ASCII. Later, Unicode (UTF-8) expanded that to cover nearly every human language and symbol.

So, when we say “plain text,” we mean:

“Data that hasn’t been encrypted and can be interpreted through a known encoding standard.”

That’s all. The notion of plaintext vs ciphertext is entirely about interpretability, not the raw bits themselves.


🧮 Quick Comparison

Category Example Reversible Requires Key Purpose Security
Encoding Base64, URL encoding ✅ Yes ❌ No Data representation ❌ None
Hashing SHA-256, bcrypt ❌ No ❌ No Data integrity ✅ One-way
Encryption AES, RSA ✅ Yes ✅ Yes Confidentiality ✅ Strong

🧩 Additional Considerations

  • Salting hashes prevents attackers from using precomputed “rainbow tables.”
  • Peppering adds a secret value known only to the server for extra security.
  • Key management is as important as the encryption algorithm — lose your key, lose your data.
  • Encoding may precede encryption — for example, an encrypted byte stream can be Base64-encoded for transport.
  • Hashing is not compression. It doesn’t make data smaller — it only produces a fixed-length digest.
  • Encrypted ≠ signed. Encryption hides content; digital signatures prove authorship.

🧭 Finally

In essence:

  • Encoding changes how data looks.
  • Hashing changes how data is identified.
  • Encryption changes who can read it.

Each has a role, each is vital, and confusing them can lead to serious design flaws — especially in authentication systems and secure communications.

Understanding these distinctions is the foundation of writing secure, maintainable, and correct software.

Support Us

Share to Friends