Random monoalphabet cipher Solution
TopsolutionsExercise P9.2. Random monoalphabet cipher. The Caesar cipher, which shifts all let-
ters by a fixed amount, is far too easy to crack. Here is a better idea. As the key,
don’t use numbers but words. Suppose the key word is FEATHER. Then first remove
duplicate letters, yielding FEATHR, and append the other letters of the alphabet in
reverse order:
F E A T H R Z Y X W V U S Q P O N M L K J I G D C B
Now encrypt the letters as follows:
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
F E A T H R Z Y X W V U S Q P O N M L K J I G D C B
Write a program that encrypts or decrypts a file using this cipher. For example, crypt -d -kFEATHER encrypt.txt output.txt
decrypts a file using the keyword FEATHER. It is an error not to supply a keyword.
Exercise P9.7. The program in Section 9.6 only locates one record and updates the salary. Write a program that raises or lowers the salaries of all employees by a given percentage.
- 10 years ago
Purchase the answer to view it
- answer.zip