303
Exercises
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
Decrypt the following message, which was encrypted with a Vigenere
cipher using the pattern CAB (repeated as necessary) for the key (on a
27-letter alphabet, with blank preceding A): DOBHBUAASXFZWJQQ
What table should be used to decrypt messages that have been encrypted
using the table substitution method?
Suppose that a Vigenere cipher with a two-character key is used to encrypt
a relatively long message. Write a program to infer the key, based on the
assumption that the frequency of occurrence of each character in odd
positions should be roughly equal to the frequency of occurrence of each
character in the even positions.
Write matching encryption and decryption procedures which use the
“exclusive or” operation between a binary version of the message with
a binary stream from one of the linear congruential random number
generators of Chapter 3.
Write a program to “break” the method given in the previous exercise,
assuming that the first 10 characters of the message are known to be
blanks.
Could one encrypt plaintext by “and”ing it (bit by bit) with the key?
Explain why or why not.
True or false: Public-key cryptography makes it convenient to send the
same message to several different users. Discuss your answer.
What is P(S(M)) for the RSA method for public-key cryptography?
RSA encoding might involve computing Mn, where M might be a k digit
number, represented in an array of k integers, say. About how many
operations would be required for this computation?
Implement encryption/decryption procedures for the RSA method (as-
sume that s, p and N are all given and represented in arrays of integers
of size 25).
304
SOURCES for String Processing
The best references for further information on many of the algorithms in
this section are the original sources. Knuth, Morris, and Pratt’s 1977 paper
and Boyer and Moore’s 1977 paper form the basis for much of the material
from Chapter 19. The 1968 paper by Thompson is the basis for the regular-
expression pattern matcher of Chapters 20-21. Huffman’s 1952 paper, though
it predates many of the algorithmic considerations here, still makes interesting
reading. Rivest, Shamir, and Adleman describe fully the implementation and
applications of their public-key cryptosystem in their 1978 paper.
The book by Standish is a good general reference for many of the topics
covered in these chapters, especially Chapters 19, 22, and 23. Parsing and
compiling are viewed by many to be the heart of computer science, and there
are a large number of standard references available, for example the book
by
Aho
and Ullman. An extensive amount of background information on
cryptography may be found in the book by Kahn.
A. V.
Aho
and J. D. Ullman, Principles of Compiler Design, Addison-Wesley,
Reading, MA, 1977.
R. S. Boyer and J. S. Moore, “A fast string searching algorithm,” Communica-
tions of the ACM, 20, 10 (October, 1977).
D. A. Huffman, “A method for the construction of minimum-redundancy
codes,”
Proceedings
of the IRE,
40
(1952).
D. Kahn, The Codebreakers, Macmillan, New York, 1967.
D. E. Knuth, J. H. Morris, and V. R. Pratt, “Fast pattern matching in strings,”
SIAM Journal on Computing, 6, 2 (June, 1977).
R. L. Rivest, A. Shamir and L. Adleman,
“A method for obtaining digital
signatures and public-key cryptosystems,” Communications of the ACM, 21,
2 (February, 1978).
T. A. Standish, Data Structure Techniques, Addison-Wesley, Reading, MA,
1980.
K. Thompson, “Regular expression search algorithm,” Communications of the
ACM,
11,
6 (June, 1968).
GEOMETRIC ALGORITHMS
. applications and
give rise to an interesting set of problems and algorithms.
Geometric algorithms are important in design and analysis systems for
physical. mathematicians has useful application in the development of algorithms
for modern computers. The field of geometric algorithms is interesting to
study because there