There are two classes of encryption algorithm. They are:
A public key encryption system is based on an algorithm of this type. Two keys are generated. One is kept private and the other can be made public. Two systems that want to hold a secure conversation can exchange their public keys. When one system sends to the other it will encrypt the message using the remote systems public key. Even though an attacker might observe the exchange of keys and an encrypted message the irreversiblity of the public key algorithm ensures that the data is secure.
The most popular public key algorithm is the RSA algorithm. (The name RSA is derived from the first letters of the surnames of the algorithms inventors, Ron Rivest, Adi Shamir, and Leonard Adleman). The algorithm is based on the difficulty of finding what two prime numbers are given only their product.
Although public key algorithms solve the key distribution problem they are much slower than symmetric key algorithms. When implemented in hardware DES is up to 10,000 faster than RSA. If efficiency is required a public key system can be used to securely exchange symmetric keys which can then be used for the bulk of the data transfer.