I think most people have learned this in MATH 347 course.

for two differet large primes $p,q$, let $d$ be a number such that $(d,(p-1)(q-1))=1$

suppose the original code is converted into a number k (For example: "cat" can be converted into "$003001020$")

note that $k \leq pq$

then use computer to calculate the residue of $k^d$ modulo $p$, call it $n$

this number will be sent as a message.

Here, $pq$ and $d$ is public, but $p, q$ are indvidually secret.

The way to decrypt the code is to find $e$ such that $de-t(p-1)(q-1)=1$.

Ususally, $e$ is given to the legal destination so that they can decrypt it quickly.

By Euler's Theorem, we know that $n^e \equiv (k^d)^e \equiv k^de \equiv k^(1+t(p-1)(q-1)) \equiv k \mod {pq}$

Hence we can get $k$ back quickly.

However, for people who don't know $e$, it'll take them a long time to factorize $pq$

Before they find $p,q$, the value of $p, q$ is already changed!!