next up previous contents
Next: A Bigger Example in Up: Examples Previous: Examples   Contents

A Small Example

So the arithmetic is easy to follow, we use small primes $ p$ and $ q$ and encrypt the single letter ``X''.

  1. Choose $ p$ and $ q$: Let $ p=17$, $ q=19$, so $ n=pq = 323$.
  2. Compute $ \varphi (n)$:

    $\displaystyle \varphi (n) = \varphi (p\cdot q)=\varphi (p)\cdot\varphi (q)
= (p-1)(q-1) = pq-p-q+1 = 323-17-19+1 = 288.$

  3. Randomly choose an $ e\in\mathbb{Z}/323\mathbb{Z}$: We choose $ e=95$.
  4. Solve

    $\displaystyle 95x \equiv 1\pmod{288}.
$

    Using the GCD algorithm, we find that $ d=191$ solves the equation.

The public key is $ (323,95)$. So $ E:\mathbb{Z}/323\mathbb{Z}\rightarrow \mathbb{Z}/323\mathbb{Z}$ is defined by

$\displaystyle E(x) = x^{95}.
$

Next, we encrypt the letter ``X''. It is encoded as the number $ 24$, since X is the $ 24$th letter of the alphabet. We have

$\displaystyle E(24) = 24^{95} = 294 \in \mathbb{Z}/323\mathbb{Z}.
$

To decrypt, we compute $ E^{-1}$:

$\displaystyle E^{-1}(294) = 294^{191} = 24 \in \mathbb{Z}/323\mathbb{Z}.
$



William A Stein 2001-10-01