# how to obtain the plaintext in counter mode using the AES block cipher

I want to obtain the plaintexts.

Sentence1

9d567b9ae76c8a1c72c9075e28d3537a8325bed6043620216c5d796fa65ef24d46a059 9b0c337e9f32465dae103cdb852cddc2e49ab525e923bf364e5c7602f31ee40805ef36 5340e83ef1ee2220fadb2d58ac6e8cf3d0348c34b7a48887a85d8a864bcd5f4ff5b3dc 0b33ada6b92c069f

Sentence2

8c507dc8ce4fb7556bc1554124c54029c420b8d71c36202177547f6ba00bf34356a00a d2067c65d026444ee20f2a979930c0d1e488b422ff2ffa3b45427018f35bb34739bb72 4b01f571e0af2538bd9e7f50eb608aa9

They were encrypted with the same nonce and key in the counter mode using the AES block cipher. The plaintexts are English sentences.

I guess the first word is 'the' in sentence2. When I found the 'Enc' in the sentence2. I thought the first word of sentence2 is 'Encrypted'.

I know that the keystream is combined the nonce and the counter value in the Counter Mode. But, I don't know what should I do after this.

I can't guess the word anymore. How can I know the nonce and obtain full plaintexts??

Any help will be really helpful to me!! Thank you!

• The best you can learn about the $i^\mathit{th}$ bit position in one plaintext is only as good as you know about the $i^\mathit{th}$ bit position in the other plaintext. If you have a probabilistic model for English sentences, that may help you, of course, to guess the two sentences given their xor. But nothing about the cryptography will inform you about bit positions you don't already know something about. – Squeamish Ossifrage Dec 9 '17 at 13:40
• hint: "working group", "you for solving this" and "It was easy, right?" might be part of the solution. – CodesInChaos Dec 9 '17 at 22:36
• the PSI working group congratulates you for solving this exercise. It was easy, right? and encrypting texts with counter mode is normally just fine, unless you do not take a fre – CodesInChaos Dec 15 '17 at 12:16

You can't obtain the nonce without having the key which was used for the block cipher.

For CTR mode the ciphertext is $c = m \oplus s$ where $m$ is the message and $s$ is the keystream (which is derived from the key $k$, a nonce and a counter, but this is a minor detail, important is, that re-using the nonce results in the same keystream).

Take two messages $m_1$ and $m_2$ and their corresponding ciphertexts $c_1$ and $c_2$. If we XOR those ciphertexts we get: $c_1 \oplus c_2 = m_1 \oplus s \oplus m_2 \oplus s = m_1 \oplus m_2 \oplus s \oplus s = \mathrm{???}$. Just apply the rules of XOR and you will see, what you get.

Our exercise sheet you are trying to solve, provided another hint: XORing a " " (space) with a letter (in ASCII) flips between lower- and uppercase, e.g. $\mathrm{‘a\verb!’!} \oplus \mathrm{‘\;\verb!’!} = \mathrm{‘A\verb!’!}$. If you XOR two plaintext messages in a character position, where one plaintext message has a space, what can you tell about the other message if you see a letter in uppercase or lowercase?

Now, you might ask yourself: How do I figure out, which of the two plaintexts contains the space? Use the other ciphertexts (there are 11 of them on the task sheet with the same nonce!). What will most of them tell you, if you XOR them with a ciphertext, you presume to have a space at position $i$?

Looking forward to see your solution tomorrow!