Block Ciphers

Block Ciphers

Yet another Cipher

What are Block Ciphers?

Block ciphers are a type of ciphers which consists of an encryption and decryption algorithm. This cipher takes n bits of input and produces n bits of output.

An encryption Algorithm in block cipher (E) takes the Key (K) and a Plaintext Block (P) and produces CipherText (C). i.e C = E(K,P) .

A decryption Algorithm in block cipher (D) takes the CipherText (C) and Key (K) to get back the original Plaintext Block (P). i.e P = D(K,C).

How do Block Ciphers work?

Key / Keyspace (K) in block cipher is expanded into n bits of random keys (k). These are then rounded with message m using the round function R(k,m). These round functions derive keys from the key space (K). Block ciphers are built over by iteration. For example: consider a block cipher with three rounds which encrypts the plain text by computing cipher text C.

C = R3(R2(R1(P)))

R1 take the key from k1, R2 take the key from k2, R3 take the key from k3 and so on

Note: Round keys should always be identical for a block cipher to avoid Slide Attack.

Slide Attack

For block cipher to be secure rounds should be identical to another round. Slide Attack looks for two plaintext or ciphertext pairs (P1, C1) and (P2, C2) where P2 = R(P1) if R is the cipher's round. When rounds are identical the relation between the two plaintexts P2 = R(P1) implies the relation between their cipher text C2 = R(C1).

Untitled Diagram.drawio.png

The above figure shows three rounds, but the relation C2 = R(C1) will hold no matter the number of rounds.

Two Notable Block Ciphers

  • Feisel Network / Lucifer / DES
  • Rijndael / AES

DES :- Data Encryption Standard

This cipher is designed by an engineer at IBM. DES has a block size of 64 bits and a key size of 56 bits. 64-bit blocks became common in block cipher designs after DES. Key length depended on several factors, including government regulation. In this cipher same algorithm and key are used for encryption and decryption, with minor differences.

Des works as follows:

  1. Split 64-bit blocks into two 32-bit blocks and assign them to L & R.
  2. Set L to L XOR F(R) where F is a substitution-permutation round.
  3. Swap the values of L and R.
  4. Move to Step 2 and perform the same steps for 15 times.
  5. Merge L & R into 64-bits output block.

Diagram representation of Feistel Network / DES

Untitled Diagram.drawio (1).png

AES :- Advanced Encryption Standard

The Rijndael cipher developed by Belgian cryptographers, Joan Daemen and Vincent Rijmen was one of the competing designs to replace DES. It won the 5-year public competition to become the AES, (Advanced Encryption Standard).

AES process blocks of 128 bits using a secret key of 128, 192 or 256 bits, with 128 bits keys being the most common because of faster encryption time. This cipher uses SPN (Substitution-Permutation Network) structure with 10 rounds for a 128-bit key, 12 rounds for a 192-bit key and 14 rounds for a 256-bit key.

AES-encryption-flowchart.png

Did you find this article valuable?

Support Shreyas K S by becoming a sponsor. Any amount is appreciated!