Cryptanalysis and Security Proofs Questions
Evaluating the strength of cryptographic constructions: attack techniques, cryptanalysis of ciphers and protocols, reduction-based security proofs, and formal analysis. Covers reasoning about what an adversary can and cannot do and how security guarantees are argued rigorously. The offensive-and-verification counterpart to scheme design.
Estimate the time required to brute-force symmetric keys of length 56, 80, 112, and 128 bits on a machine that can test 1e9 keys per second. Provide results in seconds, days, and years, and briefly discuss how parallelization or specialized hardware changes these estimates.
Sample Answer
Direct answer
Exhaustive key search over an n-bit keyspace costs up to 2^n trial operations (2^(n-1) on average before success), so dividing the keyspace size by the attacker's throughput gives wall-clock time directly. At 1e9 keys per second, a 56-bit key falls in about a day, an 80-bit key takes tens of millions of years, and 112- or 128-bit keys push into numbers vastly beyond the age of the universe for a single machine at this rate. Every extra key bit doubles the required work, which is why these numbers grow so explosively.
Structured elaboration
The governing relationship, worst case (exhaustive search of the full space):
Tseconds=R2nwhere R is keys tested per second. The average case (expected time to find the one correct key, searching in a random order) is half that. All results below use one consistent basis: seconds, converted to days by dividing by 86,400, then to years by dividing by 365.25.
Brute force is embarrassingly parallel: each machine searches a disjoint slice of the keyspace, so P independent machines at the same per-machine rate divide the total time by P almost exactly. Specialized hardware (ASICs, FPGAs) also matters far more than raw machine count: the EFF's 1998 Deep Crack machine, a purpose-built ASIC design, broke a 56-bit DES key in under three days using hardware that would look unremarkable a decade later, demonstrating that "impractical for a lone attacker on commodity CPUs" is very different from "impractical for an adversary willing to invest in custom silicon."
Worked example
At R = 1e9 keys/second, worst-case (full exhaustive search) times:
| Key size | Keyspace (2^n) | Seconds | Days | Years |
|---|---|---|---|---|
| 56 bits | 7.21 x 10^16 | 7.21 x 10^7 | ~834 | ~2.28 |
| 80 bits | 1.21 x 10^24 | 1.21 x 10^15 | ~1.40 x 10^10 | ~3.83 x 10^7 |
| 112 bits | 5.19 x 10^33 | 5.19 x 10^24 | ~6.01 x 10^19 | ~1.65 x 10^17 |
| 128 bits | 3.40 x 10^38 | 3.40 x 10^29 | ~3.94 x 10^24 | ~1.08 x 10^22 |
(Average-case time, if you only need to search until the actual key is found rather than the whole space, is exactly half of every figure above, on the same basis.)
Trade-offs and pitfalls
Notice the scale jump between 80 and 112 bits: 80-bit keys are firmly within reach of a sufficiently resourced attacker over realistic timeframes, while 112 bits (2-key 3DES territory) sits at the edge of adequate margin and 128 bits (AES-128) remains solid. A common mistake is assuming more hardware erodes security proportionally; it does not, because keyspace grows exponentially while hardware only scales resources linearly (or with parallel machine count). A million-fold increase in an attacker's compute buys only about 20 bits of effective security reduction (log2(1,000,000) ≈ 19.9), which is why 128-bit keys stay comfortably out of reach even against enormous, well-funded compute budgets, while 56- and 80-bit keys do not.
Explain the birthday paradox and why generic collision search against an n-bit hash function requires about 2^{n/2} evaluations. Compute approximate expected work to find a collision for n=128 and n=256, and discuss practical implications for choosing hash output size in modern systems.
Sample Answer
Direct answer
The birthday paradox says that among random samples drawn from N equally likely outcomes, you only need about sqrt(N) samples before two of them collide, far fewer than the N/2 that intuition suggests. For an n-bit hash function with N = 2^n possible outputs, this means generic collision search costs about 2^(n/2) hash evaluations no matter how the hash is designed internally: it is a structural limit, not a weakness of any particular construction.
Structured elaboration
With k random samples, the probability that at least one pair collides is approximately:
P(collision)≈1−e−k2/2NSetting this to 0.5 and solving gives the classic birthday bound:
k≈1.1774N=1.1774⋅2n/2so roughly 2^(n/2) evaluations, not 2^n, are needed to find a collision with even odds. This matters because it caps collision resistance well below preimage resistance for the same output size: finding a hash output that matches one SPECIFIC target still costs about 2^n (you are not helped by the birthday effect when only one target exists), but finding ANY two inputs that collide only costs about 2^(n/2). An n-bit hash therefore never offers more than n/2 bits of collision resistance, even in the best possible design.
A memory-efficient variant worth naming: Pollard's rho style parallel collision search with distinguished points still costs about 2^(n/2) time but needs only small, roughly constant memory instead of storing every sample, which is why collision search is considered practical at moderate n even without huge storage budgets.
Worked example
For n = 128: 2^(128/2) = 2^64 ≈ 1.84 x 10^19 evaluations.
For n = 256: 2^(256/2) = 2^128 ≈ 3.40 x 10^38 evaluations.
This is exactly why MD5 (128-bit output, generic 2^64 collision bound) and SHA-1 (160-bit output, generic 2^80 collision bound) were both retired as collision-resistant hashes, though not because raw compute simply caught up to those generic bounds: both were broken by cryptanalysis finding a structural shortcut well BELOW the generic bound, not by brute-force reaching it. Wang et al.'s 2004 differential attack found MD5 collisions in minutes on ordinary hardware, far cheaper than 2^64. The 2017 SHAttered attack found a real SHA-1 collision using about 2^63.1 SHA-1 evaluations (reported as roughly 6,500 CPU-years plus 100 GPU-years of compute), a huge computation in absolute terms but still roughly 120,000x cheaper than the naive 2^80 generic bound (2^80 / 2^63.1 = 2^16.9 ~ 1.2 x 10^5), because it exploited a differential path through SHA-1's compression function rather than searching blindly. Both breaks are a reminder that the birthday bound is a ceiling on what a well-designed hash forces an attacker to pay, not a floor every hash automatically delivers: a hash with real cryptanalytic weaknesses can fall far below it. SHA-256's 256-bit output, giving a generic 2^128 collision bound with no known shortcut anywhere near that scale, is the reason it replaced them for anything needing collision resistance, since 2^128 evaluations remains far beyond any realistic compute budget.
Trade-offs and pitfalls
The most common mistake is conflating "n-bit hash" with "n-bit security" across the board. If an application only needs preimage resistance (for example, reversing a single stored hash), the full 2^n generic bound applies and n bits may be enough. If it needs collision resistance (digital signatures, deduplication, content-addressed storage, anywhere two different inputs producing the same hash is a real problem), you must budget for the n/2 bound instead, which is why "128-bit security" claims for a hash function almost always mean a 256-bit output, not a 128-bit one.
Estimate the practical feasibility of factoring a 1024-bit RSA modulus using current best classical algorithms. Compare Pollard rho, elliptic curve method (ECM) for small factors, and the general number field sieve (GNFS) asymptotics. Given a 1000-core cluster providing 1000 CPU-years per calendar year, argue whether 1024-bit factoring is within reach and provide a rough cost estimate and time-to-completion reasoning.
Sample Answer
Direct answer
For a 1024-bit RSA modulus (the product of two roughly 512-bit primes), the General Number Field Sieve (GNFS) is the only algorithm with a realistic chance. Pollard's rho and the Elliptic Curve Method (ECM) only run efficiently when a factor is small relative to the modulus, and a well-generated RSA modulus deliberately has two similarly sized large primes, so neither applies. GNFS itself runs in time sub-exponential in the modulus size, dramatically better than brute force but still infeasible at 1024 bits for a modest cluster: scaling from the real, publicly documented RSA-768 factorization (completed in 2009, at a widely cited effort on the order of a couple thousand CPU-core-years), a 1,000-core cluster delivering 1,000 CPU-years per calendar year would need on the order of a thousand CALENDAR YEARS to factor a 1024-bit modulus. That specific cluster cannot do it, even though 1024-bit RSA is no longer trusted against a much larger, well-funded adversary and has been deprecated in modern standards for exactly that reason.
Structured elaboration
Pollard's rho: expected running time roughly O(sqrt(p)) where p is the SMALLEST prime factor. Against a balanced RSA modulus, where the smallest factor is itself around 512 bits, sqrt of a 512-bit number is still a roughly 256-bit-scale search, hopeless. Rho is a tool for finding small or unexpected factors, not for balanced semiprimes.
ECM: similarly depends on the size of the smallest factor (heuristic running time roughly exp(sqrt(2 ln p ln ln p))), excellent at pulling out factors up to a few hundred bits. It is the tool a serious factoring effort runs FIRST, cheaply, as a sanity check, in case key generation accidentally produced an unusually small factor, before ever committing to GNFS.
GNFS: the state of the art for balanced semiprimes, with heuristic work factor:
LN[31,(964)1/3]=exp((c+o(1))(lnN)1/3(lnlnN)2/3),c=(964)1/3Sub-exponential growth is much slower per added bit than a naive exponential algorithm, but the constants still make the jump from 768 to 1024 bits enormous. Real-world anchor: RSA-768 (768 bits) was publicly factored in 2009 after roughly two calendar years of effort across many machines, widely cited at approximately 2,000 CPU-core-years total. The jump from 768 to 1024 bits is commonly cited in the literature as roughly a 1,000x increase in GNFS work (a widely repeated estimate, treated here as an assumption, not something derived fresh).
Worked example
Estimated RSA-1024 effort: 2,000 core-years x 1,000 ≈ 2,000,000 core-years.
Given cluster: 1,000 cores delivering 1,000 CPU-years per calendar year (near-continuous use, consistent with 1,000 cores x 1 year wall-clock = 1,000 core-years).
calendar years needed=1,000 core-years / calendar year2,000,000 core-years=2,000 calendar yearsTwo thousand calendar years has no realistic operational meaning; this specific 1,000-core cluster is NOT within reach of factoring RSA-1024. Contrast with a much larger, well-funded adversary: a plausible order-of-magnitude gap between a research cluster and a nation-state's total compute-purchasing power over years, say a million-fold more dedicated compute, would bring 2,000 calendar-years down toward a single calendar day in the extreme case. This is exactly why standards bodies treat 1024-bit RSA as broken against a sufficiently resourced adversary, and disallowed it for new use years before any public factorization was demonstrated (NIST deprecated 1024-bit RSA for new key generation starting in 2013, and for signature verification more broadly by 2015).
Trade-offs and pitfalls
A common early mistake is confusing Pollard rho or ECM (small-factor tools) with GNFS (the actual threat model for a balanced RSA modulus). Another is skipping the cheap ECM sanity check, exactly the class of bug that made the ROCA vulnerability (weak, structured key generation) practically factorable where a normally generated key of the same size would not be. A third is treating "1024-bit RSA is factored" as an already-completed public event; it has not been publicly demonstrated as of this writing, but best practice treats it as broken FOR PLANNING PURPOSES against a well-resourced adversary, which is why current standards mandate 2048-bit RSA as the practical minimum, with 3072 or more for longer-term protection.
Explain the meet-in-the-middle attack on double-DES (ciphertext C = E_{k2}(E_{k1}(P))). Derive the time and memory complexity in terms of single-DES key size k=56 and show the numeric work factor and memory requirement. Explain why double-DES was not considered secure and how 3DES addresses the issue.
Sample Answer
Direct answer
Stacking two independent 56-bit DES keys as C = E_k2(E_k1(P)) looks like it should give 112 bits of security, but a meet-in-the-middle (MITM) attack, one that attacks from both ends of the computation at once instead of guessing the whole key pair, breaks it in only about 2^57 time and 2^56 memory. That is barely more work than breaking single DES, which is exactly why double-DES was never adopted and why triple-DES (3DES, using a third independent key) became the real fix.
Structured elaboration
Given one known plaintext/ciphertext pair (P, C):
- Forward pass: for every candidate k1 (all 2^56 values), compute X = E_k1(P) and store the pair (X, k1) in a lookup table, sorted or hashed by X.
- Backward pass: for every candidate k2 (all 2^56 values), compute Y = D_k2(C) and check whether Y appears in the table. Any match (X == Y) gives a candidate key pair (k1, k2) satisfying E_k2(E_k1(P)) = C for this one plaintext/ciphertext pair.
- Because a single pair produces many false-positive matches by chance, confirm each candidate against a second known plaintext/ciphertext pair, which quickly eliminates all but the true key pair.
Total time: roughly 2 x 2^56 = 2^57 operations (one pass to build the table, one to probe it), instead of the naive 2^112 needed to brute-force every key pair directly. Total memory: about 2^56 stored table entries, which turns out to be the real bottleneck.
Worked example
Time: 2 x 2^56 = 2^57 ≈ 1.44 x 10^17 single-DES operations, versus a naive brute force of 2^112 ≈ 5.19 x 10^33 key-pair trials, a reduction of about 17 orders of magnitude in time.
Memory: 2^56 ≈ 7.21 x 10^16 entries; at roughly 16 bytes per entry (a 64-bit ciphertext block plus a 56-bit key, with indexing overhead), that is about 1.15 x 10^18 bytes, on the order of an exabyte. This is genuinely large, but well within reach of a well-funded adversary as storage costs fall, and it does not require anywhere near 2^112 time, which is the entire point: MITM shows double-DES's real security sits close to single DES's 2^56, not the naively expected 2^112.
Trade-offs and pitfalls
A common wrong turn is looking at 2^57 in isolation and concluding "that's still huge, so double-DES is fine." The relevant comparison is not to zero, it is to the intended 112-bit target: MITM shows the actual margin is barely one bit better than single DES. Triple-DES fixes this by adding a genuinely independent third key (encrypt-decrypt-encrypt with three keys); the same MITM trick against 3DES would need to search a much larger combined space, restoring most of the intended margin (2-key 3DES is generally estimated at only about 80 bits of practical security against known attacks, still well short of the naive 112, which is one reason NIST now treats 3DES itself as deprecated legacy technology, recommending AES for any new system rather than any variant of DES.
Explain how you would distinguish a theoretical cryptographic weakness (e.g., best-published attack complexity slightly below brute force) from a practically exploitable weakness in an in-use protocol. List at least five criteria or heuristics you would evaluate and describe one empirical test you could run to validate practical exploitability.
Sample Answer
Direct answer
A theoretical weakness, a published attack complexity slightly below brute force, only becomes a practically exploitable one once you check it against real deployment constraints: the attacker capability it actually assumes, the amount of data or queries it needs, the absolute size of the resulting complexity number, and whether the exact oracle or side channel it relies on genuinely exists in the target system. The fastest way to validate this empirically is to actually implement the published attack against a scaled-down or realistic reproduction of the real target and measure whether it behaves as claimed, rather than trusting the asymptotic complexity figure alone.
Structured elaboration
At least five criteria to evaluate, given here as seven for completeness:
- Attacker capability match: does the published attack assume a capability, such as chosen-ciphertext access, related-key access, or many adaptive queries, that the real deployment actually grants an attacker, or is it a capability no realistic attacker in this system could ever obtain?
- Required data or query volume vs realistic limits: does the attack need, say, 2^40 chosen plaintexts under one key, and does the real protocol ever let one key produce that many messages before rotating? An attack needing more data than the system will ever generate under one key is not practically exploitable there.
- Absolute complexity, not just "below brute force": an attack at 2^126 instead of an ideal 2^128 is still practically infeasible; "below brute force" only matters once it crosses into an actually reachable range, calibrated against known real compute budgets.
- Constants and hidden factors: asymptotic notation hides real multiplicative constants and memory requirements; a formally sub-exponential attack can remain computationally or memory-infeasible at the parameter sizes actually deployed.
- Whether the deployment actually exposes the needed oracle or side channel: many published attacks assume an oracle, such as a padding-error distinguishing signal or precise timing measurement, that a specific real implementation may or may not expose; check the actual system rather than assuming the abstract protocol description grants it.
- Reproduction against a real or realistic implementation: has anyone actually run the attack end to end against a live or faithfully reproduced target and measured real resource use, or does it exist only as an asymptotic claim in a paper?
- Independent confirmation or peer scrutiny: has the result been reproduced or reviewed by others? A single, not-yet-reviewed claim deserves more skepticism before it changes deployment decisions.
Empirical test to validate practical exploitability: implement, or obtain a reference implementation of, the published attack, and run it against a scaled-down instance of the real target (a smaller key or parameter size, same algorithm and structure) small enough that the FULL attack can actually complete on available hardware. If it behaves as the paper predicts at that reduced size, recovering the key, forging a tag, or distinguishing as claimed with the predicted resource use, that is strong empirical evidence the underlying mechanism is real and will scale, rather than trusting the asymptotic formula alone. Separately, instrument the actual target system for the SPECIFIC oracle or side channel the attack needs (for example, timing real server responses) to confirm the required leak genuinely exists in this deployment, not just in the abstract protocol description.
Worked example
Walking a real published result type through the criteria: related-key attacks against AES-192 and AES-256 achieve complexities meaningfully below the ideal brute-force bound, but only under a related-key attacker model, where the attacker can request encryptions under keys mathematically related to the target key. Applying the criteria: (1) essentially no real AES deployment ever derives one key from another in a way that grants an attacker related-key access, so this fails criterion 1 immediately; (3) even setting that aside, the resulting complexity remains far outside any reachable compute budget, failing criterion 3 as well. So despite being a genuine, published, peer-reviewed cryptanalytic result, it has essentially zero practical deployment impact for ordinary AES usage, exactly the theoretical-versus-practical gap this question is about.
Trade-offs and pitfalls
A common wrong turn is treating "peer-reviewed and published" as equivalent to "operationally urgent"; most cryptanalytic advances stay purely academic for years, or forever, because they fail one or more of the criteria above. The opposite wrong turn is equally dangerous: dismissing a real published attack as "just theoretical" without actually checking the criteria against the specific deployment, since some results initially waved away as impractical later turned out to be genuinely devastating once someone actually implemented and tested them against a real target.
Unlock Full Question Bank
Get access to all 6 Cryptanalysis and Security Proofs interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.