Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started