This snippet is an example of using XOR encryption to encrypt/decrypt a file. It uses command-line input parameters as follows:argv[1] - name of input file to encrypt/decrypt
argv[2] - name of output file
argv[3] - crypt keyFor example, an input file called "main.c" is used to create an output file "file.bin" with the encryption key "key" by doing this:
H:\Daniweb>xorcrypt main.c file.bin key
Performing the reverse on the encrypted file "file.bin" will restore the original file contents into another output file "file.txt" using the same "key".
H:\Daniweb>xorcrypt file.bin file.txt key
If the code shown here was in "main.c", you should find that the second output "file.txt" matches "main.c".