This lesson is the crypto foundation for encoding-encryption-hashing, cryptographic-failures-beyond-hashing, and later token and SSO lessons. Those lessons assume you already know what a key is, what a hash computes, and why a salt matters. This lesson explains how the pieces work, so the applied lessons can explain how they break.
There is no attacking here. This is vocabulary and intuition, with one harmless hands-on step you run against your own machine. Let us start with the most fundamental fork in cryptography: the two kinds of keys.
Encryption, in one sentence
Encryption turns readable plaintext into unreadable ciphertext using a key, and reverses it with the right key. The whole question is: who holds which key? There are two answers, and they define the two families of cryptography.
Symmetric encryption — one shared secret
Symmetric encryption uses one shared secret key for both encrypting and decrypting. Whoever has the key can do both.
- It is fast, so it protects bulk data: files, full-disk encryption, bulk network traffic.
- The classic algorithm is AES.
- Its hard problem is key distribution: both sides must already share the secret key without an eavesdropper ever seeing it. How do you hand someone a key over an untrusted network? That problem is what the second family solves.
Picture a single physical key that both locks and unlocks one box. Anyone with a copy can open it.
Asymmetric (public-key) cryptography — a key pair
Asymmetric cryptography uses a key pair:
- a public key you can hand out to the whole world, and
- a private key you guard and never share.
The magic is that the two are mathematically linked so that what one key locks, only the other can unlock:
- Anyone can encrypt a message to you using your public key, and only your private key can decrypt it. (Solves confidentiality without ever sharing a secret first.)
- Only you can sign something with your private key, and anyone can verify it with your public key. (This is a digital signature — covered in the next step.)
- The classic algorithms are RSA and the elliptic-curve family (ECC).
- It is slower than symmetric, so in practice it is used to exchange a symmetric key and to sign. TLS — the protocol that encrypts web traffic — does exactly this: asymmetric crypto to agree on a shared key, then symmetric for the bulk transfer. You will study TLS in
networking-fundamentals-part2.
The one line to remember
Symmetric = one shared key. Asymmetric = a public/private key pair.
When you are ready, send Continue, and we will look at hashing — which, despite the family resemblance, is not encryption at all.