Playfair Cipher

Playfair cipher encryption and decryption using a 5x5 key matrix substitution cipher.

Key

5x5 Key Matrix

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

Encrypt

Decrypt

Instructions

Algorithm Principle

Playfair cipher uses a 5x5 letter matrix for digram substitution. The key determines matrix arrangement, plaintext is encrypted by digram: same row shift right, same column shift down, rectangle diagonal swap. J is merged into I.

Steps

1. Enter a key (English letters, J is automatically converted to I); 2. View the 5x5 key matrix (highlighted are key characters); 3. Enter plaintext, click 'Encrypt'; 4. Enter ciphertext, click 'Decrypt' to restore.

Notes

Only English letters are processed, non-letter characters are ignored; identical letter pairs are separated by inserting X; odd length is padded with X at the end; decrypted result may contain padding X, manual identification needed.