InterviewStack.io LogoInterviewStack.io

Number Theory for Cryptography Questions

Comprehensive mastery of the number theoretic and algebraic foundations that underpin modern cryptography. Core topics include modular arithmetic and modular exponentiation, prime number theory and primality testing, integer factorization problems, the discrete logarithm problem in multiplicative groups, quadratic residues and Legendre and Jacobi symbols, Euler theorem, group theory, ring theory, finite fields, and elliptic curve groups. Candidates should be able to apply these concepts to analyze and explain public key systems such as Rivest Shamir Adleman, Diffie Hellman key exchange, ElGamal, and elliptic curve cryptography, and to show why security reduces to the hardness of integer factorization or discrete logarithm in the appropriate group. The scope covers algorithmic tools and their practical complexity including the extended Euclidean algorithm, fast modular exponentiation, Chinese remainder theorem, Miller Rabin and deterministic primality tests, trial division, Pollard rho and Pollard p minus one factorization methods, elliptic curve method for factorization, quadratic sieve, general number field sieve, baby step giant step, Pollard rho for discrete logarithm, and index calculus approaches. Candidates should be comfortable solving representative problems by hand or with small code examples such as computing modular inverses, performing modular exponentiation, applying the Chinese remainder theorem, solving small discrete logarithm instances, and reasoning about how algorithmic advances translate into concrete key size and security recommendations.

EasyTechnical
57 practiced
RSA fundamentals: given p = 61, q = 53 and public exponent e = 17, compute N = p * q, phi(N), find the private exponent d (the modular inverse of e mod phi(N)), encrypt plaintext m = 65 to obtain c = m^e mod N, and then decrypt c to recover m. Show all intermediate calculations and explain why decryption recovers the original message.
HardTechnical
77 practiced
Compare the Quadratic Sieve (QS) and the General Number Field Sieve (GNFS) in detail: explain core ideas of each algorithm, their asymptotic complexities, and the practical crossover point where GNFS becomes more efficient than QS. Use numeric examples to indicate roughly where QS is still used and where GNFS dominates for factoring integers relevant to cryptographic key sizes.
EasyTechnical
60 practiced
Solve the simultaneous congruences using the Chinese Remainder Theorem (CRT): x ≡ 2 (mod 3), x ≡ 3 (mod 5), x ≡ 2 (mod 7). Show the construction using the CRT formula (explicitly compute the N_i and inverses) and give the unique solution modulo the product of the moduli.
MediumTechnical
69 practiced
Write a Python function compute_rsa_private(p, q, e) that computes the RSA private exponent d (i.e., modular inverse of e modulo phi(N)). The function should raise an exception if e is not invertible. Demonstrate the function with p = 61, q = 53, e = 17 and include basic input validation and comments explaining each step.
MediumTechnical
59 practiced
Describe the baby-step giant-step algorithm for solving the discrete logarithm problem. Then apply it to solve 2^x ≡ 5 (mod 101) by explicitly building the baby-step table and performing giant steps. Analyze the algorithm's time and memory complexity and discuss practical memory-time trade-offs.

Unlock Full Question Bank

Get access to hundreds of Number Theory for Cryptography interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.