Solutions for Chapter 4 - Cryptography and Network Security - Stallings - 4th edition

Review Questions
4.1. Briefly define a group. Get solution

4.2. Briefly define a ring. Get solution

4.3. Briefly define a field. Get solution

4.4. What does it mean to say that b is a divisor of a? Get solution

4.5. What is the difference between modular arithmetic and ordinary arithmetic? Get solution

4.6. List three classes of polynomial arithmetic. Get solution


Problems
4.1 For the group Sn of all permutations of n distinct symbols,
a. What is the number of elements in Sn?
b. Show that Sn is not abelian for n > 2. Get solution

4.2 Does the set of residue classes modulo 3 form a group
a. with respect to addition?
b. with respect to multiplication? Get solution

4.3 Consider the set S = {a, b} with addition and multiplication defined by the tables:

 Is S a ring? Justify your answer. Get solution


4.4 Reformulate Equation (4.1), removing the restriction that a is a nonnegative integer. That is, let a be any integer. Get solution

4.5 Draw a figure similar to Figure 4.2 for a < 0. Get solution


4.6 Find integers x such that
a. 5x 4 (mod 3)
b. 7x 6 (mod 5)
c. 9x 8 (mod 7) Get solution

4.7 In this text we assume that the modulus is a positive integer. But the definition of the expression a mod n also
makes perfect sense if n is negative. Determine the following:
a. 5 mod 3
b. 5 mod 3
c. 5 mod 3
d. 5 mod 3 Get solution

4.8 A modulus of 0 does not fit the definition, but is defined by convention as follows: a mod 0 = a. With this definition in mind, what does the following expression mean: a b (mod 0)? Get solution

4.9 In Section 4.2, we define the congruence relationship as follows: Two integers a and b are said to be congruent modulo n, if (a mod n) = (b mod n). We then proved that a b (mod n) if n|(a b). Some texts on number theory use this latter relationship as the definition of congruence: Two integers a and b are said to be congruent modulo n, if n|(a b). Using this latter definition as the starting point, prove that if a( mod n) = (b mod n), then n divides (a b). Get solution

4.10 What is the smallest positive integer that has exactly k divisors, for 1 k 6? Get solution

4.11 Prove the following:
a. a b (mod n) implies b a (mod n)
b. a b (mod n) and b c (mod n) imply a c (mod n) Get solution

4.12 Prove the following:
a. [(a mod n) (b mod n)] mod n = (a b) mod n
b. [(a mod n) x (b mod n)] mod n = (a x b) mod n Get solution


4.13 Find the multiplicative inverse of each nonzero element in Z5. Get solution

4.14 Show that an integer N is congruent modulo 9 to the sum of its decimal digits. For example, 475 4 + 7 + 5
16 1 + 6 7 (mod 9). This is the basis for the familiar procedure of "casting out 9's" when
checking computations in arithmetic. Get solution

4.15
a. Determine gcd(24140, 16762).
b. Determine gcd(4655, 12075). Get solution

4.16 The purpose of this problem is to set an upper bound on the number of iterations of the Euclidean algorithm. 

a. Suppose that m = qn + r with q > 0 and 0 <= r < n. Show that m/2 > r.
b. Let At be the value of A in the Euclidean algorithm after the ith iteration. Show that
Show that if m, n, and N are integers with with 1 <=m, n, <=2N, then the Euclidean algorithm takes
at most 2N steps to find gcd(m, n). Get solution

4.17 The Euclidean algorithm has been known for over 2000 years and has always been a favorite among number theorists. After these many years, there is now a potential competitor, invented by J. Stein in 1961. Stein's
algorithms is as follows. Determine gcd(A, B) with A, B >= 1.
STEP 1 Set A1 = A, B1 = B, C1 = 1
STEP n
1. If An = Bn stop. gcd(A, B) = AnCn
2. If An and Bn are both even, setA n+1 = An/2, Bn+1 = Bn/2, Cn+1 = 2Cn
3. If An is even and Bn is odd, set An+1 = An/2, Bn+1 = Bn, Cn+1 = Cn
4. If An is odd and Bn is even, set An+1 = An, Bn+1 = Bn/2, Cn+1 = Cn
5. If An and Bn are both odd, setA n+1 = |An Bn|, Bn + 1 = min(Bn, An), Cn+1 = Cn
Continue to step n + 1.
To get a feel for the two algorithms, compute gcd(2152, 764) using both the Euclidean and
Stein's algorithm.
a. To get a feel for the two algorithms, compute gcd(2152, 764) using both the Euclidean and
Stein's algorithm.
b. What is the apparent advantage of Stein's algorithm over the Euclidean algorithm? Get solution


