>
Problem 5(a): Primitive root algorithm:
 uses MAPLE's order function in the numtheory package
>
myprimroot: finds the smallest primitive root mod p.
>
(1)
(1)
Test this for p1 = 48947, p2 = 48673 e
>
Problem 4: The ElGamal message transmission
(a) The ElGamal protocol:
This encrypts a given message m in F_p using the public key (g, y, p)
 requires random numbers in the range [2,.p2].
Output: M
>
>
Problem 4: Finding the number of points on an elliptic curve
(a) Program to calculate the number of points on the elliptic curve
y^2 = x^3 + ax +b, with a, b \in F_p.
Note: This uses the legendre
>
>
Problem 1: The program multpt(k, pt, a, p).
This computes the multiple k*pt of a point pt on the elliptic curve
E: y^2 = x^3 + ax + b over F_p by the binary power method.
Note: It is assumed that
Public Key Cryptography
This message is
topsecret!
It must not fall
into the wrong
hands and hence
must be kept secret at all costs.

encode


decode

This message is
topsecret!
It must not fall
>
Problem 3(a): Converting numbers to binary form
>
(1)
>
(2)
(2)
The first command returns the binary expansion of 654123. (Note that this is actually an integer
whose decimal expansion has only 0's
>
Problem 4(a): Making a power table of b in (Z/mZ)^x:
The following program powtab(b,m) constructs a list whose kth element is b^k.
If gcd(b,m) > 1, then its returns FAI.
>
(1)
Note: In calculating
>
Problem 5(a): Calculating products in A_f, where f = x^4 + x^ 2 + 3 mod 7.
>
(1)
(1)
Calculate the product g1*g2 in A_f, where
>
(2)
>
(3)
(3)
Thus, [g1]*[g2] = [h] in A_f, where h =
(b) The onelin
Polynomial Time Algorithms
Denition: Let P (n1, . . . , nr ) be an algorithm involving positive integers n1, . . . , nr of k1, . . . , kr bits,
respectively. Then we say that P (n1, . . . , nr ) is a
Schoof s Algorithm (Basic Ideas)
Given: An elliptic curve E : y 2 = f (x) over Fq , q = pr .
Find: #E (Fq ) or, equivalently, aE = q + 1 #E (Fq ).
First reduction: By Hasses theorem and the Chinese Re
>
>
Note: The "restart" command is not necessary, but it is useful for restarting your program if you
made multiple mistakes in your computations.
Problem 5(a): Using MAPLE's power mod:
>
5132
Thus, 1
>
Problem 5(a): Using MAPLE's numtheory package:
>
Note: The "restart" command is not necessary, but it is useful for restarting your program if you
made multiple mistakes in your computations.
Using
>
Problem 3: The RSA encription method
>
(a) Program to encode a given message m using pulic key (n,e) :
>
(1)
(1)
Notes: 1) Recall that the command "Power(m,e) mod n" is MAPLE's implementation of the
The Dancing Men
Sir Arthur Conan Doyle
Message 1:
pppppppspppp
p
p pp
pppp pppppp
ppppppsppppp pppppppspppp ppppppspppp pppppppspppp pppppppspppp ppppppsppppp s pppppppspppp
p
p
p
p
pp
pp
pp
p p p p p