# Bifid Cipher: Encrypt and Decrypt Online

The Bifid cipher is a fractionating transposition cipher. It was invented by the French amateur cryptographer Félix Delastelle around 1901. The Bifid cipher uses a Polybius square to achieve the fractionation.

Each character depends on two plaintext characters thus making it a digraphic cipher.

The Bifid cipher is considered a more secure cipher because it breaks the message apart into two separate streams and then recombines them.

This spreads the information out to multiple letters, increasing security.

It uses a table with one letter of the alphabet omitted. Often the J is removed and people just use an I instead.

The Bifid cipher can encrypt 25 characters because the alphabet has 26 letters, one letter has to be replaced by another (for example replacing J by I).

The larger number of symbols produced than monoalphabetic ciphers, makes it much more resistant to frequency analysis.

Longer messages are often broken into smaller groups and then each group is encrypted by itself. If the length of each group is odd, it will be harder to break the ciphertext.

## How to encrypt using Bifid cipher?

Bifid encryption requires a square grid (or a keyword to generate the grid, generally 5 by 5 or 6 by 6) and (optional) a number N which will serve as a period/block length (otherwise take N = 1).

For example, let’s encrypt the plain message “KIFANGA” with the grid (generate with the word “SECRET”).

\ |
1 |
2 |
3 |
4 |
5 |

1 |
S |
E |
C |
R |
T |

2 |
A |
B |
D |
F |
G |

3 |
H |
I |
K |
L |
M |

4 |
N |
O |
P |
Q |
U |

5 |
V |
W |
X |
Y |
Z |

Encryption first consists in splitting letters in blocks of size N. This text-splitting is not mandatory, but simplifies encryption/decryption for long texts.

For example, a period of length N = 3 for KIFANGA gives KIF, ANG, A (if the block is incomplete, it does not matter).

For a non-split encryption, imagine a period of size N = 1 (or a period side equal to or greater than the number of letters in the plain message.

For each letter of the block, we write the coordinates of the letters (row, column) in a table.

For example, let’s take the first block KIF. K = (3, 3), I = (3, 2), F = (2, 4) and we write it in a table.

K |
3 |
3 |

I |
3 |
2 |

F |
2 |
4 |

To get new coordinates, we read the numbers of the table vertically by columns.

For example, the vertical reading gives 3, 3, 2, 3, 2, 4 or the coordinates (3, 3), (2, 3), (2, 4).

Replace the coordinates with the corresponding letters in the grid.

For example, (3, 3) for K, (2, 3) for D and (2, 4) for F.

These steps are repeated for each block.

For example, the final encrypted message is “KDFFATA”.

## How to decrypt Bifid Cipher?

Bifid decryption begins identically to encryption.

For example, the message “DBAKS” has been encrypted with a period N = 3 and the grid (generated with the word “MESSAGE”).

\ |
1 |
2 |
3 |
4 |
5 |

1 |
M |
E |
S |
A |
G |

2 |
B |
C |
D |
F |
G |

3 |
I |
K |
L |
N |
O |

4 |
P |
Q |
R |
T |
U |

5 |
V |
W |
X |
Y |
Z |

The message is split into period/block of size N.

For example, the message is decomposed in block of 3: DBA, KS.

Each letter is associated with its position in the grid as coordinates (row, column).

For example, the letters of the block D, B, A have the respective coordinates (2, 3), (2, 1), (1, 4).

So, we write the coordinates on 2 lines (and thus N columns, eventually except the last block).

2 |
3 |
2 |

1 |
1 |
4 |

Then, we read vertically by columns.

For example, we get 2, 1, 3, 1, 2, 4 or (2, 1), (3, 1), (2, 4).

The new coordinates are then associated with the corresponding letters in the grid.

For example, we find the plain letters (2, 1) = B, (3, 1) = I and (2, 4) = F.

These steps are repeated for each block.

For example, the plaintext message is “BIFID”.

Use the above Bifid cipher decoder and encoder to encrypt/decrypt simple messages.

## How to recognize Bifid Ciphertext?

The message has a low coincidence index around 0.04 to 0.05. If the grid is 5 by 5 then it can have at most 25 distinct characters.

## What does Bifid means?

Bifid means “that is cut in half lengthwise”, which applies to the Delastelle cipher: the coordinates are cut in 2 during the encryption and decryption process.

## Why the period should not be N = 1?

With a period of 1, the encryption or decryption algorithm has no effect (because the principle of column writing and row reading does not produce a shuffling effect).