Section 1: Introduction to Cryptography

Welcome. Before you can break a Vigenère cipher, factor an RSA modulus, or understand why your bank trusts a padlock icon, you need the foundations. This section defines what cryptography actually is, walks through four thousand years of codemaking and codebreaking, and arms you with the vocabulary you will use for the rest of this course.

What is cryptography?

Cryptography is the science of protecting information by transforming it into a form that adversaries cannot read, forge, or tamper with — while legitimate parties, who hold the right keys, can. The word comes from the Greek kryptós (hidden) and graphein (to write): literally, "hidden writing". Its counterpart is cryptanalysis, the art of defeating those protections. Together they form cryptology, and their perpetual duel is the engine that has driven the field for millennia.

Cryptology the whole field Cryptography making codes Cryptanalysis breaking codes symmetric one shared key AES, ChaCha20 asymmetric key pairs RSA, ECC hashing no key, one-way SHA-256 frequency analysis, brute force, side channels … (Sections 3, 8)
The family tree. Cryptography builds the locks; cryptanalysis picks them; cryptology is the whole arms race.

A common misconception is that cryptography is only about secrecy. Modern cryptography actually pursues four distinct goals, and most real systems need several of them at once:

  1. Confidentiality — keeping data secret from anyone who is not authorized to read it. When you send a message over Signal, an eavesdropper on the Wi-Fi sees only ciphertext: a stream of bytes that is computationally indistinguishable from random noise. Encryption algorithms like AES provide this.
  2. Integrity — guaranteeing data has not been altered, accidentally or maliciously, in transit or in storage. If an attacker flips a single bit of a wire-transfer instruction ("send $100" becomes "send $900"), the recipient must be able to detect it. Cryptographic hash functions and message authentication codes (MACs) provide this.
  3. Authentication — proving that a message really comes from who it claims to come from, or that a party on the other end of a connection really is your bank and not an impostor. Passwords, MACs, digital certificates, and challenge-response protocols provide this.
  4. Non-repudiation — preventing the sender from later denying they sent a message. If you digitally sign a contract, you cannot plausibly claim someone else did it, because only your private key could have produced that signature. Digital signatures (RSA, ECDSA, Ed25519) provide this. Note the subtle difference from authentication: a shared-key MAC convinces you the message came from your partner, but it cannot convince a judge, because you could have forged it yourself — you both hold the same key.
GoalQuestion it answersExample mechanism
ConfidentialityCan anyone else read this?AES encryption, TLS
IntegrityWas this modified in transit?SHA-256 hash, HMAC
AuthenticationAm I really talking to who I think?Certificates, HMAC, passwords
Non-repudiationCan the sender deny sending it?Digital signatures (RSA, ECDSA)
Alice "HELLO" plaintext Encrypt E(k, m) 8f2a…d491 insecure channel Decrypt D(k, c) Bob "HELLO" Eve eavesdropper sees only ciphertext: random-looking bytes
The classic cast: Alice sends, Bob receives, Eve listens. Confidentiality means Eve's tap yields nothing but noise — the other three goals defend against her more active cousins who modify, impersonate, and deny.
A useful mental model
Confidentiality is an envelope: it hides the contents. Integrity is a tamper-evident seal: it reveals if the envelope was opened. Authentication is checking the return address and ID of the courier. Non-repudiation is a notarized signature: the sender is bound to the message forever. A sealed, unsigned envelope tells you nothing about who sent it — the four goals are genuinely independent, and each needs its own machinery.

A brief history: four thousand years of secrets

Cryptography is as old as writing itself, and its history is best read as an arms race. Every time codemakers invented a stronger cipher, codebreakers eventually found a crack; every crack forced a stronger design. For most of history the codebreakers held the upper hand — nearly every cipher devised before the twentieth century was eventually broken, often with dramatic consequences for empires and wars. Only in the modern era, with mathematics rather than cleverness as the foundation, did the defenders finally pull ahead.

Notice the pattern: the scytale fell to anyone with a set of rods; Caesar fell to literacy; simple substitution fell to Al-Kindi’s statistics; Vigenère fell to Kasiski; Enigma fell to mathematics plus machinery plus German operator mistakes. Each generation of codemakers believed their cipher unbreakable, and each was eventually wrong. Modern cryptography breaks this cycle by doing something new: instead of hoping a scheme is strong, it reduces security to well-studied mathematical problems and invites the entire world to attack the designs in the open, for decades, before trusting them.

Why cryptography matters today

You used cryptography dozens of times today without noticing. That invisibility is the point — but it is worth seeing where it hides:

In short: modern commerce, privacy, journalism, medicine, and government all sit on a cryptographic foundation. When it fails — through weak algorithms, bad implementations, or stolen keys — the consequences are measured in breached hospitals, drained accounts, and endangered lives.

Kerckhoffs’s principle: no security through obscurity

Kerckhoffs’s principle (1883)

A cryptosystem must remain secure even if everything about it except the key falls into enemy hands. In Auguste Kerckhoffs’s words, the system "must not require secrecy, and it must be able to fall into the hands of the enemy without inconvenience." Claude Shannon later restated it bluntly: "the enemy knows the system."

