**What is Encryption and Its types? [In Depth & Practical Explanation]**

**🛡 The need for Encryption 🛡**

Encryption is the backbone of the internet, the backbone of security! Which means **“Encryption“** is one of the greatest inventions.

In this world of Computers. Networking and IT the most important term is DATA! Whether it’s your Credentials, bank account details, passwords or anything else! Security is the priority

What we wanted is that all our data should be secure while we are storing it. Or we are transferring it to somewhere else.

**🛡 What is ENCRYPTION? 🛡**

**ENCODING**:- Changing data from one form to another. For eg:- Data:- ABCDEFG I change my data to some other form like- ENCODED DATA:- 123456789

*This example is very simple actually encoding is done by passing the data through a complex mathematical function.*

**ENCRYPTION**:- The process of encoding data in such a manner that only desired people can decode it is known as encryption. Data:- ABCDEFGHI. — I change my data to some other form like

ENCODED DATA:- 123456789

I have encoded the data in such a way that only a few people which I want can understand it because they will be knowing that I have used 1 for A, 2 for B and so on…

**CRYPTOGRAPHY**:- The study of encryption is known as cryptography ⚔

**🔱 Cryptography can be divided into 3 main parts 🔱**

**Symmetric cryptography ⚔****Asymmetric cryptography ⚔****Hash function cryptography ⚔**

Before starting we need to understand a few things…

*No one can understand the encrypted data. not even the person who has encrypted it. (That data purely looks like trash!) ⚔**The encrypted data that looks like garbage is known as “Chipher text”. ⚔**The whole encryption system is based on “keys”. Keys are mainly a very complex mathematical function. ⚔*

Also Read:-

- Working of IMSI-Catcher, in-depth explanation!
- Working of DHCP and NAT.
- How does a Network Switch work? (With practical example)

**💎 SYMMETRIC KEY CRYPTOGRAPHY 💎 **

- One key to encrypt the data. (KEY 1) ⚔
- The same key can decrypt the data. (KEY 1 or KEY 2) ⚔
- As KEY 1 = KEY 2 ⚔
- The mathematical function used in the key is the reverse of itself. ⚔

To understand this method lets take an easy real-life example:

I have data which I want to send to my friend!

But I have some privacy issues! there are many unauthorized people using the same network who are trying to steal my data!

**🔱 So I Encrypt my data using KEY 1! (***Key:- A complex mathematical function***). Or in other words, I can say that I passed my data through a complex mathematical function and transform it into a data which now looks like garbage! 🔱**

And now I send it to my friend without any worries!!

Now those unauthorized people stole my flowing data in the middle of my computer and my friend’s computer.

But what they got? It’s all garbage!

*🔱 Unauthorized people know that I have encrypted the data! But they cannot decrypt it because they are not having the right key to decrypt my data! 🔱*

Now when the data reaches to my friend! he also got garbage looking values. But he then used his KEY 2 and decrypted the data using it.

Or in other words, He passed the garbage data through his KEY 2 (A complex mathematical function) and in the result, he got the real data that I wanted him to send!

#### WHAT WAS SYMMETRIC ENCRYPTION HERE?

I used key 1 to encrypt my data

My friend used key 2 to decrypt that data

*AND THE KEY 1 WAS EXACTLY THE SAME AS KEY 2*

*KEY 1 = KEY 2*

**🔱 So basically Key 1 and key 2 both were ****the same reversible mathematical function. 🔱**

In conclusion, Both are keys can either encrypt or decrypt each other’s data!

Eg:- If my friend encrypts the data with his key, he can again use his key to decrypt it. or he can send his data to me and I use my key to decrypt the data. And I can encrypt again in the same form because after all KEY 1 = KEY 2.

Also Read:

**💎 ASYMMETRIC KEY CRYPTOGRAPHY 💎 **

The key which we were using in the symmetric encryption was a mathematical function which was the reverse of itself. Which means we can use the same key to encrypt as well as decrypt the same data!

But now things have changed. In Asymmetric key cryptography, we use 2 different keys!

