![]() |
VOOZH | about |
Blowfish is an encryption technique designed by Bruce Schneier in 1993 as an alternative to the DES Encryption Technique. It is significantly faster than DES and provides a good encryption rate with no effective cryptanalysis technique found to date. It is one of the first secure block ciphers not subject to any patents and hence freely available for anyone to use. It is a symmetric block cipher algorithm.
The entire encryption process can be elaborated as:
Lets see each step one by one:
Step 1: Generation of subkeys
P[0] = "243f6a88"
P[1] = "85a308d3"
.
.
.
P[17] = "8979fb1b"
Now each of the subkey is changed with respect to the input key as:
P[0] = P[0] xor 1st 32-bits of input key
P[1] = P[1] xor 2nd 32-bits of input key
.
.
.
P[i] = P[i] xor (i+1)th 32-bits of input key
(roll over to 1st 32-bits depending on the key length)
.
.
.
P[17] = P[17] xor 18th 32-bits of input key
(roll over to 1st 32-bits depending on key length)
The resultant P-array holds 18 subkeys that is used during the entire encryption process
Step 2: Initialize Substitution Boxes
Step 3: Encryption
The description of the function " F " is as follows:
Here, the function "add" is addition modulo 2^32.
b. Post-processing: The output after the 16 rounds is processed as follows:
Below is a Java Program to demonstrate Blowfish encryption:
Output:
Description
The decryption process is similar to that of encryption and the subkeys are used in reverse{P[17] - P[0]}. The entire decryption process can be elaborated as:
Lets see each step one by one:
Step 1: Generation of subkeys
P[0] = "243f6a88"
P[1] = "85a308d3"
.
.
.
P[17] = "8979fb1b"
Note: See encryption for the initial values of P-array.
Now each of the subkeys is changed with respect to the input key as:
P[0] = P[0] xor 1st 32-bits of input key
P[1] = P[1] xor 2nd 32-bits of input key
.
.
.
P[i] = P[i] xor (i+1)th 32-bits of input key
(roll over to 1st 32-bits depending on the key length)
.
.
.
P[17] = P[17] xor 18th 32-bits of input key
(roll over to 1st 32-bits depending on key length)
The resultant P-array holds 18 subkeys that is used during the entire encryption process
Step 2: Initialize Substitution Boxes
Step 3: Decryption
Below is a Java program to demonstrate decryption.
Output: