16 Public-Key Cryptography 153
the school. An eavesdropper who cannot do division cannot decrypt the mes-
sage. It is kept private as long as Alice and Bob do not each reveal a secret
number. Furthermore, it was not necessary for Alice and Bob to meet before.
This is the main advantage of this system compared to the one-time pad from
Chap. 15.
Without Limited Mathematics
Our system is secure as long as no one is able to do divisions. However, all of
us have learned at school how to do divisions.
If you have read the previous chapters of this book carefully, you may
have noticed that by using one of the previous methods a division could be
achieved very fast (see Chap. 1). To compute the fraction a/b one may simply
guess a candidate c between 0 and a for given natural numbers a and b. Then,
one checks whether b ·c really equals a. If the result is bigger than a, a smaller
value for c must be the true one. If the result is smaller than a, it has to be the
other way around. Applying this idea repeatedly, always choosing the median
of the remaining interval (i.e., performing a binary search), we get the result
very fast.
This method uses the fact that the fraction a/b becomes smaller when b
gets larger. Otherwise, binary search would not be applicable.
A binary search will fail, however, if our calculus is based on residues. The
mathematical background for modular arithmetic is explained below. Since a
division is still efficiently computable for residues, we also have to replace the
division by something else.
ElGamal’s Method
There are (many) more operations in mathematics than just the basic arith-
metic operations. We cleverly choose new operations that are easy to perform,
and use them to replace addition, subtraction, and multiplication in our prim-
itive system from above. The operations are the following.
• Instead of addition we use modular multiplication. (Modular multiplication
is a multiplication on residues. See also the algorithms from Chap. 17 where
modular multiplication is used for sharing a secret.)
• Instead of subtraction we use modular division.
• Instead of multiplication we use modular exponentiation.
• Instead of division we use the modular logarithm.
The resulting method is known as the ElGamal cryptosystem. Till now,
no one knows an algorithm to compute the modular logarithm (also known
as the discrete logarithm) for large numbers (numbers with more than 1000
digits) efficiently. All known algorithms, however, need several centuries even
when running on the fastest computers. Even if at some time in the future
the message is decoded without the private key, it does not help because the
party will be over by that time.