Created
December 7, 2014 09:45
-
-
Save volpino/f194c1a77d64df8eaba9 to your computer and use it in GitHub Desktop.
SECCON 2014 - crypto200
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> | |
int main(int argc, char** argv) | |
{ | |
signed int result; | |
unsigned int seed; | |
FILE *input_file; | |
FILE *output_file; | |
char buf; | |
if ( argc > 2 ) | |
{ | |
seed = atoi(argv[3]); | |
srand(seed); | |
input_file = fopen(argv[1], "rb"); | |
output_file = fopen(argv[2], "wb"); | |
while ( fread(&buf, 1, 1, input_file) == 1 ) | |
{ | |
buf ^= rand(); | |
fwrite(&buf, 1, 1, output_file); | |
} | |
fclose(input_file); | |
fclose(output_file); | |
result = 0; | |
} | |
else | |
{ | |
result = 1; | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment