## Intuitive Proof

The algorithm is based on a Fermat's little theorem

$a^\left\{\left(p-1\right)\right\} \equiv 1 \pmod\left\{p\right\}$

p prime, a & p coprime.

So, if we choose d such that

$e d \equiv 1 \pmod\left\{p-1\right\}$

i.e.

$e d - 1 = k\left(p-1\right)$

Then for a message m

$m^\left\{e^d\right\} \equiv m^\left\{e d\right\} \equiv m^\left\{\left(e d - 1\right)\right\} \cdot m^1 \equiv m^\left\{k\left(p-1\right)\right\}m \equiv 1^km \equiv m \pmod\left\{p\right\}$

So a message that is encrypted by raising m to e can be decrypted by raising the result to d.

In order to provide security, RSA actually calculates

$n = p q$

(p, q prime) and then d such that

$e d \equiv 1\pmod\left\{\left(p-1\right)\left(q-1\right)\right\}$

so

$e d - 1 = k\left(p-1\right)\left(q-1\right)$

We can then continue to calculate

$m^\left\{e^d\right\} \equiv m^\left\{e d\right\} \equiv m^\left\{\left(e d - 1\right)\right\}m \equiv m^\left\{k\left(p-1\right)\left(q-1\right)\right\}m \equiv 1^\left\{k\left(q-1\right)\right\}m\equiv m \pmod\left\{p\right\}$

And likewise for q

$m^\left\{e^d\right\} \equiv m^\left\{e d\right\} \equiv m^\left\{\left(e d - 1\right)\right\}m \equiv m^\left\{k\left(p-1\right)\left(q-1\right)\right\}m \equiv 1^\left\{k\left(p-1\right)\right\}m\equiv m \pmod\left\{q\right\}$

Now if $a\equiv b \pmod\left\{p\right\}$ and $a\equiv b \pmod\left\{q\right\}$ then $a\equiv b \pmod\left\{pq\right\}$, p, q coprime.

so

$m^\left\{e^d\right\} \equiv m \pmod\left\{pq\right\}$

An attacker would need to factor n into p and q in order to determine d, and this is a hard problem.

Note that while an attacker could easily calculate f as

$e f \equiv 1 \pmod\left\{n-1\right\}$

that

$m^\left\{e^f\right\} \equiv m^\left\{k\left(n-1\right)\right\}m \neq m \pmod\left\{n\right\}$

because n is not prime.

This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.

Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.