# A geometric transposition cipher

This is my first cipher puzzle. Here is the ciphertext:

TKPHF_C_PELR_HVB_LDOAAVLEAEISGNCUTFROM_SDIOCFEAEAHAAROOAAIG_DLT_SN_LP_AREL_PTOTITOSIIUAMT_EAIS_TNWSNNI_DES_IP_FNOAC_PMCK__L_SIO___N_FN_TLIIMTICG_ANGNN_SYEEEH_AEFISTBOESNNE

That's 171 characters, but this cipher can be applied to a plaintext of any length. I've replaced spaces with underscores to make it a little easier to work with.

As the title, says the cipher is a transposition cipher, meaning that the plaintext is an anagram of the ciphertext. The cipher logic has a geometric basis. You could write a computer program to decipher it, but it's simple enough to solve using pen and paper. That's all I'll give away for now.

I think this is a pretty hard one. Not NSA hard, but hard, so I anticipate adding hints over the coming days.

Hint 1:

The geometric shape this puzzle is based on is a square. Remember that any text may be encoded with this scheme, not just messages with a square number of characters, so there will be gaps.

Hint 2, an example of a plaintext and resulting ciphertext:

IF YOU PLEASE GOOD SIR I THINK THAT A HINT IS IN ORDER IOLEOI_FI_TH_ITUI__EO_ESTRI_O_IDSADRNRPKSNAHNTYH__GA__

Hint 3:

Clockwise

Hint 4, a shorter, more telling plain/cipher text:

HELP I NEED A HINT
H_EAEII_ENTN_PHD_L

• What key did you use? – warspyking Dec 19 '14 at 1:19
• There is no key, just some method of rearranging the characters. If you write the plain text backward, for example, that's a trivial transposition cipher. No key needed. The method used here is, of course, less obvious. – Matt Malone Dec 19 '14 at 1:50
• Feedback: It looks like a cool code, but there's no starting point for me to latch on to. I tried "every Nth character" for all values of N, and it didn't work. Anything else I try will just be throwing spaghetti at a wall and checking whether the result is English. So, IMO, not enjoyable to solve in its current form. Giving clues like the fact that it has geometric basis and the difficulty of deciphering it is a step in the right direction. – Lopsy Dec 19 '14 at 3:28
• @Lopsy Added two hints. I thought I'd start it bare and add hints over time, but I think it was a little too bare. This will give you something to go on. – Matt Malone Dec 19 '14 at 5:58
• @MattMalone I think it's nicely doable with Hint 4 (maybe even with hint 2 alone and some more time). My current problem is: I can't get the time to work on it , which I hate... :c( If it isn't solved until I find the time, I'll work on it! – BmyGuest Dec 22 '14 at 21:14

The kingpin has fled to Cuba STOP Special forces have been deployed STOP Maintain vigilance against Communist infiltration among officers as well as the rank and file STOP

The biggest clue for me was

seeing that the third letter of the plaintext appeared at the end of the ciphertext

To create ciphertext from plaintext (found with the hints):

Find the lowest square above the number of characters. (171 characters -> 196 = 14 * 14) So we'll be working on a 14 by 14 square. Fill the plaintext characters in the square in the following order (only 1-9 filled in on a 4 by 4 square):

1592
---6
8---
4-73


Once the outer border is completely filled, take the next inner border. Every odd inner border starts in the lower right (instead of upper left), but continue clockwise. You'll have gaps in the middle when the sentence has stopped.

To decipher a ciphertext:

The hardest part here is finding out how to reconstruct the square from the text, figuring out where the gaps should be. To do this fill the 171 cells in a 14 by 14 table in the above mentioned manner. In this case you'll have 4 complete rows of 14 letters. The fifth until tenth row will have gaps in them, thus consisting of less than 14 letters. The eleventh until fourteenth row are again complete with 14 letters. The square looks like this:

TKPHF_C_PELR_H
VB_LDOAAVLEAEI
SGNCUTFROM_SDI
OCFEAEAHAAROOA
AIG_DLT  _SN_L
P_AR     EL_PT
OTIT     OSIIU
AMT_      EAIS
_TNWS     NNI_
DES_I  P_FNOAC
_PMCK__L_SIO__
_N_FN_TLIIMTIC
G_ANGNN_SYEEEH
_AEFISTBOESNNE


And then it's only a matter of reading the letters in the right order (as described above).

Given that the length 171 is a triangular number, I think the shape is a triangle. I didn't get anything good though by packing the letters into a triangle, regardless of which direction I read (backward/forwards, slant left/right).

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


Nor with the triangle upside-down:

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

• Nice idea with the triangulation and all that! – Conor O'Brien Dec 20 '14 at 3:11

This is also Work in Progress

Starting with the shorter text of Hint 4:

The clear text can be written in rectangle. As the clear text is

IF_YOU_PLEASE_GOOD_SIR_I_THINK_THAT_A_HINT_IS_IN_ORDER
and the cipher text is
IOLEOI_FI_TH_ITUI__EO_ESTRI_O_IDSADRNRPKSNAHNTYH__GA__
I take the letters of the cipher text as staring letters of the line-breaks, giving me a break every 4 letters:
 IF_Y
OU_P
LEAS
E_GO
OD_S
IR_I
_THI
NK_T
HAT_
A_HI
NT_I
S_IN
_ORD
ER 

This is already very encouraging, as the first 7 letters come out correct, but then it breaks down. So I think this is the way to go: Arrange given letters in a geometry, and read out into another direction. I'll have to play with some more geometries now...

• You're making progress. Keep in mind the square. – Matt Malone Dec 20 '14 at 21:20
• Also... just seven? – Matt Malone Dec 21 '14 at 2:38
• This type of cipher is known as a Route cipher. A Rail fence cipher with 3 rails could also produce the first 7 letters. Also, the last seven letters H__GA__ can be found in the third column in reverse order. – McMagister Dec 21 '14 at 4:11
• Well, as currently written your cipher is a columnar transposition cipher. But I believe the answer will be a route cipher which is slightly more complex. – McMagister Dec 21 '14 at 4:16
• @McMagister +1 for the nice homepage link – BmyGuest Dec 21 '14 at 8:41

This is a work in progress, not a final answer. Mainly, I'll start by attacking the smaller piece of code (HINT #2). It is worthy to note that this can be solved with a pen and pad, so it's not going to (likely) include trigonometry or something like that.

IF YOU PLEASE GOOD SIR I THINK THAT A HINT IS IN ORDER IOLEOI_FI_TH_ITUI__EO_ESTRI_O_IDSADRNRPKSNAHNTYH__GA__

This sorted in order of length (small x to large x, a to z).

Plaintext:

A I IF IN IS SIR YOU GOOD HINT THAT ORDER THINK PLEASE

Ciphertext:

O EO FI GA TH ITUI ESTRI ILOEOI IDSADRNRPKSNAHNTYH

It is obvious that there is no direct, easily findable order relation between the cipher text and the plaintext. However, it is worthy to note that there is some sort of order relation involving the transformation of a certain character into a space, as there are three instances of a double underscore (__), which might not occur otherwise.

It can be inferred that the a letter occurring the same number of times as the spaces would be (if it is) the direct correlation. It is a feeble attempt (I'm sure XNOR would've thought of a Caeser cipher by now), but it is worth trying.

Occurrences in Plaintext:

#E: 3
#I: 7
#O: 4
#A: 3
#N: 3
#H: 3
#L: 1
#_: 12
#T: 4

That seems like enough from now. Feel free to take this were you will, I will now retire (to bed, that is :P).

The above is the result of a misreading of the instructions. Feel free to analyze it, for it will get you no where.

Here is what I now know: The letters are arranged in a transposition, where each letter is moved to another space. I have no idea where to go, so, since it involves geometry, I'll start doing stuff with geometry.

Is $54$ characters long; $\sqrt{54}$ is remarkably close to $e^2$, this may or may not be important, as the difference is $0.04058687058$, significant enough as to not be relevant. $54$, however, is able to be put into a few differently-sized rectangles:
WIP