Professional Documents
Culture Documents
1 | Tom Busby
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.
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?
https://tom.busby.ninja/understanding-cryptography/ex2-1/ 1/4
2/24/2019 Understanding Cryptography by Christof Paar and Jan Pelzl - Chapter 2 Solutions - Ex2.1 | Tom Busby
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 Z26 , we can define a stream cipher
on the Latin Alphabet as follows (where A ↔ 0, B ↔ 1, C ↔ 2 etc):
yi = xi + ki mod 26
xi = yi − ki mod 26
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
I wrote a python script which can perform encryption and decryption with this system:
def letter_to_number(c):
return ord(c.lower()) - ord('a')
def number_to_letter(n):
return chr(n % 26 + ord('a'))
https://tom.busby.ninja/understanding-cryptography/ex2-1/ 2/4
2/24/2019 Understanding Cryptography by Christof Paar and Jan Pelzl - Chapter 2 Solutions - Ex2.1 | Tom Busby
def print_plaintext(plaintext):
print "\n=========="
print "Plaintext:"
print "==========\n"
print plaintext, "\n"
if __name__ == "__main__":
ciphertext = "bsaspp kkuosp"
key = "rsidpy dkawoy" # mistake in the key in the book, should end with y not a
print_ciphertext_and_key(key, ciphertext)
plaintext = decrypt(key, ciphertext)
print_plaintext(plaintext)
print "Q2.1.3: Kaspar Hauser was murdered via a stab wound\n"
Thomas Busby
Tweet Share
I write about computing stuff
https://tom.busby.ninja/understanding-cryptography/ex2-1/ 3/4
2/24/2019 Understanding Cryptography by Christof Paar and Jan Pelzl - Chapter 2 Solutions - Ex2.1 | Tom Busby
LOG IN WITH
OR SIGN UP WITH DISQUS ?
Name
✉ Subscribe d Add Disqus to your siteAdd DisqusAdd 🔒 Disqus' Privacy PolicyPrivacy PolicyPrivacy
https://tom.busby.ninja/understanding-cryptography/ex2-1/ 4/4