Understanding Cryptography by Christof Paar and Jan Pelzl - Chapter 2 Solutions - Ex2.10

- 3 mins

Exercise 2.10

We conduct a known-plaintext attack on an LFSR-based stream cipher. We know that the plaintext sent was:

1001 0010 0110 1101 1001 0010 0110

By tapping the channel we observe the following stream:

1011 1100 0011 0001 0010 1011 0001
  1. What is the degree of the key stream generator?
  2. What is the initialization vector?
  3. Determine the feedback coefficients of the LFSR.


This solution is verified as correct by the fact that it produces sensible output which can be fed back in for confirmation.

1. By XORing the ciphertext stream with the keystream, we get the following:

0010 1110 0101 1100 1011 1001 0111

If we arrange this into 7 bit blocks then we can easily see that the key repeats every 7 bits. The period of the LFSR is therefore 7.

0010111 0010111 0010111 0010111

Since the period of an LFSR (with primitive polynomial) is defined by , we can rearrange this to :

Therefore the degree of the LFSR must be 3.

2. The first bits of the keystream are , so therefore the initialisation vector must be:

3. Using the following 3 bits of the keystream (since we require key bits for an attack), we can construct a set of simultaneous equations where the unknowns are the feedback coefficients that produced those next three values:

Using our specific values, we get the following:

This can be converted into an augmented matrix and solved via Gauss-Jordan Elimination:

The matrix is now in reduced row echelon form, which allows the values of the unknowns to be read directly from the matrix. The feedback coefficients of the LFSR are , which is represented graphically as follows:


To double check that our solution is correct, we can run the reconstructed LFSR outselves to be sure that it produces the same keystream:

Given that this LFSR outputs the same keystream, we have proved the correctness of our derived coefficients.

Thomas Busby

Thomas Busby

I write about computing stuff

comments powered by Disqus
rss facebook twitter github youtube mail spotify instagram linkedin google google-plus pinterest medium vimeo stackoverflow reddit quora