Data Encryption Program
I have two questions on this subject.
1.) How would I (using the file manipulation commands (fstream)), do a search-and-replace for each possible letter and number in a file, and replace them with a random number from a key file?
2.) Can fstream store each change that is has performed in a text file for the decryption process to use later?
Just print out a table onto the file or a seperate file. Then, when you want to decrypt, read the table from the file.
You're implementing an encryption algorithm based on substitution isn't it?
Since you know the maximum number of letters and numbers (and perhaps also other reading signs) in the file, you could also create a table before doing anything else.
For example, there are 256 ASCII characters, so you could fill an array of 256 chars with random values. Then read the first character of the file, if this is for example 0xAB, then you could replace this character with element 0xAB of your array. Like this:
current_character = key_array [0xAB];
This way of encoding is faster than searching for characters in a file, since now you have to go through the file only once.