I'm new at C++, I am trying to make some brute force password cracking.
At the moment, it loops from aaaaa to zzzzz.
question : Is it possible to make it like from a to zzzzz?
I am working on this for like non-stop 6 hours and still could't find a solution.
Waiting for your help, thanks!
#include <iostream>
#include <string>
using namespace std;
int main()
{
string password;
string generatedPass;
int x;
cin >> password;
char digitArray[]={96,97,97,97,97,97,97,97,97,97};
int lenght=0;
int maxLenght=password.length();
while( password.compare(generatedPass) != 0 ){
digitArray[0]++;
for(int x=0;x<password.length();x++){
if (digitArray[x] == 123)
{
digitArray[x] = 97;
digitArray[x + 1]++;
}
}
// creating the string with those digits
generatedPass=digitArray[password.length()-1]; // i set the first one here
for(int i=password.length()-2 ; i>=0 ; i-- )
generatedPass+= digitArray[i]; // now i add other digits to next to first digit
cout << generatedPass << endl; // i put it to test how it looks
}
cout << generatedPass << endl; // gives the result
return 0;
}