The goal was to create the hashing algorithm and then to test it on the three provided files. The provided files were three test cases that each tested the algorithm in a different way. Recreating the no longer used encryption algorithm was intended to give greater understanding of not only C but for encryption as well. The bit shifting behind the algorithm (see picture below) was already given as well as a general road map that was provided to assist in understanding what the code was trying to do. This was extremely helpful once I got on the right track.
To begin I needed to ensure that the opening/closing of the file be the first thing and the last thing that is done every time the code is run. I started off by feeding it the test case files and appending a string at the end to make sure it was writing to the file. Then I made sure to just open and close each file with getting any issues. Then I went and added helpful error messages to see if the file was opening and closing.
Helper functions are a good tool. After going a bit overboard with making helper functions I took a critical look at which ones were actually called more than once and removed the rest. Any function that was only called once was hard coded into the program.
Rather than introduce more variables the end of lines character’s hex value was manually added to the array that held the characters that were read in from the file.
Detailed, relevant, and specific comments were an absolute must. Not having them initially lead to a lot of lost time trying to remember what went where. The almost gratuitous amount of comments paid dividends when I ended up being a peer mentor and other students asked for assistance for this class and about this project in particular.