Next: , Previous: crypto arcfour, Up: crypto


2.3.3 The Blowfish Cipher

The (weinholt crypto blowfish) library is a complete implementation of Bruce Schneier's Blowfish cipher. It is a symmetric block cipher with key length between 8 and 448 bits. The key length does not affect the performance.

— Procedure: expand-blowfish-key key

Expands a Blowfish key, which is a bytevector of length between 1 and 56 bytes (the longer the better). The returned key schedule can be used with blowfish-encrypt! or reverse-blowfish-schedule.

— Procedure: blowfish-encrypt! source source-index target target-index schedule

Encrypts the eight bytes at source+source-start using Electronic Code Book (ECB) mode. The result is written to target+target-start.

— Procedure: reverse-blowfish-schedule

Reverses a Blowfish key schedule so that it can be used with blowfish-decrypt!.

— Procedure: blowfish-decrypt! source source-index target target-index schedule

The inverse of blowfish-encrypt!.

— Procedure: clear-blowfish-schedule!

Clears the Blowfish key schedule so that it no longer contains cryptographic material. Please note that there is no guarantee that the key material will actually be gone from memory. It might remain in temporary numbers or other values.

— Procedure: blowfish-cbc-encrypt! source source-start target target-start k schedule iv

Encrypts k bytes in the bytevector source starting at source-start with Blowfish in CBC mode and writes the result to target at target-start.

The argument k must be an integer multiple of 8, which is the block length.

The iv bytevector is an Initial Vector. It should be 8 bytes long, initialized to random bytes. This procedure updates the iv after processing a block.

— Procedure: blowfish-cbc-decrypt! source source-start target target-start k schedule iv

The inverse of blowfish-cbc-encrypt!.

Version history: