written 6.1 years ago by |
Blowfish Algorithm
- Blowfish was developed by Bruce Schneier. It is very strong symmetric key cryptographic algorithm.
Features of Blowfish:
Fast: Blowfish encryption state on 32 bit microprocessors.
Compact: Blowfish can execute in less than 5KB memory
Simple: Blowfish uses only primitive operations such as addition, XOR and table lookup making its design and manipulation simple
Secure: Blowfish has a variable key length up to a maximum of 448 long, making it both flexible and secure
Operations: (Blowfish encrypts 64-bit block with a variable-length key)
1) Subkey Generation: This process covert the key up to 448 bit long to subkeys totaling 7168 bits
2) Data Encryption : This process involves the iteration of a simple function 16 times. Each round contains a key-dependent permutation and key and data substitution
Blowfish is a very fast algorithm which takes 64 bit input as plaintext and generates 64 bit output ciphertext
It uses the concept of P-array which uses 32 bit subkeys and there are 18 P-arrays $P_1 \ to \ P_{18}$
Blowfish Algorithm runs 16 times i.e. 16 rounds
Processes:
- Subkey Generation:
Key Size is variable but blowfish algorithm generates very large sub-keys . The key size is in the range of 32 bits to 448 bits or 14 words.
Concept of P-array consists of 18, 32 bit sub-keys
There are 4 S-boxes containing 256 entries of 32 bits
P-array is initialized first then four s boxes with fixed string
Then P-arryas are XORed with subkeys ie from $P_1 \ to \ P_{18}$ . Once the sub keys are generated the encryption process begins.
- Data encryption and decryption:
- We use the P arrays and S boxes during this process
Algorithm for encryption of 64 bit block
Divide X into two blocks XL and XR of equal sizes. Thus both XL and XR will consist of 32 bit each
For i=1 to 16
$\hspace{1.5cm}$XL = XL ⊕ $P_i$
$\hspace{1.5cm}$XR = f(XL) ⊕ XR
$\hspace{1.5cm}$Swap XL ,XR
$\hspace{1.5cm}$(undo last swap)
XR = XR ⊕ $P_{17}$
XL = XL ⊕ $P_{18}$
Concatenate XL and XR back into X to get ciphertext CT
Function f is as follows
$\hspace{1.5cm}$a. Divide the 32 bit XL block into four 8 bit sub blocks named a, b, c, d
$\hspace{1.5cm}$b. Compute f(a,b,c,d) = $((S_1[a ] + S_2[b] mod 2^{32}) ⊕ S_3[c])⊕ S_4 [d] mod 2^{32}$
Blowfish Decryption