Last active
March 27, 2016 18:46
-
-
Save najashark/0bfd2690f99efc7afd2e to your computer and use it in GitHub Desktop.
bruteforce code for challenge3.exe
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
//brutecelen3.c | |
//edit je ikut suka | |
//by naja & acap | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
static const char alphabet[] = | |
"abcdefghijklmnopqrstuvwxyz"; | |
static const int alphabetSize = sizeof(alphabet) - 1; | |
void bruteImpl(char* str, int index, int maxDepth) | |
{ | |
char store [7]; | |
for (int i = 0; i < alphabetSize; ++i) | |
{ | |
str[index] = alphabet[i]; | |
if (index == maxDepth - 1) { | |
int bba = (((((int)str[0]*2)+((int)str[2]*5)+((int)str[4]*1)+((int)str[1]*3)+((int)str[3]*7)+((int)str[5]*3)+((int)str[6]*7))*((int)str[0]+(int)str[1]+(int)str[2]+(int)str[3]+(int)str[4]+(int)str[5]+(int)str[6]))); | |
if (bba == 2108268){ | |
//if (str[1] == 97 || str[1] == 101 || str[1] == 105 || str[1] == 111|| str[1] == 117) | |
printf("%d - %s\n", bba,str); | |
} | |
} | |
else bruteImpl(str, index + 1, maxDepth); | |
} | |
} | |
void bruteSequential(int maxLen) | |
{ | |
char* buf = malloc(maxLen + 1); | |
for (int i = 7; i <= maxLen; ++i) | |
{ | |
memset(buf, 0, maxLen + 1); | |
bruteImpl(buf, 0, i); | |
} | |
free(buf); | |
} | |
int main(void) | |
{ | |
bruteSequential(7); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment