Assignment 1 Solution

$30.00 $24.90


Problem 1

An affine cipher is a type of simple substitution where each letter is encrypted according to the following rule c = (a p + b) mod

26. Here, p, c, a, and b are each numbers in the range of 0 to 25, where p represents the plaintext letter, c the ciphertext letter, and a and b are constants. For the plaintext and ciphertext, 0 corresponds to “a,” 1 corresponds to “b,” and so on. Consider the ciphertext QJKES REOGH GXXRE OXEO, which was generated using an affine cipher. Determine the constants a and b and decipher the message. Hint: Plaintext “t” encrypts to ciphertext “H” and plaintext “o” encrypts to ciphertext “E.”

Problem 2

Consider a Feistel cipher with four rounds. Then the plaintext is denoted as P = (L0 , R0) and the corresponding ciphertext is C = (L4, R4) . What is the ciphertext C, in terms of L0, R0, and the subkey, for each of the following round functions? (You should get the most concise solution.)

  • A. F(Ri-1, Ki) = 0

  • B. F(Ri-1, Ki) = Ri-1

  • C. F(Ri-1, Ki) = Ki

  • D. F(Ri-1, Ki) = Ri-1 Å Ki

(Note that for each of cases A – D, the cipher uses four rounds.)

Problem 3

Suppose that we use a block cipher to encrypt according to the rule :

C0=IVÅE(P0, K),

C1=C0ÅE(P1, K),

C2=C1ÅE(P2, K),

  • a. What is the corresponding decryption rule?

  • b. Give two security disadvantages of this mode as compared to CBC mode.

Read the paper (particularly Section 1, 2 and Appendix)

about Ron Rivest’s RC6 (version 1.1), which can be

downloaded from:

Implement the RC6-w/r/b, where w = 32, and r = 20. So you

can use the test vectors on page 20 to debug your program.

The input of your program should be the user key and either

plaintext (for encryption) or ciphertext (for decryption). The

output of your program should be the ciphertext (for

decryption) or plaintext (for encryption). Use a README

file to explain how the program should be executed. It’s OK

to discuss with your classmates about the details of the

paper, but you should finish programming by yourself.

Submission guidelines

Please hand in your source code and a Makefile electronically (please do not submit .o or executable code). You must make sure that your code compiles and runs correctly on a Linux machine.

Write a README file (text file, do not submit a .doc file) which contains

  • Your name and email address

  • Whether your code was tested on bingsuns.

  • Your program runs as follows: “./run ./input.txt ./output.txt”, where input.txt is the input file, and output.txt is the output file. The format of input.txt and output.txt is shown on the next slides.

  • Briefly describe your algorithm or anything special about your submission that the TA should take note of.

Place all your files under one directory with a unique name (such as p1-[userid] for assignment 1, e.g., p1-ghyan).

Tar the contents of this directory using the following command: tar –cvf [directory_name].tar [directory_name] E.g., tar -cvf p1-ghyan.tar p1-ghyan/ Use the Blackboard to upload the tared file you created above.