CS 70 Discrete Mathematics for CSSpring 2005 Clancy/Wagner HW 7Due Thursday, March 17Coverage: This assignment involves topics from the lectures of March 1, 8, and 10, and from Rosensection 2.6.Administrative reminders: We will accept only unformatted text files or PDF files for homework sub-mission. Include your name, login name, section number, and partner list in your submission. Give thecommand submit hw7 to submit your solution to this assignment.This is a programming assignment. We advise you to work with a partner. If you haven’t yet switchedpartners, you should do so for this assignment.Assignment: You are to complete a program (either in Scheme or in Java) to generate a public/privatekey pair and encrypt and decrypt messages. In Scheme, this involves completing the functions new-keys,encrypted, and decrypted in the framework file rsa.scm. The analogous task in Java is to completethe methods newKeys, encrypted, and decrypted in the framework file rsa.java.Initialization code in both programs will read or create files in your working directory named private-keyand public-key; each should contain a single line containing two numbers. We will provide the codethat works with these files.Scheme and Java both have built-in support for large integers. Indeed, Java provides in the class java.math.BigIntegerenough support to complete this assignment with hardly any code. Thus, you may not use the followingmethods in java.math.BigInteger:• gcd (BigInteger)• isProbablePrime (int)• modInverse (BigInteger)• modPow• probablePrime (int, Random)You are also forbidden to use any other RSA or bignum library, whether part of Java or external.Framework files will appear online sometime on Friday in the directory cs70/code.The directory cs70/public-keys will contain files named aa, ab, etc.; file xy will contain the publickey for user cs70-xy in the format described above. The framework code for the encrypted func-tion/method will access a specified file in this directory. Each file initially will contain the pair3 5893CS 70, Spring 2005, HW 7 1(the corresponding private key is 3827 5893). These files are writable; we encourage you to update yourfile with more reasonable values for the public key, to allow other students to test their code by sending youmessages.CS 70, Spring 2005, HW 7
View Full Document