Blowfish algorithm
• 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
• It is a symmetric block cipher algorithm.
• blockSize: 64-bits
• keySize: 32-bits to 448-bits variable size
• Number of subkeys: 18 [P-array]
• Number of rounds: 16
• number of substitution boxes: 4 [each having
512 entries of 32 bits each]
Blowfish Encryption Algorithm
Generation of subkeys
• 18 subkeys{P[0]...P[17]} are needed in both
encryption as well as decryption process
• These 18 subkeys are stored in a P-array with
each array element being a 32-bit entry.
• It is initialized with the digits of pi.
• The hexadecimal representation of each of the
subkeys is given by:
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)
Initialize Substitution Boxes
• After expanding the P-array, The S-boxes are
initialized with digits of pi.
• 4 Substitution boxes(S-boxes) are
needed{S[0]...S[3]} in both encryption aswell as
decryption process with each S-box having 256
entries{S[i][0]...S[i][255]} where each entry is
32-bit.
Encryption
• The encryption function consists of two parts:
a. Rounds: The encryption consists of 16 rounds
with each round(Ri) taking inputs the plainText
from previous round and corresponding subkey(Pi).
The description of each round is as follows:
The description of the function " F " is
as follows:
Post-processing
• The output after the 16 rounds is processed as
follows
RC4 Encryption Algorithm
• RC4 is a stream cipher and variable-length key
algorithm. This algorithm encrypts one byte at a
time (or larger units at a time).
• A key input is a pseudorandom bit generator that
produces a stream 8-bit number that is
unpredictable without knowledge of the input key.
• The output of the generator is called key-stream,
and is combined one byte at a time with the
plaintext stream cipher using X-OR operation.
• RC4 Encryption
10011000 ? 01010000 = 11001000
RC4 Decryption
11001000 ? 01010000 = 10011000
RC4