Everything2
Near Matches
Ignore Exact
Full Text
Everything2

Mathematics of RSA

created by fritz

(idea) by fritz (7 y) (print)   ?   (I like it!) 2 C!s Sun Feb 25 2001 at 2:30:19

So why does the RSA cryptosystem work? First, let's recall how it works. You pick two primes p and q of roughly the same size. You then let n = pq. This is the modulus you'll use. The public "exponent of encryption" e you set to a small constant (so that people who are sending you messages can do so at little computational cost). Then you find the multiplicative inverse d of e modulo phi(n) where phi(n) is the number of integers less than n to which it is relatively prime. This d is your private key (the "exponent of decryption"). So you publish the pair (n,e) and keep d secret. You can compute d because you know p and q and therefore phi(n). Other people cannot compute d because they don't know p and q and therefore don't know phi(n).

Whew. OK. Now for why it works:

 Fact 1:    if    x = y mod phi(n)
            then  mx = my mod n       for all m

 Fact 2:    ed = 1 mod phi(n)
            because d is selected as e's inverse mod phi(n)

 Therefore:
            
            med= m1 mod n         for all m by fact 1

 So when someone encrypts m to you she computes:  c = me mod n
 When you decrypt you compute:

           cd = (me)d mod n
              = med   mod n       by high school math
              = m1    mod n       by fact 1
              = m     mod n

 And we're done!
Note that you can prove Fact 1 above (the important part of the math, IMHO), using Fermat's Little Theorem or Euler's Theorem.

This cryptosystem is conjectured to be strong because given n and e, there is no known (efficient) algorithm that can find d. In fact, if you can find such an algorithm you will be very very very famous because then you will have found an efficient way to factor large numbers.


printable version
chaos

Fermat's little theorem public key cryptography RSA relatively prime
Euler's theorem Modulus phi cryptographic primitives
Cryptography modern cryptography Butterfinger McFlurry multiplicative inverse
public-key encryption cryptosystem Perrin numbers Cryptology
modulo efficient factor crypto
whoami Euler
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
After stirring Everything, these nodes rose to the top:
Repeat until dead
Words that are supposedly untranslatable
The Texas Chain Saw Massacre
Dutch Revolt
Tales of "The Rocky Horror Picture Show"
Refrigerant
auditory localization
strawberries
I will be the first thing you will be thinking about after you wake
Thermopylae
Perry Mason
Flapper
Dies Irae
New Writeups
Vanish
The line between normal and not(place)
Vanish
insanity(thing)
beatrice
You've been slowly taking me over for nearly a year, do you know that?(idea)
Berek
YouTube(thing)
shaogo
How to Pretend to Have a Job(idea)
hapax
Les Provinciales(review)
zoeb
The Scene(review)
aneurin
Telephone Numbers for drama purposes(idea)
Alnilamski
Cosmicopolis(fiction)
eien_meru
measure(idea)
Dreamvirus
pussy willow(thing)
czeano
Three "T"s(idea)
UncleM
Vantage Point 2: Fractal Thread Count(idea)
LostPsion
First Fiction: Night(fiction)
Lysander Peregrine
How to Pretend to Have a Job(idea)
Everything 2 is brought to you by the letter C and The Everything Development Company