The idea of Public Key Cryptography is to send messages in such a way
that only the person who receives them can understand them even if the method
of encryption is discovered by 'an enemy' who intercepts the messages.
The person who sends the message encodes it; the person who receives
the message decodes it (puts it back into a readable form).
Public Key Cryptography was discovered (or invented?)
by R. Rivest, A. Shamir and L.Adleman about 1970. This method has been widely
used to ensure security and secrecy in electronic communication and particularly
where financial transactions are involved.
The method depends on the fact that while it is easy to calculate the product
of two large prime numbers (particularly with the help of a computer) it is,
for all practical purposes, impossible to find the factors of a large number
if it has only very large prime factors. This is because all methods of
finding such factors would take many many thousands of years by even the
fastest modern computers.
In order to understand this article you need to know that two numbers are said
to be congruent in modulus arithmetic if their difference is divisible by the
modulus. For example 23 is congruent to 2 modulus 7 because the difference
between 2 and 23 is divisible by 7. Another way of expressing this is to say
if and only if
where
is an integer.
Everything else you need to know is explained in the article.
The Basic Idea (i) Bob wants to receive a coded message from Alice. (ii) EVERYBODY knows how to write the message in code. (iii) Bob is the ONLY person who knows how to decode the coded message.
The idea is that Bob chooses two (very large) prime numbers
and
,
and then writes
. Then
is used to code the message, but
and
are needed to decode the message.
The details: (1) Bob chooses two very large (distinct) prime numbers
and
; (2)
,
(lcm is the
least common multiple); (3) Bob chooses
, where
and
is coprime with
(i.e.
and
have no factors in common); (4) Bob then finds the unique
such that
mod
\. (5) Bob now tells everyone what
and
are, but does NOT say what
,
or
are. (6) Alice wants to send the message
(a single number) where
and
are coprime and
. (7) Alice finds
, where
mod
, and sends the
message
to Bob. (8) Bob receives the message
from Alice and decodes it.
Now Bob knows
, and he uses these to decode the
message
from Alice so as to find
. To do this Bob uses the theorem
that
In the following example we use small numbers so that you can work through it
using a calculator. In practice the numbers would be very big.
An example (1) Alice wishes to send the message
to Bob (2) Bob chooses
,
; so
,
,
and
. (3) Bob then tells Alice that
and
. (4) Note: It does not matter how many people have this information, they
still won't be able to find
. (5) Alice computes
and finds that
. (5) Bob receives the coded message
from Alice (6) Bob now calculates
, and finds Alice's
secret message
. Can you find it?
In order to find Alice's message you may need some help from the following
section.
Working with modulus arithmetic
You need to use the following facts: (1) If
then
(2) If
then
.
The proofs of these results are simple.
(1) If
then
divides
and if
divides
then
divides
which is the same as saying
.
(2) As
always has a factor
for all k it follows that if
divides
then
divides
so if
then
.
In order to find the secret number that Alice sent to Bob as described above
you will need to use the same sort of method as in the following example.
Suppose you want to find
where (
) and
.
As
is too large for most calculators to show exactly we start with
and, first dividing this by 101, we find that
so we now know that
The next step is to use this to tackle
.
Hence
.
Finally we prove the theorem that
,
where
and
are coprime, given that
(i)
(ii)
(iii)
Proof
As
and
are coprime we know that
and
are coprime and
and
are coprime.
By Fermat's Little Theorem it follows that
Also
and
divide
so say
, then
Similarly
So both
and
divide
and, as
, it follows that
.
We know that
so
for some integer
.
Putting all this together we have
For Further Reading
Singh, Simon (1999) 'The Code Book - The Science of Secrecy from Ancient
Egypt to Quantum Cryptography', The Fourth Estate, London ISBN 1 85702 879 1
Flannery, Sarah (2000) 'In Code - A Mathematical Journey' Profile Books,
ISBN 1 86197 222 9
This is a unique book, written by a teenager, and highly recommended for
all young people interested in mathematics.