The Trifid Cipher is a classical polygraphic cipher that extends the principles of the Bifid Cipher by using three-dimensional coordinates. It combines substitution and transposition to encrypt messages in a way that mixes letters across multiple positions, providing higher security than simple monoalphabetic or basic polygraphic ciphers.

The cipher relies on a 3×3×3 cube containing the letters A–Z (usually combining I/J into one cell). Each letter is represented by a triplet of numbers corresponding to its depth, row, and column within the cube. These coordinates are written sequentially for the plaintext, then divided into blocks of a predetermined length. The digits from each block are rearranged and regrouped into triplets, which are then converted back into letters using the same cube, producing the ciphertext.

Trifid Cipher: Encoding

To encode a message, first assign each letter its 3-digit coordinate from the cube. Then, divide the sequence of digits into blocks (here, size 5), read off all first digits of each letter in the block, then second digits, then third digits. Finally, regroup every three digits into new triplets and convert back to letters. For example, using the message "HELLO" with block size 5:

Plaintext: HELLO

Trifid Coordinates (depth-row-column, example cube):
H → 2 1 3
E → 1 2 2
L → 3 2 1
L → 3 2 1
O → 1 3 3

Step 1: Sequence all digits:
2 1 3  1 2 2  3 2 1  3 2 1  1 3 3

Step 2: Divide into block of 5 letters:
First digits: 2 1 3 3 1
Second digits:1 2 2 2 3
Third digits: 3 2 1 1 3

Step 3: Regroup every three digits into new triplets and convert to letters:
2 1 3 → O
1 2 2 → X
3 2 1 → B
3 2 1 → B
1 3 3 → O

Ciphertext: OXBBO

Trifid Cipher: Decoding

To decode, reverse the process: convert the ciphertext letters back into their 3-digit coordinates, divide the sequence into blocks of the original block size, then reassemble the digits in the correct order for each letter. Convert these triplets back into letters using the same cube. For the example above:

Ciphertext: OXBBO

Step 1: Convert letters back to coordinates:
O → 2 1 3
X → 1 2 2
B → 3 2 1
B → 3 2 1
O → 1 3 3

Step 2: Reassemble digits by block (size 5):
First digits: 2 1 3 3 1
Second digits:1 2 2 2 3
Third digits: 3 2 1 1 3

Step 3: Reconstruct triplets and map to letters:
2 1 3 → H
1 2 2 → E
3 2 1 → L
3 2 1 → L
1 3 3 → O

Plaintext: HELLO

Trifid Cipher: Notes

- The Trifid Cipher combines substitution and transposition in a single system, making it stronger than simple monoalphabetic ciphers. - Using blocks of digits allows the letters’ positions to be mixed, spreading information across multiple letters. - The cube and block size must be known to both sender and receiver to encrypt or decrypt messages. - Historically, it was introduced by Julius Fraenkel in 1902 and represents an early attempt to use three-dimensional polygraphic encryption. - While relatively secure for its time, it is still vulnerable to modern cryptanalysis if the block size or cube structure is known.

Trifid Cipher

T