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 ?
A 32-bit value output is chosen from a table depending on an 8-bit input value.
The s-box within block ciphers is typically implement with a table, with a fixed input and output size. Some ciphers have the same input and output size; for example, for AES, it uses an sbox with 8 bit inputs and outputs, while Serpent uses an sbox with 4 bit inputs and outputs. When the sbox is implemented as a table, the output size defines size of entries and the input size defines number of entries. In the case of Blowfish, the input is 8-bit (and hence there are 256 entries), and the output is 32-bit (and hence each entry is 32 bits long). These sbox contents are generated during key setup.
In C Blowfish s-boxes are defined as: