Created
October 6, 2015 06:21
-
-
Save OsandaMalith/b0703a71909a2fcf3f54 to your computer and use it in GitHub Desktop.
Solving Root-Me XORed Picture Challenge
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> | |
#define KEY_LENGTH 6 | |
/* | |
* Title: Solving Root-Me XORed Picture Challenge | |
* Author: Osanda Malith Jayathissa (@OsandaMalith) | |
* Website: https://osandamalith.wordpress.com | |
*/ | |
int main() { | |
FILE *fpIn, *fpOut; | |
unsigned char key[KEY_LENGTH] = {'f', 'a', 'l', 'l', 'e', 'n'}; | |
int enc = 0; | |
fpIn = fopen("ch3.bmp", "rb"); | |
fpOut = fopen("flag.bmp", "wb"); | |
for (size_t i = 0; fscanf(fpIn, "%c", &enc) != EOF; ++i) | |
fprintf(fpOut, "%c", enc ^ key[i % KEY_LENGTH]); | |
fclose(fpIn); | |
fclose(fpOut); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment