# cryptography - If I'm passing input (101011) from s-box 2 of DES then what should be the answer and what would be the process

I am confusing about working of s-box 2 . How it converts 6-bits input into 4-bits output? also what about 2-bits that are excluded ?

An S-box is basically just a look-up table.*

For example, to find the output corresponding to the input bitstring 101011 in the DES S2 box, you take the input, look it up in the table, and see that the output for that particular input happens to be 15 (= 1111 in binary). That's all there is to it.

In a program, you might implement the look-up something like this:

``````const char sbox2[64] = {15, 3, 1, 13, 8, 4, 14, 7, ..., 2, 14, 15, 9};

...

output = sbox2[input];
``````

*) In principle it is, of course, also possible to write a function that computes the output from the input without using an actual look-up table. For some ciphers, such as AES, the S-boxes are designed so that this can even be done fairly conveniently. For DES, though, the S-box tables are pretty much random numbers, and any function that computes them will be at least as long as the table itself would've been.