# Playfair ciphers Matrixbased block cipher used in WWI

- Slides: 8

Playfair ciphers Matrix-based block cipher used in WWI In a 5 x 5 matrix, write the letters of the word “playfair” (for example) without dups, and fill in with other letters of the alphabet, except I, J used interchangeably.

Playfair encryption 1. Break plaintext into letter pairs n n If a pair would contain double letters, split with x Pad end with x hellothere becomes… he lx lo th er ex 2. For each pair, n If they are in the same row, replace each with the letter to its right (mod 5) he KG He lx lo th er ex n KG YV RV QM GI KU If they are in the same column, replace each with the letter below it (mod 5) lo RV n To decrypt, just reverse! Otherwise, replace each with letter we’d get if we swapped their column indices lx YV

Weaknesses P is unknown, but structure of its bottom is predictable Can break using digram frequencies n He lx lo th er ex KG YV RV QM GI KU n Example: If a digram and its reverse both appear often, it’s probably ER and RE. Each plaintext letter maps to how many possible ciphertext letters?

Playfair ciphers Used in Dorothy L. Sayers’ 1932 mystery novel Have His Carcase Marketing beats technology? n n n Invented by Charles Wheatstone Lyon Playfair, a Scottish Baron, promoted it Who got the glory?

ADFGX ciphers A D F G X Why ADFGX? n A l k p b q D m v r t z n Matrix 1: n F e f o d g G x c i y n X h u w a s Morse code for these are very different Combined cryptography with error-correction 25 letters (i and j merged again) randomly placed Each plaintext letter replaced by its row and column labels hello there XA FA AA AA FF DG XA FA DF FA

ADFGX ciphers (2) C R Y P T U X A F A A A F F D G X A F A D F F A XA FA AA AA FF DG XA FA DF FA Matrix 2: pick a random keyword and write the previous result under it in scanline order. Shuffle the columns into alphabetical order Then read down the columns

ADFGX ciphers (3) C P R T U Y X A A F A D G F X A A D F F F A XA FA AA AA DG FF XA FA DF FA Matrix 2: pick a random keyword and write the previous result under it in scanline order. Shuffle the columns into alphabetical order Then read down the columns to get ciphertext: XAXFAFAAAAAADDAGFFFF

ADFGX Decryption easy… …if you know the original matrix and the keyword. n Example? Read about decryption ideas in text Variation: ADFGVX cipher allows 26 letters + 10 digits