# Finding output given an S-box input of 8 bits

I'm given the following table: I'm told to find the output given an hexidecmal input of 2B. I know that 2B in binary = 001 01 011

So I took the first two and last two outer bits (0011) to find the first row which is row 3.Then I took the remaining bits (10 10) to find number 10 on the top row. Matching up the values I get a final answer of 3, which is 11 in binary. But the correct answer is 1001 which is 9 in decimal. I have no idea where I have gone wrong here. I followed the procedure for 6 bit number, but I do feel like I'm missing a key element on how to solve this for a 8 bit number.

The S-Boxes of DES map from 6 bits to 4 bits. $2b$ written in binary representation is $10\ 1011$, not $001\ 01\ 011$ as you said. Now taking the first and last bit (as usual for DES S-boxes) yields us $11_{bin} = 3_{dec}$ which is the last row in your table. Taking the middle 4 bits equals to $0101_{dec} = 5_{dec}$. Now we can read the final result from the table as $9_{dec} = 1001_{bin}$
• Yes, you need leading zeroes, but only until you got 2 digits for the first digit of your s-box input. 6 bits go from $00_{hex}$ to $3f_{hex}$, so the first digit always has two digits in binary representation and the second one always has four. $0_{dec} = 00_{bin}, 1_{dec} = 01_{bin}, 2_{dec} = 10_{bin}, ...$ – Nova Apr 19 '18 at 3:31