Skip to content
uencoder

Blowfish

Blowfish is a symmetric block cipher designed by Bruce Schneier in 1993, using variable-length keys (32-448 bits) and 64-bit blocks; it is fast and unencumbered by patents.

Purpose

It offered a secure alternative to DES with long keys and no licensing restrictions.

Mechanism

It is a 16-round Feistel network. The key schedule builds a P-array (18 32-bit words) and four S-boxes (256 entries each), initialized from the key and fixed constants (hexadecimal digits of π). Encryption iterates the two halves through XOR with the F function.

Use cases

  • Optional OpenPGP algorithm
  • The underlying cipher of bcrypt password hashing
  • Embedded and software encryption
  • Teaching examples

Examples

  • Input
    key=128bit, data=8bytes
    Output
    8-byte ciphertext

    The 64-bit block is now considered small

Common errors

The 64-bit block invites Sweet32 attacks on large data volumes
Use AES or Twofish with 128-bit blocks

Related terms

Related tools

References