**Blowfish Cipher Tutorials - Herong's Tutorial Examples** - v2.04, by Herong Yang

Blowfish Cipher Tutorials - Herong's Tutorial Examples

https://www.herongyang.com/Blowfish

Copyright © 2012-2024 Herong Yang. All rights reserved.

This tutorial book is a collection of notes and sample codes written by the author while he was learning Blowfish cipher himself. Topics basic concepts of cipher and encryption; introduction of Blowfish cipher algorithm; 8366 Hex Digits of PI; Perl Crypt::Blowfish and Crypt::CBC, Crypt::CFB modules; OpenSSL Blowfish ciphers: bf-ecb, bf-cbc, bf-cfb, bf-ofb; PHP Mcrypt extension; Blowfish CFB-8 and OFB-8 operation modes. Updated in 2024 (Version v2.04) with minor changes.

Table of Contents

Blowfish Cipher Encryption Algorithm

Key Schedule (Sub-Keys and S-Boxes) Algorithm

Efficient Form of the Blowfish Algorithm

Blowfish Cipher Decryption Algorithm

Proof of Blowfish Cipher Algorithm

First 8336 Fractional Hex Digits of PI

piqpr8.c - Generating Hex Digits of PI

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

Installing Crypt::ECB 1.45 with ActivePerl

Crypt::ECB Encryption with No Padding

Crypt::ECB Encryption Test Cases

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 Option Tests

Crypt::CBC Blowfish Encryption Summary

OpenSSL "enc -bf-ecb" for Blowfish/ECB Encryption

Installing OpenSSL for Windows

OpenSSL "enc" Blowfish Ciphers

Ways to Control Secret Key and IV

"bf-ecb" Cipher with Literal Key

"bf-ecb" Cipher on Multiple Blocks

Secret Key Padding and Truncation

"bf-ecb" Cipher with Salted Key

Salted Key Generation Algorithm

"bf-ecb" Cipher with Random Salt

OpenSSL Default Padding - PKCS#5

OpenSSL "enc -bf-cbc" for Blowfish/CBC Encryption

"bf-cbc" Cipher with Literal Key

"bf-cbc" Cipher on Multiple Blocks

"bf-cbc" Encryption Verification

"bf-cbc" Cipher with Salted Key

"bf-cbc" Cipher with Random Salt

OpenSSL "enc -bf-cfb" for Blowfish/CFB Encryption

OpenSSL "enc -bf-ofb" for Blowfish/OFB Encryption

PHP Mcrypt Extension for Blowfish

PHP Mcrypt Blowfish Block Cipher

Mycrypt Blowfish Block Chaining Cipher

"ncfb/nofb" for Block Chaining Ciphers

Performing CFB Operation Manually

**Keywords:** Blowfish, Cipher, Encryption