One of the reasons that the Shor factoring algorithm caused such a stir, is that one of the cryptographic techniques which had come into widespread use in the 90s was the RSA public key cryptographic algorithm. RSA was invented first by GCHQ, the British Codebreaking establishment in the early 70's, but was kept secret by them. It was then reinvented by Rivest Shamir and Adelman (thus RSA) in the late 70s.
One of the key difficulties with all cryptography is the exchange of keys. Many systems have been invented which offer very great security, but all depend on both the sender and the receiver having receipt of a key. This is true of the unconditionally secure "One Time Pad" as it is of various other algorithms like DES, Blowfish, Enigma,.... Although one can imagine generating a secure channel, via quantum cryptography, highly trusted couriers, or face to face meetings, the key exchange is most problematic and difficult feature of cryptography.
In the late 70's Diffie and Hellman (in the public literature anyway) pointed out the possibility ( and a specific example) of what has come to be called public key cryptography. In this type of cryptography, there exist two keys. One is used to encrypt the message, and the other to decrypt. Furthermore the encryption key is such that even if an enemy knows the encryption key and knows the algorithm used to encrypt the message, he cannot use that information to discover what the private key is, and thus cannot decrypt any messages. That such a system was even possible came as a complete surprise to the cryptographic community.
Instead of discussing the Diffie Hellman procedure and variants thereof, I will limit myself to to the RSA technique. The RSA technique begins by finding two prime numbers and . These two primes must be kept secret. These primes are multiplied together to give a composite number . This number will be made public as a part of the public key. In addition the person chooses a number , which will also be made public. This number must be chosen so that and the the numbers and have no factors in common. A common choice for is 17, or . It is usually chosen small so as to make the work of anyone encrypting a message to you easy to carry out.
The encryption process is carried out by breaking the message up into numbers
less than (but greater than - in fact the number is padded so as
to always make is greater than ). Call this number for message. The
encrypted messages is now obtained by calculating the number
Because of the random "wrapping" that taking the modulus does (ie the remainder seems to have no particular relation to the original) it seems that even knowing what and are the attacker cannot take the logarithm to discover what the original message was.
However, knowing and , the recipient can determine the original message.
He defines another number such that
The theorem then is that for any number , which does not have or as
The secret key must be kept secret,or anyone can decrypt the messages. However, unless the attacker knows and , he can not figure out what is from and . Thus if he can factor , he will know and and thus .
The best classical algorithm (the Number field sieve) has an estimated number
of operations required to find the factors of order
Note that this rate is still far far faster than "exhaustive search" in which one tries all numbers less than to see if they divide . Assuming that each such trial division takes about operations (), there are still such operations required, for a total of about operations to factor by exhaustive search.
For an introduction to Cryptography, see for example the excellent review of current cryptography in Bruce Schneier's Applied Cryptography: Protocols, Algorithms, and Source Code in C, 2nd Edition John Wiley & Sons; ISBN: 0471117099