Question: Question 4. Alice sets up an EIGamal key with prime p, primitive root g, and private key (exponent) a defined in the file HW3 Data.txt.

 Question 4. Alice sets up an EIGamal key with prime p,primitive root g, and private key (exponent) a defined in the file

Question 4. Alice sets up an EIGamal key with prime p, primitive root g, and private key (exponent) a defined in the file HW3 Data.txt. Bob takes his message string s, encodes it with the new encode function, and uses Alice's key to generate the encrypted pair (c1, c2). What did Bob say? (Once you recover his message in encoded form, use decode to change the number back into a string.) Remember, you can use mod(n,p) to represent the equivalence class of n modulo p as an element of Z/pZ. So if you want to calculate, say, I y modulo p, you can say mod (x*y,p). Submit a pdf your Sage/CoCalc Worksheet. def encode(s): s = str(s) return sum(ord(s[i]) *256^i for i in range (len(s))) def decode (n): n = Integer (n) v = [] while n != 0: v.append (chr (n $256)) n // = 256 return ".join(v) 24512806367080779995578682555970447475954134426471557062537575503480981319 2517399080934811 g = IntegerModRing (p) (3) 35417292103649840682474357827391213481568116932732503607686891944988824119 435383742903226 c1 = 11170061227985119992874580415985293496724284383567871623990073508051645485 1068601412325475 c2 = 72775112897639502642510270141281087589691242829769705085238426686756775597 405094767685157 Question 4. Alice sets up an EIGamal key with prime p, primitive root g, and private key (exponent) a defined in the file HW3 Data.txt. Bob takes his message string s, encodes it with the new encode function, and uses Alice's key to generate the encrypted pair (c1, c2). What did Bob say? (Once you recover his message in encoded form, use decode to change the number back into a string.) Remember, you can use mod(n,p) to represent the equivalence class of n modulo p as an element of Z/pZ. So if you want to calculate, say, I y modulo p, you can say mod (x*y,p). Submit a pdf your Sage/CoCalc Worksheet. def encode(s): s = str(s) return sum(ord(s[i]) *256^i for i in range (len(s))) def decode (n): n = Integer (n) v = [] while n != 0: v.append (chr (n $256)) n // = 256 return ".join(v) 24512806367080779995578682555970447475954134426471557062537575503480981319 2517399080934811 g = IntegerModRing (p) (3) 35417292103649840682474357827391213481568116932732503607686891944988824119 435383742903226 c1 = 11170061227985119992874580415985293496724284383567871623990073508051645485 1068601412325475 c2 = 72775112897639502642510270141281087589691242829769705085238426686756775597 405094767685157

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!