🔐

🔒 CRYPTOGRAPHY LAB

Lesson 7: Hands-On Encryption & Decryption

Welcome to the Cryptography Lab! Today you'll actually ENCRYPT and DECRYPT messages, create secure passwords, and understand how secrets are kept safe online. No complex math - just hands-on learning!

0%

📚 What is Cryptography? (In Simple Words)

Think of it Like This:

Imagine you want to send a secret note to your friend in class. You don't want the teacher to read it if they catch it!

Solution: You and your friend agree on a secret code beforehand. You write "MEET AT PARK" as "NFFU BU QBSL" (each letter shifted by 1). Only your friend knows how to decode it!

That's Cryptography! 🎉

📝
Plain Message
"HELLO"
→ 🔐 →
🔒
Encrypted
"KHOOR"
→ 🔓 →
Decrypted
"HELLO"
1

Three Simple Parts of Cryptography:

  • Encryption: Turning readable text into scrambled code (locking the message 🔒)
  • Decryption: Turning scrambled code back to readable text (unlocking the message 🔓)
  • Key: The secret code/pattern used to lock and unlock (like your password 🔑)
Why Do We Need This?

Every time you:

  • Send a message on WhatsApp 💬
  • Buy something online with your credit card 💳
  • Login to any website 🔐
  • Use online banking 🏦

Cryptography is protecting you!

🎮 Let's Encrypt Something! (Caesar Cipher)

The Caesar Cipher is the simplest encryption. It's over 2000 years old! Julius Caesar used it to send secret military messages.

2

How Caesar Cipher Works (Super Simple!):

Just shift each letter forward by a certain number:

Shift by 3:

A → D

B → E

C → F

So "HELLO" becomes "KHOOR"

🎯 Try It Yourself! Caesar Cipher Tool

Your encrypted/decrypted message will appear here...

🎯 Challenge: Decode This!

JRYPBPH WR FUBSWRJUDSKB!

Hint: Try shift of 3 in the tool above! 😉

Why Caesar Cipher is NOT Secure:

There are only 25 possible shifts (1-25). A computer can try all of them in less than 1 second! This is called a "Brute Force Attack".

🔐 Modern Encryption: AES (The Real Deal)

Caesar Cipher was fun, but modern encryption is MUCH stronger! Meet AES (Advanced Encryption Standard) - used by governments and banks!

3

What Makes AES So Strong?

  • Uses a PASSWORD (key) instead of just shifting letters
  • 256-bit encryption = 2^256 possible combinations = more than atoms in universe! 🤯
  • Takes billions of years to crack with today's computers
  • Used by: WhatsApp, banks, military, governments

🎯 Try AES Encryption! (Simplified Version)

Your encrypted/decrypted message will appear here...
Important Rule:

In AES, you need the SAME password to encrypt AND decrypt. If you lose the password, your message is gone FOREVER! Keep it safe! 🔑

Feature Caesar Cipher AES Encryption Age 2000+ years old Modern (2001) Possible Keys 25 (very weak!) 2^256 (impossible to crack!) Time to Crack Less than 1 second Billions of years Used For Learning/fun Banks, military, apps

🔨 Hashing: One-Way Encryption (No Going Back!)

Sometimes we don't WANT to decrypt! Hashing turns data into a unique "fingerprint" that can't be reversed.

Real-Life Example: Passwords!

When you create a password on a website:

  1. You type: "MyPassword123"
  2. Website HASHES it: "5f4dcc3b5aa765d61d8327deb882cf99"
  3. Only the hash is saved (NOT your real password!)
  4. When you login, your password is hashed again and compared

Why? If hackers steal the database, they only get useless hashes, not real passwords!

4

Key Features of Hashing:

  • One-Way: Can't reverse a hash back to original (that's the point!)
  • Always Same: Same input ALWAYS gives same hash
  • Unique: Different inputs give different hashes (almost always)
  • Fixed Length: Any input → same length hash (e.g., 256 bits)

🎯 Try Hashing! See How It Works

Your hash will appear here...

Try This: Type "hello" then try "Hello" (with capital H). Notice how completely different the hash is? Even one tiny change = completely different hash!

Input SHA-256 Hash (256 bits) hello 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 Hello 185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969
Common Mistake:

Weak passwords like "password123" or "123456" are EASILY cracked even when hashed! Why? Hackers have databases of billions of pre-computed hashes (called "Rainbow Tables"). Always use STRONG passwords!

🛡️ Password Security: Creating Unbreakable Passwords

Now you understand hashing - let's make YOUR passwords secure!

5

What Makes a Password STRONG?

  • Length: At least 12 characters (longer = stronger!)
  • Mix: Uppercase, lowercase, numbers, symbols (@#$%)
  • Random: Not real words or patterns
  • Unique: Different password for each website!

🎯 Password Strength Tester

Test your password!

❌ WEAK Passwords (Never Use These!):

  • password123
  • 123456
  • qwerty
  • yourname123
  • letmein

✅ STRONG Passwords:

  • Tr0pic@l$unset#2024!
  • B1u3*Moon_R1s3s&Sh1n3s
  • C0ff33&D0nuts@7AM!
Pro Tip: Use a Passphrase!

Instead of random characters, use a memorable sentence with modifications:

"I love pizza on Fridays at 8pm!"

→ Becomes: ILuv_P1zz@_0n_Fr1d@ys_@_8pm!

Long, strong, and you can remember it!

🔑 Public Key Magic: Two Keys Are Better Than One!

What if you want to receive encrypted messages from people you've never met? You can't share a secret password with them first! That's where Public Key Cryptography comes in!

The Mailbox Analogy:

Think of a mailbox:

  • Mailbox (Public Key): Anyone can PUT letters in (encrypt)
  • Mailbox Key (Private Key): Only YOU can OPEN it (decrypt)

Your public key is like posting your mailbox address - anyone can send you mail, but only you can read it!

6

How It Works:

  1. You generate TWO keys: Public Key and Private Key
  2. You share your Public Key with everyone (it's safe!)
  3. Someone encrypts a message using YOUR public key
  4. Only YOUR private key can decrypt it (keep this SECRET!)
👤
Alice wants to send
secret to Bob
🔓
Alice uses Bob's
PUBLIC key to encrypt
🔐
Bob uses his
PRIVATE key to decrypt

🎯 Generate Your Key Pair!

Click below to create your own public and private keys (simplified version):

Never Share Your Private Key!

If someone gets your private key, they can read ALL messages encrypted with your public key. It's like giving someone the key to your mailbox - they can steal all your mail!

Real-World Uses:
  • HTTPS websites: Your browser uses the website's public key
  • Email encryption: PGP/GPG uses public key cryptography
  • SSH: Secure connection to servers
  • Bitcoin: Your Bitcoin address IS a public key!

🎯 Test Your Knowledge!

Question 1: What's the main difference between encryption and hashing?

Question 2: Which is a STRONG password?

Question 3: What should you NEVER share?

Question 4: Why is Caesar Cipher not secure?

Question 5: What is AES-256 used for?

🎉 CRYPTOGRAPHY EXPERT! 🎉

You've mastered Lesson 7: Practical Cryptography!

You now know how to encrypt, decrypt, hash, and create secure passwords!