# RSA Encryption

### What is RSA Encryption?

RSA encryption is an algorithm that is used to encrypt data or public keys. RSA stands for Rivest-Shamir-Adleman. Rivest, Shamir, and Adleman are the names of the scientists who developed the RSA algorithm.

It is based on the pure phenomena that it is simple to multiply big numbers, but it is challenging to factor large numbers. For example, it is straightforward to tell that 28 and 36 multiply to 1008, but when we try to find the factors of 1008, it is a long process. Let first look at the basics of encryption.

### Encryption

Encryption is the method of conveying a piece of information and combining its contents so that only certain people can look at your data.

There are two types of encryption:

- Symmetric
- Asymmetric encryption

### Symmetric Encryption

Symmetric encryption is merely transferring a file or message protected with a password. Let’s understand this concept with an example. There are two characters, you and your friend. You want to send a message to your friend that is highly confidential. You used a program to encrypt the message with a password. Now, your message can be read by the only person who has the password.

Now comes the real problem of how you are going to send the password to your friend. If you send the password using email, it can get into the wrong hands, and your message can lose its confidentiality. To solve this problem of sending passwords, asymmetric encryption was introduced.

### Asymmetric encryption

Asymmetric encryption is similar to a mailbox on the road. The mailbox can be known to anyone who identifies its position. We can say that the place of the mailbox is entirely public. Anyone who knows the place can move to the mailbox and leave a message. However, only the mailbox keeper has a passkey to open it up and see the messages.

When using asymmetric encryption, both you and your friend need to produce a key pair in your system. A key pair subsists of a public key and a private key. The public key, as the name depicts, is available to everyone. Whoever wants to send you a message will encrypt the message using your public key, and you will have to use your private key to decrypt the message. Using asymmetric encryption, while sending a message to your friend, you will take his public key and encrypt the message. As the message is encrypted using his public key only, he can decrypt the message using his private key. Whenever your friend needs to send you a message, he needs to encrypt the message using your public key, and you will be able to decrypt it using the private key you have privately stored in your system.

The durability and safety of the asymmetric encryption now rely on you and your friend to hold their private keys adequately guarded. If an intruder hijacks your private key, it can be used to decrypt all messages sent to you. However, the intruder cannot decrypt messages sent by you to your friend because that requires your friend’s private key.

Asymmetric encryption is practiced in a lot of places where protection is a concern. You might not be informed of it, but when you tour a protected website via HTTPS, you’re practicing asymmetric encryption. It is also utilized to transfer emails with the PGP protocol securely. Bitcoin also uses asymmetric encryption to ensure that only the buyer of a money wallet can remove or move money from it.

### RSA encryption Algorithm

RSA algorithm is used to create the private and public keys

The following steps are used to create public and private keys.

Step 1: Take two number say “a” and “b” and find their product “x”

Step 2: Suppose number “d” as a derived number that must be greater than one and less than (a-1) & (b-1). The first state is there should be no common factor of (a-1) & (b-1) other than 1.

Step 3: The defined set of numbers “x” and “d” make the RSA public key, and it is made known to everyone.

Step 4: Private Key “p” is created using the numbers “a,” “b,” and “d.”

### How safe and secure is RSA encryption?

The general strike on RSA encryption requires factoring a large number, which is the product of two huge prime numbers. After this, the overall idea is that getting prime numbers is relatively straightforward, and multiplying them together to make a specific large number is also very simple, but if you begin with that vast number, determining the factors is quite tricky and challenging.

The standard implementation uses many workstations for a few months or so to develop a “factor base.” The hard part is you feed that to an individual machine with enormous RAM (terabytes as an origin case) and have it work for a few weeks to perceive the factors.

The point is that the most fundamental attack on RSA has a very high primary cost even to get started. However, currently, no such computer can hold sufficient RAM even to begin an attack on something like a 1024-bit RSA key (by the way not the 2048 or 4096-bit keys some of them insist on using).

### Quantum computers could break RSA encryption.

All the encryption strategies that we use today are breakable, but they require a long time, decades, thus making it impractical to break.

Quantum computers are specialized computers that are capable of doing the work of decades in days.

Shor (quantum algorithm) showed that a strong quantum computer could do this with comfort, which will send shock waves through the security enterprise.

Quantum computers are growing in strength. It’s straightforward to think that quantum computers at this pace of growth should soon be able to beat the best classical machines.