RSA Algorithm: Encryption & Example

Instructor: David Gloag

David has over 40 years of industry experience in software development and information technology and a bachelor of computer science

With the ever increasing instances of Internet-based commerce, it makes sense that protecting those transactions will become more and more important. In this lesson, we'll take a look at a commonly used algorithm, RSA, how it works, and where it is used.

Protecting Life on the Internet

In North America, there are many of us that spend time on the Internet. We send email to one another, we interact on social media websites, and we purchase things that have value or meaning to us. In fact, it's part of our social fabric. But with the pervasiveness of the Internet, have you ever wondered why someone hasn't tried to take advantage of the situation? You know, people with malicious intent who would steal your money, or sell your account information? In fact, someone likely has. You haven't heard about it though because there is protection in place, protection that keeps your information safe. Part of that protection is composed of encryption, and one specific type is RSA.

What is Encryption?

Encryption is the process of taking information in one form (usually human-readable), and converting it to another form (not usually human-readable). It is mathematically based and makes use of an external piece of information, known as a key, to perform this conversion. There are several different types of encryption, and they are used for various things. Common examples include protecting the password on your cell phone, securing personal information stored on social media websites like LinkedIn, and hiding the login credentials used for web access to your bank account. Whatever the use, encryption is quietly doing its work, behind the scenes.

What is the RSA Algorithm?

RSA, named after the researchers who initially proposed it (Rivest, Shamir, and Adleman) is a type of public key encryption. Public key encryption is a form of encryption that uses two keys: a public key, which everyone knows, and a private key, which only you know. To encrypt, the public key is applied to the target information, using a predefined operation (several times), to produce a pseudo-random number. To decrypt, the private key is applied to the pseudo-random number, using a different predefined operation (several times), to get the target information back. The algorithm relies on the fact that encryption is easy and decryption is hard, making decryption impractical without the key. It was the first system to allow secure information transfer, without a shared key.

How Does It Work?

Let's take a look at an example. The RSA algorithm starts out by selecting two prime numbers. Normally, these would be very large, but for the sake of simplicity, let's say they are 13 and 7. Multiplying them together, we get 91. This becomes our maximum, and roll-over point. It also typically represents a value that is as big as the computer can handle. Next, we select the public key. Let's say it is 5. Using the fact that 13 and 7 are factors of 91, and the Extended Euclidean Algorithm, you can determine the private key to be 29. The Extended Euclidean Algorithm allows you to calculate, in an iterative fashion, the greatest common divisor and various coefficients.

To unlock this lesson you must be a Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use

Become a member and start learning now.
Become a Member  Back
What teachers are saying about
Try it risk-free for 30 days

Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create an account