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

- 3 mins

## Exercise 2.1

The stream cipher described in Definition 2.1.1 can easily be generalized to work in alphabets other than the binary one. For manual encryption, an especially useful one is a stream cipher that operates on letters.

1. Develop a scheme which operates with the letters A, B,…, Z, represented by the numbers 0,1,…,25. What does the key (stream) look like? What are the encryption and decryption functions?
2. Decrypt the cipher text “bsaspp kkuosp” which was encrypted using the key “rsidpy dkawoa”.
3. How was the young man murdered?

### Solution

This solution is verified as correct by the official Solutions for Odd-Numbered Questions manual.

1. Assuming the keystream is a stream of random bits in $\mathbb{Z}_{26}$, we can define a stream cipher on the Latin Alphabet as follows (where A ↔ 0, B ↔ 1, C ↔ 2 etc):

2. There is a mistake in the book, the key should be “rsidpy dkawoy”. If you use this key to decrypt the ciphertext, we get the following message:

KASPAR HAUSER


3. Kaspar Hauser was murdered by knife wound.

I wrote a python script which can perform encryption and decryption with this system: