# Is there a general method to crack this type of fractionating cipher?

I've seen a few puzzles based on a type of cipher in which letters in the plaintext are substituted with groups of characters in the ciphertext. The ciphertext only uses a handful of unique characters. For example:

a -> 154
b -> 53
c -> 12
d -> 41
e -> 153
...


In this example, bead is encoded as 5315315441.

Since not all letters are encrypted to have the same length, I can't simply break the message up into pairs of numbers and run frequency analysis. Once the key is known, however, then the character boundaries are unambiguous.

Difficulties in cryptanalysis also arise when one letter's encryption completely contains another letter's encryption, such as how e 153 contains b 53. For example, the following is unambiguous given knowledge of the key, yet might not be easy to for an attacker notice:

  4153 -> db
154153 -> ae


Let's say that I have a ciphertext, and I am reasonably sure that it is encoded in this way. How would I go about cracking it?

The only thing I know to do is to look for repeating patterns, as repeating words in the plaintext also repeat in the ciphertext. I haven't successfully solved one of these kinds of puzzles, however.

• It sounds like $|c_i|=1$ is rare in your scheme – rath Dec 15 '13 at 18:38
• Is this not on topic for crypto.SE? If so, is there any better place to post it? – PhiNotPi Dec 15 '13 at 20:35
• How is this a request for analyzing / decrypting a block of data? Please do read the questions before voting to close. [+1] to balance it out. – rath Dec 15 '13 at 20:57
• How are spaces encoded? – Dennis Dec 17 '13 at 16:16

Known plaintext attacks and chosen plain-text attacks

The attack here is straightforward. If you have any known plain-text at all, you can find codes for all the letters in the plain-text you have. You can then use this knowledge to decrypt other messages whose plain-text is unknown.

A very small number of known plaintexts would completely compromise this scheme.

Ciphertext only attack

Each letter within a language has a certain probablity of occurring. In English, the letter "e" is the most frequently used letters.

This wikipedia article gives a nice table of all the English letters and their frequencies.

The attack is fairly straightforward. Take a given cipher-text and build a frequency table for all one digit strings, two digit strings, three digits strings etc.

Then compare each string's relative frequencies compared to the table linked in the Wikipedia article. If there is a rough correspondence between a given sequence of digits and a given letter, substitute that sequence for the letter in question.

Most of the time, the substitution will be valid and the plaintext will quickly fall in to view.

• On your ciphertext only attack do you mean given say 154153 run the analysis on 1,5,4,1,5,3; 15,41,53; 154,153? Or do you mean to run it on 1,5,4,1,5,3; 15,54,41,14,43; 154,541,415,153? If the former, I don't think it will work. – mikeazo Dec 16 '13 at 13:43
• @mikeazo - The second one. You run it for unigraphs, digraphs, trigraphs, quadgraphs and so and so. Suppose "e" encoded to 121. The trigraph frequency would be much higher than any other character that encoded to three letters. Over all, it would appear more times than any other group of digits. This would lead you to substitute 121 -> e. You then select the next most frequently occurring sequence and assign that to "t." etc etc until you break the whole message. – Simon Johnson Dec 16 '13 at 14:44
• What happens if e->121 and d->21. I think your methods are good, but like any method for cryptanalysis, it is not perfect. +1 though. – mikeazo Dec 16 '13 at 14:55
• I think it would still work. You'd have two spikes superimposed on top of each other. The digraph frequency for 21 would be higher than 121. Leading to an incorrect assignment on the first pass. However, you'd quickly notice another spike at 121 and immediately see you have an overlap. Since 121 would occur roughly 8% of the time, you'd still be able to distinguish this as being the "true" e. You would then know to treat any "21" without a "1" preceding it as a different letter. You can continue with your cryptanalysis accordingly. – Simon Johnson Dec 16 '13 at 15:21