COMP 547: Assignment 1 Solutions
COMP 547: Assignment 1 Solutions
COMP 547: Assignment 1 Solutions
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
square root. In other words, we would like to be able to let msqrt know<br />
n’s factorisation n = pq, as this would allow for an efficient search for<br />
a square root modulo n, using the techniques seen in class. However,<br />
since msqrt does not allow us to do this, we must write our own function,<br />
pqsqrt, which works exactly like msqrt, except that instead of providing<br />
the function with n, we provide it with n’s prime factorisation n = pq.<br />
9. To pick my two primes p, q starting by 1 followed by 669955887 and ending<br />
by 01 or 03 of a 100 bits :<br />
genpq := proc()<br />
local p, q;<br />
randomize();<br />
p := 0;<br />
q := 0;<br />
while not isprime(p) do<br />
p := 1669955887*10^90 + rand(0..10^88-1)()*10^2 + 1;<br />
end do;<br />
while not isprime(q) do<br />
q := 1669955887*10^90 + rand(0..10^88-1)()*10^2 + 3;<br />
end do;<br />
return(p, q);<br />
end proc;<br />
This generated the following p, q pair:<br />
p := 1669955887263026818036412887272431375849039042767749903\<br />
1212357065431346056087<strong>547</strong>58160586255799694301;<br />
q := 1669955887003361797744279814925958377127037938538442466\<br />
825381252778399643783166093655256052781392403;<br />
Computing n = pq yielded the following:<br />
n := 1587706207511861907832769125027465150069895085728428488\<br />
006051557553392116910484620485578137364900762730201415942\<br />
132714983409510118890246103424460950790756546532252049282\<br />
409606090137788255468523795303;<br />
10. To pick my two random quadratic non-residues y and z,here is the following<br />
Maple function:<br />
genyz := proc(n, p, q)<br />
local a, b, y, z;<br />
randomize();<br />
with(numtheory);<br />
12