This snippet is an example of using XOR encryption to encrypt/decrypt a file. It uses command-line input parameters as follows:argv - name of input file to encrypt/decrypt
argv - name of output file
argv - 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".