Some Necessary Math Backgrounds

Before getting to RSA, let's make sure to visit some quic Math concepts that are necessary to understand the protocol.

Greatest Common Divisor (GCD)

GCD is the largest positive integer that divides two or more integers without leaving a remainder.

Example

GCD(4, 8) = 4 because 4 is the largest number that divides both 4 and 8

GCD(34, 51) = 17 because 17 is the largest number that divides both 34 and 51

Single Choice

What is GCD(97, 31)

Co-Prime

We called two integers a,ba, b co-prime to each other when GCD(a,b) = 1

Euler’s Totient Function

Euler Totient Function Ο•(n)\phi(n) is the function that counts the integers less than nn that are co-prime to nn.

Given n=∏i=1rpikin = \prod_{i=1}^{r}p_i^{k_i},

Ο•(n)=Ο•(p1k1)Ο•(p2k2)...Ο•(prkr)\phi(n) =\phi(p_1^{k_1}) \phi(p_2^{k_2})... \phi(p_r^{k_r})

=p1k1(1βˆ’1p1)p2k2(1βˆ’1p2)...prkr(1βˆ’1pr)= p_1^{k_1}(1-\frac{1}{p_1})p_2^{k_2}(1-\frac{1}{p_2})... p_r^{k_r}(1-\frac{1}{p_r})

=p1k1p2k2...prkr(1βˆ’1p1)(1βˆ’1p2)...(1βˆ’1pr)= p_1^{k_1}p_2^{k_2}...p_r^{k_r}(1-\frac{1}{p_1})(1-\frac{1}{p_2})...(1-\frac{1}{p_r})

=n(1βˆ’1p1)(1βˆ’1p2)...(1βˆ’1pr)= n(1-\frac{1}{p_1})(1-\frac{1}{p_2})...(1-\frac{1}{p_r})

Euler’s Theorem

For any co-prime a,na, n. This statement is true: aΟ•(n)≑1Β modΒ na^{\phi(n)} \equiv 1\ mod\ n

Integer Factorization Problem (IFP)

The Integer Factorization Problem asserts that:

Given: A large integer n=pβˆ—qn=p*q (e.g. 2048 bits)., where p,qp,q are large prime number.

Assumption: It is computationally infeasible to factor nn into pβˆ—qp*q in polynomial time with classical computers.