← back to Number Theory

Primitive Roots

Jim Hefferon · Elementary Number Theory · Ch. 7

A primitive root mod p is a number whose powers cycle through all nonzero residues. Every prime has one. Finding discrete logarithms (inverting this cycle) is believed to be hard, which is the foundation of Diffie-Hellman key exchange.

Order of an element

The order of a mod n is the smallest positive integer k such that a^k ≡ 1 (mod n). A primitive root mod p has order p - 1: its powers hit every nonzero residue exactly once.

Powers of 2 mod 13: a primitive root 1 2 4 8 3 6 12 11 9 5 10 7 2^0 = 1 2^1 = 2 2^2 = 4 ... 2^12 = 1
Scheme

The discrete logarithm problem

Given g, h, p where g is a primitive root mod p, find x such that g^x ≡ h (mod p). Going forward (computing g^x) is fast. Going backward (finding x from h) is believed to be hard for large p. This asymmetry is the basis of Diffie-Hellman and related cryptosystems.

Scheme
Neighbors