HW#7 9.7.2 and 9.7.3

1664 days ago by grenquistl0915

NA = 171024704183616109700818066925197841516671277 NB = 839073542734369359260871355939062622747633109 EA = 1571 EB = 87697 PB = 98763457697834568934613 QB = 8495789457893457345793 M1 = 418726553997094258577980055061305150940547956 S1 = 749142649641548101520133634736865752883277237 PHI=((PB-1)*(QB-1)) DB = EB.inverse_mod(PHI) 
       
m = pow(M1,DB,NB) s = pow(S1,DB,NB) MA = pow(int(s),EA,NA) print "m = ", print m print "s = ", print s print "MA = ", print MA # m = MA so the message did come from Alice # the message is "saygoodbye" 
       
m =  19012507151504022505
s =  150270996499036309478023705411245214416829627
MA =  19012507151504022505
m =  19012507151504022505
s =  150270996499036309478023705411245214416829627
MA =  19012507151504022505
#Problem 3 
       
pB = 7865712896579 qB = 8495789457893457345793 m2 = 14823765232498712344512418717130930 s2 = 43176121628465441340112418672065063 nB = pB*qB S2 = pow(s2,DB,10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) MA2 = pow(int(S2),EA,NA) print "nB = ", print nB print "S2 = ", print S2 #nA != m print "(s-nB) = ", print (s-nB) # Because S2 is so much bigger than nB you only get the modular answer in the last part so mod nB changes what s is so you can't decode the message using s. 
       
nB =  66825440705572478534950243249742147
S2 = 
724842248105301237380023637396949572247200781421419626749374469187784771\
674015386843489665923955555864222920103
(s-nB) =  150270996432210868772451226876294971167087480
nB =  66825440705572478534950243249742147
S2 =  724842248105301237380023637396949572247200781421419626749374469187784771674015386843489665923955555864222920103
(s-nB) =  150270996432210868772451226876294971167087480