Monday, October 14, 2013

Code 17 : Trifid Cipher


The Trifid Cipher is the Bifid Cipher taken to one more dimension. Instead of using a 5x5 Polybius Square, you use a 3x3x3 cube. Otherwise everything else remains the same. As with the Bifid Cipher, the cube can be mixed to add an extra layer of protection, but for these examples we not be using a mixed alphabet cube.
Layer 1
 123
1ABC
2DEF
3GHI
Layer 2
 123
1JKL
2MNO
3PQR
Layer 3
 123
1STU
2VWX
3YZ.
The first step is to use the cube to convert the letters into numbers. We will be writing the numbers vertically below the message in the order of Layer, Column, Row.
secret message
311213 2133111
123322 1211112
121321 2211132
The numbers are now read off horizontally and grouped into triplets.
311 213 213 311 112 332 212 111 121 213 212 211 132
The cube is used again to convert the numbers back into letters which gives us our ciphertext.
sppsdxmabpmjf
To decipher a Trifid encrypted message, you first convert each letter into its corresponding number via the cube. Now, divide the long string of numbers into three equal rows. Now, read off each column and use the cube to convert the three numbers into the plaintext letter.


Trifid Cipher

Introduction

The Trifid cipher combines substitution with transposition and fractionation. It was invented by Felix Delastelle. Delastelle was a Frenchman who invented several ciphers including the bifid, trifid, and the four-square ciphers.
Trifid is very similar to Bifid, except that instead of a 5 by 5 keysquare (in bifid) we use a 3 by 3 by 3 key cube.

The Algorithm

The key is in the form of 3 squares:
key = EPSDUCVWYM.ZLKXNBTFGORIJHAQ
                                 
square 1   square 2   square 3   
                                 
  1 2 3      1 2 3      1 2 3    
1 E P S    1 M . Z    1 F G O    
2 D U C    2 L K X    2 R I J    
3 V W Y    3 N B T    3 H A Q    
As an example, we will encipher the text DEFEND THE EAST WALL OF THE CASTLE. The first step means locating the plaintext letters in the squares above, D is in square 1, row 2, column 1, so D becomes 121. In the same manner, E becomes 111. If we write down the numbers corresponding to each letter vertically, it becomes:
D E F E N D T H E E A S T W A L L O F T H E C A S T L E .
1 1 3 1 2 1 2 3 1 1 3 1 2 1 3 2 2 3 3 2 3 1 1 3 1 2 2 1 2
2 1 1 1 3 2 3 3 1 1 3 1 3 3 3 2 2 1 1 3 3 1 2 3 1 3 2 1 1
1 1 1 1 1 1 3 1 1 1 2 3 3 2 2 1 1 3 1 3 1 1 3 2 3 3 1 1 2
At the moment this is still a substitution cipher and fairly easy to break. The next step is to use a 'period', which is a number usually 5 - 20, which is part of the key material agreed on by both sender and receiver. If we take a period of 5,
DEFEN DTHEE ASTWA LLOFT HECAS TLE.
11312 12311 31213 22332 31131 2212
21113 23311 31333 22113 31231 3211
11111 13111 23322 11313 11323 3112
we group the numbers. We now read off the numbers in each group horizontally, and do the substitution back to letters using the original keysquare.
113122111311111 123112331113111 312133133323322 223322211311313 
S  U  E  F  E   C  P  H  S  E   G  Y  Y  J  I   X  I  M  F  O  

311313123111323 221232113112
F  O  C  E  J   L  B  S  P
Which means DEFEND THE EAST WALL OF THE CASTLE. is enciphered to SUEFE CPHSE GYYJI XIMFO FOCEJ LBSP using the key square above and a period of 5.


0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.