M 343 L Computer Project solutions and comments Do the following projects on the computer of your choice, using the software of your choice and send me the results by e-mail to voloch@math.utexas.edu by November, 29th. Make sure to include your name in your message. A copy of this project is available on the course web page, so you should NOT retype the numbers below. The big numbers are broken into two lines but they should be understood as continuing on the next line. 1. Encrypt your social security number (no dashes) using the El-Gamal public key cryptosystem with parameters p= 646420927782718589563870857770984404869972572954256253542128245272681510686710283 g=5 and g^a= 458202247467459013436902049938410237719262178957608031235592810706074908848730866 Solution (My secret exponent was a=686270194694237431022221056 but you didn't need to know that) You need to produce a random number r and send me the pair of numbers h= g^r (mod p) and c=m*(g^a)^r (mod p), where m is your SSN. For example, in pari you may enter the above values for p,g,ga ( for g^a, don't call it g^a if you don't have a) r=random() (or if you want a big exponent r=bigrandom()=sum(j=0,10,random()*10^(10*j)) h=lift(Mod(g,p)^r) and if your SSN is 1234567890 c=lift(Mod(1234567890,p)*Mod(ga,p)^r) You send me h,c I can decrypt by a=686270194694237431022221056 ssn(h,c)=lift(Mod(c,p)/(Mod(h,p)^a)) Example session ? bigrandom()=sum(j=0,10,random()*10^(10*j)) ? p=646420927782718589563870857770984404869972572954256253542128245272681510686710283 %4 = 646420927782718589563870857770984404869972572954256253542128245272681510686710283 ? g=5 %5 = 5 ? ga=458202247467459013436902049938410237719262178957608031235592810706074908848730866 %6 = 458202247467459013436902049938410237719262178957608031235592810706074908848730866 ? r=bigrandom %15 = 15019998040760127757135906193011161979230929253064085492829720689048541263288607140825742801317872692084557890 ? h=lift(Mod(g,p)^r) %16 = 291240549423880095513691307414395023185039604919999879943425230789282637525095189 ? c=lift(Mod(1234567890,p)*Mod(ga,p)^r) %17 = 266163362008935925707896039563543659959153582849415550537645039642738838555598760 ? a=686270194694237431022221056 %12 = 686270194694237431022221056 ? ssn(h,c)=lift(Mod(c,p)/(Mod(h,p)^a)) ? ssn(h,c) %18 = 1234567890 2. Find a composite number which is a strong pseudoprime to all bases b between 2 and 9. (hint try numbers of the form (n+1)(2n+1) Solution. First the Miller-Rabin test, outputs 1 if n is a strong pseudoprime to base b, 0 if not. { milrab(n,b,r)=r=0; v=valuation(n-1,2);m=(n-1)/(2^v); c=Mod(b,n)^m;k=0; if(c==Mod(1,n),r=1, while(c != Mod(-1,n) && k0,s=s/2;j--);x=lift(Mod(b,n)^s); if(x != 1 && x != n-1, print(gcd(x+1,n));print(gcd(x-1,n));flag=0,b++)) } This is searching for solutions of x^2 =1 mod n, x not 1 or -1, among the b^((ed-1)/2^j) mod n. Another solution, that works because ed-1 is not much bigger than n is to take n as a reasonable approximation to phi(n) (which we don't know) in the sense that n/phi(n) is close to 1 so (ed-1)/n should be close to (ed-1)/phi(n). We find that (ed-1)/n is very close to 7 so we can guess that phi(n)=(ed-1)/7 and from that get the factors of n.