












Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Theory: Deterministic algorithm to test for primality. • See breakthrough paper “Primes is in P”. Practice: Miller-Rabin Test (randomized algorithm).
Typology: Summaries
1 / 20
This page cannot be seen from the preview
Don't miss anything!













Topic 24: Finding Prime Numbers, RSA
𝑔𝑔 𝑥𝑥mod N = 𝑔𝑔[𝑥𝑥 𝑚𝑚𝑚𝑚𝑚𝑚 𝝓𝝓 𝑵𝑵^ ]^ mod N
Theorem 8.32. For any n > 1 the fraction of n-bit integers that are prime is at least 1 ⁄3𝑛𝑛.
GenerateRandomPrime (1 n^ )
For i=1 to 3n 2 :
p’ {0,1}n- p 1 ‖𝑝𝑝𝑝 if isPrime(p) then return p
return fail
Theorem 8.32. For any n > 1 the fraction of n-bit integers that are prime is at least (^1) ⁄3𝑛𝑛.
GenerateRandomPrime (1 n^ )
For i=1 to 3n 2 :
p’ {0,1}n- p 1 ‖𝑝𝑝𝑝 if isPrime(p) then return p
return fail
Assume for now that we can run isPrime(p). What are the odds that the algorithm fails?
On each iteration the probability that p is not a prime is 1 − (^) 3𝑛𝑛^1
We fail if we pick a non-prime in all 3n 2 iterations. The probability is
1 −
1 3𝑛𝑛
3𝑛𝑛 2 = 1 −
1 3𝑛𝑛
3𝑛𝑛 𝑛𝑛 ≤ 𝑒𝑒 −𝑛𝑛
Input : Integer N and parameter 1t
Output : “prime” or “composite”
for i=1 to t:
a {1,…,N-1} if 𝑎𝑎 𝑁𝑁−1^ ≠ mod N then return “composite”
Return “prime”
Claim: If N is prime then algorithm always outputs “prime”
Proof: For any a ∈ {1,…,N−1} we have 𝑎𝑎 𝑁𝑁−1^ = 𝑎𝑎 𝜙𝜙 𝑁𝑁^ = 1 𝑚𝑚𝑚𝑚𝑚𝑚 𝑁𝑁
Input : Integer N and parameter 1 t
Output : “prime” or “composite”
for i=1 to t:
a {1,…,N-1} if 𝑎𝑎 𝑁𝑁−1^ ≠ 1 mod N then return “composite”
Return “prime”
Fact: If N is composite and not a Carmichael number then the algorithm outputs “composite” with probability 1 − 2 −𝑡𝑡
De cSK ( c ) = 𝑚𝑚 𝑒𝑒^ 𝑚𝑚^ mod N = 𝑚𝑚 𝑒𝑒𝑚𝑚^ mod N = 𝑚𝑚[𝑒𝑒𝑚𝑚^ 𝑚𝑚𝑚𝑚𝑚𝑚 𝝓𝝓 𝑵𝑵^ ]^ mod N = 𝑚𝑚^1 mod N = 𝑚𝑚
Let GenModulus (1n^ ) be a randomized algorithm that outputs (N=pq,p,q) where p and q are n-bit primes (except with negligible probability negl (n)).
Experiment FACTOR (^) A,n
Experiment FACTOR (^) A,n
∀𝑃𝑃𝑃𝑃𝑃𝑃 𝐴𝐴 ∃𝜇𝜇 (negligible) s. t Pr FACTOR (^) A,n = 1 ≤ 𝜇𝜇(𝑛𝑛)
Plain RSA is not secure against chosen-plaintext attacks
Plain RSA is not secure against chosen-plaintext attacks
https://www.cs.purdue.edu/homes/jblocki/courses/555_Spring17/slid es/Lecture24Demo.nb
Note : Online version of mathematica available at https://sandbox.open.wolframcloud.com (reduced functionality, but can be used to solve homework bonus problems)