Why insist on this? Because algorithms are hard to keep secret — they get reverse-engineered, leaked by insiders, or captured (the Allies pulled Enigma machines out of sinking U-boats). A key, by contrast, is small, easy to change, and easy to replace if compromised. History has repeatedly punished designers who relied on secret algorithms: proprietary ciphers in DVDs (CSS), GSM phones (A5/1), and contactless cards (MIFARE Crypto-1) were all reverse-engineered and broken. Every algorithm you will meet in this course — AES, SHA-256, RSA — is fully public, studied by thousands of researchers, and secure anyway. That open scrutiny is precisely why we trust them.

Essential terminology

These terms recur throughout the course. Skim them now, and come back whenever you need a refresher.

plaintext
The original, readable message before encryption. Also called cleartext.
ciphertext
The scrambled output of encryption — unintelligible without the key.
cipher
An algorithm (a pair of procedures) for encrypting and decrypting data.
key
The secret parameter that controls a cipher. Same algorithm, different key, completely different output. Security lives here, per Kerckhoffs.
keyspace
The set of all possible keys. A Caesar cipher has a keyspace of 25; AES-128 has 2128 ≈ 3.4 × 1038. Bigger keyspace means brute force takes longer.
encryption
Transforming plaintext into ciphertext under a key.
decryption
The reverse: recovering plaintext from ciphertext using the key.
hash
A fixed-size "fingerprint" of arbitrary data, computed by a one-way function such as SHA-256. Easy to compute, infeasible to invert or to find two inputs with the same output.
symmetric cryptography
Schemes where the same key encrypts and decrypts (AES, ChaCha20). Fast, but both parties must somehow share the key first.
asymmetric cryptography
Schemes with a key pair: a public key anyone may see and a private key only the owner holds (RSA, elliptic curves). Solves key distribution and enables digital signatures.
nonce
A "number used once" — a value that must never repeat under the same key, used to make each encryption unique. Reusing a nonce can be catastrophic.
IV (initialization vector)
A starting value fed into a cipher mode so that encrypting the same plaintext twice yields different ciphertexts. Closely related to a nonce; usually random or unique per message.
salt
A random value mixed into password hashing so identical passwords produce different hashes, defeating precomputed rainbow-table attacks.
cryptanalysis
The study of breaking cryptographic systems — recovering plaintext or keys without authorization. The codebreaker’s half of cryptology.
brute force
The attack of last resort: trying every key in the keyspace until one works. Defeated by making the keyspace astronomically large.
protocol
A precisely defined sequence of messages and computations between parties — such as TLS or Signal — that combines cryptographic primitives to achieve security goals. Most real-world failures happen at the protocol level, not inside the primitives.
keyspace size (log scale — each pixel step doubles the count) Caesar 25 keys — brute-forced by hand DES 2⁵⁶ ≈ 7.2×10¹⁶ — machine-cracked, 1998 AES-128 2¹²⁸ ≈ 3.4×10³⁸ — beyond any conceivable brute force on a linear scale, the Caesar and DES bars would be invisibly thin slivers of the AES bar
Keyspace is the brute-force budget. Note the scale is logarithmic: AES-128's bar is not "about 25 times" Caesar's — it is about 10³⁷ times DES, and DES is already 10¹⁵ times Caesar.

Your first encryption

Enough theory — encrypt something. The widget below implements the Caesar cipher: every letter slides a fixed number of positions down the alphabet, wrapping from Z back to A. Type a message and drag the slider. Watch what happens at shift 0 and shift 13, and ask yourself: if an attacker knows this is a Caesar cipher, how many guesses do they need at most? (You will formalize the answer — and break this cipher automatically — in Section 3.)

Caesar cipher playground
Do not use this for anything real
The Caesar cipher has a keyspace of 25 — a human can brute-force it on paper in minutes, and frequency analysis breaks it instantly. It survives here purely as a teaching tool. Real confidentiality starts at AES, which you will meet in Section 5.

Check your understanding

Where to learn more

These are the resources this course draws on most, and the ones worth your time first. All are free except the books.

bookThe Code Book — Simon Singh
The definitive popular history of cryptography, from Mary Queen of Scots to quantum crypto. The best companion to this section.
videoComputerphile (YouTube)
Short, sharp explainer videos on Enigma, hashing, TLS, and key exchange by working researchers.
videoChristof Paar — Introduction to Cryptography lectures
A full university course on YouTube, paired with the excellent textbook Understanding Cryptography. Rigorous but beginner-friendly.
pdfCrypto 101
A free introductory book (PDF) by Laurens Van Houtven covering practical modern crypto, started from his PyCon talk.
courseKhan Academy — Journey into Cryptography
Gentle interactive introduction: Caesar, frequency analysis, randomness, and RSA with visual exercises.
courseCryptography I — Dan Boneh (Coursera)
The classic Stanford MOOC. More mathematical; ideal once you finish this site and want proofs.

Next up: Section 2 — Mathematical Foundations, where you will pick up the modular arithmetic that powers everything from Caesar to RSA.