Guest User

Untitled

a guest
Feb 20th, 2016
185
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <unistd.h>
  5. #include <sys/stat.h>
  6. #define XOR_BYTE 0xAA
  7. #define JOB_CRYPT 1
  8. #define JOB_DECRYPT 2
  9. int xorFile(char *infile, char *outfile) {
  10.   char ch;
  11.   FILE *source = fopen(infile, "rb");
  12.   if(source==NULL) {
  13.     fprintf(stderr,"Enter valid file\n");
  14.     fclose(source);
  15.     exit(EXIT_FAILURE);
  16.   }
  17.   FILE *target = fopen(outfile,"wb");
  18.   if(target==NULL) {
  19.   }
  20.   while((ch=fgetc(source))!=EOF)
  21.   {
  22.     ch ^= XOR_BYTE;
  23.     fputc(ch,target);
  24.   }
  25.   fclose(target);
  26.   fclose(source);
  27.   return 0;
  28. }
  29. int main(int argc, char *argv[]) {
  30.   xorFile(argv[1],argv[2]);
  31. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×