Encryption

Your repo crossed the public internet unread by every router along the way — because of a padlock icon and one mathematically stubborn idea from the 1970s. This is the reference for symmetric vs asymmetric keys, the TLS handshake, hashes, and every phrasing of the question the exam uses.

Symmetric — one shared key

The same key encrypts and decrypts. Fast, simple, and the cipher you have already built by hand (Caesar: shift letters by 3). Its fatal flaw is not strength — it is key distribution: to agree on a shared key you already need a private channel, and the public internet never offered one.

message + key → ciphertext  →  ciphertext + key → message

CAT  → (+3) → FDW  →  FDW  → (−3) → CAT

Caesar dies not to brute force but to the statistics of language — frequency analysis. The most common letters in English are ETAOIN; match their ciphertext patterns and the key falls out. Every real symmetric cipher since scrambles the pattern, but the lesson remains: a cipher that preserves any structure is a puzzle, not a lock.

Asymmetric — the public pair

The breakthrough: generate a KEY PAIR where one key encrypts and only the other decrypts. You publish the PUBLIC key (literally — on your website, in a certificate); you keep the PRIVATE key secret. Anyone can lock a message to you; nobody but you can open it. Publishing the lock reveals nothing about the key — that asymmetry rests on one math fact: multiplying two huge primes is easy, but factoring their product back into those primes is intractable for any computer you can buy.

Symmetric (e.g. AES)Asymmetric (e.g. RSA)
KeysOne shared secretPublic + private pair
SpeedVery fastSlow
SolvesBulk encryptionKey exchange + identity
Struggles withGetting the key thereVolume

TLS — using both, for the best of both

HTTPS is the two working together. The asymmetric part builds trust once per session; the symmetric part does the actual work. The handshake, in six lines:

1. browser → server:          "hello"
2. server → browser:          certificate + public key
3. browser verifies the certificate against a trusted authority
4. browser:                   generates random session key,
                              encrypts it with the server's PUBLIC key
5. server:                    decrypts it with its PRIVATE key
                              (the only being that can)
6. both sides:                switch to fast symmetric, session key only

Step 3 is what "certificate" means: a third party vouches that this public key really belongs to github.com. Without that verification, anyone on your wifi could impersonate the site and hand you THEIR key — the man-in-the-middle attack. When your browser says a certificate is invalid, step 3 failed, and the correct move is to close the tab, not click through.

Hashing — encryption's cousin that is NOT encryption

A hash is a one-way fingerprint: any input becomes a fixed-size output, and no reasonable path leads back. password123 → ef92b778bafe.... There is no key because there is no decryption — login works by hashing what you type and comparing fingerprints. Salting (mixing a random per-user value in before hashing) makes every stored hash different even for identical passwords, defeating the precomputed-table attack. The exam phrasing to know: a hash provides integrity (did this change?) and password storage, never secrecy.

The exam-question shapes

What can break it (and what cannot)

Where you meet crypto this year

← The Internet All docs Unit 10: Jam Season →