Bachelor of Science in Computer Science
Course ContentCryptography
Habari Mwanafunzi! Welcome to the World of Secret Codes!
Have you ever wanted to send a secret message to your friend, one that your younger brother or sister can't read? Imagine writing a note, but in a special, jumbled-up language that only your friend knows how to understand. That's exactly what Cryptography is all about! It’s the art of creating and solving secret codes to keep information safe. In today's digital world, it’s like having a super-strong lock for your digital secrets!
Think about M-Pesa. When your parent sends money, a secret message is sent from their phone. Cryptography makes sure that only Safaricom and the person receiving the money can understand this message, keeping the money safe from thieves. It’s a digital kifuri (strongbox)!
The Basic Ingredients of a Secret Code
To be a master code-breaker (or code-maker!), you need to know these important words:
- Plaintext: This is your normal, everyday message that anyone can read. For example, "TUKUTANE KESHO".
- Ciphertext: This is your secret, scrambled message that looks like nonsense. For example, "VWNWWDPG MGUJQ".
- Encryption: This is the process of turning your plaintext into ciphertext. It’s like locking the message in a box.
- Decryption: This is the process of turning the ciphertext back into readable plaintext. It’s like unlocking the box.
- Key: This is the secret password or piece of information you need to lock and unlock the message. Without the key, the ciphertext is just gibberish!
Here is how it all flows together:
Plaintext Message +----------+ Ciphertext Message
(e.g., "HELLO") -----> |ENCRYPTION| ----> (e.g., "KHOOR")
| with KEY |
+----------+
|
|
V
Plaintext Message +-----------+ Ciphertext Message
(e.g., "HELLO") <----- |DECRYPTION | <---- (e.g., "KHOOR")
| with KEY |
+-----------+
Let's Make Our First Code: The Caesar Cipher!
One of the oldest and simplest ciphers is the Caesar Cipher, named after the Roman Emperor Julius Caesar. He used it to send secret messages to his army generals. The idea is simple: just shift the letters of the alphabet by a certain number. This number is your key!
Let's encrypt the word "SIMBA" using a Key of 3. This means we shift every letter forward by 3 places.
Step 1: Write down the alphabet.
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Step 2: Find our first letter 'S'. Move 3 steps forward.
S -> T -> U -> V
So, S becomes V.
Step 3: Find our next letter 'I'. Move 3 steps forward.
I -> J -> K -> L
So, I becomes L.
Step 4: Do this for all the letters.
M -> N -> O -> P (M becomes P)
B -> C -> D -> E (B becomes E)
A -> B -> C -> D (A becomes D)
Step 5: Put the new letters together.
Plaintext: S I M B A
Ciphertext: V L P E D
Hongera! Congratulations! You have just encrypted your first message. The secret code for "SIMBA" is "VLPED". Only someone who knows the key (Key = 3) can figure it out.
Image Suggestion: [A vibrant, cartoon-style image of a circular alphabet wheel. The inner wheel shows the normal alphabet (A-Z). The outer wheel is slightly rotated to show a shift of 3, so that 'A' on the inner wheel lines up with 'D' on the outer wheel. A friendly cartoon lion is pointing at the wheel with a smile.]
Cryptography in Your Daily Life in Kenya
You use cryptography every single day without even realizing it!
When you see that little message on WhatsApp that says, "Messages and calls are end-to-end encrypted," it means they are using a very powerful form of cryptography. It’s like you and your friend have a special secret key that only your two phones know. Not even the people at WhatsApp can read your messages! It's like whispering a secret in Sheng' that only your best friend understands, even in a crowded and noisy market like Gikomba.
Symmetric vs. Asymmetric: One Key or Two?
Imagine you have a box for your secrets. There are two main ways to handle the keys.
-
Symmetric Cryptography (One Key): This is like having a diary with a padlock. You use the SAME key to lock it (encrypt) and to open it (decrypt). You and your friend must both have a copy of the exact same key. It's simple, but you have to find a safe way to share the key first!
Me [Secret Message] ===(Same Key)===> Friend (Lock) (Unlock) -
Asymmetric Cryptography (Two Keys): This is clever! It’s like having a personal postbox at the post office. Anyone can drop a letter in through the public slot (this is the Public Key). But only YOU have the special, private key to open the postbox and read the letters (this is the Private Key). This is what makes online banking and M-Pesa so secure. Your bank can use your public key to send you information, but only your private key can unlock it.
Everyone can use this! (Public Key) | v [LOCKED BOX] ----> Only YOU can open it with your (Private Key)
Image Suggestion: [A split-screen illustration. On the left, two happy Kenyan children are exchanging a single, identical, brightly-colored key. This side is labeled "Symmetric: One Key for Locking & Unlocking". On the right, a person is using a unique, personal key to open their mailbox, while several other people drop letters into the public slot. This side is labeled "Asymmetric: Public Key to Lock, Private Key to Unlock".]
Your Turn to Be a Spy!
Mambo vipi, agent? Here is your mission. I have sent you a secret message using the Caesar Cipher. Can you decrypt it?
Secret Message: "JCUEJC"
Secret Key: 2
Hint: To decrypt, you do the opposite of encrypting. Instead of moving forward in the alphabet, you move backwards by the key number. For example, with a key of 2, C would become A (C -> B -> A). Good luck!
(Scroll down for the answer... no peeking until you've tried!)
Answer: The decrypted message is "HABARI"! Did you get it? Kazi nzuri! (Good job!)
Conclusion: You are now a Code Master!
Today, you've learned that cryptography is the magic that keeps our digital world safe. From your WhatsApp chats to M-Pesa transactions, these secret codes are working hard to protect our information. You've even learned how to make and break your own code!
The world of computer security is huge and exciting. Keep asking questions, stay curious, and you could be the one creating the next generation of unbreakable codes!
Pro Tip
Take your own short notes while going through the topics.