# Block Cipher Mode of Operations

I am studying for a test and I don't seem to understand the Block Cipher and its different modes of operations especially when it comes to encrypting and decryption. Could anyone please help solve these questions?

Block Cipher Mode of Operations. Please refer to the image attached for a diagram of PCBC, a similar mode of operation to CBC.

Input
000 001 010 011 100 101 110 111

Output 111 110 101 100 011 001 000 010

for (a) I am getting 110 110 110 110 and for (b) I am getting 110 001 110 001

But I am not sure if that is correct. My confusion is do I decrypt the ciphertext with the key, XOR it with the IV giving me the Plaintext(PT1)- and then for the next step; I XOR the Plaintext(PT1) with the first ciphertext which will then be used as the input to be XORed with the decrypted ciphertext2? You then basically repeat the process?

• What is the block size? It seems 3. You are going to find the block cipher's current permutation fixed under the key. make a table using the given known plaintext. – kelalaka Nov 12 '20 at 6:26
• Yes, it is 3. I not sure I follow. – IAMKIN Nov 12 '20 at 22:30
• Normally you cannot find the key of a secure cipher, however, this is a conceptual cipher with block size 3, therefore you have at most 2^8 different plaintext and corresponding ciphertext to identify it ( permutation). You are given 8 pairs, so you can identify it. I don't want to write an answer since I want you to see it. – kelalaka Nov 12 '20 at 22:33
• My understanding is that you use the key pairs to decrypt the ciphertext depending on the mode CBC you are using. I did it again and I got (a) 110 110 110 110 (b) 110 111 111 111 you are actually right, I am actually interested in understanding it rather than just getting the answer correct. – IAMKIN Nov 12 '20 at 22:54
• You need to use PCBC to determine the cipher's permutation as a table. Then the rest is esy. – kelalaka Nov 12 '20 at 22:57

It is a block cipher with block size 3. Therefore for a given known-plaintext, we can build the current key's action table that has $$2^3=8$$ values. We will use the decryption part $$P_i = D(C_i) \oplus C_{i-1} \oplus P_{i-1}$$ with $$C_{0} \oplus P_{0} = IV$$ with conversion

$$D(C_i) = P_i \oplus C_{i-1} \oplus P_{i-1}$$

P_i          000 001 010 011 100 101 110 111
P_i-1        ??? 000 001 010 011 100 101 110
C_i-1        ??? 111 110 101 100 011 001 000
--- xor-all
x-ored       ??? 110 101 100 011 010 010 001
C_i          111 110 101 100 011 001 000 010


Now built the decryption table and the encryption table is just the reverse of it.

$$\begin{array}{|c|c|}\hline \text{input} & \text{output} \\ \hline \texttt{000} & \color{red}{\texttt{010}}\\ \hline \texttt{001} & \color{red}{\texttt{010}}\\ \hline \texttt{010} & \texttt{001}\\ \hline \texttt{011} & \texttt{011}\\ \hline \texttt{100} & \texttt{100}\\ \hline \texttt{101} & \texttt{101}\\ \hline \texttt{110} & \texttt{110}\\ \hline \texttt{111} & \texttt{???}\\ \hline \end{array}$$

With the current information, this question is not solvable since the defined block cipher is not reversible. The PCBC mode requires this.

P.S. Maybe I had a mistake with the simple calculations. If so inform me please;

• Note: this is not complete. Actually, I want the OP to finish it. However, there is a mistake around. – kelalaka Nov 15 '20 at 22:33