Ready to Start Your Career?

By: HamzaMegahed

January 6, 2016

# Block Cipher Encryption Method

By: HamzaMegahed

January 6, 2016

**Block Cipher**Block Cipher is an encryption method where the encryption algorithm operates on a plaintext block of n bits and produces a block of n bits ciphertext. Block Cipher has 2^n possible different plaintext block to encrypt.

**Nonsingular Transformation:**Nonsingular Transformation means the encryption algorithm must be reversible (Nonsingular) to decrypt the ciphertext into the original plaintext. The ciphertext must be unique for each plaintext block.

**Example:**Encryption Block Cipher with a plaintext block length n=4 bits and ciphertext, with 2^4=16 possible input states.plaintext | Ciphertext0000 01010001 01110010 10010011 00000100 11000101 01100110 10100111 00111000 10111001 10001010 00101011 11111100 11101101 00011110 01001111 1101 This example has 16 possible input states, with a Nonsingular transformation (as you can see in the next table.)Ciphertext | Plaintext0000 00110001 11010010 10100011 01110100 11100101 00000110 01010111 00011000 10011001 00101010 01101011 10001100 01001101 11111110 11001111 1011

*This algorithm is reversible (Nonsingular).*There's a problem with a small block size n in that this system is vulnerable to statistical analysis. Yet, if n is large enough, the statistical analysis will be much harder.Also, it's not practical to establish a large enough reversible substitution cipher (the ideal block cipher). The solution to this problem is Feistel Cipher:

**Feistel Cipher:**Feistel proposed that we can approximate the ideal block cipher system for large n, built up by components that are easily realizable. This is the execution of 2 or more simple ciphers in sequence and the result is a strong encryption.The required form of this approach is to develop a block cipher with a key length = k bits, and a block length = n bits with a total possible transformation = 2^k rather than 2^n.

**Feistel Structure:**

Feistel Cipher consists of a number of identical rounds of processing. In each round, a substitution is preformed on one half of data being processed followed by a permutation that interchanges the two halves. The original key is expanded so that a different key is used for each round.

*image courtesy of Amirki *

**Feistel Encryption Algorithm:**The Feistel Encryption Algorithm (the left hand side): inputs to a encryption algorithm are a plaintext block of length - 2w bits and key K.The plaintext is divided into two halves Lo and Ro, which pass through n rounds of processing. Each round i has inputs - Li-1 and Ri-1. Then, they're combined to produce the ciphertext block.The subkey Ki is derived from the overall K; Ki is different from K and from each other.

*Feistel Cipher actually performs two operations:*

**1- A substitution**is performed on the left half of data by applying a round function F to the right half of data, then by doing XOR the output of round function F with the left half of data.The round function F has the same structure every round, but there's a change in parameter subkey Ki for each round.

**2- A permutation**is performed, which consists of interchanges on the two halves of data.Feistel Cipher structure is form of substitution permutation network (SPN).

**Feistel Decryption Algorithm:**Feistel Decryption Algorithm (the right hand side): inputs to decryption algorithm are ciphertext and subkey Ki but in reverse order. It starts start with Kn then Kn-1 ans so on until K1 in the last round.

**Note#1:**At every round the value of encryption algorithm is equal to the corresponding value(n-ith) of decryption algorithm, but the two halves are swapped.For example, in a system with 16 rounds, the value of 5th round in encryption algorithm is equal to the value of 12th round of decryption algorithm, but L and R are swapped.

**Note#2:**The round function F is not required to be a reversible function.

**Feistel Cipher Parameters and Design Features:**

**1- Block size:**Large block size means greater, but reduced encryption and decryption speed.

**2- Key size:**Large key size mean greater security, but may also reduce the encryption and decryption speed.

**3- Number of rounds:**Increasing security can be achieved by increasing the number of rounds.

**4- Round Function F:**Increasing the complexity of round function F increasing the resistance to cryptanalysis.

**5- Subkey generation algorithm:**Increasing of complexity here also increases the resistance to cryptanalysis. Thanks and I hope this was useful to you!