Blowfish Cipher Tutorials - Herong's Tutorial Examples - Version 2.00, by Dr. Herong Yang
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 http://search.cpan.org/~dparis/Crypt-Blowfish-2.14/Blowfish.pm for more information.
Last update: 2018.
Table of Contents