Blowfish Cipher Tutorials - Herong's Tutorial Examples
∟OpenSSL "enc -bf-cbc" for Blowfish/CBC Encryption
Tutorial notes and example codes are provided OpenSSL 'enc -bf-cbc' command for Blowfish encryption in CBC mode. Topics include introduction of CBC (Cipher Block Chaining) cipher operation mode; Literal Key options to specify secret key and IV directly; Salted Key and Random Salt options to specify secret key and IV indirectly; Prepended cipher headers; PKCS#5 standard padding.
"bf-cbc" Cipher with Literal Key
"bf-cbc" Cipher on Multiple Blocks
"bf-cbc" Encryption Verification
"bf-cbc" 2-Block Test Vectors
"bf-cbc" Cipher with Salted Key
"bf-cbc" Cipher with Random Salt
"enc -bf-cbc" Command Summary
Takeaways:
- OpenSSL is a generic cryptography toolkit library with a command line interface.
- OpenSSL is easy to install if you download the Windows binary package.
- OpenSSL uses a single command "enc" with a standard set
of options to encrypt and decrypt files with different block cipher algorithms.
- OpenSSL supports Blowfish cipher algorithm in 4 operation modes:
ECB, CBC, CFB and OFB.
- OpenSSL supports 3 ways to control the secret key and the IV:
Literal Key, Salted Key and Random Salt.
- OpenSSL uses MD5 hash function to derive the secret key and the IV
from a given passphrase and a given salt or random salt.
- OpenSSL prepend the salt value in the ciphertext with header blocks,
if salt is used. So no need to pass the salt to the receiver separately.
- OpenSSL supports the standard PKCS#5 padding algorithm
- CBC (Cipher Block Chaining) operation mode takes each plaintext block from the input stream,
XOR it with the previous ciphertext block,
and encrypt the XOR result to give the ciphertext.
- CBC is the most commonly used encryption operation mode comparing to
ECB, CFB and OFB operation modes.
- Test vectors of Blowfish CBC operation mode with 2-block plaintext are provided.
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