Assignment 4

Due Tuesday, July 17, in class

Recommended reading (from Stallings, unless otherwise stated):

  1. (15 points) Write a program that takes two integers a and m as input and outputs their greatest common divisor. If the gcd is one, your program should also output a^{-1} mod m (i.e., a number b such that ab = 1 mod m).

    Notes:

  2. (Due Tuesday, 7/24) (35 points) Write a program that takes a string as input, encrypts it with DES, and writes the key to a file and the ciphertext to a second file. Also write a program that reads the key and ciphertext from the files, decrypts the message, and outputs the correct version.

    Note:

    Problems 3-5 should be submitted in class, July 17, on paper.

  3. (5 points) Stallings, Problem 7.8.
  4. Let f(n) be the sum of phi(d), summing over all divisors d of n. For example, f(6) = phi(1) + phi(2) + phi(3) + phi(6) = 1 + 1 + 2 + 2 = 6. (We define phi(1) = 1.)
    1. (5 points) Compute f(n) for n = 2, 3, ..., 10, and conjecture a formula for f(n) in general.
    2. (15 points extra credit) Prove that your formula works for all n.
  5. (10 points) In class, we discussed the Birthday Attack on a hash. This attack is also discussed on pages 256-257 of Stallings.

    I have written a simple hashing program, called hashme. You can download hashme, or just run it on the UNIX machines by typing ~kutin/hashme. This program hashes a line of text, and returns an integer between 0 and 63.

    Do a birthday attack on this hash, and find two different messages that hash to the same value. Indicate what inputs you tried, and how long it took you to find a collision.


Course home page