# How Encryption Works – Let’s Understand

**IF YOU ARE GOING FOR AN INTERVIEW ( AT BEST Social Network COMPANY – Like Facebook ) THEN READ THIS POST CAREFULLY. THIS POST WILL HELP YOU A LOT, we will tell you that How Encryption Works.**

## Encryption and Decryption

The words encryption and decryption are quite familiar to us you might have already come across these technical words in this Article series as well as in your daily life.

**Q: What is encryption and why is it needed? and ****How do our messages travel through the internet?**

**A:** At the end of this post you will also understand the magic, that **prime numbers play** in **encryption and decryption** technology.

There is a local internet service provider communicating with a regional service provider followed by a network service provider and then the final destination, we know that data travels in packets and could take any path through the different routes to reach the destination and in general, we assume that **ISPs or NSPS** don’t eavesdrop on our communications when we are connecting to a public Wi-Fi hotspot in a restaurant or a shopping mall we have to be cautious that whoever installed the Wi-Fi hotspot is unable to see what we are browsing many of you will have noticed the prefixes **HTTP and HTTP** being shown on URL addresses these are internet protocols for communication and s represents that the communication is secure, for a secure communication the access point provider won’t be able to know anything other than that we have accessed this site they cannot see our logins which page we are looking at or anything else all of these are encrypted.

In cellular communication, the data to your cell tower is usually encrypted let’s look in detail at how this important encryption operation is done.

encryption is the process of transforming plain text to cipher text in this example the text message is encrypted by adding one digit this is the encryption key only the receiver who knows the key can decrypt the message and an intruder cannot.

**Q: What is Symmetrical Encryption? and let’s Understand the Process of Encryption**

**A:** You can consider this case as similar to a confidential document being locked in a briefcase before sending it to its destination a thief or the transporter will not be able to access the document only the receiver with the key to the briefcase will be able to open it a very responsible key distribution center takes the responsibility of transferring the key from the sender to the receiver if the receiver uses the same key to open the suitcase it is **called symmetrical encryption** if the opening key is different to the locking key the encryption method is** called asymmetrical,** however.

**Q: what if the key itself is stolen?**

**A:** To overcome this issue** let’s design an intelligent locking system** in this system each user has two keys the user submits one of his keys to the key distribution center it means this key is publicly available so let’s call this a public key however nobody shares the other key this is private to each of the users the most interesting part of this new system is the lock can be closed with any public key but the same key cannot open the lock to open it you have to use the corresponding private key no other users private key or the public key will be able to open this lock with this system the data transfer is highly secure.

** let’s Understand how**

If Nina wants to send the box to Alex Nina requests the public key of Alex from the KDC the KDC chairs the public key with Nina and she locks the box after transportation only Alex will be able to open the lock because only he has the private key this system is highly secure because Alex hasn’t shared his private key with anyone.

In the digital world we can build the same system **here this hello message** is encrypted with Alex’s public key and sent only Alex’s private key will be able to decrypt it back and only Alex will be able to do that.

now let’s examine one particular property of the new lock we have already seen that a lock closed with a public key can be opened only with the corresponding private key can these two keys have a random shape even if such a lock exists it cannot have a random shape the shapes of the keys have to be connected in some way one example of such a connection is **shown in Image.**

Similarly in the digital world, the keys we saw earlier should be connected otherwise the algorithm will not work an efficient connection between these keys is that they are derived from the product of two prime numbers in the **previous example** we saw that the public key of Alex was in fact the multiplication of two prime numbers the private key of Alex was one of the factors of this public key the algorithm we have seen is just a representative one in actual algorithms prime numbers are not directly used to produce public and private keys a popular algorithm used in the private-public method is called **RSA** lets Understand

**Q: How RSA uses two prime numbers to generate private and public keys by using an Image?**

**A:** the encryption and decryption of the letter H using these keys is also Shown here in Image, please note that a detailed explanation of this algorithm is beyond the scope of this Article, now you might have a question in your mind.

**Q:** **Why are we using only prime numbers and not any other numbers**

**A:** The process of finding out the factors of a number is known as factorization hacker always uses some brute force method to factorize the numbers involved thus he can find out the private key, the factorization algorithm works quite fast when the factors are not prime numbers however if the factors are prime numbers the algorithm is quite slow especially when the prime numbers are big this way the hacker will struggle to get your private key from the RSA algorithm using brute force you must not get the impression that the asymmetric encryption method such as public private key cryptography has superseded symmetric encryption methods one major issue with the asymmetric encryption method is that it is very computationally intensive we have already seen in RSA that the algorithm will prevent a brute-force attack only if the prime numbers are huge this means if we use RSA directly it will cause a significant time delay in exchanging dataone **clever remedy for this problem is the** symmetric encryption systems like advanced encryption standard **AES** which are widely used today in such systems using public/private key cryptography a key is exchanged as the very first message this key is** known as a session key** and **it is a symmetric key** using this symmetric key the two parties can continue their remaining data exchange without further key transfers.

The session key is frequently updated depending on the communication protocol used for example and **what’s up** for every message there is a new session key in **HTTP** it may be for a certain period or until the session ends the key size for a public private key is around **2048 bits** and the encryption and decryption takes more time when compared to symmetric systems which employ key sizes of around **256 bits** the message is encrypted by the **256 bit** **symmetric key** are no less secure than the **2048 bit** asymmetric key system and are less computationally intensive, the public-private key approach also creates a way to authenticate a message **authentication means** that alex has to make sure that this message is from Nina for this Nina encrypts the message with her own private key now Alex can decrypt this message with Nina’s public key and can make sure that the message is from her because only Nina has her private key here Nina is said to have signed the message and not encrypted it because anybody can decrypt the message we hope this Post has given you some great insights into encryption and decryption please support our educational services by Sharing this post with your friends, thank you

If you want to Understand that How Control System Works? then Read this Post