# how do i find the number of possible keys / password to decrypt a plain text

I would like to know if there is any way to recover the plain-text of a message that's been encrypted with 55 rounds of the Caesar cipher, with a different (independently chosen) key for each round; I must use a brute-force attack, and do not know the length of the keys or characters used.

• Sure, you brute-force the keys and character lengths. Is this a homework question? This is an awfully specific and arbitrary scenario. – schroeder May 28 '20 at 8:04
• If you know it's a caesar cipher, then the key "length" is only about `4.6` bits. To brute-force it, you merely have to combine that fact with the knowledge that iterating Caesar ciphers is identical to only changing the key — it increases the key strength by about 0.05 bits the first time, and none thereafter. – JamesTheAwesomeDude Feb 22 at 19:21

## 3 Answers

An encrypted plain-text is a cipher-text. A Plain-text - like its name says - is an unencrypted text.

The Caesar cipher is a simple encryption in which every plain-text letter of a given string is shifted by a given key.

Like schroeder said, your question looks awfully specific and it seems to be a homework question.

Anyway: If you rotate a given string 55 rounds with a different key (e.g. 1-26 for the latin character set), at the end there is only one single key to decrypt the whole cipher-text to a meaningful plain-text which doesn't looks like garbage. That is simply because the function is nothing less or more than:

``````encrypt(encrypt(encrypt(encrypt(string,key1), key2), key3), keyx)
``````

The algorithm uses the output of the first round as input for the second round and so on. If one knows the cipher-text and the plain-text he doesn't need to reproduce all X rounds. He simply is able to figure out one key from cipher-text to plain-text. If one only knows the cipher-text, a analysis of the quantity of every letter in the alphabet in known words would help to guess this one key. A simple explanation of this you can find here:

Cracking a Caesar-Cipher

I hope, that this "answer" helps you to put a little bit effort in solving your specific 55-Round encryption problem.

how do i find the number of possible keys … without knowing the length of the keys

As-stated, this question is impossible to answer: the number of possible keys is 2n, where n is the length (in bits) of the key.

…however, that's only the case for "real" ciphers. In this case, if you'd checked Wikipedia before posting, you'd see that there are just 25 possible keys for a Caesar cipher (this corresponds to a 4-to-5-bit key).

But, to dig more into the context of your question:

Chaining ciphers with independently-chosen keys essentially adds the lengths of the keys to get the composite key length of the resulting cipher. In theory, 55 such cycles of a cipher with 25 possible keys would yield a final key strength of just shy of 256 bits. (Again according to Wikipedia, this is probably safe given that “in order to simply flip through the possible values for a 128-bit symmetric key … would, theoretically, require… [by] the Von Neumann-Landauer Limit[,] … about 0.1% of the yearly world energy production”; a 256-bit key takes about 3.4×1038 times as many resources as that.)

However, the above all assumes the attacker does not have any cryptanalytic attacks on the cipher.

We can perform an extremely easy killer cryptanalysis on this supposedly 255-bit cipher to reduce it to a single Caesar cipher:

1. Consider the fact that `caesar_m` chained with `caesar_n` yields `caesar_(n+m mod 26)`.
2. Repeat (1) until the number of cycles the cipher has is reduced to 1.

(This is in addition to some other cryptanalytic failures it's got; but this is the most important one to exploit in this case, so I'll only go into it.)

So you only have to try "all" 26 caesar ciphers (the 26th possibility, of a null cipher, can emerge from combining, say, a +20 and a +6 shift); people across the country crack a 600 sextillion times harder cipher with breakfast every morning. You should be able to brute-force it by hand in a few minutes by attempting to decrypt just the first handful of letters and checking if the resulting text is valid language.

In does not matter how many rounds of caesar cipher you use, effectively it still becomes one single round with key (k1+k2+k3 ....kn) mod a, where a is the number of alphabets, 26 in English alphabet. So, you only need 26 attempts to break it.