Recursive Brute Force String Generation

[Yes, I've looked at all the other examples!] Trying to make a non-encrypted brute force for the fun of it. Haven't been coding for awhile as I took an interest in security related studies. But I've hit an end after working for awhile. I can seem to find where to put in the match testing (I've tried a few locations). Any help is appreciated!

1
2
3
//global consts
const string chars="abcdefghijklmnopqrstuvwxyz";
string pwd="";


 
cin >> pwd;


1
2
   siz=pwd.length();
   GenerateAllPasswords("", 0, pwd.length());


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
void GenerateAllPasswords(string temp,int pos,int siz)
{
      if (pos < siz)
      {
//         cout << "temp= " << temp << " -1\n";     
         for(int i=0; i < chars.length(); i++) 
         {        
         GenerateAllPasswords(temp + chars[i], pos + 1, siz);
//         cout << "temp= " << temp << " -3\n";  
         } 
      } 
      else  
      {
         cout << "DONE!\n[+]Your password is '" << temp << "'.\n";
//         if (temp==pwd) { return; }
      }
}
Topic archived. No new replies allowed.