|       Crypto: HW 7      |       Fall 2001      |       Michael Siff       |
Read the handouts given in class on Thursday (10/4) before class on Monday (10/8).
The problems below are due Thursday, October 11.
| 7 |
| 9 |
| 62 |
| 63 |
| 64 |
| 233 |
| 244 |
| 255 |
| 1001 |
| 1101 |
| 10010 |
| 10101 |
| 110100 |
| 100101 |
| 1111111 |
| 11001000 |
Binary arithmetic
1001 + 1101 ------ 10110Compute the following base-2 sums:
10010 111110 + 10101 + 10110 ------- --------Show your work and check your results by converting the numbers to base-10 and performing addition in that more familiar system, as in:
base 2 base 10 ==================== 1001 9 = 8 + 1 + 1101 + 13 = 8 + 4 + 1 ------ ---- 10110 22 = 16 + 4 + 2
101 x 11 ----- 101 + 1010 ------ 1111Compute the following base-2 products:
111 10001 x 101 x 110 ----- -------Show your work and check your results by converting the numbers to base-10 and performing multiplication in that more familiar system, as in:
base 2 base 10 ==================== 101 5 = 4 + 1 x 11 x 3 = 2 + 1 ----- --- 101 + 1010 ------ 1111 15 = 8 + 4 + 2 + 1
Algorithms Here is an algorithm for converting a number to its binary (base-2) representation:
input d // a positive integer
k <- 0
while d > 0 do
bk <- d mod 2
d <- d - bk
d <- d / 2
k <- k + 1
output bk-1, bk-2, ... , b0
bk-1, bk-2, ... , b0
and use the same style and form shown above.
ASCII
(It may be useful to consult an ASCII table.) For each of the following pieces of ASCII text, write the corresponding decimal and (8-bit) binary encodings. For example, the text is
CatYou should write:
| symbol | decimal | binary |
|---|---|---|
| C | 67 | 01000011 |
| a | 97 | 01100001 |
| t | 116 | 01110100 |
XOR encoding
We can encrypt ASCII plaintext using binary keys and the XOR operation. For example, to encrypt the plaintext he using the key 00100101, we would write:
h (symbolic plaintext) e (symbolic plaintext)
104 (decimal ASCII for h) 101 (decimal ASCII for e)
01101000 (binary ASCII for h) 01100101 (binary ASCII for e)
xor 00100101 (the key) xor 00100101 (the key)
-------- --------
01001101 (binary ciphertext) 01000000 (binary ciphertext)
77 (decimal ciphertext) 64 (decimal ciphertext)
M (symbolic ciphertext) @ (symbolic ciphertext)
So the ciphertext corresponding to he is M@.
| crypto home | assignments | labs | notes | tools | contact instructor |