What is Data Encryption and Decryption in Blowfish Algorithm?

Blowfish is a symmetric block cipher algorithm invented by Brute Schneier in December 1993. The Blowfish algorithm has several advantages. It is applicable and efficient for hardware implementation and no license is needed. The elementary operators of Blowfish algorithm contains table lookup, addition and XOR. The table contains four S-boxes and a P-array.

Blowfish is a cipher depends on Feistel rounds, and the design of the F-function used amounts to a simplification of the principles used in DES to support the same security with higher speed and effectiveness in software.

Blowfish is a 64-bit symmetric block cipher that need a variable-length key from 32 to 448-bits (14 bytes). The algorithm was produced to encrypt 64-bits of plaintext into 64-bits of cipher text effectively and securely.

The operations selected for the algorithm were table lookup, modulus, addition and bitwise exclusive-or to minimize the time needed to encrypt and decrypt information on 32-bit processors.

As with DES, Blowfish include a 16 round Feistel network for encryption and decryption. But during every round of Blowfish, the left and right 32-bits of data are changed unlike DES which only changes the right 32-bits to develop into the next round’s left 32-bits.

Blowfish includes a bitwise exclusive-or operation to be implemented on the left 32- bits before being changed by the F function or propagated to the right 32-bits for the following round.

Blowfish also includes two exclusive-or operations to be implemented after the 16 rounds and a swap operation. This operation is different from the permutation function implemented in DES.

Encryption Process − There are two news of encryption process including information image as plain text and the encryption key. In this method, original image data bit stream is divided into the blocks length of Blowfish algorithm.

Image header is unauthorized to encrypt and the start of the bitmap pixel or array begins right after the header of the file. The byte component of the array are saved in row order from left to right with each row defining one scan line of the image and the rows of the image are encrypted from top to bottom.

Decryption Process − The encrypted image is divided into the equivalent block length of Blowfish algorithm from top to bottom. The first block is entered to the decryption function and the equivalent encryption key can be used to decrypt the image but the application of sub keys is reversed. The process of decryption is extended with different blocks of the image from top to bottom.

The basic algorithm for Blowfish is as follows −

Divide x into two 32-bit halves : xL, xR.

Then, for i = 1 to 16;

xL = xLXOR Pi

xR = F(xL) XOR xR

Swap xL and xR

After the 16th round, Swap xL and xR again to undo the last swap.

Then, ciphertext = concatenation of xL and xR, xR = xR XOR P17 and xL = xL XOR P18.

Updated on: 15-Mar-2022


Kickstart Your Career

Get certified by completing the course

Get Started