# S boxes in Blowfish

I know how the s-boxes in blowfish are initialized, but how is the output sorted, I mean which bit from the input goes where in the box ? and what do mean they have 256 entries if they are 32-bit S-Boxes ?

• Blowfish s-boxes have 256 entries, because they have 8-bit input and 32-bit output. I do not understand other part of the question. – LightBit Nov 29 '15 at 17:32
• Oh hi, I mean for every 8 bit input a 32 bit output is generated right? how is this mapping done ? for example in DES S-Boxes we use the outer and Inner bits method – user29481 Nov 29 '15 at 17:40
• It splits half block in 4 8-bit pieces, which are then used as an input to s-box (each piece goes through different s-box). 32-bit output of s-boxes is than combined. See this picture: upload.wikimedia.org/wikipedia/commons/2/22/… – LightBit Nov 29 '15 at 19:09
• yeah, thanks man but you still didn't get my question :<. I get this part, what I meant is how does the algorithm decide what 8 bits get mapped to which 32 bits ? If the incoming bits are 11110000 how does the S-Box get the output 32 ? – user29481 Nov 29 '15 at 19:39
• Table lookup. Value from 11110000 (240)th position. – LightBit Nov 29 '15 at 20:29

uint32_t S;