Blowfish algorithm’s key expansion involves two phases: P-array and S-boxes initialization, followed by the actual key expansion.
In the first phase, the 448-bit key is divided into 32-bit chunks which are XORed with the initial values of the P-array (18 elements). The Blowfish uses a hexadecimal digit of Pi as its initial value.
The second phase involves scrambling the initialized P-array using the Blowfish encryption algorithm. This scrambled array replaces the original P-array. Then, each element of the four S-boxes (256 elements each) is sequentially replaced in the same manner.
This process ensures that even a small change in the key causes significant changes in both the P-array and S-boxes, contributing to the security strength of the Blowfish cipher.