4.18 Show that if Stein's algorithm does not stop before the nth step, then
Cn+1 x gcd(An+1, Bn+1) = Cn x gcd(An, Bn)
a. Show that if Stein's algorithm does not stop before the nth step, then
Cn+1 x gcd(An+1, Bn+1) = Cn x gcd(An, Bn)
b. Show that if the algorithm does not stop before step (n 1), then
c. Show that if 1 <=A, B<= 2N , then Stein's algorithm takes at most 4N steps to find gcd(m, n).

Thus, Stein's algorithm works in roughly the same number of steps as the Euclidean algorithm.
d. Demonstrate that Stein's algorithm does indeed return gcd(A, B). Get solution

4.19 Using the extended Euclidean algorithm, find the multiplicative inverse of
a. 1234 mod 4321
b. 24140 mod 40902
c. 550 mod 1769 Get solution

4.20 Develop a set of tables similar to Table 4.3 for GF(5). Get solution

4.21 Demonstrate that the set of polynomials whose coefficients form a field is a ring. Get solution

4.22 Demonstrate whether each of these statements is true or false for polynomials over a field:
a. The product of monic polynomials is monic.
b. The product of polynomials of degrees m and n has degree m + n
c. The sum of polynomials of degrees m and n has degree max[m, n]. Get solution

4.23 For polynomial arithmetic with coefficients in Z10, perform the following calculations:
a. (7x + 2) (x2 + 5)
b. (6x2+ x + 3) x (5x2 + 2) Get solution

4.24 Determine which of the following are reducible over GF(2):
a. x3 + 1
b. x3+ x2 + 1
c. x4 + 1 (be careful) Get solution

4.25 Determine the gcd of the following pairs of polynomials:
a. x3+ x + 1 and x2 + x + 1 over GF(2)
b. x3x + 1 and x. + 1 over GF(3)
c. x5+ x4+ x3x2x + 1 and x3+ x2 + x + 1 over GF(3)
d. x5+ 88x4+ 73x3+ 83x2+ 51x + 67 and x3+ 97x2 Get solution

4.26 Develop a set of tables similar to Table 4.6 for GF(4) with m(x) = x4+ x + 1. Get solution

4.27 Determine the multiplicative inverse of x3+ x + 1 in GF(24), with m(x) = x4+ x + 1. Get solution


4.28 Develop a table similar to Table 4.8 for GF(24) with m(x) = x4+ x + 1. Get solution

Solutions for Chapter 3 - Cryptography and Network Security - Stallings - 4th edition

Review Questions
3.1 Why is it important to study the Feistel cipher? Get solution

3.2 What is the difference between a block cipher and a stream cipher?  Get solution

3.3 Why is it not practical to use an arbitrary reversible substitution cipher of the kind shown in Table 3.1? Get solution

3.4 What is a product cipher? Get solution

3.5 What is the difference between diffusion and confusion? Get solution

3.6 Which parameters and design choices determine the actual algorithm of a Feistel cipher? Get solution

3.7 What is the purpose of the S-boxes in DES? Get solution

3.8 Explain the avalanche effect. Get solution

3.9 What is the difference between differential and linear cryptanalysis? Get solution

Problems
3.1 In Section 3.1, under the subsection on the motivation for the Feistel cipher structure, it was
stated that, for a block of n bits, the number of different reversible mappings for the ideal block
cipher is 2n!. Justify.
a. In that same discussion, it was stated that for the ideal block cipher, which allows all possible
reversible mappings, the size of the key is n x 2 n bits. But, if there are 2 n! possible mappings, it
should take log2 2 n! bits to discriminate among the different mappings, and so the key length
should be log2 2 n!. However, log2 2n! <n x 2n. Explain the discrepancy.
b. In that same discussion, it was stated that for the ideal block cipher, which allows all possible
reversible mappings, the size of the key is n x 2n bits. But, if there are 2n! possible mappings, it
should take log2 2n! bits to discriminate among the different mappings, and so the key length
should be log2 2n!. However, log2 2n! <n x 2n. Explain the discrepancy. Get solution


