Plaintext is the unencrypted, readable form of data, and ciphertext is the encrypted, unreadable form.

Let’s see this in action. Imagine we have a secret message: "Meet me at noon."

plaintext = "Meet me at noon."

To make this secret, we’ll use a simple substitution cipher, like Caesar cipher with a shift of 3. This means every letter in our plaintext will be shifted three positions forward in the alphabet. 'A' becomes 'D', 'B' becomes 'E', and so on.

Applying this to our message: 'M' becomes 'P' 'e' becomes 'h' 'e' becomes 'h' 't' becomes 'w' ’ ’ remains ’ ’ (spaces are often left as-is or handled specially) 'm' becomes 'p' 'e' becomes 'h' ’ ’ remains ’ ’ 'a' becomes 'd' 't' becomes 'w' ’ ’ remains ’ ’ 'n' becomes 'q' 'o' becomes 'r' 'o' becomes 'r' 'n' becomes 'q' '.' remains '.' (punctuation is also often left as-is)

So, our plaintext "Meet me at noon." transforms into the ciphertext: "Phhw ph dw qrrq."

ciphertext = "Phhw ph dw qrrq."

This ciphertext looks like gibberish to anyone who doesn’t know the key (the shift of 3). If an attacker intercepts this message, they can’t understand its contents without knowing how to decrypt it.

The process of converting plaintext to ciphertext is called encryption. The process of converting ciphertext back to plaintext is called decryption. Both require a key, which is essentially a piece of secret information (like the shift number 3 in our Caesar cipher example) that determines how the encryption and decryption are performed.

The core problem cryptography solves is secure communication over insecure channels. If you and a friend are sending messages across a public network (like the internet), anyone could potentially listen in. Encryption turns your readable messages into unreadable ones, ensuring that even if intercepted, the message remains confidential.

There are many types of encryption, from simple substitution ciphers like our Caesar example to complex algorithms like AES (Advanced Encryption Standard) used today. The strength of an encryption method depends on the algorithm used and the secrecy and length of the key. A longer, more complex key makes it exponentially harder for an attacker to guess or brute-force.

The basic idea behind most modern encryption is to use mathematical operations that are easy to perform in one direction (encryption) but extremely difficult to reverse (decryption) without the correct key. This is often achieved through techniques like bitwise operations (XORing), modular arithmetic, and complex substitutions and permutations.

The transformation from plaintext to ciphertext isn’t just about scrambling letters; it’s about making the data statistically indistinguishable from random noise to an unauthorized observer. For example, in English text, the letter 'e' is the most common. A simple substitution cipher might preserve this frequency, making it vulnerable to frequency analysis. Modern ciphers aim to spread out the frequencies of characters in the ciphertext, making such attacks much harder.

When you use HTTPS on a website (the little padlock in your browser), your browser and the web server are using encryption (usually TLS/SSL) to protect the data you send and receive. Your login credentials, credit card numbers, and browsing activity are all encrypted into ciphertext before they travel across the internet.

The process of encryption and decryption isn’t instantaneous; it consumes computational resources. For very large amounts of data, the time and processing power required for encryption and decryption can become a factor. This is why efficient algorithms and hardware acceleration are important in cryptographic systems.

The true magic of modern cryptography lies in its ability to create trust in an untrusted environment. It’s not about hiding information; it’s about making sure that only the intended recipient can reveal the information, and doing so in a way that guarantees the information hasn’t been tampered with.

The next concept you’ll likely encounter is hashing, which is a one-way process to create a unique "fingerprint" of data, fundamentally different from encryption’s reversible nature.

Want structured learning?

Take the full Cryptography course →