Question
What is the difference between a cryptographic algorithm and a cryptographic protocol?
Answer
An algorithm is a finite, well-defined sequence of steps that solves a specific problem (a single computation). A protocol is a set of rules for communication between multiple parties — specifying which messages are exchanged, in what order, and which algorithms are used inside.
* An algorithm is one party computing a value; a protocol is two+ parties exchanging ordered messages to reach a shared state. *
| Algorithm | Protocol | |
|---|---|---|
| Performed by | One party (one machine) | Two or more parties, communicating |
| Output | A computed value (ciphertext, hash, signature, …) | A negotiated state (a shared key, an authenticated session, a signed agreement, …) |
| Examples | SHA-256, AES, RSA | TLS, Kerberos, Signal protocol, e-voting protocol |
The food analogy:
- An algorithm is like a recipe — fixed steps you follow to bake a cake.
- A protocol is like a multi-course meal at a restaurant — the rules of "waiter brings menu, customer orders, chef cooks, waiter delivers, customer pays" that coordinate multiple actors.
Why this distinction matters in security review:
- Algorithm security is about mathematical hardness (Is factoring large
ninfeasible? Is the S-box non-linear enough?). Decades of focused academic analysis vet a small number of well-known algorithms. - Protocol security is about interactions (Can an attacker replay a message? Reorder them? Strip a signature? Trick parties into using a weaker option?). Most real-world breaks are protocol-level even when the underlying algorithms are unbroken.
Tip: A common engineering mistake is "we use AES, so we're secure". AES is just an algorithm — without a correct protocol around it (mode of operation, IV management, key exchange, MAC, replay protection), you have a building block, not a system. Use vetted protocols (TLS 1.3, Signal, age) rather than rolling your own.
Go deeper:
Cryptographic protocol (Wikipedia) — how primitives compose into a communication protocol.
Note saved — thanks!
Question
For each major cryptographic task, which canonical algorithm is the modern default?
Answer
Hashing → SHA-256. Symmetric encryption → AES. Key agreement → Diffie-Hellman (often ECDHE). Asymmetric encryption → RSA or ECC. Digital signatures → RSA or DSA/ECDSA.
* The modern default primitive for each cryptographic task, at a glance. *
| Task | Canonical algorithm(s) |
|---|---|
| Cryptographic hash | SHA-256 (SHA-3 / BLAKE3 as modern alternatives) |
| Symmetric encryption | AES (with GCM for AEAD) |
| Key agreement | Diffie-Hellman, usually ECDHE for forward secrecy |
| Asymmetric encryption | RSA-OAEP, ECIES |
| Digital signatures | RSA-PSS, DSA, ECDSA, EdDSA (Ed25519) |
| Password hashing | Argon2id (or bcrypt/scrypt) |
| Authenticated MAC | HMAC-SHA-256, AES-GCM, Poly1305 |
Why this short list dominates everything:
- Each algorithm has been subjected to decades of public cryptanalysis.
- They're implemented in hardware on modern CPUs (AES-NI, SHA extensions, ARM Crypto Extensions).
- Standardised by NIST / IETF / ISO, available in every crypto library.
A protocol typically uses several of these together — e.g. TLS 1.3 combines ECDHE (key agreement) + AES-GCM (bulk encryption) + ECDSA or RSA-PSS (signing) + HKDF-SHA-256 (key derivation).
Tip: When asked to choose primitives, default to this list. Picking algorithms outside it (DES, MD5, RC4, ElGamal-as-such, custom S-boxes) is a code smell unless there's a specific, documented reason.
Go deeper:
Cryptographic primitive (Wikipedia) — the canonical low-level building blocks.
Cryptographic Right Answers (Latacora) — a practitioner's default-algorithm-per-task guide.
Note saved — thanks!