Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

algorithm
network security

What is the Blowfish encryption algorithm?

Anusheh Zohair Mustafeez

The Blowfish encryption algorithm is a symmetric block cipher designed to succeed in the DES algorithm that was slow and insecure. In this shot, we will study the steps in the Blowfish encryption algorithm.

svg viewer
Blowfish algorithm in diagrammatic form

The diagram above provides a high-level overview of how the Blowfish algorithm works. Let’s look at this step by step:

  1. Since Blowfish makes use of an SP network, the first step is to initiate the substitution box (Sbox) and permutation box (Pbox). The Pbox entries are shown as the Pi in the diagram above. There are a total of 18 Pbox entries.
  2. Next, we split our 64-bit plaintext into two equal blocks, L and R.
  3. Next, we enter an encryption loop that runs 16 times. The following steps take place in each loop:
    a. We XOR L with Pi, where i depends on the loop’s current iteration.
    b. We then XOR R with F, which is a function of L that makes use of the Sbox split into 4 blocks. The overview of the F function is shown in the image below.
    c. Finally, L and R are swapped before the loop enters its next iteration.
  4. After the loop finishes, L and R are swapped once more.
  5. Next, we make use of our last two unused Pbox entries by XORing R with P17 and L with P18.
  6. Finally, we combine L and R to retrieve the ciphertext.
svg viewer
Function F in diagrammatic form

Blowfish was a strong contender to succeed DES, but it had one main drawback: a small block size of 64. The creator of Blowfish, Bruce Schneier, improved on this flaw by coming up with the Twofish encryption algorithm, which had a block size of 128. Ultimately, the AES algorithm was selected as the new standard, but Schneier’s algorithms are still to be considered resilient and secure.

RELATED TAGS

algorithm
network security

CONTRIBUTOR

Anusheh Zohair Mustafeez
Copyright ©2023 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses