Friday, September 16, 2022

Cryptography (Part-2) Historic Cipher

Historical Cipher (Caesar Cipher and Visionary Cipher)



At the outset, cryptography is a very complex thing. There's different math involved, but the ones I'll teach below today are the simplest ways to encrypt and decrypt data.

The most popular category of cryptography is the cipher.


Above you can see three types of cipher - Historic, Block, and Stream cipher. These three have many branches.

In this episode we will learn and practice the Historic Cipher, so we will talk about the other branches in the next episode. But before that, you need to know the basic 6 things.


6 points are explained below:

Plain Text:

The information or text you want to hide and send is plain text.

Encryption:

Encryption is the method of hiding plain text.

Cipher Text:

The text that can be found after encryption is called cipher text. (Cypher and Cipher are the same)

Decryption:

Decryption is the process of turning cipher text into plain text.

Algorithm:

The mathematical rules by which plain text is converted into cipher text or cipher text is converted into plain text is called an algorithm.

Key:

The number on which the algorithm is executed is called the “key” (key). This key will be known only to the customer. That means the person you send it to must know this key number, or they won't be able to decrypt it.

Let's apply the example of the last post to understand this better.

Here is Plain Text: There is 1M taka in a box in the small room.

This encryption and decryption method is: Caesar Cipher (Caesar Cipher) which is a branch of Historic Cipher.

Here the Cypher Text is: Uifsf jt 2N ublb jo b cpy jo uif tnbmm sppn.

The algorithm here is: Addition of next 1 digit.

So the key is: 1

If the person you send the text to knows that you changed 1 cell with the next one, he will get the original text by changing 1 cell less than the original text.

Now our hysterical cipher begins.

Historic Cipher

First, choose a sentence/data that we will encrypt-

Know for sharing

1. Caesar Cipher:

Caesar cipher is the text or sentence that you make a few spaces behind or ahead of the English language.

Since we have already seen 1 birth ahead, so now we will try 3 births ahead. Then if "know for sharing" is taken 3 years ahead,

k = n

n = q

o = r

w = z

I hope you understand.

Then the whole sentence stands – nqrz iru vkdulqj

Tell me, how much is the key here?

Yes, 3.

Many may ask how to take 1 house or 3 houses after Z? Answer: Start again from the beginning. That is, Z will be followed by A again. And if A is ciphered one letter back, then A will be replaced by Z, that is, it can be compared to a circle of 26 letters.

If one changes the Key to 25, then it is said to be 1 born backward. For example, if E is moved forward by 25 houses then we get D. Calculate it. So if you want to move back one row, you get two keys 25 and -1, yes -1 moved back one room.

Now I will take 2 years back.

then,

k = i

n = l

o = m

w = u

If you write the whole sentence like this, you will get - ilmu dmp qfypgle

(Please let me know if I wrote something wrong)

If you want, you can do Caesar cipher with 1 lakh houses behind or ahead. Since it is very difficult for people to calculate so many houses, in that case, a device or software will be needed.

2. Vigenere Cipher:

For the visionary cipher, you need to follow a table. I gave below. It is almost impossible to memorize, so this table must be used every time to encrypt or decrypt.


The red marked part of the table is “Column” and the blue marked part is “Row”.

What we will encrypt now is - known for sharing

Now a key is required.

I think the key is ITshwrov


Now we will remove all the spaces. It will be convenient to encrypt. then,

Plain Text: knowforsharing (14 words)

Key: ITshwrov (8 Borns)

In the case of this type of encryption, we have to make an equal number of characters of Plain Text and Key. But no change can be made in plain text. The scope of the Key should be increased. So if we write ITshwrov twice in a row, we get - ITshwrovITshwrov were 16 characters. But due to increasing the range of keys, we will now call it key stream. We need 14 characters, so we will remove the last two characters. Therefore, I will write ITshwrovITshwrov which is 14 letters long.


(Note: you can't keep key or keystream in numbers. That is, if plain text is in the English alphabet, then the key must be kept in the English alphabet. Key can be encrypted by keeping numbers, but that method is quite complex. I understand a little bit myself, so you (not teaching that method)


Take a look at all the information.

Plain Text: knowledge sharing

Keystream: ITshwrovITshwrov

now,


In the above figure, the red color is a column and the blue color is the row. The red letters above are our Plain Text and the blue letters on the side are our keys.

The first letter of our Plain Text is: K (red).

The first letter of our keystream is: T (nil).

Now in the red column of the vision table, we look for K and mark it as below.


Then I looked for T in the blue row of the table and marked it.


Now see which letter we got along K and T.


So, D is the first letter of our Cipher Text.

Only one letter is gone. now,

The 2nd letter of our Plain Text is: N (red).

The 2nd letter of our keystream is: R (blue).

Now as before, again in the red column of the vision table we look for N and mark it as below.

Then I looked for R in the null row of the table and marked it.

Now see which letter we got along N and R.

So, E is the 2nd letter of our Cipher Text.

The 3rd letter of our Plain Text is: O (red).

The 3rd letter of our keystream is: i (blue).

Now as before, again in the red column of the vision table we look for O and mark it as below.


Now see which letter we got along N and R.


So, E is the 2nd letter of our Cipher Text.

The 3rd letter of our Plain Text is O (red).

The 3rd letter of our keystream is i (blue).

Now as before, again in the red column of the vision table we look for O and mark it as below.


Then I searched and mark I in the null row of the table

Now see which letter we got along O and i.



So, W is the 3rd letter of our Cipher Text.

Keep doing this, again and again, then the whole cipher text will be like the below.

DEWYPPULYITSOJ

or, in lower case,

dewyppulyitsoj

job done

now,

Plain Text: knowledge sharing

Key: itshowrav

Keystream: itshwrovitshwrov

Cipher Text: dewyppulyitsoj

So far today.

I left practice for you.

I have taught Encrypt so far, and now you must use your intelligence to Decrypt.

The way you did Encrypt, it will be decrypted only if you reverse the whole process.

I taught plain text to cipher text.

Now, I will give you a small cipher text, and comment it as plain text. (I will not insist, I gave it for your practice. After learning something, if you practice it, it stays in your brain for a long time.)

Cipher text: QOFZHYA

Key: X







No comments:

Post a Comment