I am having trouble with all the different types: strings, char, char * while appending, adding, concatenating variables that end up not compatible since they are different types.
I am trying to run all possible 3 character combinations for ascii characters 48 through 127. However, i get an annoying "+C" term at the end of my 3 character combinations. How do I get rid of that. Thank you so much in advance~~
(also just a heads up I wanted to see all possible combos so i have a print statement inside the nested for loop that shows me all the possible combos that run to ensure it got all of them)
int main(int argc, char * argv[])
{
char * hash = argv[1];
char guess_3[3];
// too many too little arguements
if (argc != 2)
{
printf("Usage: %s hash\n", argv[0]);
return 1;
}
char salt[2];
//get salt
for (int i = 0; i < 2; i++)
{
salt[i] = hash[i];
}
//check for three characters
for (int i = 48; i < 127; i++)
{
char ASCII_i = i;
for (int j = 48; j < 127; j++)
{
char ASCII_j = j;
for (int k = 48; k < 127; k++)
{
char ASCII_k = k;
guess_3[0] = ASCII_i;
guess_3[1] = ASCII_j;
guess_3[2] = ASCII_k;
printf("%s\n", guess_3);
char * check = crypt(guess_3, salt);
if (check == hash)
{
printf("%s\n", guess_3);
return 0;
}
}
}
}
}