Created
May 2, 2016 21:38
-
-
Save abatilo/b3308507d33cf1883c796edea3509e3b 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 <stdlib.h> | |
#include <string.h> | |
int main(int argc, char* *argv) | |
{ | |
// FOR STREAM VIEWERS | |
// A buddy of mine into security/cryptography challenged me to this | |
// "very easy" problem. | |
// Now I'm making a friend of mine and YOU guys try and solve the same | |
// challenge | |
// 1. The challenge is to figure out what this program is doing | |
// 2. Then we need to find out what the answer is for what the program is doing | |
// Things we know - ahoward1024 | |
// length of input has to be the same length as the address of a | |
int len; | |
unsigned ii; | |
const unsigned long long a = 0x4017111a1b1d29; | |
char b = (0x11 + 0x52) ^ 34; | |
char *c = (char*)&a; | |
char *d; | |
if (argc != 2) { | |
return -1; | |
} | |
len = strlen(argv[1]); | |
d = argv[1]; | |
if (len != strlen(c)) { | |
return -1; | |
} | |
for (ii=0; ii<len; ii++) { | |
if ((*d ^ b) == *c) { | |
b = *d; | |
d++; | |
c++; | |
} else { | |
return -1; | |
} | |
} | |
puts("congratz\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment