#GLORIA LIU, Apr 20 2024, Assignment 24 read `C24.txt`: #=====================================# #1. Decide whether you would like to sign up for the annual field trip to the Princeton cemetery followed by a free dinner. #{} #=====================================# #2. Generalize AliceToBob(M,Nbob,eBob,Nalice,dAlice,H) and BobReadAlice(MS,Nbob,dBob,Nalice,eAlice,H) to #AliceToBobG(ListM,Nbob,eBob,Nalice,dAlice,H) and BobReadAliceG(MS,Nbob,dBob,Nalice,eAlice,H) (where MS=[ListM',S]), #where ListM is an arbitrary list of integers each between 1 and Nbob, and the signature is the sum of the integers in #ListM cubed mod H. The encrypting and descryting is done separately for each member of ListM. AliceToBobG:=proc(ListM,Nbob,eBob,Nalice,dAlice,H) local m,ListM1,m1,x,S: ListM1:=[]: x:=0: for m in ListM do m1:=m&^eBob mod Nbob: ListM1:=[op(ListM1), m1]: x:=x+m mod H: od: x:=x&^3 mod H: S:=x&^dAlice mod Nalice: [ListM1, S]: end: BobReadAlice:=proc(MS,Nbob,dBob,Nalice,eAlice,H) local m1,m,ListM,ListM1,S,x,x1: ListM1:=MS[1]: S:=MS[2]: ListM:=[]: x:=0: for m1 in MS do m:=m1&^dBob mod Nbob: ListM:=[op(ListM), m]: x:=x+m mod H: od: x:=x&^3 mod H: x1:=S&^eAlice mod Nalice: if x1<>x then RETURN(FAIL): fi: ListM: end: #=====================================# #3. Look at the class mailing list and find the three students right after you #Email them your public ([N,e]) part of your public key (but keep d to yourself). Also email them your public H (so the #Hash function is M^3 mod H) #Ask them to email you THEIR [N,e] but to keep their d to themselves. key:=MakeRSAkey(20,10); H:=nextprime(rand(10^10..10^11)()); #key := [249846258933717282231658119892328072250259,57885386393133504599689153013392340889181,108767995984135205057484974537235722651557] #H := 67646025787 #I sent the correct message and signature to Nkhalo, [1361451599237996173775, 63408949518079727907542252003102021972084] using the public key N := 2111365616595924973189 e := 332986169625729448079. He was able to decode it correctly. #I sent the correct message and signature to Lucy, [1609714563803922791728, 63408949518079727907542252003102021972084] using the public key N=1883925284252198456411 e=489703529340811966481. #I received [127194014635818882616264466777093555824061, 867633009183092191876] from Joseph and was able to find his birthday (6122003). #Update: I received [220212942073894330003834774776685565211173, 298332590935502338435285101982783606776542] from Nuray and was able to find her birthday (8042003).