Trifid Cipher Encryption and Decryption
Plaintext
Ciphertext
1 | 2 | 3 | |
---|---|---|---|
1 | A | B | C |
2 | D | E | F |
3 | G | H | I |
1 | 2 | 3 | |
---|---|---|---|
1 | J | K | L |
2 | M | N | O |
3 | P | Q | R |
1 | 2 | 3 | |
---|---|---|---|
1 | S | T | U |
2 | V | W | X |
3 | Y | Z | _ |
What is the Trifid Cipher?
The Trifid Cipher is a positional substitution cipher developed by French cryptographer Felix Delastelle in 1901. Unlike traditional substitution ciphers, which rely solely on the order of the alphabet, the Trifid Cipher uses three dimensions to assign letter positions. It divides the alphabet into three groups and converts plaintext letters into three-dimensional coordinates (layer, row, column) for encryption.
In the encryption process, the Trifid Cipher maps each letter of the plaintext to a three-dimensional coordinate system. Afterward, the coordinates are rearranged according to certain rules, generating the ciphertext. The complexity of combining three-dimensional coordinates provides a higher level of security than traditional substitution ciphers.
How Does the Trifid Cipher Encrypt?
The encryption process involves the following steps:
- Prepare the Plaintext: Remove spaces, punctuation, and any non-alphabet characters from the plaintext.
- Define the Trifid Cipher Alphabet: The Trifid Cipher uses a standard alphabet, assigning letters to a three-dimensional coordinate system based on layers, rows, and columns.
- Convert the Plaintext Letters to Three-Dimensional Coordinates: Each letter's position is represented by its layer, row, and column.
- Organize the Coordinates into a Table: Each letter's three-dimensional coordinates are organized vertically in a table, with the first row showing the layer, the second row showing the row, and the third row showing the column.
- Group by Size: The organized coordinates are grouped by the specified group size, sorted by columns.
- Rearrange Coordinates by Group: Within each group, the coordinates are recombined horizontally, with three coordinates per group, resulting in new coordinates.
- Generate the Ciphertext: Using the new coordinates, find the corresponding letters in the three-dimensional grid and substitute them for the ciphertext.
Example
Suppose the plaintext is "HELLO WORLD", the alphabet is made up of 26 English letters plus a special character ("ABCDEFGHIJKLMNOPQRSTUVWXYZ_"), and the group size is 4.
1. Generate the Three-Dimensional Coordinate System:
① | 1 | 2 | 3 |
---|---|---|---|
1 | A | B | C |
2 | D | E | F |
3 | G | H | I |
② | 1 | 2 | 3 |
---|---|---|---|
1 | J | K | L |
2 | M | N | O |
3 | P | Q | R |
③ | 1 | 2 | 3 |
---|---|---|---|
1 | S | T | U |
2 | V | W | X |
3 | Y | Z | _ |
2. Convert the Letters to Three-Dimensional Coordinates:
- H → (1, 3, 2)
- E → (1, 2, 2)
- L → (2, 1, 3)
- L → (2, 1, 3)
- O → (2, 2, 3)
- W → (3, 2, 2)
- O → (2, 2, 3)
- R → (2, 3, 3)
- L → (2, 1, 3)
- D → (1, 2, 1)
3. Organize the Coordinates into a Table:
Plaintext | H | E | L | L | O | W | O | R | L | D |
---|---|---|---|---|---|---|---|---|---|---|
Layer | 1 | 1 | 2 | 2 | 2 | 3 | 2 | 2 | 2 | 1 |
Row | 3 | 2 | 1 | 1 | 2 | 2 | 2 | 3 | 1 | 2 |
Column | 2 | 2 | 3 | 3 | 3 | 2 | 3 | 3 | 3 | 1 |
4. Group by Size:
H | E | L | L |
---|---|---|---|
1 | 1 | 2 | 2 |
3 | 2 | 1 | 1 |
2 | 2 | 3 | 3 |
O | W | O | R |
---|---|---|---|
2 | 3 | 2 | 2 |
2 | 2 | 2 | 3 |
3 | 2 | 3 | 3 |
L | D |
---|---|
2 | 1 |
1 | 2 |
3 | 1 |
5. Rearrange Coordinates by Group:
- Group 1: (1, 1, 2), (2, 3, 2), (1, 1, 2), (2, 3, 3)
- Group 2: (2, 3, 2), (2, 2, 2), (2, 3, 3), (2, 3, 3)
- Group 3: (2, 1, 1), (2, 3, 1)
6. Convert Coordinates to Ciphertext Letters:
- (1, 1, 2) → B
- (2, 3, 2) → Q
- (1, 1, 2) → B
- (2, 3, 3) → R
- (2, 3, 2) → Q
- (2, 2, 2) → N
- (2, 3, 3) → R
- (2, 3, 3) → R
- (2, 1, 1) → J
- (2, 3, 1) → P
Therefore, the encryption result for "HELLO WORLD" is: "BQBRQNRRJP".
How Does the Trifid Cipher Decrypt?
The decryption process is the reverse of the encryption process. The first three steps are the same as the encryption process, but from step 4 onwards, there are key differences:
- Organize the Coordinates into a Table: The coordinates are horizontally filled into the table based on the group size, with each group containing three rows. After each group is filled, the next group is added. The last group will have its columns dynamically adjusted based on the number of rows.
- Rearrange Coordinates: Each group consists of three rows, with the first row representing the layer, the second row representing the row, and the third row representing the column. The coordinates are recombined vertically.
- Decrypt the Ciphertext: Using the newly arranged coordinates, find the corresponding letters and reconstruct the plaintext.
Example
Suppose we need to decrypt the ciphertext "BQBRQNRRJP" with a group size of 4, using the same alphabet as the encryption process.
1. Obtain the Three-Dimensional Coordinates for the Ciphertext Characters:
- B → (1, 1, 2)
- Q → (2, 3, 2)
- B → (1, 1, 2)
- R → (2, 3, 3)
- Q → (2, 3, 2)
- N → (2, 2, 2)
- R → (2, 3, 3)
- R → (2, 3, 3)
- J → (2, 1, 1)
- P → (2, 3, 1)
2. Organize the Coordinates into a Table by Group Size:
1 | 1 | 2 | 2 |
3 | 2 | 1 | 1 |
2 | 2 | 3 | 3 |
2 | 3 | 2 | 2 |
2 | 2 | 2 | 3 |
3 | 2 | 3 | 3 |
2 | 1 |
1 | 2 |
3 | 1 |
3. Rearrange Coordinates by Columns:
- Group 1: (1, 3, 2), (1, 2, 2), (2, 1, 3), (2, 1, 3)
- Group 2: (2, 2, 3), (3, 2, 2), (2, 2, 3), (2, 3, 3)
- Group 3: (2, 1, 3), (1, 2, 1)
4. Decrypt to Plaintext:
- (1, 3, 2) → H
- (1, 2, 2) → E
- (2, 1, 3) → L
- (2, 1, 3) → L
- (2, 2, 3) → O
- (3, 2, 2) → W
- (2, 2, 3) → O
- (2, 3, 3) → R
- (2, 1, 3) → L
- (1, 2, 1) → D
Therefore, the decryption result for "BQBRQNRRJP" is: "HELLOWORLD".