Lessons › coding and computer science · taught by Leo
Encryption explained: plaintext, ciphertext, and keys
Learn how encryption turns readable plaintext into ciphertext and how a key lets the right person decrypt it.
Learn this with Leo, freeA voiced lesson with a live whiteboard, quizzes and a tutor you can call, at tutelage.appSecret messages are still data
Encryption is just a way to turn readable data into a scrambled form so other people cannot understand it.
Think of it like putting a note in a locked envelope before it travels.
Encryption turns text into ciphertext
The readable message is called plaintext. The scrambled result is ciphertext.
A key is the secret ingredient that controls the scrambling and the unscrambling.
Predict: what does encryption need?
What must both sides have for the message to be scrambled and then restored correctly?
- A key
- A bigger file
- A printer
Show answer
A key: Yes — a key controls both the scrambling and the restoration.
Same idea, one worked example
Let’s use a simple shift cipher. We start with the word H E L L O.
Then we shift each letter forward by three places. That turns it into K H O O R.
To read it again, the receiver shifts back by three. That gets the original word back.
Quick check: what is ciphertext?
If the plain message is shifted and becomes YJQQT, what is YJQQT?
- Plaintext
- Ciphertext
- The key
Show answer
Ciphertext: Right — that scrambled form is ciphertext.
Why encryption works
The main reason encryption works is that the secret key makes the message hard to read without permission.
Good systems also make it easy for the right person to decrypt, but hard for everyone else to guess the key.
Encryption and decryption pair
Here is the full flow. Readable text goes in, scrambled text comes out, and the same key lets it go back again.
So encryption is not about hiding the existence of a message. It is about hiding the meaning.
Your turn: spot the output
After encryption, what do you get?
- Plaintext
- Ciphertext
- A password
Show answer
Ciphertext: Correct — encryption produces ciphertext.
Watch out: key is not the message
A common mistake is mixing up the message with the key. They are different things.
The message is what you want to protect. The key is what controls the protection.
Encryption checklist
Use this checklist on your own: start with plaintext, use a key, get ciphertext, then decrypt with the right key.
If you can name those four parts, you understand the basic idea of encryption.
Final check: what must stay secret?
In most encryption systems, what should stay secret?
- The key
- The ciphertext
- The monitor
Show answer
The key: Exactly — the key is the secret part.