>
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 etc. and compare the result to MAPLE's primroot function
>
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 = [M1, M2] = [g^k, m*y^k], where k is a random number.
>
>
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 function from the numtheory package
>
(1)
(1)
(b) Test
>
>
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 pt lie on the curve E (and that \Delta_E <> 0).
(a) Pro
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
into the wrong
hands and hence
must be kept secret at
>
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 and 1's.; cf. Maple's help apge on "convert/binary".)
T
>
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 the powers b^k mod m, remember to use the recursive for
>
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 oneline multiplication function:
>
(4)
Testing this for the v
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
polynomial time algorithm if there exist numbers
d1 0,
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 Remainder Theorem it is enough to determine
aE (mod ), fo
>
>
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, 1234^123456789 = 5132 (mod 7777).
If we try to compute t
>
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 the function order in the number theory package:
>
930
>
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
powermod algorithm which we learned in class. If had
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 p pp p p
p
ppppppppppppp
pppp
pppp pppppp pppppp pppp