﻿ ﻿
﻿

Blowfish Cipher Encryption Algorithm

The Blowfish cipher algorithm is presented based on the algorithm designer Bruce Schneier's technical paper. Blowfish cipher is 16-round and 64-bit block cipher.

﻿

Blowfish algorithm was developed by Bruce Schneier in 1993. Here is the Blowfish encryption algorithm presented in Bruce's paper "Description of a New Variable-Length Key, 64-Bit Block Cipher (Blowfish)" at http://www.schneier.com/paper-blowfish-fse.html:

Input:
T: 64 bits of plaintext
P{1), P(2), ..., P(18): 18 sub-keys, 32 bits each
F(): Round function

Output:
C: 64 bits of ciphertext

Algorithm - Blowfish Encryption:
C = Blowfish(T), Blowfish round process defined as:
(xL, xR) = T, dividing T into two 32-bit parts
Loop on i from = 1 to 16
xL = xL XOR P(i)
xR = F(xL) XOR xR
Swap xL and xR
End of loop
Swap xL and xR
xR = xR XOR P(17)
xL = xL XOR P(18)
C = (xL, xR), combine xL, xR into 64-bit block

The round function F(A) is defined as:

Input:
A: 32-bit input data
S1[], S2[], S3[], S4[]: 4 S-box lookup tables, 256 bits each

Output
B: 32-bit output data

Algorithm
(a, b, c, d) = A, dividing A into four 8-bit parts
B = ( (S1[a] + S2[b] mod 2**32) XOR S3[c] ) + S[d] mod 2**32

As you can see from the algorithm, Blowfish is clearly a 16-round and 64-bit block cipher.

See next tutorials on how Sub-keys P{1), P(2), ..., P(18) and S-boxes S1[], S2[], S3[], S4[] are constructed.

Last update: 2018.

﻿

﻿ ﻿