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

- 3 mins- Return to index
- Exercise 2.1
- Exercise 2.2
- Exercise 2.3
- Exercise 2.4
- Exercise 2.5
- Exercise 2.6
- Exercise 2.7
- Exercise 2.8
- Exercise 2.9
- Exercise 2.10
- Exercise 2.11
- Exercise 2.12

## 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.

- 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?
- Decrypt the cipher text “bsaspp kkuosp” which was encrypted using the key “rsidpy dkawoa”.
- 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 , 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: