home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: sci.math
- Path: sparky!uunet!pipex!pavo.csi.cam.ac.uk!gjm11
- From: gjm11@cus.cam.ac.uk (G.J. McCaughan)
- Subject: Re: HELP on RSA scheme for Encryption/Decryption
- Message-ID: <1992Nov11.170156.307@infodev.cam.ac.uk>
- Sender: news@infodev.cam.ac.uk (USENET news)
- Nntp-Posting-Host: bootes.cus.cam.ac.uk
- Organization: U of Cambridge, England
- References: <6605@dciem.dciem.dnd.ca>
- Distribution: na
- Date: Wed, 11 Nov 1992 17:01:56 GMT
- Lines: 52
-
- In article <6605@dciem.dciem.dnd.ca> jorchard@dretor.dciem.dnd.ca writes:
-
- > I would like to know the algorithm for encrypting/decrypting codes
- > with the RSA scheme. I took it in first year algebra, but I sold my
- > textbook and can't remember for the life of me how it went.
- >
- > Could someone out there with better resources (or better memory)
- > help me?
-
- Surely.
-
- Everyone who wants to be sent messages using the RSA scheme picks two
- large prime numbers, say p and q, and multiplies them together to give
- a number n=pq.
- He also picks a number d coprime to phi(n)=(p-1)(q-1).
- He computes another number e, which has the property: de congruent 1 mod phi(n)
- He makes public the numbers n and e.
- He keeps private the numbers p and q; also phi(n) [as given pq and (p-1)(q-1)
- one can find p and q by solving a quadratic equation]; also d [for reasons
- which will become clear].
-
- Now, the first important fact you need to know is that any number coprime to n
- has a^phi(n) congruent to 1 mod n.
-
- So, if someone wants to send this guy a message, she does this: encode the
- message in some standard way as a sequence of numbers less than n and coprime
- to n. Then for each such number a, compute a^e mod n; the resulting sequence
- is the encrypted message.
-
- To decrypt this, suppose b is one of the numbers produced; then compute b^d
- mod n; this is a^(de), which is a^(something times phi(n) plus 1), which is
- a^(something times phi(n)) times a, which is a. [All this is done modulo n.]
-
- This is why we can't make d public, of course: it would enable everyone to
- decrypt messages.
-
- Now, how secure is this? Well, basically the only way to crack it is to factor
- n; that is, to find p and q. It is thought (though not proved) that it is hard
- to factorise numbers; that is, that provided some precautions are taken in
- choosing p and q there is no quick way to find what the factors of pq are.
-
- Precautions include: not having p,q too close together; making sure p-1 and q-1
- don't have any really small factors; probably lots of other things I can't
- think of offhand.
-
- I hope this is of some use. If I've assumed you know more mathematics than you
- actually do, send me some e-mail or something and I can explain what the words
- mean...
-
- --
- Gareth McCaughan Dept. of Pure Mathematics & Mathematical Statistics,
- gjm11@cus.cam.ac.uk Cambridge University, England. [Research student]
-