Main : Index : Pencil and Paper Systems : Improving Substitution : Polygraphic Ciphers and Fractionation : Two Trigraphic Ciphers, and a Heptagraphic One

Based on the Playfair cipher, I once thought of a way to make a cipher that worked on groups of three letters.

Using a square, as with Playfair:

T X V H R L K M U P N Z O J E C G W Y A F B S D I

encipher with the following rules:

- If all three letters are the same, replace them by three repetitions of the letter diagonally below and to the right of that letter. Thus: MMM becomes JJJ in the square above. Below, and to the right, are always interpreted cyclically, so DDD becomes RRR, and PPP becomes NNN, and even III becomes TTT.
- If two of the letters are the same, encipher the two letters as if
they were part of a digraph to be enciphered with Playfair.
- If the two letters are in the same row, replace each one with the letter to its right. Thus: PKK becomes LMM, NON becomes ZJZ.
- If the two letters are in the same column, replace each one with the letter below it. Thus: HUH becomes UJU, ZZB becomes GGX.
- If the two letters are neither in the same row nor the same column, replace each letter with the letter that is in its own row, but in the column of the other letter. Thus: BOO becomes SZZ, MIM becomes PSP.

- When all three letters are different, follow these rules:
- If all three letters are in the same row, replace each one with the letter to its right. Thus, CYG becomes GAW, ZEN becomes ONZ.
- If all three letters are in the same column, replace each one with the letter below it. Thus, MOW becomes OWS, KGB becomes ZBX.
- If two letters are in the same row, and one of those two is in the same column as the third letter, replace the letter that is in the same row as one other letter and the same column as the other other letter with the letter that is in the same column as the letter with which it shares a row, and in the same row as the letter with which it shares a column. Replace the two other letters by each other. Thus, YUK becomes KGY, WVY becomes HYV, POE becomes OPM, GAP becomes PKG.
- If two letters are in the same column, but the third letter is neither in that column nor in the same row as either of those two letters, replace each letter by the letter which is in its own row, but in the other column used by the three letters. Thus, TCO becomes VWN, TAN becomes RCE, HUG becomes XKY.
- If two letters are in the same row, but the third letter is neither in that row nor in the same column as either of those two letters, replace each letter by the letter which is in its own column, but in the other one of the two rows used by the letters. Thus, NED becomes FIJ, GAS becomes BIW, LOP becomes NME.
- If no two letters share either a row or column, each letter is replaced by the letter in its own row, but in the column of the next letter of the trigram, the first letter being the 'next letter' for the last one. Thus, TOY becomes VJC, LOB becomes MZF, GET becomes ANX.

Note that since a trigram with repeated letters always enciphers to a trigram with repeated letters, one could use a separate square for each of the three possibilities, or even just use an arbitrary substitution alphabet for the case of three identical letters.

If one uses a substitution where each letter of a 27-letter alphabet is replaced by three digits from 1 to 3, then the obvious method of constructing a trigraphic cipher from this is to write the equivalents of the three letters in by columns and take them out by rows; thus, with the alphabet

W 111 M 121 Z 131 N 211 O 221 L 231 C 311 T 321 U 331 A 112 & 122 Y 132 E 212 V 222 P 232 X 312 J 322 G 332 K 113 B 123 H 133 Q 213 R 223 S 233 I 313 F 323 D 333

we encipher like this:

T H E 3 1 2 X 2 3 1 L 1 3 2 Y

But how can we adapt these two ciphers to a 26-letter alphabet?

Let's imagine that we want to have a method that doesn't require, as the original Playfair did, inserting a letter like X into the plaintext when a double letter occurs; we want something that can be applied mechanically to any arbitrary input text. This would make it suitable for use as a step in encryption performed by a computer.

For the cipher derived from Playfair, the structure of the rules provides a clue. When the extra letter turns up, ignore it for encryption, but place it in the ciphertext without alteration, and treat two remaining letters, if they are different, as in regular Playfair, and a single remaining letter (or two identical remaining letters) as if they were three identical letters.

How, though, can we possibly make the cipher which requires a 27-letter alphabet work with only 26 letters?

First, choose a substitution table such that the unused letter, &, is represented by the code 333.

U 111 F 121 P 131 Q 211 D 221 W 231 B 311 R 321 G 331 X 112 J 122 I 132 C 212 A 222 K 232 Y 312 T 322 V 332 H 113 M 123 O 133 S 213 Z 223 L 233 E 313 N 323 & 333

Now then, any combination that does not contain an ampersand, but which produces a combination that does contain one, will have produced a combination that, when enciphered again, doesn't contain an ampersand.

L O G S & G 2 1 3 S 2 3 3 L 3 3 3 & 1 3 3 O 3 3 1 G 3 3 1 G

That appears to be a trivial consequence of the fact that this cipher is reciprocal.

Since an ampersand is represented by the code 333, however, that means that whether or not a square produces an ampersand depends only on the positions of the 3s in that square; the other two digits, 1 and 2, are irrelevant. Thus, we can do better than leaving trigrams which encipher to combinations including an ampersand unenciphered.

Between the two encipherments, we can apply a substitution to the letters of the first result, as long as that substitution leaves the 3s unchanged. Since this substitution operates perpendicular to the plaintext and the ciphertext, the cipher still mixes the letters of the trigram together in this case.

Such a substitution might look like this:

111 212 113 123 131 232 311 321 133 233 112 122 123 223 132 231 312 311 233 133 121 211 213 113 231 131 321 322 313 313 122 221 223 213 232 132 322 312 323 323 211 121 331 332 212 222 332 331 221 111 222 112 333 333

With such a substitution, our encipherment would become:

L O G H & V 2 1 3 S 213 -> 113 (H) 1 3 3 O 3 3 3 & 333 -> 333 (&) 1 3 3 O 3 3 1 G 331 -> 332 (V) 3 3 2 V

Having now obtained two trigraphic ciphers which both operate on trigrams of the 26-alphabet, but which operate on different principles, one is immediately tempted to combine them to create a cipher which will be much stronger than either one alone.

One way to do this is simply to apply both in sequence. However, inspired by recently encountering the polymorphic block ciphers of Kostadin Bajalcaliev, I have thought of a more elaborate way of doing this.

Let us encipher a block of seven letters at a time. Three letters are enciphered trigraphically by one of the two systems given above, and the next three are enciphered using the other system. The seventh letter is used to indicate which system is used.

Then, the letters are rearranged according to the permutation

from 1 2 3 4 5 6 7 to 4 7 1 2 3 5 6

and the process is repeated.

Since it seems wasteful to leave a letter unenciphered just to use it as the source of one bit of information, that letter could also be used to choose between twelve possibilities: there could be three different sets of tables for one of the block ciphers, and four different sets of tables for the other. For the one based on Playfair, it is not even necessary that the omitted letter be the same for each set of tables.

[Next] [Up] [Previous] [Index]

Next

Chapter Start

Skip to Next Section

Table of Contents

Main page

Home page