Blowfish Cipher Tutorials - Herong's Tutorial Examples - v2.04, by Herong Yang
Secret Keys with Repeating Pattern
Tutorial examples are provided to show that secret keys with a repeating pattern will result the same ciphertext for the same given plaintext.
Another interesting feature of Blowfish algorithm is that the secret key will be used repeatedly to build array of 576 bits (72 bytes) long. So the following statement should be always true:
Encryption outputs will be the same for the same plaintext with different secret keys, if those secret keys are repeated strings of the same pattern.
For example, if you use the following secret keys to encrypt a plaintext, you will get the same ciphertext.
1122334455667788 11223344556677881122334455667788 112233445566778811223344556677881122334455667788 ...
Let's use our test script, Crypt-Blowfish-Test.pl, to verify the above statement:
C:\herong>perl Crypt-Blowfish-Test.pl \ 1122334455667788 \ 0123456789abcdef Crypt::Blowfish Test - output in Hex: Key in Hex (1122334455667788) Plaintext in Hex (0123456789abcdef) keysize() 0 bytes blocksize() 8 bytes Ciphertext in Hex (103248f0eea98e89) Decrypted text in Hex (0123456789abcdef) C:\herong>perl Crypt-Blowfish-Test.pl \ 11223344556677881122334455667788 \ 0123456789abcdef Crypt::Blowfish Test - output in Hex: Key in Hex (11223344556677881122334455667788) Plaintext in Hex (0123456789abcdef) keysize() 0 bytes blocksize() 8 bytes Ciphertext in Hex (103248f0eea98e89) Decrypted text in Hex (0123456789abcdef) C:\herong>perl Crypt-Blowfish-Test.pl \ 112233445566778811223344556677881122334455667788 \ 0123456789abcdef Crypt::Blowfish Test - output in Hex: Key in Hex (112233445566778811223344556677881122334455667788) Plaintext in Hex (0123456789abcdef) keysize() 0 bytes blocksize() 8 bytes Ciphertext in Hex (103248f0eea98e89) Decrypted text in Hex (0123456789abcdef)
The output indeed confirms that those 3 different secret keys give the same ciphertext 0x103248f0eea98e89.
Table of Contents
Installing Crypt::Blowfish 2.14 with ActivePerl
Crypt::Blowfish Behavior Tests
►Secret Keys with Repeating Pattern
Crypt::Blowfish Verification with Test Vectors
Blowfish Test Vectors with 16-Byte Keys
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