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); bf.setPaddingEnabled(true); 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.