My version of crack.c is not finding two passwords. As far as I can tell, I am exhausting the entire alphabetic search space, and I've found both upper and lowercase passwords. Assuming there's no spaces or other special characters in the solution set, what could this brute force solution be missing?
//Headers, args, salt, etc omitted
char alphabet[53] = {'A'};
for(int i = 0;i<26;i++)
{
alphabet[i]=alphabet[0];
alphabet[0]++;
}
alphabet[0] = 'A';
alphabet[26]= 'a';
for(int i = 26;i<52;i++)
{
alphabet[i]=alphabet[26];
alphabet[26]++;
}
alphabet[26]= 'a';
for(int first=0;first<53;first++)
{
for(int second=0;second<53;second++)
{
for(int third=0;third<53;third++)
{
for(int fourth=0;fourth<53;fourth++)
{
for(int fifth=0;fifth<53;fifth++)
{
char candidate[] = {alphabet[first],alphabet[second],alphabet[third],alphabet[fourth],alphabet[fifth]};
char *candidate_crypt = crypt(candidate,salt);
if (strcmp(hash, candidate_crypt) == 0)
{
printf("%s",candidate);
exit(0);
}
}
}
}
}
}
printf("No result found");
return 1;
Edit:
Took off the 5 character assignment, but still not finding those last passwords...