Re: Creating all key combinations passwords

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I wanted to do the same some time ago and considered doing it in php but i realized that php is not the appropriate language for doing that... i wanted to insert the data into a mysql-database, too i thought about doing it in C++ but my coding skills were too poor, i didn't know how to implement mysql-access -.- i had another idea some time ago, something that should also work in php (i won't do this in php, i'd use C++ or python or something like that) the idea is the following: create all possible combinations in a C++ program and write it into a file where there is something like
INSERT INTO passwords (password, hash) VALUES [and here all the data]
and then import it using the command line into mysql

i have this code to generate the combinations, i wrote it some time ago and unfortunately there is a segfault, i don't know why and didn't work on this for some time

#include <iostream>
#include <string>
using namespace std;

unsigned int lastcharindex(string input, string charset) {
       int position = charset.find(input[(input.length())-1],0);
       return position;
}

void generatewords(string start, unsigned int maxlength, string charset) {
if(start.size() <= maxlength && lastcharindex(start, charset) != 0 && lastcharindex(start, charset) != charset.size()
-1) {
start[start.size()-1] = charset[lastcharindex(start, charset)+1];
               cout << start << endl;
               generatewords(start, maxlength, charset);
       }
else if(start.size() <= maxlength && lastcharindex(start, charset) == charset.size()-1) {
               while(lastcharindex(start, charset) == charset.size()-1) {
                       start.erase(start.size()-1,1);
                       if(start=="") {break;}
               }
start[start.size()-1] = charset[lastcharindex(start, charset)+1];
               cout << start << endl;
               start += charset[0];
               cout << start << endl;
               generatewords(start, maxlength, charset);
       }
else if(start.size() < maxlength && lastcharindex(start, charset) == 0) {
               start += charset[0];
               cout << start << endl;
               generatewords(start, maxlength, charset);
       }
else if(start.size() <= maxlength && lastcharindex(start, charset) == 0) { start[start.size()-1] = charset[lastcharindex(start, charset)+1];
               cout << start << endl;
               generatewords(start, maxlength, charset);
       }
}


@Stut: the idea is NOT to be a cracker kid, the intent is only to realize that project to train and develop my coding skills and to run some tests how secure passwords are

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux