# DES and using the S-Box 1

Can someone please check my work and correct me if I am wrong, I am just starting to learn about DES. I am trying to solve the following problem:

Show that S1(x1) XOR S1 (x2) != S1(x1 XOR x2).
x1 = 000000, x2 = 000001

So, we get S1(x1) first: 00 is our row, and 0000 is our column which is (0,0) and in the S1 Box table is the value 14. 14 in binary is 1110.

Now we get S1(x2): 01 is our row, and 0000 is our column which is (1,0) and in the S1 Box table is the value 0. In binary, it's 0000.

Now we XOR the two outputs:

    1110
XOR 0000
= 0001


Thus, S1(x1) XOR S1(x2) = 0001.

Now we XOR X1 and X2 first:

     0000000
XOR 0000001
=  1111110


Now we lookup our output in the S1 table: Our row is 10, and our column is 1111 which is (2,15) and in the S1 Box Table is the value 08 which is 1000.

Thus, 0001 != 1000. Is that correct? (And in case it isn’t, where did I take a wrong turn?)

• Your XOR looks like XNOR.
– otus
Oct 2, 2015 at 5:42
• In addition to using XNOR (which made you lookup from an incorrect input), it looks like you read the S1table at (1,15) rather than (2,15) as you wrote you would. And you did not detail how you split the 6 input bits into those for row and column. See page marked 14 of FIPS 46-3 for theses important details.
– fgrieu
Nov 19, 2015 at 10:21

Your XOR equations are wrong. You wrote:

    1110
XOR 0000
= 0001


But it's not how the XOR works. 1 xor 0 = 1, and in your example it somehow turns into 0 wich is an error. Reference the xor table: https://en.wikipedia.org/wiki/Exclusive_or

So, the correct answer for S1(x1) XOR S1(x2) is:

    1110
XOR 0000
= 1110


and for x1 xor x2:

    0000000
XOR 0000001
= 0000001

• x1, x2, and x1 XOR x2 are bitstrings of 6 bits, not 7 bits as shown.
– fgrieu
Nov 19, 2015 at 10:27