DEV Community

Sreekar Reddy
Sreekar Reddy

Posted on • Originally published at sreekarreddy.com

πŸ” Encryption Explained Like You're 5

A secret code with a key

Day 17 of 149

πŸ‘‰ Full deep-dive with code examples


The Secret Code

When you were a kid, you might have created a secret code with friends:

A β†’ 1
B β†’ 2
C β†’ 3
...
Enter fullscreen mode Exit fullscreen mode

"HELLO" becomes "8 5 12 12 15"

Friends who know the code can read it!

Encryption is the real-world version of this idea: you transform readable text into something unreadable without a key.

One important difference: modern encryption is not a simple A→1 mapping — it uses well-studied algorithms plus a secret key.


How It Works

You have a message you want to keep private.

Encrypt with a special key:

"Meet me at 5"
        ↓ (secret key)
"xK9#mL@pQr!5vB2n..."
Enter fullscreen mode Exit fullscreen mode

Without the key, it should be impractical to recover the original message.

Decrypt with the same key:

"xK9#mL@pQr!5vB2n..."
        ↓ (same secret key)
"Meet me at 5"
Enter fullscreen mode Exit fullscreen mode

Someone with the key can read it.


Types of Encryption

Symmetric: Same key to lock and unlock

  • Like a house key
  • Fast, simple
  • Problem: How do you share the key secretly?

Asymmetric: Two different keys (public + private)

  • Public key: Anyone can use to LOCK
  • Private key: The key-holder can UNLOCK
  • Like a mailbox: anyone can drop mail, and the key-holder can open it

Where You See It

  • πŸ”’ HTTPS (encrypts data in transit between your browser and the site)
  • πŸ“± WhatsApp (uses end-to-end encryption for messages; some backups and features can change what’s protected)
  • πŸ’³ Online payments
  • πŸ”‘ Password managers (encrypted vaults)

Note: the lock icon mainly means the connection is encrypted and the site proved control of its domain via a certificate β€” it doesn’t tell you whether the site is trustworthy.

Note: Password storage is usually done with hashing (not encryption).


In One Sentence

Encryption scrambles your data so someone with the right key can unscramble and read it.


πŸ”— Enjoying these? Follow for daily ELI5 explanations!

Making complex tech concepts simple, one day at a time.

Top comments (0)