- One key to encrypt the data. (KEY 1) ⚔
- Another key to decrypt the data (KEY 2) ⚔
- Here
**KEY 1**AND**KEY 2**are not the same! ⚔ *NOTE:-**KEY 1**AND**KEY 2**ARE REVERSES OF EACH OTHER! (Means**KEY 2 is a reverse mathematical function of KEY 1) ⚔***Any data encrypted by KEY 1 can only be decrypted by KEY 2! And similarly and data encrypted by KEY 2 can only be decrypted by KEY 1. ⚔**- If we encrypt data with KEY 1 and again pass the data through KEY 1, the data will get more and more encrypted! but not get decrypted, as it can only get decrypted by KEY 2. ⚔

**Real Life Practical Example:**

Let’s assume that Google is trying to communicate with our laptop.

Google have KEY 1 and KEY 2.

- Google keeps it’s
**KEY 1**with itself and never shares it with anyone! Here the key is called**PRIVATE KEY (KEY 1). ⚔** - And Google makes it’s KEY 2 available for everyone! Here the key is called as Public key. ⚔

*🔱 In the real world, Google’s public key is pre-installed in all the browsers! 🔱*

So Google uses its KEY 1 to encrypt a data and send it to our laptop.

and we use the Public key of Google which was already pre-installed in our browser to decrypt the data.

🔱 However, If any encrypted data gets decrypted by googles public key. It means that the data was Encrypted by Google only! And not anyone else! 🔱

In a similar way, I Encrypt my response data with googles public key and Google can easily decode it with its private key.

** BUT DO YOU THINK THE CONNECTION IS SECURE?**

If you can have the googles public key in your browser! Similarly, everyone can have it too!

So the process from here changes a little bit.

Now, our laptop also has a pair of private (KEY 3) and public (KEY 4) keys.

*So now WE ENCRYPT OUR PUBLIC KEY (KEY 4) USING GOOGLES PUBLIC KEY, AND THEN SEND IT TO GOOGLE. ON THE OTHER HAND, GOOGLE USES ITS PRIVATE KEY TO DECRYPT THE DATA AND GOOGLE GETS OUR PUBLIC KEY (KEY 3) *

Now, we can securely communicate with each other! by using KEY 3 and KEY 4.

🔱 Yes, its a little bit complicated but you need to understand this because this is a very important concept as it is used almost everywhere. And if you are not able to understand this, read it again, but don’t quit! 🔱

Also Read:

### Symmetric vs Asymmetric Cryptography (Hindi):-

**💎 HASH KEY CRYPTOGRAPHY 💎**

The key which we were using in the symmetric encryption was a mathematical function which was the reverse of itself. Which means we can use the same key to encrypt as well as decrypt the same data!

The pair of keys which we were using in Asymmetric encryption was a pair of a mathematical function which is reverse of each other.

- In this method, we only use one KEY! ⚔
- This KEY is (A Non-Reversible mathematic function) ⚔
- MEANS: If we encrypt any data with this method, it cannot be decrypted! ⚔
*The encrypted data is always of fixed length! Means, no matter how long or short is the plaintext is. Once it is HASHED the result will be of fix size!*- This method is used for data storing purpose. (passwords or other credentials) ⚔

**Real Life Practical Example:**

Facebook is a very big social media company. and obviously! It stores all the passwords of the users in its database.

But what if someday it got hacked? All the passwords of its users will get compromised!

But the answer is NO! Because Facebook uses **HASH KEY CRYPTOGRAPHY** to keep their data safe, as the data cannot be recovered back.

But then how does Facebook knows that we have entered the correct password, as all the data is encrypted in their database? (Not decryptable).

Actually, when we enter our password, Facebook passes our entered text through their HASHING algorithm (Or say, they pass our entered text through their Hash KEY) and in the result, they get an encrypted data.

Now they compare the encrypted data to the data which is already stored in their database!

However, If the two data match. HURRAY! the password you entered is correct!

There’s a lot more to learn! However, these were the basics that you definitely need to know! As these concepts are being used in our day to day life!

### Hash key cryptography (Hindi):-

Grab some more details on Hash Encryption and some popular cracking methods here.

Thank you! Please don’t forget to comment and share it if you learned something new today!

Author -INNOVATIVE NOOB. 💡

## 1 thought on “What is Encryption and Its types? [In Depth & Practical Explanation]”