

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: RSA
incomplete
2: RSA vs. ECC
incomplete
3: RSA Key Generation
incomplete
4: Totient and E
incomplete
5: Modular Arithmetic
incomplete
6: Modular Arithmetic
incomplete
7: Encryption
incomplete
8: Multiplicative Inverse
incomplete
9: Private Key
incomplete
10: Decryption
incomplete
11: Encryption and Decryption Explained
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Due to these properties:
RSA is a secure algorithm that allows us to encrypt and decrypt messages.
c = m^e (mod n)
c is the ciphertextm is the messagee is the public key exponentn is the public key modulusIt's secure because it's not possible to get the original message m back from c. There is no mathematical inverse of this formula without knowing the private key d.
m = c^d (mod n)
m is the messagec is the ciphertextd is the private key exponentn is the public key modulusFirst, let's remember how d was generated: it's the modular multiplicative inverse of e in "mod phi":
ed ≡ 1 (mod ϕ(n))
Which, according to what we learned about these equations being equivalent:
n ≡ r (mod q)
n = qk + r
Can be converted to this equation for the key:
ed = ϕ(n)k + 1
Next, remember that the equation for decryption is:
c^d (mod n)
Which, through substitution of the encryption formula, is the same as:
(m^e)^d (mod n)
Which is the same as:
m^(ed) (mod n)
So we can plug the key equation into the ed in the decryption equation:
m^(ϕ(n)k + 1) (mod n)
Which can be rewritten as:
(m^(ϕ(n)))^k * m (mod n)
Euler's Theorem tells us that:
m^ϕ(n) ≡ 1 (mod n)
So we can rewrite the equation as:
1^k * m (mod n)
Which is just:
m (mod n)
Which is the original unencrypted message m!
Here's another good reference if you're curious to read more.