• Articles
  • generate any possible password in lowerc
Published by
Jun 22, 2010

generate any possible password in lowercase alpha

Score: 2.7/5 (26 votes)
*****
generate any possible combination of words to find the passwords of any length in lowercase alphabits (a to z)

this piece of code prints more than 500 combinations (if there are more than 500) per second on intel core i3,i5,i7 processor family...
this code can be modified to make it more faster only you have to do is to make a file instead of printing the words on the screen about more than 50,000 combinations per second...

for more information mail me at "ubaidazad@gmail.com"


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <iostream.h>
#include <conio.h>
#include <fstream.h>
#include <math.h>
int index_z=0,min,max;
char alpha[10],temp;
inline void intialize_values(int m) {
     for (int j=0;j<m;j++)
     { alpha[j]='a'; }
     }
inline int increament(int l) {
     for (int a=l-1;a>=0;a--)
     {
         if (alpha[a]=='z' && min<=max) {
                            alpha[a]='a';
                            index_z++; }
         else {
              temp=alpha[a];
              temp++;
              alpha[a]=temp;
              index_z=0;
              break; }
     }
     if (index_z==l) {
                     l++; }
     return l; 
     }
         
int main () {
    int len,val,last,check;
    double total=0E+0;
    ofstream outfile("random.txt");
    do {
        system("cls");
    cout << "min = ";
    cin >> min;
    cout << "max = ";
    cin >> max; } while(min>max || max==0);
    len=min;
    last=min;
    val=min;
    for (int i=min;i<=max;i++)
    {
    intialize_values(val);
    check=1;
    while (check==1) {
    for (int k=0;k<len;k++) {
        cout << alpha[k]; }
        cout << "\n";
    total++;
    len=increament(last);
    if (len>last) {
                  last++;
                  check=0;
                  val++; }
                  }
    }
    cout << "\n\n\n";
    cout << "Total Generated = " << total << endl;
    double ch=0E+0;
    for (int i=min;i<=max;i++) {  
    ch+=pow(26,i); }
    if (total==ch)
    cout << "\n\n" << "Task Completed Successfully.";
    cout << "\n\n\n\t\t\tpress any key to exit...";
    getch();
    return 0;
}