Blowfish Cipher Tutorials - Herong's Tutorial Examples
∟Perl Crypt::CBC Module
Tutorial notes and example codes are provided on Crypt::CBC Perl module. Topics include introduction and installation of Crypt::CBC; Encryption options, Literal Key, Salted Key and Random Salt; Padding options; Test Vectors.
What is Crypt::CBC
Installing Crypt::CBC 2.33 with ActivePerl
Crypt::CBC Encryption with Literal Keys
Crypt::CBC Literal Key Error Cases
Crypt::CBC Encryption with Crypt::Blowfish Objects
Crypt::CBC Operation Simulation
Crypt::CBC Encryption Verification
Blowfish CBC 2-Block Test Vectors
Crypt::CBC Prepending IV to Ciphertext
Crypt::CBC Encryption with Salted Keys
Crypt::CBC Salted Key Test Cases
Crypt::CBC Secret Key and IV Algorithm
Crypt::CBC Encryption with Random Salt
Crypt::CBC Padding Options
Crypt::CBC Padding Option Tests
Crypt::CBC Blowfish Encryption Summary
Takeaways:
- Crypt::CBC is a Perl module that can be used to run Blowfish encryption in CBC operation mode.
- The "Literal Key" option allows us to directly control
what secret key and IV to use to encrypt the plaintext.
The secret key must be 56 bytes long
- The "Crypt::Blowfish Object" option allows us to directly control
what secret key and IV to use to encrypt the plaintext.
And the secret key can have any size from 8 bytes to 56 bytes.
- The "Salted Key" option allows us to specify a passphrase and a salt.
The system to derive the secret key and the IV.
- The "Random Salt" option allows us to specify a passphrase only
and let the system to take random salt to derive the secret key and the IV.
- If salt is used, the receiver may need to know the secret key generation algorithm
to be able to decrypt the ciphertext.
- To avoid decryption issue, you should consider use the "Crypt::Blowfish Object" option
and pass the IV with the ciphertext.
- 'standard' (PKCS#5) should be used as the padding option.
It is widely supported by many encryption tools.
Table of Contents
About This Book
Blowfish Cipher Algorithm
Perl Crypt::Blowfish Module
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
PHP Mcrypt Extension for Blowfish
Blowfish 8-Bit Cipher in PHP
References
Full Version in PDF/EPUB