Hi everyone since I’m into cryptography these days I thought why don’t I give a try to code the algorithms that are used to encrypt. My most favorite one is PlayFair Cipher, so I thought it would be easy to code but really took me a lot of hours. First let’s see what is PlayFair Cipher and working of the algorithm and then we can dive into the code.

ENCRYPTION

PlayFair Cipher

It is first practical digraph substitution cipher. It has 25*25 = 625 possible diagraphs. Diagraph means encrypt using 2 letter rather than 1 letter. Playfair is significantly harder to break since the frequency analysis used for simple substitution ciphers does not work with it.

How does PlayFair Cipher Encryption algorithm work?

I will explain with an example, so let us take plaintext as PASSIVE ATTACK IS STILL BAD and key is PROGRAMMING

There are three steps in the algorithm:

1. Separate the Plaintext into pairs of text.

2. Generate Key Matrix or Key Square.

3. Encrypt Plaintext using Key square or Key Matrix from step 2.

#python3 #encryption #cryptography #python

Play Fair Cipher Encryption using Python3
70.80 GEEK