# Thread: An Interesting Matrix Modulo 27 Problem

1. ## An Interesting Matrix Modulo 27 Problem

This is a Hill Cipher implementation with 0=space, 1=a, 2=b, ... We have a message p that is encoded as c=pK where K is a 2x2 matrix with integer entries from 0 to 26 and both c and p are 1x2 vectors. The entries of c are reduced modulo 27. So p=cK^-1 where K^-1 is the inverse, modulo 27, of the matrix K. So I've found that the 2 most common vectors in the coded message are UJ and HF (which correspond to [21 10] and [8 6] respectively) and that these correspond to the uncoded message through parts of the word "the" and spaces before and after the word (ie. "space T"=[0 20], "TH"=[20 8], "HE"=[8 5], and "E space"=[5 0]). I'm not sure which these two specifically correspond to but I've tried all combinations in solving for K and can't seem to get a K that has all integer entries. Can anyone find this K or its inverse?

2. Originally Posted by evilpotato
This is a Hill Cipher implementation with 0=space, 1=a, 2=b, ... We have a message p that is encoded as c=pK where K is a 2x2 matrix with integer entries from 0 to 26 and both c and p are 1x2 vectors. The entries of c are reduced modulo 27. So p=cK^-1 where K^-1 is the inverse, modulo 27, of the matrix K. So I've found that the 2 most common vectors in the coded message are UJ and HF (which correspond to [21 10] and [8 6] respectively) and that these correspond to the uncoded message through parts of the word "the" and spaces before and after the word (ie. "space T"=[0 20], "TH"=[20 8], "HE"=[8 5], and "E space"=[5 0]). I'm not sure which these two specifically correspond to but I've tried all combinations in solving for K and can't seem to get a K that has all integer entries. Can anyone find this K or its inverse?
I can't find a K satisfying the conditions specified either. What is the source
of your frequency data is it compiled from a ciphertext or given. What about
the next most common plaintext digraphs? Do you know what they are?

RonL

3. I know, it's weird. The frequency data is given and the next most common digraphs in the cryptotext are FH and ND ([6 8] and [14 4] respectively). I'm not really sure what the next most common digraphs in plaintext would be, but a frequency table suggests they may be ".A', "S.", or "D." ([0 1],
[19 0], or [4 0]).

4. Originally Posted by evilpotato
I know, it's weird. The frequency data is given and the next most common digraphs in the cryptotext are FH and ND ([6 8] and [14 4] respectively). I'm not really sure what the next most common digraphs in plaintext would be, but a frequency table suggests they may be ".A', "S.", or "D." ([0 1],
[19 0], or [4 0]).
Now I have compiled a small digraph frequency table from a sentence of
two of Moby Dick. I have done this because most digraph tables are for
text with the spaces removed so are not applicable here.

The top scorers are:

(IN, 6), (.F, 5), (IS,4), (FI, 4), (N., 4), (ST,4), (.N, 3), (.P, 3), (.I, 3),
(TI, 3), (TE,3), (SI, 3), (RS, 3), (PE,3), (NG, 3), (IG, 3), (G.,3), (ER, 3),
(ED, 3), (D.,3)

While this is a small table it is clear that, in this case at least, the most
common digraphs do not derive from "THE". The above table suggests
that you try IN as the plain text digraph corresponding to the ciphertext
digraph UJ, and that HF might be the ciphertext for the plaintext .N or IS
(because the ciphertext digraph FH is also common, as are the plaintext
N. and SI).

RonL

5. Ok, thanks - that might change things. I thought the key was the modulo 27 thing. I don't have a lot of time at the moment so did you work it out to get an integer entry answer for K?

6. Originally Posted by evilpotato
Ok, thanks - that might change things. I thought the key was the modulo 27 thing. I don't have a lot of time at the moment so did you work it out to get an integer entry answer for K?
No it still does not work out (at least for the casesa I have tried)

RonL