## What is Encryption and How Does it Work?

In this post, we will give you Full Info About – What is Encryption and How Does it Work? So Let’s Start – We are all familiar with the terms encryption and decryption. These technical terms may have already appeared in this article series as well as in your daily life.

## What is encryption and why is it needed?

You will also comprehend the importance of prime numbers in encryption and decryption technology at the end of this article.

## How do our messages travel through the internet?

A local internet service provider communicates with a regional service provider, then with a network service provider, and finally with the final destination. We know that data travels in packets and that it can take any route through the routers to get to its destination. Furthermore, in general.

We assume that no IPSs or NSPs listen in on our conversations. When we connect to a public Wi-Fi hotspot at a restaurant or a shopping mall, we must ensure that whoever installed the hotspot cannot see what we are surfing.

Many of you have probably noticed the HTTPS and HTTP prefixes on URL addresses. These are communication protocols for the internet. And the letter S denotes the fact that the transmission is secure. For secure communication, the access point provider will only be able to see that we have visited this website.

They can’t see our passwords, which pages we’re on, or anything else we’re doing. All of these are password-protected. The data sent to your mobile tower is normally encrypted in cellular transmission.

Let’s take a closer look at how this crucial encryption procedure is carried out? The process of converting plain text to cipher text is known as encryption. The text message is encrypted in this case by adding one digit. The encryption key is this. An intruder cannot decipher the communication since only the receiver knows the key. Consider this instance to be equivalent to securing a private paper in a briefcase before shipping it to its intended recipient.

The document will not be accessible to a thief or a transporter. Only the recipient with the briefcase’s key will be able to open it. The job of passing the key from the sender to the receiver is taken on by a very responsible key distribution facility. Symmetrical encryption occurs when the recipient uses the same key to unlock the suitcase. The encryption method is referred to as asymmetrical if the opening key differs from the locking key. However

## What if the key itself is stolen?

Let’s create an intelligent locking system to solve this problem. Each user has two keys in this system. One of the user’s keys is sent to the key distribution center. This indicates that the key is open to the public.

This is referred to as a public key. The other key, on the other hand, is kept secret. Each user’s information is kept confidential. The lock is the most intriguing aspect of this new technology. Any public key can be used to open the lock. The same key, however, will not open the lock. You must use the appropriate private key to open it. This lock will not be opened by any other user’s private or public key. The data flow is extremely secure using this technology.

Let’s have a look at how. Nina requests Alex’s public key from the KDC if she wants to send the package to him. Nina receives the public key from the KDC and locks the box. Only Alex will be able to open the lock after transportation because he is the only one who possesses the private key.

Because Alex hasn’t disclosed his private key to anyone, this method is extremely secure. We can create a similar mechanism in the digital realm. This HELLO message is encrypted and sent using Alex’s public key. Only Alex’s private key will be able to decode the data, and Alex will be the only one who can do it.

Now let’s look at one of the new lock’s unusual features. We’ve already seen that a lock that is closed with a public key can only be opened with the private key that corresponds to it.

## Can these two keys have a random shape?

Even if such a lock exists, its shape cannot be arbitrary. The important forms need to be connected in some way. This is an example of such a link. In the digital realm, the keys we saw before must be connected in order for the algorithm to work. The fact that these keys are obtained from the product of two prime numbers provides an efficient connection between them.

We saw in the last example that Alex’s public key was the multiplication of two prime numbers. One of the components of this public key was Alex’s private key. The algorithm we’ve seen is merely illustrative. Prime integers are not directly used to generate public and private keys in practical algorithms. RSA is a prominent algorithm used in the private-public method.

Let’s use Image as an animation to demonstrate how **RSA** generates private and public keys using two prime numbers. This page also shows the encryption and decryption of the letter H using these keys. Please notice that this video does not include a full explanation of the method. You may now be asking yourself a question.

## Why are we using only prime numbers and not any other numbers?

Factorization is the process of determining the factors of a number. To factorize the numbers involved, a hacker always uses a brute force method. As a result, he can deduce the private key. When the factors are not prime numbers, the factorization procedure works quickly.

The algorithm is sluggish when the factors are prime numbers, especially when the prime numbers are large. The hacker will have a hard time extracting your private key from the **RSA method** using brute force in this manner.

You should not believe that asymmetric encryption methods like public-private key **cryptography** have replaced symmetric encryption methods. The asymmetric encryption approach has a number of drawbacks, one of which is that it is computationally costly. We saw in RSA that the procedure will only avoid a brute force assault if the prime numbers are really large. This means that using RSA directly will result in a substantial delay in data exchange.

**Symmetric encryption** techniques like the Advanced Encryption Standard AES, which are extensively used today, are one ingenious solution to this problem. A key is exchanged as the initial message in such systems employing public-private key cryptography. This key is referred to as a session key, and it is symmetric in nature. The two parties can continue their remaining data exchange without transferring keys using this symmetric key. (music that is upbeat) Depending on the communication protocol, the session key is updated often.

In WhatsApp, for example, each message generates a new session key. It could be for a set amount of time or until the session finishes in HTTPS. When compared to symmetric systems, which have key sizes of roughly 256 bits, a public-private key has a key size of around 2048 bits, and encryption and decryption takes longer. The message is encrypted with a 256-bit symmetric key, which is both more secure and less computationally costly than a 2048-bit asymmetric key method.

The public-private key technique also allows communication to be authenticated. Authentication refers to Alex confirming that this message came from Nina. Nina accomplishes this by encrypting the message with her own private key. Now that Alex has Nina’s public key, he can decrypt the message and verify that it is from her because only Nina has her private key. Nina is said to have signed the communication rather than encrypting it because anyone can decipher it.