Question: Question 1 . Given the prime p from the data file for this homework, how many characters can we encode per message? Remember that the
Question Given the prime from the data file for this homework, how many characters can we encode per message? Remember that the ASCII encoding of characters gives a number up to in size. You can take a base logarithm in Sage with the command, usinglog to obtain a numerical estimate. You must justify your answer; saying 'I saw the number in the code' is not sufficient!Alice publishes a public El Gamal key as the elliptic curve given in the
data file with points and where is her secret key and is given in the data file, and cannot be determined from without solving the elliptic curve discrete logarithm problem. Bob chooses a random ephemeral private key sends her the message encoded using the ECencode function as encrypted as inE using the Gamal cipher:
Notice Bob did not need to send Alice the message, only her public key was used.
The Given Code is as follows
def ECencodes:
if lens:
printError: Trying to encode a message too long for this
curve.
return
s strs
x sumordsii for i in rangelens
for i in range:
x modx i p
y xaxb
if modypp:
return Exyp
printFailed to encode message on curve. This should literally almost
never happen."
return False
def ECdecodeP:
n IntegerP
n nn
v
while n :
vappendchrn
n
return joinv
def prtx EE:
if x:
printstrE strx strx
else:
printzcoordinate is not : z strx
p
F GFp
a
b
E EllipticCurveFa b
P
E
k
C
E
C
E
P
E
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
