How does RSA work

It's pretty damn cool

Euler's theorem

\text{We have } a^{\phi(m)} = 1 \mod{m}
\text{For any } a, m \text{ such that gcd}(a, m)=1

This is fundamental for RSA. We will see that it's the reason why it works (not the reason it's secure however)

What's so special about 1?

a^{\phi(m)} = 1 \mod{m}

We care because 1 means we cycle.

Getting our intuition kicking in

And let's use numbers cos why not

\text{Let } a = 2, m = 5
\text{By Euler's theorem, we have } 2^{\phi(5)} = 1 \mod{5}.
(\text{Since 5 is prime, } \phi(5) = 5 - 1 = 4)
2^4 = 2 \cdot 2 \cdot 2 \cdot 2 = 1 \mod{5}
2^5 = \underbrace{2^4}_\text{1} \cdot 2 = 2^1 \mod{5}
2^{15} = \underbrace{2^{4 \cdot 3}}_\text{1} \cdot 2^3 = 2^3 \mod{5}

The cycle

a^t = a^{(t \mod{\phi(m)})} \mod{m}

Encryption and decryption

Gotta be inverses of each other right?

\text{enc: } m \rightarrow m^t \mod{N}

Not going to justify why we choose this, I want to focus on the decryption function

\text{dec}(m^t) \stackrel{?}{=} m = m^1

Decryption function

\text{dec: } c \rightarrow c^s \mod{N}

How do we choose s?

\text{dec}(\text{enc}(m)) = m
\text{dec}(m^t) = m
(m^t)^s = m
m^{ts} = m^1
\text{Remember that} \\ \text{we are working} \\ \text{in }\mathbb{Z}_N
m^{ts} = m^1 \mod{N}

Combining it all together

m^{ts \mod{\phi(N)}} = m^1 \mod{N}
\text{We need to find } t,s \text{ such that}
t \cdot s = 1 \mod{\phi(N)}

Why is it secure tho?

\text{Because } \phi(N) \text{ is bloody hard to compute}

(incomplete)

Cheers

Mathieu Paturel

30 July 2020

Finite Maths (MATH2400 <3)

deck

By Mathieu Paturel