Solutions to Understanding Cryptography Problems - Chapter 3

Intro

My solutions to the practice problems in “Understanding Cryptography: A Textbook for Students and Practitioners - Chapter 3”.

The solution scripts to some of the problems have been uploaded to GitHub, you can check them out at: https://github.com/yype/UnderstandingCrypto.

Problems

3.1

Show that $S_1(x_1)\oplus S_1(x_2)\neq S_1(x_1\oplus x_2)$:

\[x_1=000000,x_2=000001\\ S_1(x_1)\oplus S_1(x_2)=14\oplus 00=14\\ S_1(x_1\oplus x_2)=S(000001)=00\\ \text{}\\ x_1=111111,x_2=100000\\ S_1(x_1)\oplus S_1(x_2)=13\oplus 04=09\\ S_1(x_1\oplus x_2)=S(011111)=08\\\\ \text{}\\ x_1=101010,x_2=010101\\ S_1(x_1)\oplus S_1(x_2)=06\oplus 12=10\\ S_1(x_1\oplus x_2)=S(111111)=13\\\\\]

3.2

\[IP^{-1}(IP(1))=IP^{-1}(58)=1\\ IP^{-1}(IP(2))=IP^{-1}(50)=2\\ IP^{-1}(IP(3))=IP^{-1}(42)=3\\ IP^{-1}(IP(4))=IP^{-1}(34)=4\\ IP^{-1}(IP(5))=IP^{-1}(26)=5\\\]

3.3

The output of the first round of the DES algorithm when the plaintext and the key are both all zeros.

\[\text{(The subscript denotes the bit size)}\\ x=00...00_{64}\\ IP(x)=00...00_{64}\\ L_0=00...00_{32},R_0=00...00_{32}\\ \text{}\\ \begin{drcases} k=00...00_{64}\\ PC-1(k)=00...00_{56}\\ C_0=00..00_{28},D_0=00..00_{28}\\ C_1=LS_1(C_0)=00..00_{28}\\ D_1=LS_1(D_0)=00..00_{28}\\ k_1=PC-2(C_1D_1)=00..00_{48}\\ \end{drcases}\text{Key schedule} \text{}\\ \text{}\\ \begin{drcases} E(R_0)=00...00_{48}\\ \begin{aligned} E(R_0)\oplus k_1=00&..00_{48}\\ &\Downarrow \end{aligned}\\ 000000\ 000000\ 000000\ 000000\ 000000\ 000000\ 000000\ 000000\\ \bigg\Downarrow\text{SBox}_{1\sim8}\\ \begin{aligned} &1\ &&5\ &&9\ &&13\ &&17\ &&21\ &&26\ &&29\\ &1110\ &&1111\ &&1010\ &&0111\ &&0010\ &&1100\ &&0100\ &&1101\\ \end{aligned}\\ \bigg\Downarrow\text{Permutation}\\ \begin{aligned} &1101\ &&1000\ &&1101\ &&1000\ &&1101\ &&1011\ &&1011\ &&1100\\ &13\ &&8\ &&13\ &&8\ &&13\ &&11\ &&11\ &&12\\ \end{aligned}\\ \Rightarrow\text{D8D8DBBC}_\text{hex} \end{drcases}\text{The f-Function}\\ \text{}\\ \text{}\\ \begin{drcases} R_1=L_0\oplus \text{D8D8DBBC}_\text{hex}=\text{D8D8DBBC}_\text{hex}\\ L_1=R_0=00..00_{32} \end{drcases}\text{Output of the first round}\]

3.4

The output of the first round of the DES algorithm when the plaintext and the key are both all ones.

\[x=11...11_{64}\\ IP(x)=11...11_{64}\\ L_0=11...11_{32},R_0=11...11_{32}\\ \text{}\\ \begin{drcases} k=11...11_{64}\\ PC-1(k)=11...11_{56}\\ C_0=11..11_{28},D_0=11..11_{28}\\ C_1=LS_1(C_0)=11..11_{28}\\ D_1=LS_1(D_0)=11..11_{28}\\ k_1=PC-2(C_1D_1)=11..11_{48}\\ \end{drcases}\text{Key schedule} \text{}\\ \text{}\\ \begin{drcases} E(R_0)=11...11_{48}\\ \begin{aligned} E(R_0)\oplus k_1=00&..00_{48}\text{(becomes the same as 3.3)}\\ &\Downarrow \end{aligned}\\ 000000\ 000000\ 000000\ 000000\ 000000\ 000000\ 000000\ 000000\\ \bigg\Downarrow\text{SBox}_{1\sim8}\\ \begin{aligned} &1\ &&5\ &&9\ &&13\ &&17\ &&21\ &&26\ &&29\\ &1110\ &&1111\ &&1010\ &&0111\ &&0010\ &&1100\ &&0100\ &&1101\\ \end{aligned}\\ \bigg\Downarrow\text{Permutation}\\ \begin{aligned} &1101\ &&1000\ &&1101\ &&1000\ &&1101\ &&1011\ &&1011\ &&1100\\ &13\ &&8\ &&13\ &&8\ &&13\ &&11\ &&11\ &&12\\ \end{aligned}\\ \Rightarrow\text{D8D8DBBC}_\text{hex} \end{drcases}\text{The f-Function}\\ \text{}\\ \text{}\\ \begin{drcases} R_1=L_0\oplus \text{D8D8DBBC}_\text{hex}=\text{27272443}_\text{hex}\\ L_1=R_0=11..11_{32} \end{drcases}\text{Output of the first round}\]

3.5

· Crypto, Understanding Cryptography