Created
March 19, 2014 10:19
-
-
Save ma34s/9638980 to your computer and use it in GitHub Desktop.
暗号化といえば暗号化 何のためにつくうのやら、、、くだらなすぎる・・・・
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <fcntl.h> | |
#define KEY 0x34 | |
#define BUFFER_SIZE 1024 | |
int main(int argc,char* argv[]) | |
{ | |
int read_cnt; | |
char buffer[BUFFER_SIZE]; | |
FILE* fp; | |
FILE* fp2; | |
int i; | |
int total=0; | |
char tmp; | |
if(argc < 2 ) | |
{ | |
return -1; | |
} | |
fp = fopen(argv[1],"rb"); | |
if(fp == (FILE*)0) | |
{ | |
return 1; | |
} | |
printf("file:%s\n",argv[1]); | |
fp2 = fopen(argv[2],"wb"); | |
if(fp2 == (FILE*)0) | |
{ | |
return 1; | |
} | |
for(;;) | |
{ | |
read_cnt = fread(buffer,BUFFER_SIZE,1,fp); | |
total += read_cnt*BUFFER_SIZE; | |
if( read_cnt == 0 ) | |
{ | |
printf("processed size:%d\n",total); | |
break; | |
} | |
for(i=0;i<(read_cnt*BUFFER_SIZE);i++) | |
{ | |
tmp = buffer[i] ^ KEY; | |
fwrite(&tmp,1,1,fp2); | |
} | |
} | |
fclose(fp); | |
fclose(fp2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment