## Trifid Cipher

Trifid ciphers are one of the most complicated substitution ciphers in this list. They work by splitting each letter into 3 parts, each part then interacts with other parts from other letters to form a secure encryption.

### Encrypting

The key for a Trifid cipher is a grid with three, 3x3 boxes (see example below). Each cell in the grid is filled up randomly with letters. Each letter can be found by using a 3-part coordinate; (which box, which row, which column).

To encrypt a message, write out the letters in a line, underneath each letter write the letter's coordinates in a column.

For example (using the grid below):

H E L L O
2 0 0 0 2
1 0 2 2 0
0 2 0 0 2

Now read off, from left to right, all of the coordinates in groups of three:

`200,021,022,002,002`

Now look up these new coordinates in the grid:

`UZXEE`

### Decrypting

To decrypt, convert each letter in the cipher text to a coordinate triplet and write the triplets out, from left to right, forming three equal-width rows.

Now read down each column to retrieve the original triplet and use your table to convert it into the original letter.

To make your own key simply draw out three 3x3 boxes in a grid. Fill the boxes with letters in random positions, use A-Z plus a space. To write down this grid as a key simply read off the grid left to right, row by row. See the example below.

### Example

Here's a grid that you can edit. When you change the letters in the grid the key will update and the example plaintext will be encrypted for you. Can you see how it all works?

 Box 0 Box 1 Box 2 0 1 2 0 1 2 0 1 2 0 1 2

`HELLO WORLD`