Why Cryptography Matters
Chapters and transcript
Why Cryptography Matters You open your banking app and send a payment. Your data passes your Wi-Fi router, your internet provider and many other networks before it reaches the bank. Anyone who controls one of those points could try to read it. Cryptography makes sure they see only scrambled data. In this lesson, you will learn the three goals of cryptography, its basic words, and the most important rule for anyone who builds software.
What it is Cryptography is the science of protecting information using mathematics. It lets two people communicate safely, even when others can see or touch the messages on the way. It can keep data secret, and it can make data tamper-proof, so any change is noticed.
An old idea Cryptography is very old. More than two thousand years ago, people shifted each letter of the alphabet by a fixed number of places. This is called a Caesar cipher. On this screen, a shift of three turns HELLO into KHOOR. Shift back, and HELLO returns. It looks secret, but there are only twenty-five possible shifts. Anyone can try them all in a minute.
The three goals Cryptography helps with three main goals. Confidentiality asks: can only the right people read it? Encryption is the main tool. Integrity asks: has it been changed? Hashing and message authentication codes help here. Authenticity asks: did it really come from who it claims? Digital signatures and certificates are the main tools. These goals are separate. Good systems, such as the protocol behind HTTPS, give all three together.
The three goals Now watch each goal fail. On public Wi-Fi, an attacker reads your login details. Confidentiality failed. Next, he changes the bank account number in an invoice email. Integrity failed. Then a fake website pretends to be your bank. Authenticity failed. Cryptography is built to stop all three.
One more idea A related idea is non-repudiation. It means a person cannot later deny that they signed something, because only their private key could have made that signature. This matters for contracts and for financial approvals.
The basic words Here are the basic words. Plaintext is the original readable data. A key is a secret value that controls the algorithm. The algorithm, or cipher, is the method, such as AES or RSA. Encryption turns plaintext into ciphertext, the scrambled, unreadable data. Decryption turns ciphertext back into plaintext, with the key.
The basic words Watch the words in action. You encrypt a message with a key, and the ciphertext travels across the network. An attacker on the way sees only random-looking data. Your friend has the key, so they decrypt it back to plaintext.
Only the key is secret Here is the most important idea in this lesson. The algorithm is not the secret. AES is public, and anyone can study it. Only the key is secret. This is called Kerckhoffs's principle. Why? Software gets copied and apps get taken apart, so algorithms are hard to hide. Keys are small and easy to change. If a key leaks, you replace the key.
Key length Key length matters too. A key is measured in bits. A one hundred twenty-eight bit key has two to the power of one hundred twenty-eight possible values. Trying them all would take far longer than any attacker has. So attackers look for weaker points instead, such as stolen keys, weak passwords or badly written software.
You already use it You use cryptography many times every day. The padlock on HTTPS websites means the connection is encrypted. WhatsApp and Signal use end-to-end encryption. Modern phones encrypt the data they store. Your phone checks a digital signature before it installs an update. Banking and wallet apps, and well-built password storage, rely on it too.
Never roll your own The rule is simple: never roll your own crypto. That means never invent your own encryption method. AES was chosen after years of public study by experts. Home-made ideas have had no testing. Swapping letters, reversing text, XOR with a short repeating word, or just using Base64. These can usually be broken in minutes.
Never roll your own Let me show you why Base64 is not encryption. The word secret becomes this string of letters. It looks scrambled. But one command turns it straight back, with no key at all. Anyone can do this. Security through obscurity, hoping attackers will not discover how your system works, is not real protection.
Easy to get wrong Even a good algorithm is easy to get wrong. Many real failures happened because developers used a strong algorithm in a weak mode, wrote the key inside the app's code, used a predictable random number, or turned off certificate checks to fix an error. The answer is to use well-known libraries, with their safe default settings.
Quick check Quick check. A shop app says your data is protected by its own secret encryption method. What is the best response? Take a moment, then choose.
Key takeaways Let us put it together. Prefer the standards, such as AES and TLS. Protect keys like passwords, never in code, emails or chats. Turn on the encryption you already have: a screen lock, full-disk encryption, and HTTPS. Do not ignore security warnings. And developers, use trusted libraries. Next, you will learn about symmetric encryption.
Every time you send a WhatsApp message, open your banking app or log in to a website, cryptography is working in the background to protect you. In this lesson you will learn what cryptography is trying to achieve, the basic words used in this field, and the most important rule for anyone who builds software.
What cryptography is
Cryptography is the science of protecting information using mathematics. It lets two people communicate safely even when other people can see or touch the messages on the way.
This matters because the internet is not a private place. When you send data from your phone, it passes through your Wi-Fi router, your mobile or internet provider, and many other networks before it reaches the server. Anyone who controls one of those points could, in theory, read or change your data. Cryptography makes that data useless or tamper-proof for them.
Cryptography is very old. More than two thousand years ago, people used simple tricks such as shifting each letter of the alphabet by a fixed number of places. This is called a Caesar cipher. With a shift of 3, the word HELLO becomes KHOOR. It looks secret, but there are only 25 possible shifts, so anyone can try them all in a minute. Modern cryptography is much stronger, but the basic idea is the same: turn readable data into something unreadable, in a way that only the right people can reverse.
The three goals
Cryptography helps with three main security goals. You will see these words again and again.
| Goal | Question it answers | Example of failure |
|---|---|---|
| Confidentiality | Can only the right people read it? | Someone on public Wi-Fi reads your login details |
| Integrity | Has it been changed? | An attacker changes a bank account number in an invoice email |
| Authenticity | Did it really come from who it claims? | A fake website pretends to be your bank |
Confidentiality means keeping data secret. Encryption is the main tool for this.
Integrity means detecting any change to data. Even a change of one character should be noticed. Hashing and message authentication codes help here, as you will see in later lessons.
Authenticity means proving where data came from. Digital signatures and certificates are the main tools.
These goals are separate. A message can be secret but still be changed on the way, if the system only gives confidentiality. A message can be signed and proven genuine but still be readable by everyone. Good systems, such as the protocol that protects HTTPS, provide all three together.
A related idea is non-repudiation. This means a person cannot later deny that they signed something, because only their private key could have made that signature. It matters for contracts and financial approvals.
Plaintext, ciphertext and keys
Here are the basic words of cryptography:
- Plaintext: the original readable data, such as a message or a file.
- Ciphertext: the scrambled, unreadable data after encryption.
- Encryption: turning plaintext into ciphertext.
- Decryption: turning ciphertext back into plaintext.
- Algorithm (or cipher): the method, the set of mathematical steps used to encrypt and decrypt. AES and RSA are algorithms.
- Key: a secret value that controls the algorithm. The same algorithm with a different key gives completely different ciphertext.
A simple picture:
plaintext + key --[ encrypt ]--> ciphertext
ciphertext + key --[ decrypt ]--> plaintext
Here is the most important idea in this lesson. The algorithm is not the secret. AES is public. Its design is published, and anyone can study it. Only the key is secret. This idea is called Kerckhoffs's principle: a system should stay secure even if the attacker knows everything about it except the key.
Why design it this way? Because algorithms are hard to keep secret. Software gets copied, apps get taken apart, and employees leave. Keys, on the other hand, are small and easy to change. If a key leaks, you replace the key. If a secret algorithm leaks, you have to rebuild the whole system.
Key length matters too. A key is measured in bits. A 128-bit key has 2 to the power of 128 possible values. That number is so large that trying every key would take far longer than any attacker has, even with very large computer systems. This is why modern encryption is rarely broken by guessing the key. Attackers look for weaker points instead, such as stolen keys, weak passwords or badly written software.
Where you already use cryptography
You use cryptography many times every day, usually without noticing:
- HTTPS websites: the padlock in your browser means the connection is encrypted with TLS.
- Messaging apps: WhatsApp and Signal use end-to-end encryption, so the company in the middle cannot read your chats.
- Mobile payments: banking and wallet apps such as JazzCash or Easypaisa rely on encrypted connections to their servers.
- Phone storage: modern phones encrypt the data stored on the device, and your screen lock helps protect the key.
- Passwords: well-built websites store a special hash of your password, not the password itself.
- Software updates: your phone checks a digital signature before installing an update, so it knows the update really came from the maker.
The rest of this path explains how each of these works.
Never roll your own crypto
In security, "rolling your own crypto" means inventing your own encryption method or building your own version of a standard one. The rule is simple: do not do it.
Designing a strong cipher is extremely hard. Standard algorithms such as AES were chosen after years of public competition and study by many experts around the world. People have tried to break them for decades and failed. A home-made method has had none of that testing. Common home-made ideas, such as swapping letters, reversing text, XOR with a short repeating word, or simply using Base64, can usually be broken in minutes.
Even using a good algorithm is easy to get wrong. Many real-world failures happened because developers:
- Used a strong algorithm in a weak mode (you will learn about modes in the next lesson)
- Wrote the key directly inside the app's code, where anyone could extract it
- Used a predictable "random" number instead of a truly random one
- Turned off certificate checks in an app to "fix" an error
Security through obscurity, meaning hoping attackers will not discover how your system works, is not real protection. Assume attackers know your design.
What should developers do instead? Use well-known, well-maintained libraries, and use their high-level functions with safe default settings. Let experts handle the hard parts.
What to do
Whether you are a user, an IT person or a developer, these habits help:
- Prefer the standards. When a tool or vendor offers encryption, ask which algorithm it uses. Good answers name AES, ChaCha20, RSA, elliptic curves or TLS. Be careful with answers like "our own secret method".
- Protect keys like passwords. Never put keys in source code, emails or chat messages. Store them in a proper secrets store or password manager.
- Turn on encryption that already exists. Set a screen lock on your phone, use full-disk encryption on laptops (such as BitLocker on Windows or FileVault on Mac), and check for HTTPS before entering data on a website.
- Do not ignore warnings. Browser certificate warnings and app security alerts exist for a reason. You will learn more in the final lesson.
- Developers: use trusted libraries. Use the crypto features built into your programming language or a well-known library, and follow its documentation.
In the next lesson you will look at symmetric encryption, the fast type of encryption that protects most of the data in the world.
Check your understanding
Answer every question correctly to complete this lesson. If you miss one, try the quiz again.
1. An attacker changes the amount in a bank transfer message from 500 to 900 rupees while it travels. Which goal of cryptography failed?
2. Kerckhoffs's principle says a system should stay secure even if the attacker knows everything except one thing. What is that one thing?
3. A developer writes his own encryption method because 'nobody will know how it works'. Why is this a bad idea?
Locked: answer every quiz question above correctly to complete this lesson.
Spotted a mistake or something unclear? Report a mistake