Playfair Cipher

<>Playfair Cipher:

The Playfair cipher was the first practical digraph substitution cipher. The scheme was invented in 1854 by Charles Wheatstone but was named after Lord Playfair who promoted the use of the cipher. In playfair cipher unlike traditional cipher we encrypt a pair of alphabets(digraphs) instead of a single alphabet.
It was used for tactical purposes by British forces in the Second Boer War and in World War I and for the same purpose by the Australians during World War II. This was because Playfair is reasonably fast to use and requires no special equipment.


<>Encryption:

  1. Key Generation:
    • Choose a keyword (omitting duplicate letters and then filling the remaining alphabets of the grid in order).
  2. Grid Formation:
    • Create a 5x5 grid using the unique letters of the keyword and the rest of the alphabet (I and J together).
  3. Message Preparation:
    • Break the plaintext into pairs of letters.
    • If the two letters in a pair are the same, a bogus letter (commonly 'Z') is inserted to separate them
    • If there's an odd number of letters, add a bogus letter (commonly 'Z') at the end.
  4. Letter Transformation Rules:
    • If the two letters in a pair are located in the same row of the secret key, the corresponding encrypted character for each letter is the next letter to the right in the same row (with wrapping to the beginning of the row if the plaintext letter is the last character in the row).
    • If the two letters in a pair are located in the same column of the secret key, the corresponding encrypted character for each letter is the letter beneath it in the same column (with wrapping to the beginning of the column if the plaintext letter is the last character in the column).
    • If the two letters in a pair are not in the same row or column of the secret, the corresponding encrypted character for each letter is a letter that is in its own row but in the same column as the other letter.
  5. Ciphertext Generation:
    • The resulting pairs of letters are the ciphertext.

<>Decryption:

  1. Key Reconstruction:
    • Recreate the same 5x5 grid based on the keyword.
  2. Ciphertext Preparation:
    • Break the ciphertext into pairs of letters (digraphs).
  3. Letter Transformation Rules:
    • If the two letters in a pair are located in the same row of the secret key, the corresponding encrypted character for each letter is the previous letter to the left in the same row (with wrapping to the ending of the row if the plaintext letter is the first character in the row).
    • If the two letters in a pair are located in the same column of the secret key, the corresponding encrypted character for each letter is the letter above it in the same column (with wrapping to the ending of the column if the plaintext letter is the first character in the column).
    • If the two letters in a pair are not in the same row or column of the secret, the corresponding encrypted character for each letter is a letter that is in its own row but in the same column as the other letter.
  4. Plaintext Generation:
    • The resulting pairs of letters are the plaintext.

<>Plafair Cipher Encryption:

Note: Before Encryption, please read Rules and process carefully.




<>5x5 Grid:

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




<>Plaintext Pair:


<>Plafair Cipher Decryption:

Note: Before Decryption, please read Rules and process carefully.




<>5x5 Grid:

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




<>Cipertext Pair:


<>Vigenere Cipher:

Vigenère cipher, type of substitution cipher used for data encryption in which the original plaintext structure is somewhat concealed in the ciphertext by using several different The cipher was invented in 1553 by the Italian cryptographer Giovan Battista Bellaso but for centuries was attributed to the 16th-century French cryptographer Blaise de Vigenère, who devised a similar cipher in 1586. A polyalphabetic cipher is any cipher based on substitution, using multiple substitution alphabets. The encryption of the original text is done using the Vigenère square or Vigenère table.


<>Encryption:

  1. Key Selection:
    • Choose a keyword or key phrase. This key should be repeated or extended to match the length of the plaintext message.
  2. Conversion to Numeric Values:
    • Convert both the plaintext message and the keyword into numeric values. This is commonly done using a simple scheme, such as A=0, B=1, ..., Z=25.
  3. Encryption Formula:
    • Ei=(Pi+Ki) mod 26
  4. Process:
    • Find The corresponding letter in the keyword.
    • Use the Vigenere table to find the encrypted letter.
    • The encrypted letter is determined by the intersection of the row corresponding to the plaintext letter and the column corresponding to the keyword letter.
    • Repeat this process for each letter in the plaintext, cycling through the keyword as needed.

<>Decryption:

  1. Key Repetition:
    • Repeat the decryption key to match the length of the ciphertext message.
  2. Ciphertext Conversion :
    • Convert both the ciphertext message and the repeated decryption key into numeric values. Again, this is often done using a simple scheme, such as A=0, B=1, ..., Z=25.
  3. Decryption Formula:
    • Di=(Ci-Ki) mod 26
  4. Decryption Process:
    • Determine the numeric value of the corresponding letter in the decryption key.
    • Shift the cipertext letter backward by the corresponding value in the key(mod26),wrapping around if necessary.
    • Convert the resulting numeric value back to a letter.

Vigenere Cipher Encryption:

Note: Before Encryption, please read Rules and process carefully.




0 1 2 3 4 5 6 7 8 9 10 11 12
A B C D E F G H I J K L M
13 14 15 16 17 18 19 20 21 22 23 24 25
N O P Q R S T U V W X Y Z

Encrypted Text:


Vigenere Cipher Decryption:

Note: Before decryption, please read rules and process carefully.




0 1 2 3 4 5 6 7 8 9 10 11 12
A B C D E F G H I J K L M
13 14 15 16 17 18 19 20 21 22 23 24 25
N O P Q R S T U V W X Y Z


Decrypted Text: