What Is Crypt::Blowfish?

A quick introduction is provided for the Crypt::Blowfish Perl module, which can be used to perform encryption and decryption on a single cipher block of 64 bits.

What Is Crypt::Blowfish? Crypt::Blowfish is a Perl module providing the Blowfish cipher functionality based on the original implementation of Blowfish algorithm done by A.M. Kuchling.

Here is description of Crypt::Blowfish on the cpan.org Web site: "Blowfish is capable of strong encryption and can use key sizes up to 56 bytes (a 448 bit key). You're encouraged to take advantage of the full key size to ensure the strongest encryption possible from this module."

Crypt::Blowfish module offers the following methods:

$c = new Crypt::Blowfish($key) - Returns a new Crypt::Blowfish object with a given secret key, which is required to be in the range of 8 bytes (64 bits) and 56 bytes (448 bits).

$c->encrypt($plaintext) - Returns the ciphertext for the given plaintext, which is required to be exactly 8 bytes (64 bits) long.

$c->decrypt($ciphertext) - Returns the plaintext for the given ciphertext, which is required to be exactly 8 bytes (64 bits) long.

$c->blocksize() - Returns 8, indicating that the cipher is a 8-byte (64-bit) block cipher.

$c->keysize() - Returns 0. This method is dummy method, since Blowfish supports variable length keys.

As you can see from method descriptions, Crypt::Blowfish is designed to perform encryption and decryption on a single cipher block only. It needs to be used with other Crypt modules, like Crypt::CBC, to be more operational to better padding and multi-block encryptions.

See Crypt::Blowfish Web page at cpan.org for more information.

Last update: 2015.

Table of Contents

 About This Book

 Blowfish Cipher Algorithm

Perl Crypt::Blowfish Module

What Is Crypt::Blowfish?

 Installing Crypt::Blowfish 2.14 with ActivePerl

 Crypt::Blowfish Behavior Tests

 Secret Keys with Repeating Pattern

 Crypt::Blowfish Verification with Test Vectors

 Blowfish Test Vectors with 16-Byte Keys

 Perl Crypt::ECB Perl Module

 Perl Crypt::CBC Module

 Perl Crypt::CFB Perl Module

 OpenSSL "enc -bf-ecb" for Blowfish/ECB Encryption

 OpenSSL "enc -bf-cbc" for Blowfish/CBC Encryption

 OpenSSL "enc -bf-cfb" for Blowfish/CFB Encryption

 OpenSSL "enc -bf-ofb" for Blowfish/OFB Encryption

 References

 PDF Printing Version