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:
Knights Templar
beige
Changing your sexuality
Anthrax
Everything Style Guide
retina
Live and Let Die
Walter Matthau
Gun safety
Good Bye Lenin!
Taking Down Large Larry
Bard
Palisade Restaurant
New Writeups
tonymasiello
Google Knol(idea)
Mythi
July 24, 2008(personal)
locke baron
The fall of Earth(fiction)
BookReader
Fear the Cold(dream)
Pavlovna
Kathleen MacInnes(person)
stainedglass
1(fiction)
kalen
Three "T"s(idea)
octillion369
Undead(idea)
archiewood
Ico(fiction)
Heisenberg
Why I love Everything2(log)
octillion369
Death Knight(person)
XWiz
Are you hoping for a miracle?(review)
santo
The Host(review)
LostPsion
"Shut the Fuck Up" Theaters(idea)
beatrice
You've been slowly taking me over for nearly a year, do you know that?(idea)
This affordable entertainment brought to you by The Everything Development Company