Encryption
Encryption is a core domain and tests practical judgment: which primitive for which job, and where key management fails. Know the split between symmetric algorithms (AES, ChaCha20) for bulk data, asymmetric algorithms (RSA, ECC/ECDSA, ECDH) for key exchange and signatures, and cryptographic hashes (SHA-256, SHA-3) for integrity-not confidentiality. Encoding (Base64, hex) is not encryption.
Rules that earn marks
- Symmetric is fast but needs a shared secret; asymmetric solves key distribution but is slow, so TLS uses an asymmetric handshake to agree a symmetric session key.
- Hashing is one-way; salts defeat precomputed rainbow tables; password KDFs (bcrypt, scrypt, Argon2) are deliberately slow. Never store passwords with plain SHA-256 alone.
- Digital signatures are a hash plus a private-key operation; verify with the public key. A certificate binds a public key to an identity and is validated via a CA chain, expiry, and hostname.
- TLS protects data in transit; full-disk encryption protects data at rest; they solve different threats.
- Perfect forward secrecy (ECDHE) means a stolen long-term key cannot decrypt past sessions.
Worked example
You download a Linux ISO. The site publishes SHA-256SUMS and a detached GPG signature. Compute sha256sum on the ISO, compare it to the signed file, then run gpg --verify SHA-256SUMS.sig. Reasoning: the hash detects corruption or a swapped file; the signature proves the hash list came from the project's private key. A hash alone over an unauthenticated channel proves nothing against an attacker who can replace both file and hash.
Traps
MD5 and SHA-1 are broken for collision resistance. Encryption is not authentication: encrypt-then-MAC or an AEAD mode (AES-GCM) avoids padding-oracle mistakes. Losing a key is losing the data; escrow and backups matter. Self-signed certificates are not automatically trusted.