"bf-ofb" Encryption Verification

A tutorial example is provided to verify OpenSSL 'enc -bf-ofb' command against the Blowfish OFB test vector published at www.schneier.com.

Okay, we have learned that OpenSSL "enc -bf-ofb" command can perform Blowfish encryption in OFB mode on multiple plaintext blocks. Now we needed to verify its output against existing Blowfish OFB test vectors.

When I search the Internet, I only see one published test vector for Blowfish in OFB mode at https://www.schneier.com/code/vectors.txt:

chaining mode test data
key[16]   = 0123456789ABCDEFF0E1D2C3B4A59687
iv[8]     = FEDCBA9876543210
data[29]  = "7654321 Now is the time for " (includes trailing '\0')
data[29]  = 37363534333231204E6F77206973207468652074696D6520666F722000
ofb64 cipher text cipher[29]= 

Below is the my test to verify OpenSSL "enc -bf-ofb" cipher against the above test vector:

C:\herong>perl -e "binmode(STDOUT); print pack('H*', 
   >> OFB-Test-Vector.txt

C:\herong>\local\gnuwin32\bin\openssl enc -bf-ofb -e 
   -K 0123456789ABCDEFF0E1D2C3B4A59687 -iv FEDCBA9876543210  
   -in OFB-Test-Vector.txt -out cipher.txt -nopad -p
iv =FEDCBA9876543210

C:\herong>perl -e "while (read(STDIN,$_,1)){print unpack('H*',$_);}" 
   < cipher.txt
e73214a2822139ca62b343cc5b65587310dd908d0c241b2263c2cf80da 46fbb8
         Matched the test vector at schneier.com

Congratulations! The ciphertext matches with what given in the test vector. Now we can confidently say that OpenSSL "enc -bf-ofb" command works correctly.

Last update: 2015.

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

 "bf-ofb" Cipher with Literal Key

 "bf-ofb" Cipher on Multiple Blocks

"bf-ofb" Encryption Verification

 "bf-ofb" 2-Block Test Vectors

 "bf-ofb" Cipher with Salted Key

 "bf-ofb" Cipher with Random Salt

 "enc -bf-ofb" Command Summary


 PDF Printing Version