Originally posted by: xtknight
Originally posted by: talyn00
I'm not quite following what the following is doing.
I have to agree...what in god's name is going on ? lol
OK the last example makes a lot more sense. What is the lab? To create a caeser cipher or to map A to 0 and B to 1?
I'll just copy and paste what it says, maybe that will be better than me paraphrasing:
7.4 Laboratory Exercise
7.4.1 Purpose
The purpose of this laboratory exercise is to manipulate text data that was stored on
the computer hard disk, perform computations and analysis of data, and to store the
results on the computer hard disk using the Software Development Method.
7.4.2 Speci¯cation
The programmer is required to design and implement a program that encrypts and
decrypts messages using a Caesar/additive cipher and analyzes the ciphertext.
The program shall prompts the user with a menu choice of: 1) encryption, or 2)
decryption.
The program shall read in all the characters from an input data ¯le. A data ¯le
will be provided during the laboratory period and your program may not assume its
length, except that it will be more than one character. The fractional portion of any
displayed answer must be rounded to three decimal place accuracy. However, all
calculations must carry the full decimal accuracy.
For this cipher, only valid characters are to be encrypted/decrypted. The valid
set of characters are A, B, C, ... X, Y, Z. Any other character (e.g. a blank space)
are to be included, but not processed.
Note: n-dimensional arrays are not required for this lab. You may chose to use
them, but TAs will not assist in debugging errors related to the usage of arrays for
this lab.
1 - Encryption [2 marks]
When encrypting, the program shall assume an input ¯le name of plaintext.txt
and an output ¯lename of ciphertext.txt. The user does not need to input the ¯le
names; the programmer may hardcode them for this lab.
Each character shall be read in to the program individually, encrypted using the
assigned key (see Implementation Requirements), and written out to the hard disk.
Each time a character is encrypted, both the plaintext and ciphertext character are
Chapter 7. Lab 3: Introduction to Cryptography 61
to be displayed to the screen, clearly labeled and on a single line. The ciphertext
must also be analyzed (see Analysis of Ciphertext) and a summary report generated.
2 - Decryption [2 marks]
When decrypting, the program shall assume an input ¯le name of ciphertext.txt
and an output ¯lename of message.txt. The user does not need to input the ¯le
names; the programmer may hardcode them for this lab.
Each character shall be read in to the program individually, decrypted using the
assigned key (see Implementation Requirements), and written out to the hard disk.
Each time a character is decrypted, both the ciphertext and plaintext character are
to be displayed to the screen, clearly labeled and on a single line. The ciphertext
must also be analyzed (see Analysis of Ciphertext) and a summary report generated.
Analysis of Ciphertext [2 mark]
The following analyses are to be performed on the ciphertext and a neatly formatted
summary report displayed on the screen:
1. Sum the ASCII integer value of each character,
2. the mean of the data set (ASCII values),
3. the standard deviation of the entire data set (ASCII values),
4. the number of unique valid characters,
5. the relative frequency of all 26 valid characters as percent.