Skip to content
An implementation of the Blowfish encryption algorithm in Qt.
Branch: master
Clone or download

Latest commit


Type Name Latest commit message Commit time
Failed to load latest commit information.


QBlowfish is a Qt implementation of the Blowfish encryption algorithm, as described in the original Blowfish paper by Bruce Schneier.

The Blowfish algorithm requires the input in 8-byte blocks. To simplify usage, QBlowfish can optionally add PKCS5 padding to the input data. (For example, if the input is only 60 bytes long, 4 bytes will be padded to bring the bytecount to a multiple of 8.) When padding is enabled during decryption, QBlowfish will also remove the padded bytes from the output.

You only need to add 3 files (src/*) to your project. You can then use the QBlowfish class to encrypt and decrypt stuff.

QByteArray secretKey("This is a secret")
QString clearText("Stuff to encrypt");

QBlowfish bf(secretKey);
QByteArray encryptedBa = bf.encrypted(clearText.toUtf8());

A more detailed example is included in the repo.

QBlowfish is not optimized for speed. It processes the data in bytes (most other Blowfish implementations seem to work on 4-byte words) and is endianness-agnostic.


Unit tests are written using QTestLib. Tests include the official test vectors.

QBlowfish is known to work fine with Qt versions 4.8, 5.0 and 5.1, on Windows, Mac and Linux platforms (not all combinations have been tested, though). If you find it's not working in your setup, please open an issue.


QBlowfish is published under the MIT license.

You can’t perform that action at this time.