ddn.crypto.legacy.cipher.blowfish

Blowfish Block Cipher.

WARNING: DEPRECATED ALGORITHM

Blowfish is deprecated due to its 64-bit block size (vulnerable to birthday attacks). Use AES-256 for new encryption.

Standards

Schneier's Blowfish specification
class Blowfish

Types 1

Blowfish block cipher implementation (Schneier's specification).

DEPRECATED: Do not use for new encryption.

Blowfish encrypts 64-bit blocks using a variable-length key from 32 to 448 bits (4 to 56 bytes). This implementation is provided for legacy compatibility only.

Example:

auto bf = new Blowfish(key);  // 4-56 byte key
ubyte[8] ciphertext;
bf.encrypt(plaintext, ciphertext);

Methods
size_t blockSize() @property const @safe pure nothrow @nogcReturns: The block size in bytes (always 8 for Blowfish).
void encrypt(const(ubyte)[] input, ubyte[] output)Encrypts a single 8-byte block.
void decrypt(const(ubyte)[] input, ubyte[] output)Decrypts a single 8-byte block.
Constructors
this(const(ubyte)[] key)Constructs a Blowfish cipher with the given key.