CX 103 : Introduction to Computers

Assignment 17

Due: Monday, April 2

Reading

Read Chapter 7 "American Pie" in Freiberger and Swaine, Fire in the Valley: The Making of the Personal Computer.

Begin reading Chapter 11: "JavaScript/JScript: Functions" in Deitel, Deitel & Nieto, Internet & World Wide Web: How to Program.

Paper and Pencil Exercises

1) Discuss how you would modify our MiddFee program so that it prompts users to input the annual percentage increase in Middlebury's Comprehensive Fee and the number of years in the future they wish to see the projected fee.

2) Discuss how you would modify our JavaScript program which sums all the even integers from 2 to 200 to produce a program which sums all the even integers from 2 to N where N is a positive integer obtained by a prompt from the user.

3) Information that is transmitted from one computer to another over the Internet passes through many insecure channels, places where the message can be intercepted, read or copied. Your credit card number which you sent to Amazon.com from the computer in our dorm room could easily be nabbed while it passes through an intermediate computer in, for example, Kansas or Afghanistan. To insure privacy and security of information transmitted over the Internet, people have developed methods of encrypting the data so that only the sender and receiver can make sense of the message. What a third party sees appears to be gibberish.

In this exercise, we look at one method of encryption. A message is first broken up into pairs of consecutive characters Each pair is converted to a four digit number by using the ASCII values of the characters; for example, BY is converted to 6689 because the ASCII value for B is 66 and the ASCII value for Y is 89.

Then we add 7 mod 10 to each digit. This is done by adding 7 to the digit and taking the remainder on dividing by 10: e.g., the sum of 6 and 7 is 3. . In our example, the result of adding 7 (mod 10) to each digit of 6689 is 3356.

Finally, we swap the first and fourth digit and the second and third digit. In our example, this will produce 6533, the encrypted form of BY

(a) Show that GO is encrypted as 6484

(b) Encrypt your initials.

(c) Decrypt 2314 2335

(d) Do you think this method provides a secure encryption scheme? Explain.

(e) Develop a detailed algorithm, one you would be able to translate into JavaScript, which does the conversion from the original version of the four digit number to the encrypted version.