Exercises PDF
Exercises PDF
Exercises PDF
April 3, 2012
Exercises in
Cryptography and Coding Theory
Per-Anders Svensson
b
1
o
14
c
2
p
15
d
3
q
16
e
4
r
17
f
5
s
18
g
6
t
19
h
7
u
20
i
8
v
21
j
9
w
22
k
10
x
23
l
11
y
24
m
12
z
25
We will not distinguish between capitals and small letters, whence s and S will
both be encoded as 18, for instance. All spaces and punctuation marks, such as
points, commas, colons, semicolons, exclamation marks, question marks, etc.,
will be excluded before encryption. It is also assumed that any text will not
contain any digits.
As an example, according to the these rules, the text
This message has 2 sentences. The second one ends with an
exclamation mark!
will be transformed to
thismessagehassentencesthesecondoneendswithanexclamationmark
before encryption.
For some ciphers, such as RSA, the plaintext is divided into blocks consisting
of n letters each. If the numbers of letters in the plaintext isnt a multiple of n,
a number of so called junk letters are added to the last block, so that each block
will contain exactly n letters. Furthermore each letter is encoded according to
the scheme
a 01, b 02, . . . , y 25, z 26.
For example, to divide the plaintext cryptology into three-letter blocks we will
have to add some junk letters to the last block. We then obtain
cry pto log yxx
Here we have used x as a junk letter. We now encode each block, letter by
letter, to obtain
31824, 162015, 121507, 252424.
(b) a = 4 and b = 3
(e) a = 13 and b = 2
2. Let b = 3 and complete the table below according to the Division Algorithm a = bq + r.
a
q
r
1
0
1
a
q
r
10
11
12
13
14
15
16
(b) 15
(c) 27
(d) 28
4. Compute
(a) gcd(3, 9)
(d) gcd(36, 192)
(b) 12 and 33
(e) 11 and 191
(c) 54 and 73
(f ) 13 and 195
(c) a = 34, b = 55
7. Find integers s and t, such that as + bt = gcd(a, b), for each choice of a
and b in the previous exercise. (Note that s and t are not uniquely determined.)
8. Are there any integers m and n such that gcd(m, n) = 3 and m + n = 100?
9. Let a be an integer. What can you then say about the value of gcd(a, a+2)?
10. Compute
(a) 3 + 6 in Z7
(d) 142 + 67 in Z143
(b) 2 8 + 4 3 in Z9
(e) 7270 in Z73
(c) 32 + 42 in Z25
(f ) (149+553)83 in Z37
(c) 3 17 (mod 5)
(f ) 621 0 (mod 9)
12. For what values of the integer m > 1 are the following congruences true?
(a) 6 1 (mod m)
(b) 31 7 (mod m)
13. Is there a positive integer m such that a b (mod m) is true for all
integers a and b?
14. The Rule of Nines says that an integer a is divisible by 9, if and only if the
sum of the digits of a (when expressed in the decimal notation) is divisible
by 9. For instance, 9 | 738, since the sum of digits of 738 is 7 + 3 + 8 = 18,
and 18 is divisible by 9.
(a) Use the Rule of Nines to show that 9 | 451 099 125.
(b) Prove the Rule of Nines.
Hint: Show that 10k 1 (mod 9) for each positive integer k.
15. Construct one table for addition modulo 8 and one for multiplication modulo 8 on the set Z8 = {0, 1, 2, 3, 4, 5, 6, 7}, similar to those on page 72 in
the text book.
16. What will you obtain if you compute 1 + 2 + 3 + + (n 1) in Zn ?
17. Find all elements in Zn that have a multiplicative inverse modulo n, if
(a) n = 8
(b) n = 9
(c) n = 10
(d) n = 11.
20. Suppose a and b both have a multiplicative inverse modulo n. What can
you then say about the multiplicative inverse modulo n of ab and a + b?
21. Find all solutions to the following congruence equations.
(a) 3x 2 (mod 8)
(d) 2x 7 (mod 10)
(b) 6x 2 (mod 9)
(e) 9x 8 (mod 11)
23. For what integers a, where 0 a < 70, has the congruence equation
30x a (mod 70) a solution? How many solutions are there in each such
case?
Classical ciphers
1. (a) Encrypt encrypt with the Caesar cipher.
(b) The ciphertext mxolxv was obtained by Caesar encryption. What
was the plaintext?
2. Encrypt plus by using a shift cipher with the shift length
(a) 5
(b) 10
(c) 14.
3. In some computer programs one can encrypt a message by using a command called Rot13. This command works like a shift cipher with the shift
length 13, i.e. the encryption mapping may be written as
E(x) = x + 13
(mod 26).
b
52
o
58
t
41
c
19
p
188
u
122
d
24
q
32
v
137
e
14
r
32
w
36
f
31
j
97
x
2
g
2
k
141
y
106
h
117
l
2
z
113
i
26
m
9
a
b
c
d
e
f
g
h
i
0
3
19
21
39
39
22
0
28
j
k
l
m
n
o
p
q
r
24
57
12
2
6
8
11
0
42
s
t
u
v
w
x
y
z
5
15
11
62
11
8
23
39
(b) E(x) = 4x + 1
(e) E(x) = 12x
(c) E(x) = x
(f ) E(x) = 15x + 15
10. How many affine mappings E(x) = ax + b can be used as a key for an
affine cipher, if the alphabet we are using contains
(a) 28 letters
(b) 26 letters
(c) 29 letters?
11. Use the affine mapping E(x) = 3x + 17 (mod 26) to encrypt the message
vaxjo. Which affine mapping should be used for decryption?
12. An affine cipher uses E(x) = 25x + b (mod 26) for encryption, where
b Z26 . For which b Z26 will the mapping for decryption look exactly
the same?
13. Suppose we know that an affine cipher encrypts the letters e and n to s
and t, respectively. How will hurrah be encrypted with this cipher?
14. Is there an affine cipher that encrypts
(a) he to it
(b) no to we
15. A plaintext is encrypted two times. First, we use the affine mapping
E1 (x) = 9x + 19 (mod 26) as the key, then E2 (x) = 5x + 2 (mod 26).
The resulting ciphertext can be obtained from the plaintext by using a
single mapping mapping E(x) = ax + b. Which one?
16. Decrypt the ciphertext yqjjoodboik, provided that we know that it is the
result from an affine cipher that encrypts be to do.
17. Let E1 , E2 , and E3 denote affine mappings on Z26 . If we encrypt the
plaintext examine twice, first using E1 and on top of that E2 , the ciphertext labfvol is obtained. If we instead encrypt by first using E2
followed by E3 , the resulting ciphertext will be mvgystm. Find E3 , given
that E1 (x) = 5x + 11 (mod 26).
5
a
Q
n
G
b
A
o
B
c
Z
p
Y
d
W
q
H
e
S
r
N
f
X
s
U
g
E
t
J
h
D
u
M
i
C
v
I
j
R
w
K
k
F
x
O
l
V
y
L
m
T
z
P
4
2
3
1
and B =
2
3
2
7
be given. Compute
(a) AB (mod 10)
8
2
5
2
has an inverse
(a) (mod 5)
13
(c)
1
11
2
27. Find the inverse (mod 25), in case it exists, to each one of the matrices in
the previous exercise.
28. A binary matrix is a matrix whose elements can only be 0 or 1. How
many binary 2 2 matrices are there? How many of those matrices has
an inverse modulo 2?
29. Which of the matrices below is possible to use as a key in a Hill cipher?
(We assume that our alphabet consists of 26 letters.)
3 18
5 11
7 1
4 13
(a)
(b)
(c)
(d)
4 21
8 27
4 2
8 18
30. Encrypt check with a Hill cipher that uses the matrix
1 10
3 5
as an encryption key. (Append a junk letter, x for instance, to the end
of the word check, so it can be divided into two-letter blocks.)
31. By using the matrix
4
3
1
12
as a key for Hill encryption, the ciphertext krji is obtained. Find the
plaintext.
A=
3
1
21
7
(b) S1 (010100)
(c) S7 (000010)
(d) S6 (100111)
2. What will the outcome of the first round (of 16) in the Feistel system that
is a part of the DES algorithm, if both the plaintext block and the key
consist of ones only? Or in other words, given the plaintext m = 111 . . . 1
(64 bits) and the key K = 111 . . . 1 (56 bits), decide L1 R1 (see Figure 4.4
on page 125 in the textbook).
3. Suppose we encrypt messages using the following version of 3DES: Each
message m is encrypted with two DES keys K1 and K2 by the formula
c = EK1 (EK2 (EK2 (m))).
Describe how to break this cipher using a Meet-in-the-Middle Attack.
4. As described on page 144 of the textbook, the DESX cryptosystem is
described as one way to strengthen up DES. To encrypt a plaintext m
using DESX, you choose three DES keys K1 , K2 , and K3 , and compute
c = K3 EK2 (K1 m),
where signifies bitwise addition (XOR), and EK2 stands for DES encryption. How do you decrypt c, using DESX?
5. Using long division, compute the quotient q(x) and remainder r(x) when
f (x) is divided by g(x), according to the division algorithm of Z2 [x], if
(a) f (x) = x3 + x2 + x + 1 and g(x) = x + 1
(b) f (x) = x6 + x2 + x and g(x) = x3 + x + 1
(c) f (x) = x7 + x6 + 1 and g(x) = x2 + x.
6. Compute the products of bytes given below, by means of the arithmetic
of GF(28 ) that is used in the Rijndael cipher.
(a) 00010011 00000111
(c) 10101010 00010010
7. Suppose that the input to the first round of the four layers BS, SR, MC
and ARK, that is used in the Rijndael cipher, is given by the matrix
M0 =
00001001 01010010 01010010 01010010 .
01010010 01010010 00001001 01010010
Find the output matrix M1 of this round, if the key that is used for this
actual round is represented by the identity matrix of bytes, i.e.
K1 =
00000000 00000000 00000001 00000000 .
00000000 00000000 00000000 00000001
9
(b) x2 + 1
(c) x3 + x + 1
10
(d) x4 + x + 1
RSA
1. Suppose that we encode a plaintext by encoding each of one its letters
according to
a 01, b 02, . . . , y 25, z 26.
How will then the following plaintexts be encoded?
(a) no
(b) yes
(c) hello
(d) goodbye
2. Divide the following plaintexts into blocks of three letters each (and add
junk letters (e.g. x) to the last block if necessary), and encode each such
block according to the principle of the previous exercise.
(a) beatles
(b) rollingstones
(c) elvispresley
3. Translate the following pairs of integers into blocks of letters, using the
principles of Exercise 1 above. Put together the blocks into a single plaintext and ignore the junk letters in the last block (if there are any).
(a) (130120, 81924)
(c) (13051919, 1070524)
(b) n = 765237
(c) n = 2610
(d) n = 1073 ?
(b) (17)
(c) (18)
(d) (22)
(e) (25),
(c) (256)
10. Find the remainder when 11183 and 23176 are divided by 16.
11. Use n = 77 and e = 7 as the public key for an RSA cryptosystem, to
encrypt the message yes. (Encode the plaintext letter by letter, with its
ordinal number in the alphabet.)
12. A ciphertext, represented by c1 = 60, c2 = 71, and c3 = 57, has been
obtained by RSA encryption. The same public key as in the previous
exercise has been used. Find the plaintext.
13. Find e and n in the public key of an RSA cryptosystem, if the private key
is given by
(a) p = 5, q = 3, d = 3
(c) p = 23, q = 11, d = 19
14. Find p, q, and d in the private key of an RSA cryptosystem, if the public
key is given by
(a) n = 55, e = 3
(c) n = 26, e = 7
(b) n = 143, e = 13
(d) n = 95, e = 65.
15. Bob is about to construct a key for an RSA cryptosystem. So far, he has
chosen the primes p = 17 and q = 31 and an integer e = 7.
(a) How will the public and the private key look like?
(b) Use Bobs key to encrypt the plaintext hey.
16. Bob is going to construct a public RSA-key. He starts by choosing two
primes p = 59 and q = 73. When he comes to choosing the number e, he
hesitates between choosing e = 32, e = 53, or e = 261. Explain to Bob,
why two of these alternatives for e are out of discussion, and help him
to complete the construction his public key, as well as the corresponding
private key.
17. In a public key (n, e) for an RSA cryptosystem, e = 3. Suppose that a
plaintexts represented by the integers m and m+1 yields the ciphertexts c1
and c2 , respectively. Show that we can find the plaintext m, by solving
the congruence equation
(c2 c1 + 2)x c2 + 2c1 1
(mod n)
20. Bobs public RSA-key is given by (n, e) = (1333, 11). You happen to know
that (n) = 1260. Find Bobs private key (p, q, d).
12
(b) 161
(c) 2021
(d) 11663
23. Verify that none of the integers below is a prime, by using Fermats
method, i.e. if gcd(a, n) = 1 and an1 6 1 (mod n), then n is not a
prime.
(a) 15
(b) 33
(c) 645
13
(d) 1 729
(b) 3
(c) 5
(d) 6
(e) 11
(e) 101
4. Use the information given in the previous exercise to find all primitives
root modulo the prime p, given that is a primitive root:
(a) p = 17, = 3
(b) p = 19, = 2
5. Given that 2 is a primitive root modulo 11, compute the discrete logarithms
(a) L2 (8)
(b) L2 (5)
(c) L2 (7)
(d) L2 (6).
(b) L5 (10)
(c) L5 (8)
(d) L5 (25)
(e) L5 (52)
Hint: 125 52 (mod 73). Recall that La (bc) La (b)+La (c) (mod p1).
8. Suppose we use (p, , ) = (13, 2, 3) as the public key in ElGamals cryptosystem. Find the private key a.
9. Bob intends to construct a key for an ElGamal cryptosystem. He chooses
the prime p = 17 and finds that = 3 is a primitive root modulo 17.
Furthermore, he chooses a = 3.
(a) Help Bob to finish the construction.
(b) Encrypt the message m = 13, using the random number k = 4.
(c) Decrypt the ciphertext (4, 9).
10. Encrypt the message m = 5 with (p, , ) = (11, 2, 9) as the public key in
ElGamals cryptosystem.
11. Encrypt the plaintext ok using ElGamals cryptosystem, when the public
key is given by (p, , ) = (59, 44, 48). The number k that is needed in
the encryption process may be chosen from the set {2, 3, 4}.
14
12. A message m is encrypted to (r, t) = (3, 5), using ElGamals krypto. The
private key is a = 4. When it comes to the public key (p, , ), we know
that p = 7. Find m.
13. Two different messages m1 and m2 have been encrypted in ElGamals
cryptosystem with the same public key (p, , ). The corresponding ciphertexts are represented by (r1 , t1 ) = (5, 10) and (r2 , t2 ) = (5, 9), respectively. Suppose m1 = 4. Find m2 , given that p = 17.
14. As a public key to ElGamals cryptosystem (p, , ) = (47, 5, 43) is used.
Eve intercepts the ciphertext (14, 23), (14, 9), (14, 8). Knowing that the
first letter of the plaintext is e, she can actually find the complete message!
What is it?
15. Bobs public key to ElGamals cryptosystem is (p, , ) = (29, 2, 8). Alice
uses this to send him the ciphertext (13, 26), (19, 24), (21, 13). What is the
plaintext?
16. Alice and Bob will use Diffie-Hellmans key exchange protocol to decide
a key k for a symmetric cryptosystem. The key is represented by an
integer. Let p = 47. Then = 5 is a primitive root modulo 47. Alice
chooses x = 21 and Bob chooses y = 7. Compute those integers that they
will send to one another, as well as the key k.
17. When using the Diffie-Hellman key exchange protocol, Alice computes
a = x (mod p) and sends it to Bob. Here p is a prime, a primitive
root modulo p, and x an element in Zp1 . Find , given that p = 17,
a = 3, and x = 11. (Hint: Note that gcd(x, p 1) = 1, whence x has a
multiplicative inverse modulo p 1.)
15
Coding Theory
1. Compute the following Hamming distances.
(a) d(10011, 10100)
(c) d(0110111, 1001000)
3. Based on the answers of the two previous exercises, there seems to be some
kind of connection between the Hamming distance between two words and
the Hamming weight of sum of the same words. What kind of connection?
Is this connection generally true? Give a proof or find a counterexample.
4. Let x and y be words in An . Prove that wt(x + y) wt(x) + wt(y).
Hint: Exercise 3 and the triangle inequality.
5. Prove that d(x + z, y + z) = d(x, y) for all x, y, z An . (The Hamming
distance is invariant of translations.)
Hint: Exercise 3.
6. Find the minimum distance and the minimal Hamming weight for each
one of the codes below.
(a)
(b)
(c)
(d)
(e)
(b) correct?
10. Find all words in each one of the Hamming spheres below.
(a) B(0000, 1)
(b) B(01001, 1)
(c) B(101, 2)
11. Study the code C = {0000, 0111, 1011, 1101} in A4 . Compute wt(C) and
d(C). Is the code linear? Justify your answer.
16
2n
.
N
(1)
This is the so-called Hamming bound of the code C. For example, the code
C = {000000, 010101, 101010, 111111} A6 (that can correct 1 error)
fulfills the Hamming bound, since
1
X
6
k=0
6
6
26
= 1 + 6 = 7 16 = .
+
0
1
4
1 0 0 1 1
G = 0 1 0 0 1 .
0 0 1 1 0
How many errors is the code capable to detect and correct?
15. Find the parity check matrix H that corresponds to the generating matrix G in the previous exercise.
16. Let C be a linear (6, 3)-code with the parity check matrix
1 0 1
0 1 1
1 1 0
.
H=
1 0 0
0 1 0
0 0 1
(a) Find all codewords in C and its minimum distance.
(b) Correct the following words (if possible): 101011, 100110, and
010100.
17
17. Construct a linear (5, 2)-code that can correct all single-bit errors.
Hint: Construct a suitable parity check matrix.
18. The matrix
1
G = 0
0
0
1
0
0
0
1
1
0
1
0
1
1
1
0
0
0 1 1
1 0 1
1 1 0
H=
1 1 1 .
1 0 0
0 1 0
0 0 1
Decide whether the words below are codewords or not. Correct those
words that are not codewords to the closest codeword (with respect to the
Hamming distance).
(a) 0011001
(d) 0110010
(b) 1100001
(e) 0101010
(c) 1010011
(f ) 1110111
1
G = 0
0
0 0 1 1 1
1 0 0 1 1 ,
0 1 1 1 0
1
S = 1
0
that is invertible modulo 2, and
0
0
0
P=
1
0
0
1
1 ,
1
0
1
1
0 1 0 0 0
1 0 0 0 0
0 0 0 0 1
.
0 0 0 0 0
0 0 1 0 0
0 0 0 1 0
0 1 1
S 1 = 1 1 0
1 1 1
and
P 1
0
0
1
=
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
19
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
,
0
1
0
Answers
Elementary number theory
1 (a) q = 2, r = 0
(d) q = 0, r = 5
(b) q = 1, r = 1
(e) q = 6, r = 1
(c) q = 71, r = 2
(f ) q = 7, r = 1
1
0
1
2
0
2
3
1
0
4
1
1
5
1
2
6
2
0
7
2
1
8
2
2
a
q
r
9
3
0
10
3
1
11
3
2
12
4
0
13
4
1
14
4
2
15
5
0
16
5
1
3 (a) 1, 7
(c) 1, 3, 9, 27
4 (a) 3
(d) 12
(b) 1, 3, 5, 15
(d) 1, 2, 4, 7, 14, 28
(b) 5
(e) 124
(c) 1
(f ) 2
6 (a) 5
(b) 2
(c) 1
7 (a) s = 11, t = 5
(b) s = 19, t = 21
(c) s = 21, t = 13
8 No. Why?
9 It is either 1 or 2, depending on whether a is odd or even.
10 (a) 2
66
(d) 66
(b) 1
(c) 0
(e) 1
(f ) 36
13 Yes, m = 1
15 Addition table:
20
+
0
1
2
3
4
5
6
7
0
0
1
2
3
4
5
6
7
1
1
2
3
4
5
6
7
0
2
2
3
4
5
6
7
0
1
3
3
4
5
6
7
0
1
2
Multiplication table:
0 1 2 3
0 0 0 0 0
1 0 1 2 3
2 0 2 4 6
3 0 3 6 1
4 0 4 0 4
5 0 5 2 7
6 0 6 4 2
7 0 7 6 5
4
4
5
6
7
0
1
2
3
5
5
6
7
0
1
2
3
4
6
6
7
0
1
2
3
4
5
7
7
0
1
2
3
4
5
6
4
0
4
0
4
0
4
0
4
5
0
5
2
7
4
1
6
3
6
0
6
4
2
0
6
4
2
7
0
7
6
5
4
3
2
1
(b) 1, 2, 4, 5, 7, and 8
(d) all elements but 0
18 0, 1, 4, 5, 6, or 9
19 (a) 2
(d) 9
(b) no inverse
(e) no inverse
(c) 23
(f ) 39
x 6 (mod 8)
(b) no solutions
x 4 (mod 10), x 9 (mod 10)
no solutions
(e) x 7 (mod 11)
x 7 (mod 18), x 16 (mod 18)
22 (a) x 5 (mod 7)
(b) x 1 (mod 11)
(c) x 1 (mod 12), x 5 (mod 12), x 9 (mod 12)
(d) x 168 (mod 969), x 491 (mod 969), x 814 (mod 969)
23 a = 0, 10, 20, 30, 40, 50, 60; there are 10 solutions in each case.
Classical ciphers
1 (a) hqfubsw
2 (a) uqzx
(b) julius
(b) zvec
21
(c) dzig
3 (a) uryyb
4 No. Why?
5 (a) A known plaintext attack yields the key k = 5
(b) A ciphertext only attack yields the key k = 11
6 D(x) = x + 19 mod 26, since this will map l, the most common letter in
the ciphertext, onto e, the most common letter in the English alphabet.
7 D(x) = x + 9 yields the plaintext goodguess.
8 oxygen
9 (a), (c), (d), and (f)
10 (a) 335
(b) 311
(c) 811
(if you do not take the affine mapping E(x) = x into consideration)
11 crish; D(x) = 9x + 3
12 All b Z26
13 boffgb
14 (a) Yes
(b) No
(c) Yes
15 E(x) = 19x + 19
16 coffeebreak
17 E3 (x) = 3x (mod 26)
18 what is the meaning of life
19 (a) gmlxip
(b) lunch
20 attack
21 (a) V1 (vigenere) = aqxwgjzv, V2 (vigenere) = nmisahji
(b) 30
22 The keyword is lsfmrg for both V and W .
23 (a) guywfoqr, jeqhgirs, and wunpoigurs, respectively
(b) secretmessage
7 9
1 8
9
24 (a)
(b)
(c)
7 1
4 5
9
25 (a) Yes
(b) No
(c) No
22
8
0
(d) Yes
26 (a) No inverse
27 (a)
16
17
6
16
11 1
(b)
10 9
11 16
(b)
10 4
(c) No inverse
(c) No inverse
8
1
17
11
36 (a) x {1, 3, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25}
(b) Depending on how x is chosen, the following ciphertexts are obtained:
x ciphertext
1 bfzrygrz
3 brzzygrj
7 bpzpygrd
9 bbzxygrn
11 bnzfygrx
13 bzznygrh
15 blzvygrr
17 bxzdygrb
19 bjzlygrl
21 bvztygrv
23 bhzbygrf
25 btzjygrp
(b) 0110
(c) 1011
(d) 1100
23
7 M1 =
00000001 00000001 00000011 00000011
00000011 00000001 00000001 00000011
8 (c) and (d) are irreducible
RSA
1 (a) 1415
(c) 805121215
(b) 250519
(d) 7151504022505
(b) hill
(c) message
(d) exercise
4 (a) 2
(b) 3
(c) 1
(d) 36
5 (a) 4
(b) 16
(c) 6
(d) 10
(e) 20
6 (a) p(p 1)
(b) pk1 (p 1)
(c) 162
(d) 4000
7 (a) 58
(b) 20
(c) 128
(d) 1160
(b) 19
(c) 9
(d) 19
8 n (n)
9 (a) 8
10 15 and 1, respectively
11 The ciphertext is represented by c1 = 53, c2 = 47, and c3 = 68.
12 doh
13 (a) n = 15, e = 3
(c) n = 253, e = 139
(b) n = 221, e = 11
(d) n = 1 271, e = 667
14 (a) p = 5, q = 11, d = 27
(c) p = 2, q = 13, d = 7
15 (a) The public key is (527, 7) and the private key is (17, 31, 343)
(b) 219, 129, 304
16 Neither e = 32 nor e = 261 is relatively prime to (p 1)(q 1), so the
24
public key must be (n, e) = (4307, 53), while (p, q, d) = (59, 73, 2285) is
the corresponding private key.
17 m = 60
18 No
19 (a) 11 23
(b) 13 31
(c) 5 37
(d) 41 43
(c) 43 47
(b) 7 23
(b) 2, 6, 7, and 8
2 2, 6, and 11
3 (a) 4
(d) 40
(b) 6
(e) 40
(c) 10
(f ) (p 1)
(b) 4
(c) 7
(d) 9
6 14
7 (a) 19
(b) 9
(c) 24
(d) 2
(e) 3
8 a=4
9 (a) (p, , ) = (17, 3, 10); a = 3
(b) (13, 1)
(c) 2
k=3
(47, 36)
k=2
k=4
and
(3, 17)
(48, 33)
respectively.
12 m = 3
13 m2 = 7
14 end
15 bob
25
k=3
(47, 50)
k=4
(3, 40)
Coding Theory
1 (a) 3
(b) 4
(c) 7
(d) 5
2 (a) 3
(b) 4
(c) 7
(d) 5
Minimum
Minimum
Minimum
Minimum
Minimum
distance:
distance:
distance:
distance:
distance:
2;
3;
4;
2;
2;
minimal
minimal
minimal
minimal
minimal
Hamming
Hamming
Hamming
Hamming
Hamming
weight:
weight:
weight:
weight:
weight:
2
2
4
1
3
2, f (001, 110) =
3.
9 (a) Code (a), (d), and (e) can detect all single-bit errors, code (b) can
detect all double-bit errors, and code (c) can detect all triple-bit
errors.
(b) Code (b) and (c) can correct all single-bit errors, while there could
be single-bit errors that neither code (a), (d), nor (e) can correct.
10 (a) 0000, 1000, 0100, 0010, and 0001
(b) 01001, 11001, 00001, 01101, 01011, and 01000
(c) 101, 001, 111, 100, 110, 000, and 011
11 wt(C) = 3, d(C) = 2; the code is not linear.
14 00000, 00110, 01001, 01111, 10011, 10101, 11010, and 11100; the code
can detect all single bit errors but not correct them all.
1 1
0 1
15 H =
1 0 (Note that the rows of H are not all different.)
1 0
0 1
16 (a) Codewords: 000000, 001110, 010011, 011101, 100101, 101011,
110110, and 111000. Minimum distance: 3
(b) 101011 is a codeword; 100110 can be corrected to 110110; 010100
cannot be corrected.
26
0
1
1
1
0
1
1
0
0
1
0
Codeword
Not codeword;
Not codeword;
Not codeword;
Codeword
Not codeword;
is corrected to 1101001
is corrected to 1000011
is corrected to 0110011
is corrected to 1111111
1
G = 0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
1
1
H=
0
0
0
0
1
1
1
1
0
0
0
0
0
1
1
1
1
0
0
0
0
0
1
1
1
1
0
0
0
1
1
28 (a)
(b)
(c)
(d)
0 0 1
G1 = 0 1 1
1 1 0
6
101111, 101100,
m = 110
0
1
0
1
0
1
1
1
1
28