# Kryptos Solution

Notes on my K4 journey

## K4: Not 2x2 Hill Cipher A-Z Alphabet

For those that are interested, K4 is not a 2x2 Hill cipher using the standard English alphabet.

Here is my worksheet.

```NYPVTT
BERLIN
0123456789012345
01234567891111111111222222
ABCDEFGHIJKLMNOPQRSTUVWXYZ
KRYPTOSABCDEFGHIJLMNQUVWXZ

24x + 15y = 4  17
21x + 19y = 11 8

24 15 | 4 17
21 19 | 11 8

168 105 | 28 119
168 152 | 88 64

168 105 | 28 119
168 152 | 88 64
--------------------
0   -47   -60 55
0   5     18  3
7
8
168

24 15 | 4  17
0  5  | 18  3

24 15 | 4  17
0  15 | 54  9
--------------
24 0   -50 8
24 0   2   8

24 0  | 2   8
0  5  | 18  3

*21 (modular inverse of 5)
0  105 | 378 63
---------------

24 0 | 2   8
0  1 | 14 11

3  22 | 19  9
0  1  | 14 11

3  22 | 19  9
0 22 | 308 242
---------------
3 0  | 23  1

3 0 | 23  1
0 1 | 14 11

*9
1 0 | 25 9
0 1 | 14 11

Final key:
25 14
9  11
```

Yes, it was all done by hand with the help of a few tools to find modular inverses.

The decoded text gives this:
AHURUWRXOBEPRZKNKXNUWTTAVBMXJKEIAWSXKRCEHXAWGQNGEQDKODWFSUMAFQZWERLITRTUVLKEHHLKDKOZYIKYNXUMGQYS

That was NOT done by hand. I have my own tool to encode and decode Hill ciphers. The red section shows what should have been BERLIN. The reader may attempt to solve at a different position if they wish (one back or one ahead).

What would be nasty is if the encoding alphabet is different than the decoding alphabet. It could also be that the alphabet is homophonic at 31 or something like that.

I will try the KRYPTOS alphabet next just for fun. After that, I will try 3x3. I think I can write some code that can check all the remaining possibilities.

update: Using the KRYPTOS alphabet doesn't work. The letters two apart are both even. So I can't produce a diagonal. For 2x2, one could check regular alphabet for ciphertext and KRYPTOS alphabet for the plaintext. Other than that, you'd need different alphabets or even different alphabet lengths.

### Write a comment

New comments have been disabled for this post.

December 2013
S M T W T F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31