7CCSMCIS Cryptography and Information Security

Coursework 3
MSc Computing and Security
4 min read

What is a meet-in-the-middle attack?

In 2DES (2 keys, running run encryption twice), a meet-in-the-middle attack is where an attacker can run the ciphertext through the encrypt function for all 256 possible K1 . They can store this in a table, sorted. The attacker can then run the cipher-text through the decrypt function for all 256 possible K2

How many keys are used in triple-DES and why?

There are 2 keys used in 3DES. This is to maintain compatibility with standard DES.

Why is the middle portion of triple-DES a decryption rather than an encryption?

a

  • Consider a block cipher that applies bit permutations (transpositions) to bit vectors length 4. i.e. the permutation cipher with alphabet A={0,1} and block length 4.
  • Consider the key K that transforms a bit vector of length 4 by shifiting it by one bit to the left i.e. K permutes the bit order 1,2,3,4 to 2,3,4,1. The for example E(K,1000)=0001 .
  • Consider IV=1010 .

Use the ECB mode of operation to encrypt the plaintext P=101100010100101 .

P = 101100010100101

Becomes:

P = 1011 0001 0100 101
P = 1011 0001 0100 1010

E(K, 1011) = 0111
E(K, 0001) = 0010
E(K, 0100) = 1000
E(K, 1010) = 0101

C = 0111 0010 1000 0101

We pad the last block by appending a 0 (or 1 if we like).

Use the CBC mode of operation to encrypt the plaintext P=101100010100101 with IV=1010 , and then decrypt it.

P = 101100010100101

Becomes:

P = 1011 0001 0100 101
P = 1011 0001 0100 1010
  1. C1=E(K,IVP1)=E(K,10101011)=E(K,0001)=0010
  2. C2=E(K,C1P2)=E(K,00100001)=E(K,0011)=0110
  3. C3=E(K,C2P3)=E(K,01100100)=E(K,0010)=0100
  4. C4=E(K,C3P4)=E(K,01001010)=E(K,1110)=1101
C = 0010 0110 0100 1101

Decryption:

C = 0010 0110 0100 1101
  1. P1=D(K,C1)IV=D(K,0010)1010=00011010=1011
  2. P2=D(K,C2)C1=D(K,0110)0010=00110010=0001
  3. P3=D(K,C3)C2=D(K,0100)0110=00100110=0100
  4. P4=D(K,C4)C3=D(K,1101)0100=11100100=1010
P = 1011 0001 0100 1010
  • Consider a block cipher that applies bit permutations (transpositions) to bit vectors of length 3, i.e., S=3 .
  • Consider the key K that transforms a bit vector of length 4 by shifting it one bit to the left, i.e. K permutes the bit order 1,2,3,4 to 2,3,4,1.
  • Consider IV=1010 .

Use CFB mode of operation to encrypt the plaintext P=101100010100101 .

S = 3, therefore split plaintext into 3s.

P = 101 100 010 100 101
IV = 1010
  1. C1=P1MSBs(E(K,IV))=101MSB3(0101)=101010=111
  2. C2=P2MSBs(E(K,C1))=100MSB3(E(K,0111))=100MSB3(1110)=100111=011
  3. C3=P3MSBs(E(K,C2))=010MSB3(E(K,0011))=010MSB3(0110)=010011=001
  4. C4=P4MSBs(E(K,C3))=100MSB3(E(K,0001))=100MSB3(0010)=100001=101
  5. C5=P5MSBs(E(K,C4))=101MSB3(E(K,0101))=101MSB3(1010)=101101=000

Gives:

C = 111 011 001 101 000

Use OFB mode of operation to encrypt the plaintext P=101100010100101 (with block length 4).

P = 1011 0001 0100 101
IV = 1010
  1. C1=P1E(K,IV)=1011E(K,1010)=10110101=1110 .
  2. C2=P2E(K,IV)=0001E(K,0101)=00011010=1011 .
  3. C3=P3E(K,IV)=0100E(K,1010)=01000101=0001 .
  4. C4=P4E(K,IV)=101E(K,0101)=1011010=000 .

Gives:

C = 1110 1011 0001 000