next up previous
Next: The Discrete Logarithm Problem Up: Lecture 8: Public-key Crypto Previous: Some Quotes

Let's try it!

To make finding $ g$ easier, let's choose a prime $ p$ such that $ (p-1)/2=q$ is prime (so $ p-1 = 2q$, with $ q$ prime). Since for any $ g$ with $ \gcd(g,p)=1$,

$\displaystyle g^{2q} \equiv 1\pmod{p},
$

the order of $ g$ is $ 1$, $ 2$, $ q$, or $ 2q=p-1$, so the order of $ g$ is easy to compute.

For our first example, let $ p=23$. Then $ g=5$ has order $ p-1=22$. (I found $ g=5$ using the function znprimroot in PARI. You can also just compute the order of $ 2$, $ 3$, etc., until you find a number with order $ p-1$.)



Nikita: Chooses secret $ n=12$; sends $ g^{12} = 5^{12} \equiv \mathbf{18}
\pmod{23}$.



Michael: Chooses secret $ n=5$; sends $ g^5 = 5^5 \equiv \mathbf{20}
\pmod{23}$.



Compute Shared Secret:
Nikita: $ 20^{12} \equiv \mathbf{3}\pmod{23}
$
Michael: $ 18^{5} \equiv \mathbf{3}\pmod{23}.
$



William A Stein 2001-09-28