Blowfish Algorithm

ALGORITHM

There are two parts to this algorithm; a part that handles the expansion of the key and a part that handles the encryption of the data. 

 
KEY EXPANSION

The first step in the algorithm is to break the original key into a set of subkeys. Specifically, a key of no more than 448 bits is separated into 4168 bytes. There is a P-array and four 32-bit S-boxes. The P-array contains 18 32-bit subkeys, while each S-box contains 256 entries.

The following steps are used to calculate the subkeys:
Initialize the P-array and S-boxes
XOR P-array with the key bits. For example, P1 XOR (first 32 bits of key), P2 XOR (second 32 bits of key), ...
Use the above method to encrypt the all-zero string
This new output is now P1 and P2
Encrypt the new P1 and P2 with the modified subkeys
This new output is now P3 and P4
Repeat 521 times in order to calculate new subkeys for the P-array and the four S-boxes

最近悩んでるのは、この blowfishで、明後日にはこいつら(これはアルゴリズムの一部でしかない)のフローチャートを書いて、しかもいろいろレポートにまとめなくてはならない。しかもTEXで書かなくちゃならなくて、めんどくさい。中間発表が終わったらそっこーでテフテフでレポートを書かないとなぁ。