Blow Fish

DES Triple DES Blow Fish Rijndael Twofish Comparison References

 

It is a Feistel network, with a secret-key block cipher.  It has an iteration of 16 times with a block size of 64 bits and each key can be any lenght up to 448 bits.  Although there is a complex initialization phase required before any encryption can take place, the actual encryption of data is very efficient on large microprocessors.

The key size can be variable, with a 64-bit block cipher.  The algorithm consists of two parts: a key-expansion part and a data- encryption part. Key expansion converts a key of at most 448 bits into several subkey arrays totaling 4168 bytes.

The encryption ocurrs with a 16-round Feistel network.  A permutation of the key dependent is needed every round just as data dependent substitution.  All the operations used are XORs and additons on 32-bit words.  Also it use four indexed arrays data lookups.

 

Algorithm:

 This algorith was taken from the book described on the references section.

1. Initialize first the P-array and then the four S-boxes, in order, with a fixed string. This string consists of the hexadecimal digits of pi (less the initial 3). For example:

 

P1 = 0x243f6a88

P2 = 0x85a308d3

P3 = 0x13198a2e

P4 = 0x03707344

2. XOR P1 with the first 32 bits of the key, XOR P2 with the second 32-bits of the key, and so on for all bits of the key (possibly up to P14). Repeatedly cycle through the key bits until the entire P-array has been XORed with key bits. (For every short key, there is at least one equivalent longer key; for example, if A is a 64-bit key, then AA, AAA, etc., are equivalent keys.)

3. Encrypt the all-zero string with the Blowfish algorithm, using the subkeys described in steps (1) and (2).

4. Replace P1 and P2 with the output of step (3).

5. Encrypt the output of step (3) using the Blowfish algorithm with the modified subkeys.

6. Replace P3 and P4 with the output of step (5).

7. Continue the process, replacing all entries of the P- array, and then all four S-boxes in order, with the output of the continuously-changing Blowfish algorithm.

In total, 521 iterations are required to generate all required subkeys. Applications can store the subkeys rather than execute this derivation process multiple times.

 

Examples:

 

Original Text:

 

Se necesitan dos aos para aprender a hablar y sesenta para aprender a callar.  Una frase de un personaje complejo que vivi intensamente y que escribi hasta lo que debi callar.

 

Encrypted Text with phrase: securenet2002:

egGW;҇       $}IF[Y a
;`")3B8$KohTT_[NJnI[1]MbfAq/Q϶+MmYM\1a8+,1N $0ϫ.o,fY:݆[ܒ^.aihb{Νlz/'=zI|?§\,ҥd{D(`'Cr;'@jˮ‑Q$N
xC$VuhZJj% ueU        paԤоB{VEt;jWqKv)J_6