The Trifid cipher is the Bifid cipher taken to one more dimension. Instead of using a 5x5 Polybius square, you use a 3x3x3 cube. And there is additional group size variable.
First, a mixed alphabet is splitted into 3x3x3 cube:
1 | 2 | 3 | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
The message "SECRETMESSAGE" is converted to its coordinates (Layer-Row-Column) but instead of writting them horizontally, they are written vertically beneath:
S | E | C | R | E | T | M | E | S | S | A | G | E |
---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | 1 | 1 | 2 | 1 | 3 | 2 | 1 | 3 | 3 | 1 | 1 | 1 |
1 | 2 | 1 | 3 | 2 | 1 | 2 | 2 | 1 | 1 | 1 | 3 | 2 |
1 | 2 | 3 | 3 | 2 | 2 | 1 | 2 | 1 | 1 | 1 | 1 | 2 |
The next step is to use a 'group size' variable, which is a number usually between 5 and 20, which is part of the key material agreed on by both sender and receiver. If we take a period of 5, then we will get:
S | E | C | R | E | T | M | E | S | S | A | G | E | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | 1 | 1 | 2 | 1 | 3 | 2 | 1 | 3 | 3 | 1 | 1 | 1 | ||
1 | 2 | 1 | 3 | 2 | 1 | 2 | 2 | 1 | 1 | 1 | 3 | 2 | ||
1 | 2 | 3 | 3 | 2 | 2 | 1 | 2 | 1 | 1 | 1 | 1 | 2 |
Then we write down the numbers by reading horizontaly in each group.
311211213212332 321331221121211 111132112 ->
311 211 213 212 332 - 321 331 221 121 211 - 111 132 112
Then the triplets are turned back into letters using the same cube:
SJLKZ VYMDJ AHB -> SJLKZVYMDJAHB
To decrypt, the procedure is simply reversed.