Bifid Cipher
Encode and decode text using the classical Bifid cipher, combining a Polybius square fractionation with transposition.
What is the Bifid Cipher?
The Bifid Cipher is a classical polygraphic substitution cipher invented by the French cryptographer Félix Delastelle around 1901. Delastelle was famous for introducing ciphers that combined **fractionation** and **transposition** to achieve high levels of confusion and diffusion, which were exceptionally strong before the advent of computer-based cryptography.
Bifid achieves this by converting each character into row and column coordinates in a **Polybius square** (a 5x5 grid of letters). These coordinates are written out, mixed (transposed) in blocks of a specific size (the period), and then recombined to look up new letters in the same square.
Mathematical Formulation of Fractionation
Let $\mathcal{A}$ be the alphabet of 25 characters (standard is $26$ letters with 'J' replaced by 'I'). The Polybius square maps each character $m \in \mathcal{A}$ to a unique pair of coordinates: $$\Phi(m) = (r, c) \quad \text{where} \quad r, c \in \{0, 1, 2, 3, 4\}$$ For a block of text of period $P$, we denote the plaintext characters as: $$M = (m_1, m_2, \dots, m_P)$$ Each character is fractionated into its coordinates: $$\Phi(m_i) = (r_i, c_i) \quad \text{for} \quad i = 1, \dots, P$$
Block Transposition & Recombination
The coordinates are listed horizontally in a single sequence of length $2P$: $$S = (r_1, r_2, \dots, r_P, c_1, c_2, \dots, c_P)$$ This coordinate stream is then divided into new pairs to read off the ciphertext characters: $$(r'_i, c'_i) = (S_{2i-1}, S_{2i}) \quad \text{for} \quad i = 1, \dots, P$$ Finally, the ciphertext block $C = (c'_1, c'_2, \dots, c'_P)$ is retrieved using the inverse mapping: $$c'_i = \Phi^{-1}(r'_i, c'_i)$$
Step-by-Step Bifid Example
Let's encrypt the word "HELLOWORLD" with the key "BIFID" and period **5**:
-
Construct the Polybius Square:
Using the keyphrase "BIFID" and merging "J" to "I", we populate the 5x5 grid:
0 1 2 3 4 0 B I F D A 1 C E G H K 2 L M N O P 3 Q R S T U 4 V W X Y Z
-
Fractionate the first block "HELLO":
Find the coordinates of H, E, L, L, O in the grid:
- H $\to$ Row 1, Col 3
- E $\to$ Row 1, Col 1
- L $\to$ Row 2, Col 0
- L $\to$ Row 2, Col 0
- O $\to$ Row 2, Col 3
-
Write coordinates horizontally:
Rows: 1 1 2 2 2 Cols: 3 1 0 0 3 Stream: 1, 1, 2, 2, 2, 3, 1, 0, 0, 3
-
Re-group coordinates into pairs:
- (1, 1) $\to$ **E**
- (2, 2) $\to$ **N**
- (2, 3) $\to$ **O**
- (1, 0) $\to$ **C**
- (0, 3) $\to$ **D**
Frequently Asked Questions
What is the "period" or "block size" in the Bifid cipher?
The period is the block size used to partition the message before transposition. A larger period spreads letters further apart, which enhances transposition and diffusion, making the ciphertext harder to crack using frequency analysis. A period of 5 or 7 is standard.
How does the Bifid cipher handle non-alphabet characters?
By default, this tool keeps non-alphabet characters (like spaces, numbers, and punctuation) in their original positions and preserves letter casing. This means the formatting of sentences remains intact, making it easier to read the resulting ciphertext or decrypted plaintext. You can also choose to strip them out using the "Remove / Ignore" setting.
What happens to the letter 'J' in the Polybius square?
Since a Polybius square is a 5x5 grid, it has 25 slots. Because the English alphabet has 26 letters, one letter must be merged or omitted. Historically and in this tool, the letter 'J' is mapped to 'I'. You can also choose to map 'I' to 'J', or omit the letter 'Q'.
Is the Bifid cipher cryptographically secure?
No, classical ciphers like the Bifid cipher are not secure by modern standards. Computers can break a Bifid cipher using techniques like hill climbing or simulated annealing in a fraction of a second. However, it is an amazing tool for puzzles, geocaching challenges, and educational demonstrations of classical fractionation ciphers.
Who invented the Bifid cipher?
The Bifid cipher was invented by Félix Delastelle, a French amateur cryptographer. He published it in his book "Traité Élémentaire de Cryptographie" in 1901, shortly before his death.
Related tools
Your recent visits