Skip to content

Instantly share code, notes, and snippets.

@okumurakengo
Created May 17, 2020 07:26
Show Gist options
  • Save okumurakengo/1a48c3690008c47f54855bb82a422371 to your computer and use it in GitHub Desktop.
Save okumurakengo/1a48c3690008c47f54855bb82a422371 to your computer and use it in GitHub Desktop.
c言語で排他的論理和を使って超簡単に暗号化、複合化
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
FILE *infile, *outfile;
int ch;
int key = 3;
infile = fopen(argv[1], "rb");
outfile = fopen(argv[2], "wb");
while ((ch = fgetc(infile)) != EOF) {
putc(ch ^ key, outfile);
printf("%d %d\n", ch, ch ^ key);
}
return 0;
}
@okumurakengo
Copy link
Author

./a.out foo.txt bar.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment