The site's ten Cryptography entries — Diffie–Hellman Key Exchange, RSA Encryption, SHA-256, HMAC, RSA Digital Signature, PBKDF2, bcrypt, AES, OAEP, and BLAKE2b — mostly don't compete for the same job the way, say, the site's twelve Comparison Sorts do. Eight of the ten are genuinely standalone, answering seven distinct questions between them — six answered by exactly one entry each, and one ("check a human password without a cheap guess") answered by two, PBKDF2 and bcrypt alike, the first time two entries here answer the identical question by different mechanisms rather than each owning a different one. OAEP and BLAKE2b are the two true exceptions, for different reasons: OAEP is a required companion to RSA Encryption specifically, not an independently selectable choice at all — see below for why. BLAKE2b answers no question on this page's own list at all; it's a supporting hash function with no "reach for it when" moment of its own here yet, built as the internal primitive the still-unbuilt Argon2 row would need, the same supporting role HMAC plays underneath PBKDF2 one row down. This guide reuses each page's own numbers and demos rather than measuring anything new, and draws out three threads that only show up once the eight standalone entries sit side by side: the exact same multiplicative shortcut breaking two different guarantees on two different pages, the exact same toy-modulus pitfall shape recurring on three of the eight, and PBKDF2 and bcrypt's own direct comparison on the one question they share.
Two people who've never met need to agree on a secret, over a channel anyone can listen to. That's Diffie–Hellman Key Exchange — and only that. It produces a shared number, nothing else; it doesn't encrypt anything and doesn't tell either side who they actually just talked to.
One specific party needs to send a message only one other specific party can read. RSA Encryption — anyone can encrypt with a published public key, but only the matching private key can decrypt.
Data needs a short, fixed-size fingerprint, with no secret or key involved at all — checking a download hasn't been corrupted, or indexing content by its own hash the way Merkle Tree does. SHA-256 — deterministic, one-way, and, unlike the other four entries here, keyless.
A message needs to be provably unaltered and provably from whoever holds a secret both sides already share in advance. HMAC — a symmetric MAC: the same key authenticates on one end and verifies on the other.
A message needs to be provably from whoever holds one specific private key, and anyone — not just a party who was trusted with a shared secret in advance — needs to be able to check that. RSA Digital Signature — the only one of the seven built for public verifiability without the power to forge.
A human-chosen password needs to be checked without making a guess as cheap as one fast hash. PBKDF2 and bcrypt — the only two of the eight where the "secret" is something a person picked and typed, not a randomly generated key, and the only two whose entire job is to make their own cost per guess a deliberate, tunable knob rather than fixed by the construction. See below for how the two differ.
Once a secret is agreed (by Diffie–Hellman or RSA Encryption) or shared in advance, the bulk of the actual data still needs encrypting fast. AES — unlike the two asymmetric entries above, the same key encrypts and decrypts, and like SHA-256 (see below), it rests on no number-theoretic hard problem at all, just the absence of a known attack faster than brute force over the key space. It's also the only entry built for genuinely high throughput: a fixed 10 rounds per 16-byte block, not a modular exponentiation.
OAEP doesn't answer a ninth independent question — nobody reaches for OAEP instead of Diffie–Hellman the way they might reach for RSA Encryption instead of it. It's a required companion to RSA Encryption specifically: textbook RSA with no padding at all is unsafe to use (see below), so this isn't eight choices plus a ninth — it's eight choices, one of which (RSA Encryption) needs OAEP layered on top to actually be safe in practice.
Diffie–Hellman and RSA Encryption are the two entries built around a genuine trapdoor: a direction that's cheap to compute and a reverse direction believed hard — unless a secret unlocks it. They rest on two different unproven-hard problems, not the same one twice. Diffie–Hellman's own Complexity section rests the entire scheme on the discrete logarithm problem (see Baby-Step Giant-Step); RSA Encryption's own Complexity section rests on integer factorization instead (see Pollard's Rho). Neither direction has ever been proven hard in either case — both pages say so outright, and both page's own security rests on nobody having found a fast way to do either one, not on a proof that no fast way exists.
Both pages demonstrate the forward/reverse asymmetry the same way: a deliberately tiny toy-sized instance, cracked live on the page by a named "Eve" who sees only what actually crosses the wire or gets published, using the exact same algorithm this site already built as a Number Theory entry (Baby-Step Giant-Step for Diffie–Hellman, Pollard's Rho for RSA). See below for the measured detail.
RSA Encryption and RSA Digital Signature aren't two different hard problems — they're the identical
trapdoor used for opposite purposes. RSA Digital Signature's own page reuses RSA Encryption's
keygen/modpow/modinv verbatim, with only the two exponents'
roles reversed: encryption applies the public exponent first and the private one to undo it (secrecy —
only the private-key holder can read); a signature applies the private exponent first and the public
one to check it (authenticity — only the private-key holder could have produced it, but anyone can
verify).
That shared arithmetic means a shared weakness, verified directly on both pages rather than just
argued by analogy. RSA Encryption's own Pitfalls section shows that textbook encryption is
multiplicative: encrypting 5 and 7 separately under its first preset
(n = 3,233, e = 7) gives 533 and 2,361, and
533 × 2,361 mod 3,233 = 776 — exactly the direct encryption of 35, no
decryption required to see it. RSA Digital Signature's own Pitfalls section runs the mirror-image attack
on signatures: two genuine signatures, produced with the real private exponent, multiply together into a
third valid signature for the product message, that the signer never actually produced or saw. Same
underlying algebra; one version breaks secrecy, the other breaks authenticity — "arguably worse," in
that page's own words, because a forged signature can be waved around as proof of consent the key's
owner never gave. Both pages name the identical fix in different standard's clothing: RSA Encryption
needs OAEP padding before encrypting — now built as its own entry,
with a live demo showing the same message encrypt to a different ciphertext every time, which is
exactly what removes the multiplicative structure this section just described; RSA Digital Signature
needs the message hashed (and, in a real deployment, padded with RSASSA-PSS or PKCS#1 v1.5) before
signing — those two signature-specific padding schemes remain unbuilt here, but RSA Digital Signature's
own second demo does build and verify the hash-first half of that fix live: the identical multiplication
trick, retried against hash-reduced values instead of raw numbers, fails every time, because a real
hash has no algebraic relationship between H(m1)·H(m2) and H(m1·m2) the way
raw modular exponentiation does.
SHA-256 is the odd one out among these five in a way that's easy to miss just from "it's also cryptography": it has no key, no public/private pair, and — its own Complexity section says this outright — no believed-hard mathematical problem underneath it at all, unlike Diffie–Hellman's discrete log or RSA's factoring. Its security is just the absence, so far, of any shortcut through its specific sequence of bit operations faster than brute force. It answers a structurally different question: not "who can read this" or "who could have produced this," but "does this data still match what it matched before" — a fingerprint, not a secret.
That keylessness is exactly why SHA-256 can't do HMAC's or RSA Digital Signature's job on its own.
Its own Pitfalls section demonstrates, live, that SHA-256(secret‖message) is forgeable by
anyone who knows the secret's byte length — not its contents — through length extension: resuming the
compression function from a published hash's own internal state to extend it with attacker-chosen data.
HMAC exists specifically to close that gap without inventing a new
hash function, and below compares it against the other authentication
option here.
HMAC and RSA Digital Signature answer the same high-level question — "could only a specific party have produced this?" — with opposite machinery, and RSA Digital Signature's own intro draws the line precisely: HMAC needs the same secret in advance on both ends, which only works between parties who already trust each other with it; a signature replaces that shared secret with a key pair, so anyone holding only the public half can verify without ever gaining the ability to forge. That asymmetry is "structurally unavailable to a symmetric MAC like HMAC," in that page's own words — not a missing feature HMAC could add, a different shape of trust entirely.
The cost of that extra power is real and already measured on the two pages. HMAC's own Complexity
section puts its cost at roughly two SHA-256 calls — fast, a constant multiple of plain hashing. RSA
Digital Signature's own Complexity section costs one full modular exponentiation (O(log n),
the same square-and-multiply Modular Exponentiation
uses) on top of the same SHA-256 hash — meaningfully more arithmetic for the privilege of not needing a
pre-shared secret at all. Neither page measures the two side by side in wall-clock time, so this is a
structural comparison (one hash-speed operation vs. one exponentiation on top of it), not a race.
PBKDF2 and bcrypt are the one pair here that answer the identical question by two different mechanisms, rather than each owning a different question the way every other entry does: "can a human-chosen password be checked without a guess costing as little as one fast hash?" Neither answers "who could have produced this" at all — a narrower question none of the other five entries do. Both SHA-256's and HMAC's own Pitfalls sections name the same gap — "real password storage uses deliberately slow, salted key-derivation functions" — and PBKDF2's page is built to close it by chaining HMAC's own primitive thousands of times, while bcrypt's page closes it by rebuilding a modified Blowfish key schedule's own internal state from scratch on every guess — nothing new invented in either case, each reusing machinery this site already built. Where every other entry here has a cost fixed by its own construction (one hash, one HMAC call, one modular exponentiation), both PBKDF2's and bcrypt's entire design is a tunable cost knob — more chained HMAC calls or more key-schedule rounds, more work per guess, for defender and attacker alike, each measured live on its own page rather than only asserted.
PBKDF2's own Pitfalls section is upfront about what chaining HMAC doesn't fix: every guess still needs only a single 32-byte running state, so parallel hardware (GPUs, ASICs) can run many guesses side by side cheaply, with no memory bottleneck to slow that down. bcrypt and Argon2 — named on SHA-256's, HMAC's, and PBKDF2's own pages alike — close that specific gap by also requiring a large, hard-to-parallelize memory footprint per guess. bcrypt's own page measures exactly how much memory that buys (a fixed ~4 KB per guess) and is honest about the limit: Argon2's own, independently tunable memory parameter can go far larger, and remains the one piece still unbuilt here. PBKDF2 is a genuine, standardized, widely-deployed improvement over a bare hash; it just isn't the strongest tool available against an attacker with custom hardware.
Three of the eight standalone entries — the two trapdoor schemes and the signature scheme built on one of them — share a deliberately small number, and all three draw the identical lesson: the underlying math doesn't change between the toy case and a real deployment, only the size of the number does, and that size is the entire reason one is instant and the other is currently infeasible. Two of the three let a visitor actually watch the crack happen on the page; the third only asserts the identical risk by direct reference, rather than running its own factoring demo.
| Page | Toy value | Who breaks it, how | Result |
|---|---|---|---|
| Diffie–Hellman Key Exchange | p = 23 |
Eve, via Baby-Step Giant-Step — live on the page | all 441 possible secret pairs cracked, at most 5 giant steps each, 0 failures |
| RSA Encryption | n = 8,051 (83 × 97) |
Eve, via Pollard's Rho — live on the page | factored in 3 tortoise-and-hare steps, every time |
| RSA Digital Signature | the same n = 8,051 preset |
not run on this page — its own Pitfalls section only asserts "the same toy-sized factoring risk RSA Encryption's own Pitfalls section demonstrates … applies here against forgery, unchanged" | no independent crack demo; risk is identical by direct reference to RSA Encryption's own result |
SHA-256, HMAC, and AES have no equivalent axis at all — there's no modulus to shrink, because none of
the three rests on a number-theoretic hard problem in the first place. Their own weak points are
structurally different: SHA-256's is length extension (a construction flaw, fixed by nesting, not by a
bigger number); HMAC's own Pitfalls section names a verifier that compares tags byte-by-byte and leaks
timing information one byte at a time, and the unrelated fact that a fast MAC is still a bad
password-hashing function for the same reason plain SHA-256 is; AES's own Pitfalls section names a
different pair entirely — ECB mode leaking repeated plaintext structure, and a table-indexed S-box
leaking through cache-timing even though its own round count never varies — neither one a size problem
a bigger key would fix. PBKDF2 has an axis that looks similar — a number that's small-today, large-tomorrow —
but it's a deliberately chosen iteration count, not an accident of an underlying hard problem; shrinking
it doesn't reveal a mathematical weakness the way a small RSA modulus does, it's simply an
under-provisioned defense, the gap its own Pitfalls section measures directly. OAEP has a size constraint too, but it's a third, independent shape
again: not factoring hardness, not a tunable defense, but a structural floor — a modulus has to be at
least 2×hLen + 2 bytes (66, for SHA-256) just to have room for OAEP's own encoding, with
nothing left over to hold a real message. A modulus can clear that floor comfortably (this site's own
~900-bit toy key does) while still being nowhere close to safe against factoring — the two constraints
don't move together.
None of this is a ranking, because a real system doesn't pick one of these eight — it stacks several of them, each covering a gap the others leave open by design. Diffie–Hellman's own Pitfalls section says it plainly: the exchange "secures the exchange against someone who can only listen, not against someone who can also intercept and substitute," and names the fix outright — "real systems (TLS, for instance) layer authentication — certificates, digital signatures — on top of this exact exchange rather than changing it." RSA Digital Signature is this site's own entry for that exact layer, built to close that exact forward reference. A full handshake in practice needs a key-establishment step (Diffie–Hellman or RSA Encryption), an authentication step over that exchange (a signature, or HMAC once a shared secret already exists), and — for the bulk of the actual data, once a secret is agreed — a fast symmetric cipher. This guide's own previous revision named that last piece as "a fast symmetric cipher this site hasn't built yet, a genuine gap rather than an oversight papered over here"; AES is now that piece, built specifically to close that exact forward reference. OAEP is the clearest example of this layering on the page: nobody picks it as an alternative to anything, it just rides along underneath RSA Encryption any time that specific key-establishment step is the one chosen, exactly the way a signature or HMAC rides on top of whichever exchange produced the secret they're authenticating. SHA-256 sits underneath several of the others rather than beside them: HMAC is literally SHA-256 nested twice, RSA Digital Signature hashes with the same page's own SHA-256 implementation before ever touching the private exponent, and PBKDF2 chains HMAC again on top of that same foundation — a different layer for a different kind of secret, a password a human remembers rather than a key one of the other six entries agreed on, generated, or symmetrically shared in advance. bcrypt answers that identical "password, not key" question but sits on none of this site's own SHA-256 foundation at all — its own slow part is a modified Blowfish key schedule, built from a block cipher rather than layered on a hash.
| Entry | Keyed? | Rests on | What breaks it | Reach for it when |
|---|---|---|---|---|
| Diffie–Hellman Key Exchange | no shared secret going in — that's the output | discrete logarithm hardness | a too-small modulus (Baby-Step Giant-Step); no authentication of either party, ever | two strangers need a shared secret over a public channel, with authentication supplied separately |
| RSA Encryption | asymmetric key pair | integer factorization hardness | a too-small modulus (Pollard's Rho); raw/unpadded messages leak multiplicative structure (fixed by OAEP) | one party must read a message only they can decrypt |
| SHA-256 | no key at all | no known hard problem — just absence of a known attack | length extension, if used naively as H(secret‖message) |
a fixed-size fingerprint of data, with no secrecy or authentication claim attached |
| HMAC | symmetric — one shared secret | SHA-256's own compression function, nested | naive non-nested concatenation; a non-constant-time verifier | both sides already share a secret and need fast tamper-evidence |
| RSA Digital Signature | asymmetric key pair | integer factorization hardness (RSA Encryption's own trapdoor, reversed) | signing raw unhashed messages (multiplicative forgery, demonstrated live); a too-small modulus (asserted by reference to RSA Encryption's own demo, not run on this page) | anyone must verify authenticity without ever gaining the power to forge |
| PBKDF2 | no key — a human password instead, chained through HMAC's own primitive | HMAC-SHA256, chained — no new hardness assumption beyond HMAC's own | a too-low iteration count for current hardware (time-hard, not memory-hard); a reused or missing salt | a password needs checking without a guess costing as little as one fast hash |
| bcrypt | no key — a human password instead, run through a modified Blowfish key schedule | Blowfish's own unbroken-cipher assumption, plus the cost parameter chosen at design time | a too-low cost factor for current hardware (still only ~4 KB of memory per guess, not truly memory-hard); the 72-byte silent truncation; a non-constant-time hash comparison | PBKDF2's own parallel-hardware weakness is the actual threat, and Argon2 isn't available |
| AES | symmetric — one shared key, same key decrypts | no known hard problem — just absence of a known attack faster than exhausting the key space | ECB mode's pattern leak (demonstrated live); a table-indexed S-box's cache-timing leak, even though its own round count is fixed | the bulk of the actual data needs encrypting fast, once a secret is already agreed or shared |
OAEP deliberately has no row of its own here — the "reach for it when" question doesn't apply, since it's never an alternative to any of the eight rows above, only a required companion to the RSA Encryption row specifically (see above). BLAKE2b has no row either, for a different reason: it isn't an alternative to anything above or a companion to one specific row, it's the hash function the still- unbuilt Argon2 row would use internally — nothing on this table reaches for BLAKE2b directly yet.