Cipher  Blowfish Algorithm
Part:
1
2
3
4
This chapter describes:
 What is block cipher.
 The Blowfish cipher algorithm.
 The Blowfish key schedule algorithm.
 Java implementation by Markus Hahn.
 The Blowfish decryption algorithm.
 The Blowfish algorithm initialization data  8366 hex digits of the
fractional portion of "pi".
Block Cipher
Block Cipher  An encryption scheme that "the clear text is broken up into blocks
of fixed length, and encrypted one block at a time".
Usually, a block cipher encrypts a block of clear text into a block of cipher text
of the same length. In this case, a block cipher can be viewed as a simple substitute
cipher with character size equal to the block size.
ECB Operation Mode  Blocks of clear text are encrypted independently.
ECB stands for Electronic Code Book. Main properties of this mode:
 Identical clear text blocks are encrypted to identical cipher text blocks.
 Reordering clear text blocks results in reordering cipher text blocks.
 An encryption error affects only the block where it occurs.
CBC Operation Mode  The previous cipher text block is XORed with
the clear text block before applying the encryption mapping. Main properties of
this mode:
 An encryption error affects only the block where is occurs and one next block.
Product Cipher  An encryption scheme that "uses multiple ciphers
in which the cipher text of one cipher is used as the clear text of
the next cipher". Usually, substitution ciphers and transposition ciphers are used
alternatively to construct a product cipher.
Iterated Block Cipher  A block cipher that "iterates a fixed number of times
of another block cipher, called round function, with a different key, called round key,
for each iteration".
Feistel Cipher  An iterate block cipher that uses the following algorithm:
Input:
T: 2t bits of clear text
k1, k2, ..., kr: r round keys
f: a block cipher with bock size of t
Output:
C: 2t bits of cipher text
Algorithm:
(L0, R0) = T, dividing T in two tbit parts
(L1, R1) = (R0, L0 XOR f(R0, k1))
(L2, R2) = (R1, L1 XOR f(R1, k2))
......
C = (Rr, Lr), swapping the two parts
Blowfish Cipher Algorithm
Blowfish  A 16round Feistel cipher with block size of 64 bits.
Blowfish was developed by Bruce Schneier in 1993. Here is the algorithm presented in Bruce's paper:
Input:
T: 64 bits of clear text
P1, P2, ..., P18: 18 subkeys
F(): Round function
Output:
C: 64 bits of cipher text
Algorithm:
(xL, xR) = T, dividing T into two 32bit parts
Loop on i from = 1 to 16
xL = xL XOR Pi
xR = F(xL) XOR xR
Swap xL and xR
End of loop
Swap xL and xR
xR = xR XOR P17
xL = xL XOR P18
C = (xL, xR)
(Continued on next part...)
Part:
1
2
3
4
