- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# 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 : x_{L}, x_{R}.

Then, for i = 1 to 16;

x_{L} = x_{L}XOR Pi

x_{R} = F(x_{L}) XOR x_{R}

Swap x_{L} and x_{R}

After the 16^{th} round, Swap x_{L} and x_{R} again to undo the last swap.

Then, ciphertext = concatenation of x_{L} and x_{R}, x_{R} = x_{R} XOR P_{17} and x_{L} = x_{L} XOR P_{18}.