(Enforcing Privacy with Cryptography) The explosive growth of Internet communications and data storage on Internet-connected computers has greatly increased privacy concerns. The field of cryptography is concerned with coding data to make it difficult (and hopefully—with the most advanced schemes—impossible) for unauthorized users to read. In this exercise you’ll investigate a simple scheme for encrypting and decrypting data. A company that wants to send data over the In- ternet has asked you to write a program that will encrypt it so that it may be transmitted more se- curely. All the data is transmitted as four-digit integers. Your application should read a four-digit integer entered by the user and encrypt it as follows: Replace each digit with the result of adding 7 to the digit and

What will be an ideal response?


```
// Encrypt a number.
#include
using namespace std;

int main()
{
int number; // original number

// enter four-digit number to be encrypted
cout << "Enter a four-digit number: ";
cin >> number;

// encrypt (digit numbers are counted from left)
int digit1 = ( number / 1000 + 7 ) % 10;
int digit2 = ( number % 1000 / 100 + 7 ) % 10;
int digit3 = ( number % 100 / 10 + 7 ) % 10;
int digit4 = ( number % 10 + 7 ) % 10;

int encryptedNumber =
digit1 * 10 + digit2 + digit3 * 1000 + digit4 * 100;

cout << "Encrypted number is " << encryptedNumber << endl;
} // end main
```

Computer Science & Information Technology

You might also like to view...

Operator ______________ creates an object of the class specified to the right of the keyword.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

When saving a presentation as a video, ________ slides are not part of the video and that hyperlinks do not work

Fill in the blank(s) with correct word

Computer Science & Information Technology

Case 15-1 Frank, a business analyst at Pro-White Technologies, deals with vast amount of data and analysis. Since Frank uses Excel worksheets for most of his work, he uses several advanced functions of Excel that eases and speeds up his work. Frank fills eight columns and over a thousand rows of text in an Excel worksheet. He wants to collate the text in three of the columns in a single column. Frank enters the first two cells manually and then uses the Flash Fill function. Flash Fill suggests a pattern that is not the pattern Frank requires. To reject the suggested pattern, Frank should press the _____ key.

A. ?Alt B. ?Ctrl C. ?Esc D. ?Shift

Computer Science & Information Technology

While a presentation is running, you can use the ________ to draw lines on the slide

A) Pencil B) Marker C) Pen D) Highlighter

Computer Science & Information Technology