## Introduction To Encryption

Before we learn about Encryption try reading this —> **hsrdzrx**

Of course you can read that but do you think it has meaning? Its meaningless right?

You will get your answer soon.

So me and my friend wanted to develop a *secret* language (something like code words) to talk secretly and I came up with an idea. I wrote **hsrdzrx** on a paper and gave it to him and he was like what the hell is this? Some randomly placed letters?

I laughed and asked him to replace every letter with the next alphabet,

Umm like replacing **D** with E, **Y** with **Z** and so on..

So when he did that he got this,

1 2 3 4 5 6 7 | h ----> i s ----> t r ----> s d ----> e z ----> a r ----> s x ----> y |

So this message (hsrdzrx) actually meant **itseasy**.

Now lets use this analogy to understand basic Encryption terms:

**1. Plaintext**

I wanted to say “itseasy” in above example which is readable (by someone who knows English) and it is something we call **Plaintext** or **Cleartext**.

More technically I will say,

Data which can be read simply without using any special measures is called **Plaintext** or ** Cleartext**.

**2. Algorithm**

The method I used to convert **itseasy** into **hsrdzrx** (i.e. replacing the letter with the next alphabet) is something we call an **operation**, and the sequence of two or more* operations is called an **Algorithm**

**3. Ciphertext**

So applied an algorithm to the Plaintext and got the *coded* text i.e. **hsrdzrx** which is an example of **Ciphertext**.

**4. Encryption**

The process of applying algorithm to a Plaintext to convert it into a Ciphertext is called **Encryption**.

**5. Decryption**

The process of converting Ciphertext to Plaintext is called **Decryption**.

So is that all about Encryption? No..keep reading.

Me and my friend were very happy to have our conversation encrypted but then something bad happened. One of our classmates guessed the way in which we were encrypting our messages and we were exposed.

Now we had to find a permanent solution and we got one.

We bought a pen (with red colored LED at the cap) whose ink was only visible in green light, so we started to use that pen to write our Ciphertext which gave us added security to our Encryption.

We will call that pen a **Key**. So if someone wants to read our messages he will need that key.

Or in more technical words I would say,

A key is a piece of information that allows only those that hold it to encode and decode a message.

So as we encrypted **itseasy** by using the next alphabet but as a key we may replace our letter with the 5th next alphabet like,

1 2 3 | A B C D E F G H I J K L M N O P Q R S T U V W X Y Z | | | | | | | | | | | | | | | | | | | | | | | | | | F G H I J K L M N O P Q R S T U V W X Y Z A B C D E |

Then the key will be **5** and to decrypt the data the receiver needs to know he key before he can decrypt the message.

Now there are two types of encryption,

**1. Symmetric Encryption**

The sender encrypts the message and sends the data to the receiver and then sends the key which can be used to decrypt the message. But what if a hacker intercepts the sent information? Yep…He will be able to decrypt everything.

**2. Asymmetric Encryption**

This type of encryption involves two type of keys, a **Public Key** and a **Private key**.

Public key is used to **Encrypt** the message and a Private Key is used to **Decrypt** the message.

So like you are setting up a Shopping Website you may give Public key to users so they can (actually their browser/program does that) encrypt their Credit Card details.

Now only **YOU** own the Private Key which can decrypt the data.

So Encryption is used to encrypt text? Naah…

It is used to encrypt **Data**. You can encrypt your Hard Drive with a custom key. VPN (We are gonna talk about it soon) is a good example of encryption. SSL (Secure Sockets Layer) technology also uses Encryption to provide secure connections.

Sorry we can’t help you in anything which is illegal.

Really D’s article covered full of knowledge thanks again somdev bro..!