LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   8 digit wordlist alphanumeric (https://www.linuxquestions.org/questions/linux-newbie-8/8-digit-wordlist-alphanumeric-4175504463/)

tirmazi3 05-09-2014 10:04 AM

8 digit wordlist alphanumeric
 
Hi,
I want to genrate a 8 digit alphanumeric wordlist consisting of charset (0123456789abcdefghijklmnopqrstuvwxyz)with some exceptions i.e, every key consist of any 5 numbers and alphabets not more then 3 in a key.
For example 2556b92d , 15688we4 , 34854a27 , 13420aw4 , etc.

i hope so you understand what i'm looking for please help me to create such a list or if any one has it please share with me :)

Thanks in advance !

grail 05-09-2014 11:40 AM

Try searching the forums for things like password generators as this topic has come up multiple times.

Also, if you wish for any help in actually writing or changing any code you would have to first present some as no one will do the work for you.

Beryllos 05-09-2014 12:32 PM

In which programming language, or do you need only a description of the method?

mreff555 05-10-2014 07:38 PM

This should be a good start. Its quick and dirty, you can add bells and whistles if you like but it functions and matches the criterion you mentioned for now

compile with:

g++ -o <name for executible> <name of file>

Code:

#include<iostream>
#include<ctime>
#include<cstdlib>
using namespace std;
/* Change these values */
int char_per_word = 8;
int words_to_gen = 5;
/* Leave the rest alone */

int numbers_in_word = 0;
int chartype;
int value;
char chargen(){
        chartype = rand() % 3;
            if ( chartype == 0 ){
                        value = rand() % 10 + 48;
                        numbers_in_word++;
                }
            else if ( chartype == 1 ) value = rand() % 26 + 65;
            else value = rand() % 26 + 97;
            return value;       
}
void wordgen(int char_per_word){
        char word[ char_per_word ];
        do{
                numbers_in_word = 0;
            for( int i = 0; i < char_per_word; i++ ) word[i] = chargen();
        } while( numbers_in_word != 5 );
       
        for( int i = 0; i < char_per_word; i++ ) cout << word[i];
               
                cout <<endl;
    }
int main(){
    srand( time( NULL ) );
    for( int i = 0; i < words_to_gen; i++ ) wordgen( char_per_word);   
    cout << endl;
}



All times are GMT -5. The time now is 04:32 AM.