3.2 Consider a Feistel cipher composed of 16 rounds with block length 128 bits and key length 128 bits. Suppose that, for a given k, the key scheduling algorithm determines values for the first 8 round keysk, 1, k2, ..., k8, and then sets k9 = k8, k10 = k7, k11 = k6, ..., k16 = k1
Suppose you have a ciphertext c. Explain how, with access to an encryption oracle, you can decrypt c and determine m using just a single oracle query. This shows that such a cipher is vulnerable to a chosen plaintext attack. (An encryption oracle can be thought of as a device that, when given a plaintext, returns the corresponding ciphertext. The internal details of the device are not known to you and you cannot break open the device. You can only gain information from the oracle by making queries to it and observing its responses.) Get solution


3.3 Consider a block encryption algorithm that encrypts blocks of length n, and let N = 2
n . Say we have t plaintext-ciphertext pairs Pi, Ct = E(K, Pi), where we assume that the key K selects one of the N! possible mappings. Imagine that we wish to find K by exhaustive search. We could generate key K' and test whether C = E(K', Pi) for 1 t. If K'
encrypts each Pi to its proper Ci then we have evidence that K = K'. However,
it may be the case that the mappings E(K, ·) and E(K', ·) exactly agree on the t plaintext-ciphertext pairs Pi, Ci and agree on no other pairs.
a. What is the probability that E(K, ·) and E(K', ·) are in fact distinct mappings?
What is the probability that E(K, ·) and E(K', ·) agree on another t' plaintext-ciphertext pairs where 0
t' N - t? Get solution

3.4 Let p be a permutation of the integers 0, 1, 2, ... (2n- 1) such that p(m) gives the permuted value of m, 0 m <= 2n. Put another way, p maps the set of n-bit integers into itself and no two integers map into the sameinteger. DES is such a permutation for 64-bit integers. We say that p has a fixed point at m if p(m) = m. Thatis, if p is an encryption mapping, then a fixed point corresponds to a message that encrypts to itself. We areinterested in the probability that p has no fixed points. Show the somewhat unexpected result that over 60% of mappings will have at least one fixed point. Get solution

3.5 Consider the substitution defined by row 1 of S-box S1 in Table 3.3. Show a block diagram similar to Figure 3.1 that corresponds to this substitution. Get solution

3.6 Compute the bits number 1, 16, 33, and 48 at the output of the first round of the DES decryption, assuming that the ciphertext block is composed of all ones and the external key is composed of all ones. Get solution

3.7 Suppose the DES F function mapped every 32-bit input R, regardless of the value of the input K, to
a. 32-bit string of ones,
b. bitwise complement of R.
Hint: Use the following properties of the XOR operation:
1. What function would DES then compute?
What would the decryption look like?



where
A, B, C are n-bit strings of bits
0 is an n-bit string of zeros
1 is an n-bit string of one Get solution

3.8 This problem provides a numerical example of encryption using a one-round version of DES. We start with
the same bit pattern for the key K and the plaintext, namely:
in hexadecimal notation: 0 1 2 3 4 5 6 7 8 9 A B C D E F
in binary notation: 0000 0001 0010 0011 0100 0101 0110 0111
1000 1001 1010 1011 0100 1101 1110 1111
a. Derive K1, the first-round subkey.
b. Derive L0, R0.
c. Expand R0 to get E[R0], where E[·] is the expansion function of Figure 3.8.
d. Calculate A = E[R0] K1.
Group the 48-bit result of (d) into sets of 6 bits and evaluate the corresponding S-box
substitutions.
e. Group the 48-bit result of (d) into sets of 6 bits and evaluate the corresponding S-box
substitutions.
f. Concatenate the results of (e) to get a 32-bit result, B.
g. Apply the permutation to get P(B).
h. Calculate R1 = P(B) L0.
i. Write down the ciphertext. Get solution


3.9 Show that DES decryption is, in fact, the inverse of DES encryption. Get solution


3.10 The 32-bit swap after the sixteenth iteration of the DES algorithm is needed to make the encryption process invertible by simply running the ciphertext back through the algorithm with the key order reversed. This was demonstrated in Problem 3.7. However, it still may not be entirely clear why the 32-bit swap is needed. To demonstrate why, solve the following exercises. First, some notation:
A||B = the concatenation of the bit strings A and B
Ti(R||L) = the transformation defined by the ith iteration of the encryption algorithm, for 1 ≠  I ≠16
TDi(R||L) = the transformation defined by the ith iteration of the decryption algorithm, for 1 ≠  I ≠16
T17(R||L) = L||R. This transformation occurs after the sixteenth iteration of the encryption
algorithm.


a. Now suppose that we did away with the final 32-bit swap in the encryption algorithm. Then we
would want the following equality to hold:
TD1(IP(IP-1(T16(L15||R15))))) = R15||L15
Does it?
b.Now suppose that we did away with the final 32-bit swap in the encryption algorithm. Then we
would want the following equality to hold:
TD1(IP(IP-1(T16(L15||R15))))) = R15||L15
Does it? Get solution

3.11 Compare the initial permutation table (Table 3.2a) with the permuted choice one table (Table 3.4b). Are the structures similar? If so, describe the similarities. What conclusions can you draw from this analysis? Get solution


3.12 When using the DES algorithm for decryption, the 16 keys (K1, K2, ..., K16) are used in reverse order. Therefore, the right-hand side of Figure 3.5 is no longer valid. Design a key-generation scheme with the appropriate shift schedule (analogous to Table 3.4d) for the decryption process.  Get solution


3.13Let X' be the bitwise complement of X. Prove that if the complement of the plaintext block is takenand the complement of an encryption key is taken, then the result of DES encryption with these
values is the complement of the original ciphertext. That is,
If Y = E(K, X)

Then Y' = E(K', X')
Hint: Begin by showing that for any two bit strings of equal lengthA, and B, (A B)' = A x B.
It has been said that a brute-force attack on DES requires searching a key space of 256 keys. Does the result of part (a) change that?
b. It has been said that a brute-force attack on DES requires searching a key space of 2 56 keys. Does the result of part (a) change that? Get solution


3.14 Show that in DES the first 24 bits of each subkey come from the same subset of 28 bits of the initial key and that the second 24 bits of each subkey come from a disjoint subset of 28 bits of the initial key. Get solution


3.15 For any block cipher, the fact that it is a nonlinear function is crucial to its security. To see this, suppose that we have a linear block cipher EL that encrypts 128-bit blocks of plaintext into 128-bit blocks of ciphertext. Let EL(k, m) denote the encryption of a 128-bit message m under a key k (the actual bit length of k is irrelevant).
Thus EL(k, [m1 m2]) = EL(k, m1) EL(k, m1) for all 128-bit patterns m1, m2

Describe how, with 128 chosen ciphertexts, an adversary can decrypt any ciphertext without knowledge of the secret key k. (A "chosen ciphertext" means that an adversary has the ability to choose a ciphertext and then obtain its decryption. Here, you have 128 plaintext/ciphertext pairs to work with and you have the ability to chose the value of the ciphertexts.)
Note: The following problems refer to simplified DES, described in Appendix C. Get solution


3.16 Refer to Figure C.2, which depicts key generation for S-DES.
a. How important is the initial P10 permutation function?
b. How important are the two LS-1 shift functions? Get solution


3.17 The equations for the variables q and r for S-DES are defined in the section on S-DES analysis. Provide the equations for s and t. Get solution

3.18 Using S-DES, decrypt the string (10100010) using the key (0111111101) by hand. Show intermediate results after each function (IP, Fk, SW, Fk, IP -1). Then decode the first 4 bits of the plaintext string to a letter and thesecond 4 bits to another letter where we encode A through P in base 2 (i.e., A = 0000, B = 0001,..., P =1111).
Hint: As a midway check, after the application of SW, the string should be (00010011).
Solution: OK




Solutions for Chapter 2 - Cryptography and Network Security - Stallings - 4th edition

Review Questions
2.1 What are the essential ingredients of a symmetric cipher? Get solution

2.2 What are the two basic functions used in encryption algorithms? Get solution

2.3 How many keys are required for two people to communicate via a cipher? Get solution

2.4 What is the difference between a block cipher and a stream cipher? Get solution

2.5 What are the two general approaches to attacking a cipher? Get solution

2.6 List and briefly define types of cryptanalytic attacks based on what is known to the attacker. Get solution

2.7 What is the difference between an unconditionally secure cipher and a computationally secure cipher? Get solution

2.8 Briefly define the Caesar cipher. Get solution

2.9 Briefly define the monoalphabetic cipher. Get solution

2.10 Briefly define the Playfair cipher. Get solution

2.11 What is the difference between a monoalphabetic cipher and a polyalphabetic cipher? Get solution

2.12 What are two problems with the one-time pad? Get solution

2.13 What is a transposition cipher? Get solution

Problems
2.1 A generalization of the Caesar cipher, knows as the affine Caesar cipher, has the following form: For each plaintext letter p, substitute the ciphertext letter C:
C = E([a, b], p) = (ap + b) mod 26

A basic requirement of any encryption algorithm is that it be one-to-one. That is, if p q, then E(k, p) ≠  E(k, q). Otherwise, decryption is impossible, because more than one plaintext character maps into the same ciphertext character. The affine Caesar cipher is not one-to-one for all values of a. For example, for a = 2 and b = 3, then E([a, b], 0) = E([a, b], 13) = 3.
a. Are there any limitations on the value ofb ? Explain why or why not.
b. Determine which values of a are not allowed.
c. Provide a general statement of which values of a are and are not allowed. Justify your statement. Get solution


2.2 How many one-to-one affine Caesar ciphers are there? Get solution

2.3 A ciphertext has been generated with an affine cipher. The most frequent letter of the ciphertext is 'B', and the second most frequent letter of the ciphertext is 'U'. Break this code. Get solution

2.4 The following ciphertext was generated using a simple substitution algorithm:
53 305))6*;4826)4 .)4 );806*;48 8¶60))85;;]8*;: *8 83
(88)5* ;46(;88*96*?;8)* (;485);5* 2:* (;4956*2(5*-4)88*
;4069285);)6 8)4 [ddagger];1( 9;48081;8:8 1;48 85;4)485 528806*81
( 9;48;(88;4( ?34;48)4 ;161;:188; ?;
Decrypt this message. Hints:
As you know, the most frequently occurring letter in English is e. Therefore, the first or second (or
perhaps third?) most common character in the message is likely to stand for e. Also, e is often
seen in pairs (e.g., meet, fleet, speed, seen, been, agree, etc.). Try to find a character in the
ciphertext that decodes to e.
1. As you know, the most frequently occurring letter in English is e. Therefore, the first or second (or
perhaps third?) most common character in the message is likely to stand for e. Also, e is often
seen in pairs (e.g., meet, fleet, speed, seen, been, agree, etc.). Try to find a character in the
ciphertext that decodes to e.
2. The most common word in English is "the." Use this fact to guess the characters that stand for t
and h.
3. Decipher the rest of the message by deducing additional words.
Warning: The resulting message is in English but may not make much sense on a first reading. Get solution


2.5 One way to solve the key distribution problem is to use a line from a book that both the sender and the receiver possess. Typically, at least in spy novels, the first sentence of a book serves as the key. The particular scheme discussed in this problem is from one of the best suspense novels involving secret codes, Talking to Strange Men, by Ruth Rendell. Work this problem without consulting that book!
Consider the following message:
SIDKHKDM AF HCRKIABIE SHIMC KD LFEAILA
This ciphertext was produced using the first sentence of The Other Side of Silence (a book about the spy Kim Philby):
The snow lay thick on the steps and the snowflakes driven by the wind looked black in the headlights of the cars.
A simple substitution cipher was used.
a. What is the encryption algorithm?
b. How secure is it?
To make the key distribution problem simple, both parties can agree to use the first or last
sentence of a book as the key. To change the key, they simply need to agree on a new book. The
use of the first sentence would be preferable to the use of the last. Why?
c. To make the key distribution problem simple, both parties can agree to use the first or last
sentence of a book as the key. To change the key, they simply need to agree on a new book. The
use of the first sentence would be preferable to the use of the last. Why? Get solution

2.6 In one of his cases, Sherlock Holmes was confronted with the following message.
534 C2 13 127 36 31 4 17 21 41
DOUGLAS 109 293 5 37 BIRLSTONE
26 BIRLSTONE 9 127 171
Although Watson was puzzled, Holmes was able immediately to deduce the type of cipher. Can you? Get solution

2.7 This problem uses a real-world example, from an old U.S. Special Forces manual (public domain). A copy is available at ftp://shell.shore.net/members/w/s/ws/Support/Crypto/FM-31-4.pdf
Using the two keys (memory words) cryptographic and network security, encrypt the following
message: Be at the third pillar from the left outside the lyceum theatre tonight at seven. If you are distrustful bring two friends.
Make reasonable assumptions about how to treat redundant letters and excess letters in the
memory words and how to treat spaces and punctuation. Indicate what your assumptions are.
Note: The message is from the Sherlock Holmes novel, The Sign of Four.
b. Decrypt the ciphertext. Show your work.
c. Comment on when it would be appropriate to use this technique and what its advantages are. Get solution


2.8 A disadvantage of the general monoalphabetic cipher is that both sender and receiver must commit the
permuted cipher sequence to memory. A common technique for avoiding this is to use a keyword from which the cipher sequence can be generated. For example, using the keyword CIPHER, write out the keyword followed by unused letters in normal order and match this against the plaintext letters:
plain: a b c d e f g h i j k l m n o p q r s t u v w x y z
cipher: C I P H E R A B D F G J K L M N O Q S T U V W X Y Z
If it is felt that this process does not produce sufficient mixing, write the remaining letters on successive lines and then generate the sequence by reading down the columns:
C I P H E R
A B D F G J
K L M N O Q
S T U V W X
Y Z
This yields the sequence
C A K S Y I B L T Z P D M U H F N V E G O W R J Q X

Such a system is used in the example in Section 2.2 (the one that begins "it was disclosed yesterday"). Determine the keyword. Get solution


2.9 When the PT-109 American patrol boat, under the command of Lieutenant John F. Kennedy, was sunk by a Japanese destroyer, a message was received at an Australian wireless station in Playfair code:
KXJEY UREBE ZWEHE WRYTU HEYFS
KREHE GOYFI WTTTU OLKSY CAJPO
BOTEI ZONTX BYBNT GONEY CUZWR
GDSON SXBOU YWRHE BAAHY USEDQ
The key used was royal new zealand navy. Decrypt the message. Translate TT into tt. Get solution


2.10
a. Construct a Playfair matrix with the keyl argest.
Construct a Playfair matrix with the key occurrence. Make a reasonable assumption about how to
treat redundant letters in the key.  Get solution


2.11 Using this Playfair matrix
M F H I/J K
U N O P Q
Z V W X Y
E L A R G
D S T B C

encrypt this message:
Must see you over Cadogan West. Coming at once.
Note: The message is from the Sherlock Holmes story, The Adventure of the Bruce-Partington
Plans.
a. Using this Playfair matrix







 encrypt this message:
Must see you over Cadogan West. Coming at once.
Note: The message is from the Sherlock Holmes story, The Adventure of the Bruce-Partington
Plans.

b. Repeat part (a) using the Playfair matrix from Problem 2.10a.
c. How do you account for the results of this problem? Can you generalize your conclusion? Get solution


2.12 How many possible keys does the Playfair cipher have? Ignore the fact that some keys might
produce identical encryption results. Express your answer as an approximate power of 2.
a. Now take into account the fact that some Playfair keys produce the same encryption results. How
many effectively unique keys does the Playfair cipher have?
b. Repeat part (a) using the Playfair matrix from Problem 2.10a. Get solution


2.13 What substitution system results when we use a 25 x 1 Playfair matrix? Get solution


2.14 Decipher the message YITJP GWJOW FAQTQ XCSMA ETSQU SQAPU SQGKC PQTYJ using the Hill cipher with the inverse key . Show your calculations and the result.
a. Decipher the message MWALO LIAIW WTGBH JNTAK QZJKA ADAWS SKQKU AYARN
CSODN IIAES OQKJY B using the Hill cipher with the inverse key (5 1
                                                                                                                 2 7) .
Show your calculations and the result.
b. Decipher the message MWALO LIAIW WTGBH JNTAK QZJKA ADAWS SKQKU AYARN CSODN IIAES OQKJY B using the Hill cipher with the inverse key (2  23
                                                                                                                21  7 )
Show your calculations and the result. Get solution



2.15 Encrypt the message "meet me at the usual place at ten rather than eight oclock" using the Hill
cipher with the key (9   4
                                 5  7)


 Show your calculations and the result.

b. Show your calculations and the result. Get solution



2.17 It can be shown that the Hill cipher with the matrix (a  b
                                                                                          c  d)
requires that (ad bc) is relatively prime to 26; that is the only common positive factor of (ad bc) and 26 is 1. Thus, if (ad bc) = 13 or is even, the matrix is not allowed. Determine the number of different (good) keys there are for a 2 x 2 Hill cipher without counting them one by one, using the following steps:


a. Find the number of matrices whose determinant is even because one or both columns are even.
(A column is "even" if both entries in the column are even.)
b. Find the number of matrices whose determinant is even because one or both columns are even.
(A column is "even" if both entries in the column are even.)
c. Find the number of matrices whose determinant is even because all of the entries are odd.
d. Taking into account overlaps, find the total number of matrices whose determinant is even.
Find the number of matrices whose determinant is a multiple of 13 because the first column is a
multiple of 13.
e. Find the number of matrices whose determinant is a multiple of 13 where the first column is not a
multiple of 13 but the second column is a multiple of the first modulo 13.
f. Find the number of matrices whose determinant is a multiple of 13 where the first column is not a
multiple of 13 but the second column is a multiple of the first modulo 13.
g. Find the total number of matrices whose determinant is a multiple of 13.
h. Find the number of matrices whose determinant is a multiple of 26 because they fit case (a) and
(e). (b) and (e). (c) and (e). (a) and (f). And so on ...
i. Find the total number of matrices whose determinant is neither a multiple of 2 nor a multiple of 13. Get solution


2.18 Using the Vigenère cipher, encrypt the word "explanation" using the keyleg. Get solution

2.19 This problem explores the use of a one-time pad version of the Vigenère cipher. In this scheme, the key is a stream of random numbers between 0 and 26. For example, if the key is 3 19 5 ..., then the first letter of plaintext is encrypted with a shift of 3 letters, the second with a shift of 19 letters, the third with a shift of 5 letters, and so on.
a. Encrypt the plaintext sendmoremoney with the key stream 9 0 1 7 23 15 21 14 11 11 2 8 9.
b. Using the ciphertext produced in part a, find a key so that the cipher text decrypts to the plaintext. Get solution

2.20 What is the message embedded in Figure 2.8? Get solution


2.21 In one of Dorothy Sayers's mysteries, Lord Peter is confronted with the message shown in Figure 2.9. He also discovers the key to the message, which is a sequence of integers:
787656543432112343456567878878765654
3432112343456567878878765654433211234
a. Decrypt the message. Hint: What is the largest integer value?
b. If the algorithm is known but not the key, how secure is the scheme?
c. If the key is known but not the algorithm, how secure is the scheme?




Solutions for Chapter 1 - Cryptography and Network Security - Stallings - 4th edition

Review Questions
1.1 What is the OSI security architecture? Get solution

1.2 What is the difference between passive and active security threats? Get solution

1.3 List and briefly define categories of passive and active security attacks. Get solution

1.4 List and briefly define categories of security services. Get solution

1.5 List and briefly define categories of security mechanisms. Get solution

Problems
1.1 Draw a matrix similar to Table 1.4 that shows the relationship between security services and attacks. Get solution

1.2 Draw a matrix similar to Table 1.4 that shows the relationship between security mechanisms and attacks. Get solution