Assignment title: C Programming
Question
C Programming
Q
1. The Background
You are given a decryptor binary executable (fdecrypt) that can be
used as follows:
./fdecrypt
E.g.
./fdecrypt myEncryptedFile.txt mypassword
When run, fdecrypt returns zero if the password matches with the
password used to encrypt the file or a non-zero return value if it
does not. Under normal operation, it does not produce any other
outputs.
2. The Problem
You have been asked to write a C program to find the password for
any encrypted file, by means of brute force trial and error. As this
is a computationally intensive task, you are required to parallelise
your search to divide up the work load across different processes
(fork) so they would be executed in parallel (exec), shortening the
search duration.
3. Development Requirements (up to 12 marks and 3 bonus marks)
The assignment is broken down to several milestones and there is a
mandatory evaluation section.
Requirements for the "short" level (4 marks)
1. The fdecrypt executable can be downloaded from Blackboard-
>Assignments->Assignment 2.
2. Your code must be written in C and must use fork and a
relevant variation of exec.General expectations: At compilation, your code must not
produce warnings with "gcc –Wall –pedantic". There should also
be no memory leaks. Everything must be runnable on the RMIT
"coreteaching" Linux servers.
3. Your search program should allow the user to specify the
number of processes (>=1) to use. In other words, its logic
should gracefully scale. This can be done via the command-line
or via a prompt.
4. Each process/thread must show a message when it starts its
portion of the work and when it finishes its work. You must
not print out every combination tried as there would be too
many.
Note: To keep things simple, you may assume the password is
all numeric. You are expected to create your own test files
following the example data file given on the Blackboard.
Requirements for the "tall" level (+4 marks)
5. Complete previous steps.
6. Employ a stopping mechanism. E.g. Ask the user for a maximum
number of combinations to try (or a time limit).
Alternatively, you can ask the user to enter a range of
passwords to search for (e.g. 0000..9999. Not a dictionary).
Alternatively (or additionally) employ a checkpoint mechanism
so that the search can be resumed after a system shut down
without retrying the previously tried combinations (do not
write all the tried combinations to disk, as that would
require a lot of space. Consider writing start and end markers
for ranges if you want to employ this strategy).
Requirements for the "grande" level (+4 marks)
7. Complete the previous steps
8. You must employ a strategy to stop the processes from
searching further when one has found the solution. I.e. after
the password is found, everything should stop (and the
password should also be displayed).
Requirements for the "venti" bonus level (+3 bonus marks)
9. Complete the previous steps
10. Only if the previous levels are fully functional,
consider the following: The non-zero value returned by
fdecrypt (when the password is a mismatch) indicates the
number of mismatched characters between the provided password
and the real password. Use this information and implement a
non-brute force/heuristic search.
Note: The maximum mark for Hurdle A (weekly work+assignments)
is capped at 50.4. Evaluation Requirements (4 Marks)
Within comments at the top of your main C source file, attempt the
following:
Explain the extent to which your program meets the specified
requirements and if there are any requirements that have been left
out or not fully implemented. You will be assessed on your ability
to clearly identify these and not on how much you write.
Explain the specifics of the strategy used for steps 6 and 8 (and
when applicable, 10) above. Are there better ways of doing this?
Explain in a short paragraph. If you attempted only the "short"
level, explain how you would have attempted the higher levels (up to
"grande").
5. Demo (Mandatory part of final submission)
Demo your assignment anywhere between now and week 12 (inclusive).
Your lab assistants will keep track of the levels that you have
demoed. Only up to the highest level that you have demoed will be
marked from your final submission. In other words, you must manage
your time accordingly.
6. Submission Instructions
This is an individual assignment and all submitted work must only be
your own effort. Please familiarise yourselves with RMIT
University's Plagiarism and Academic Integrity Policies.
Remember to do the demo in addition to the final (files) submission
or else your submission will not be complete and therefore will not
be marked.
The submissions will be made via Blackboard->Assignments->Assignment
2 by means of separate submission links for the different levels.
Only your last submission will be marked and only up to that level
(not higher