3.6 Fermat’s Theorem and Euler’s Theorem

Two of the most basic results in number theory are Fermat’s and Euler’s theorems. Originally admired for their theoretical value, they have more recently proved to have important cryptographic applications and will be used repeatedly throughout this book.

Fermat’s Theorem

If p is a prime and p does not divide a,  then

ap11(modp).

Proof. Let

S={1, 2, 3, , p1}.

Consider the map ψ:SS defined by ψ(x)=ax(modp). For example, when p=7 and a=2,  the map ψ takes a number x,  multiplies it by 2, then reduces the result mod 7.

We need to check that if xS,  then ψ(x) is actually in S; that is, ψ(x)0. Suppose ψ(x)=0. Then ax0(modp). Since gcd(a, p)=1,  we can divide this congruence by a to obtain x

Get Introduction to Cryptography with Coding Theory, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.