Blowfish Cipher Tutorials - Herong's Tutorial Examples - Version 1.21, by Dr. Herong Yang
"bf-cfb" Cipher on Multiple Blocks
A tutorial example is provided to show you how multiple plaintext blocks are encrypted in CFB operation mode. the encryption of each plaintext block is impacted by the encryption of the previous block.
Since CFB operation mode supports multiple plaintext blocks, let's run the "enc -bf-cfb" command with longer plaintext:
C:\herong> perl -e "binmode(STDOUT); print pack('H*', '0000000000000000')" > 2-block.txt C:\herong> perl -e "binmode(STDOUT); print pack('H*', '0000000000000000')" >> 2-block.txt C:\herong>\local\gnuwin32\bin\openssl enc -bf-cfb -e -K 00000000000000000000000000000000 -iv 0000000000000000 -in 2-block.txt -out cipher.txt -nopad -p salt=0200000000265301 key=00000000000000000000000000000000 iv =0000000000000000 C:\herong>perl -e "while (read(STDIN,$_,1)){print unpack('H*',$_);}" < cipher.txt 4ef997456198dd78 e1c030e74c14d261 ---------------- ---------------- block 1 block 2 C:\herong> perl -e "binmode(STDOUT); print pack('H*', '0000000000000000')" > 3-block.txt C:\herong> perl -e "binmode(STDOUT); print pack('H*', '0000000000000000')" >> 3-block.txt C:\herong> perl -e "binmode(STDOUT); print pack('H*', '0000000000000000')" >> 3-block.txt C:\herong>\local\gnuwin32\bin\openssl enc -bf-cfb -e -K 00000000000000000000000000000000 -iv 0000000000000000 -in 3-block.txt -out cipher.txt -nopad -p salt=0200000000267F00 key=00000000000000000000000000000000 iv =0000000000000000 C:\herong>perl -e "while (read(STDIN,$_,1)){print unpack('H*',$_);}" < cipher.txt 4ef997456198dd78 e1c030e74c14d261 53e3b2a5a3bc297f ---------------- ---------------- ---------------- block 1 block 2 block 3
The output matches my expectation. Ciphertext strings from both tests are identical to those from the "enc -bf-cbc" command. This is because my plaintext blocks are the same as the IV value, which will result the same cipher output from both CBC and CFB operation modes.
Last update: 2015.
Table of Contents
OpenSSL "enc -bf-ecb" for Blowfish/ECB Encryption
OpenSSL "enc -bf-cbc" for Blowfish/CBC Encryption
►OpenSSL "enc -bf-cfb" for Blowfish/CFB Encryption
"bf-cfb" Cipher with Literal Key
►"bf-cfb" Cipher on Multiple Blocks
"bf-cfb" Encryption Verification
"bf-cfb" Cipher with Salted Key
"bf-cfb" Cipher with Random Salt