Submit: Turn in your codebreaker.c
source file
using the turnin command
on morbius.mscsnet.mu.edu or one of the
other Systems
Lab machines.
Work is to be completed individually. Be certain to include
your name in the file. You may submit multiple times, but only the
last turnin will be kept. The automatic submission system will not
accept work after the deadline. (See turnin instructional
video HERE. Note that the
video is for a different course number, and that Morbius's domain
name has changed since the video was
made: morbius.mscs.mu.edu
-> morbius.mscsnet.mu.edu)
Include a comment block at the very top of each file that
contains the following:
/**
* COSC 3250 - Project #
* Explain briefly the functionality of the program.
* @author [your name]
* Instructor [your instructor]
* TA-BOT:MAILTO [your email address]
*/
Ring of Xinu
Unbeknownst to Lord Xinu (Dark Lord of the Mips), his super-secret,
Wormhole X-Treme! cereal box decoder is actually a pretty
lousy secret message channel. (Lord Xinu's specialty is embedded
operating systems, not cryptography.)
Thwart Lord Xinu's insidious scheme to commandeer the world's home
networking appliances by building a program that will crack his
decoder ring's code.
Simple Cryptanalysis
The downfall of Lord Xinu's decoder ring scheme is that there are
effectively only 27 possible key values. You can use any number
as the key, but after the first modulus is taken, you're back to
27 real possibilities.
Code breakers often begin attacking such a weak cipher by trying
all of the possibilities, hoping one of the results will obviously
be the original message.
How will our program recognize when we've found the right key?
Many algorithms exist, but one common technique is to examine the
frequency of letters in the deciphered text. Written English has a
known profile
of letter
frequencies. Let us assume that the correct key will result in
the deciphered text that results in the most occurrences of the
letter 'E'. This is a very close pass, but actually gives us the
wrong key for most test inputs -- it gives us the incorrect key
value that happens to decipher space characters from the original
in the letter 'E'. Instead, we want the key that gives us the next
largest number of E's in the deciphered text.
Construct a program that takes ciphertext output from the
encoder-ring program, tries decoding it with all 27 possible keys,
and outputs the key value that resulted in the second largest
number of E's, followed by the deciphered text.
We have provided an example program for your reference, executable
on Morbius as ~brylow/os/Projects/codebreaker.
Notes
- Unlike the first project, this project does not require
command-line arguments. Unlike the first project, which could
handle an arbitrary length text to encipher, your code
breaker is only required to handle message lengths of up to
1024 characters.
- Whereas the first project could be implemented without use of
arrays, this project will require them. You can implement this
program using only statically-allocated arrays. That is, you need
not use pointers and dynamic memory allocation at this point.
- This simple code breaker is by no means perfect -- it
is only likely to work on longer messages in which 'E' is indeed
the most common letter. A more elaborate crypt analysis engine
would look at the relative frequencies of other letters, and
probably search for common combinations of letter in English, such
as "the", "of", or "is".
- In the case of a tie, your code breaker should return
the lowest key value that produces the maximum number of E's.
- For reference, your assignments will be compiled and graded on
Morbius.
- The Systems Lab (CU 310) is the primary development environment
for COSC 3250. It is expected that you will learn
to use the required tools for developing, testing, and submitting
your projects.
The Systems
Lab machines are available locally in Cudahy 310, and can be
accessed remotely via ssh using your CS Department credentials.
(See D2L Laboratory Instructions for instructions for learning
your credentials.) Free secure shell (ssh) clients are readily
available for other platforms, including Windows and Mac at home
or in the dorms. We recommend the built-in ssh client in found in
Terminal for MacOS users, or in the Cmd.exe command interpreter in
modern Windows. If you are fortunate enough to already have a Linux
client at home, ssh is likely installed by default.
-
The Systems
Lab machines run the Linux operating system. If you need a
refresher on using the UNIX environment, please see
the
UNIX Tutorial.
- The reference implementation is considered an integral part of the
specifications for this assignment. Project grades will be based in
significant part upon an automated comparison of behavior against the
reference implementation. Devise test cases to discover the expected
behavior, and do your best to match it precisely. Creativity will be
valued in later assignments, but first one must master the tools.
- Use the electronic turnin system to submit your work.
The command is "turnin", followed by the name(s) of files(s) you
wish to submit. The command "turnin -v" will print a listing
verifying the contents of your submission. See "turnin -h" for
a list of other relevant options. The system does not accept work
after the deadline, and neither does the professor.
[back]
[Revised 2022 Feb 02 12:52 DWB]