Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!

# CycleChars

Giorgos Mourtasagas
Greenhorn
Posts: 18
Hello.
I have a table with 3 elements.e.g String table{"a","b","c"}
And I want the result to be like this:
aaa
aab
aac
aba
abb
abc
.
.
.
ccc
But I don't know how to do this.I would like to do this because I want to make a program to find out the password of some files with brute force.

Joe Ess
Bartender
Posts: 9323
10
This problem sounds a lot like your previous post. Since that post was about homework, I am going to guess that this is homework too. We ask that you DoYourOwnHomework. If you have some code you've written, we'll be glad to help you figure out the problems you are having.

Giorgos Mourtasagas
Greenhorn
Posts: 18
Thanks for the quick responding.
It's the same project with the older post.Then my code was wrong , because I want to found a password with a variable length and not with a constant.Therefore I try to rebuilt from the start.
But I don't know how to print the result like this:
aaa
aab
aac
.
.
.
ccc
Of caurse the variable of the table will be much bigger and not just 3 letters.
As an example I use only 3 letters.
So I use these tables: String table["a","b","c"] , String tbl[3] , int index[0,0,0].
The table tbl[3] I want to save the next possible correct password(aaa,aab,aac,....ccc).
The table index[0,0,0] corresponds to the length of the possible paassword.
If the table index[] at the end , look like this index[1,2,3] the password will be index[0,1,2]=[a,b,c].
Each one of the places of index[] it corresponds in a place of the table[](e.g 0=a,1=b,2=c)
Here is my big problem i don't know how to combine all this.

Joe Ess
Bartender
Posts: 9323
10
First, you can simplify things. Primitive characters are ordinal. You can use them like so:

What are the exact parameters of the password? Can it contain numbers, capital letters, other characters? How short and long?

Giorgos Mourtasagas
Greenhorn
Posts: 18
I use capital and small letters.
And the sort of the password will be 8 characters.

Joe Ess
Bartender
Posts: 9323
10
Always 8 characters, or somewhere between 1 character and 8 characters? It makes a big difference.

Giorgos Mourtasagas
Greenhorn
Posts: 18
Always 8 characters

Joe Ess
Bartender
Posts: 9323
10
So what's a good way to represent 8 characters?

Giorgos Mourtasagas
Greenhorn
Posts: 18
I made an effort to do the program.
Here is the result:

But I have a problem.It doesn't find code that the first or second digit it beegins from 2 or bigger.
In my program i want to find the password of file , that it has as code that :12345678 but it doesn'
t find.Other codes like :11111111,11112222,111444444 it finds.
So I don't understand where is the problem.

Joe Ess
Bartender
Posts: 9323
10
Giorgos Mourtasagas wrote:
So I don't understand where is the problem.

The first step to understanding what's wrong is to IsolateTheProblem. That's why I was trying to guide you into construction a good data structure for figuring out a password. I always try to break down a problem into parts, get each part working, then piece it all together. Much easier than throwing code at the wall and hoping it sticks.
Try creating a program that just iterates through the possible permutations (remember your previous post?).

Giorgos Mourtasagas
Greenhorn
Posts: 18
Joe Ess wrote:First, you can simplify things. Primitive characters are ordinal. You can use them like so:

What are the exact parameters of the password? Can it contain numbers, capital letters, other characters? How short and long?

So what's a good way to represent 8 characters?

I understand that is much difficult to find out the problem in that throwing code.
So can you help me to do step by step?
In the upper code you give me , I made it.
In the question how to represent the 8 characters , I want to represent in table of 8 characters.

Giorgos Mourtasagas
Greenhorn
Posts: 18
The previous problem , i had with the brute force was solved.Here is the code:

Now I want the program not search all the charList[] but only the selection I want between the numbers,lower letters,upper letters and all of them.I want the user to write a,A,1 and one of this selection to represent the equivalent table.I think that I need 4 more tables.One with the lower letters , one with uperr letters , one with the digits and one more.In last table they will be placed the selection from user.
And my other opinion is to use only one more table to place the selection from user.But I don't know how to get the selection from user and fill in the table. e.g If the user write a,1 then , the second table must fill with lower letters and numbers.So the brute force will be run only for the selections and not all the table.
So the program will be much faster and not search all the table without reason.