Skip to content

Instantly share code, notes, and snippets.

@volpino
Created December 7, 2014 09:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save volpino/f194c1a77d64df8eaba9 to your computer and use it in GitHub Desktop.
Save volpino/f194c1a77d64df8eaba9 to your computer and use it in GitHub Desktop.
SECCON 2014 - crypto200
#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