BruteForce algo needed

Discuss all kind of algorithms and data structures from their mathematical and programming sides.

Moderators: Darobat, RecursiveS, Dante Shamest, Bugdude, Wizard

BruteForce algo needed

Postby _XTREME_ » Tue Dec 16, 2003 3:13 pm

Hello brains!
I am new in this forum and i post here for first time. Nevermind.
I need bruteforce algo. which combines difined by me characters. If i defined that the characters that will be used are "1","2" and "3" i need tha algo to combine them in this order:
1
2
3
11
12
13
21
22
23
31
32
33
111
112
113
121
...
u got the point :lol:
this will go on till the strlen() of the current combination is equal to max_password_lenght, defined by me. 10x for the answers...
PostQuitMessage(0);
/* Join the Dark Forces! */
User avatar
_XTREME_
 
Posts: 102
Joined: Tue Dec 16, 2003 2:54 pm
Location: V. Tyrnovo, Bulgaria, Europe :)

Postby loobian » Tue Dec 16, 2003 3:29 pm

Hi, and welcome to our forums!
I am bulgarian, too by the way :)

I think what you need is permutation algorithm... search for permutation. Also, check out:
www.tutorials.cpp-home.com
Click on "Sub-categories" and see the "Algorithms" category with all of its sub-categories... you might find something useful there, too.
User avatar
loobian
Site Admin
 
Posts: 679
Joined: Mon Sep 15, 2003 3:09 pm

ooo братк&

Postby _XTREME_ » Tue Dec 16, 2003 3:45 pm

Аз сега се сещам че българи правиха този сайт. Мойте поздравления!
PostQuitMessage(0);
/* Join the Dark Forces! */
User avatar
_XTREME_
 
Posts: 102
Joined: Tue Dec 16, 2003 2:54 pm
Location: V. Tyrnovo, Bulgaria, Europe :)

Postby loobian » Tue Dec 16, 2003 3:57 pm

Thanks!
But please, do post in english because this site is viewable for many people who do not know bulgarian.

Translation of _XTREME_'s message:
"I now remember that bulgarians made this site. Congratulations!"
User avatar
loobian
Site Admin
 
Posts: 679
Joined: Mon Sep 15, 2003 3:09 pm

But, after all i need the algo :)

Postby _XTREME_ » Tue Dec 16, 2003 4:09 pm

OK, sorry for writing in !english (non-english). So, i checked the algo-s in this site, nothing about bruteforce. Can somebody write this f() or not? My brain refuses to work last few days. :lol: :lol: I repeat: i need algo which combines the characters in this way:

a
b
c
d
...
aa
ab
ac
ad
...
aaa
aab
aac
aad
aba
abb
....

10x!
PostQuitMessage(0);
/* Join the Dark Forces! */
User avatar
_XTREME_
 
Posts: 102
Joined: Tue Dec 16, 2003 2:54 pm
Location: V. Tyrnovo, Bulgaria, Europe :)

Postby MXP » Tue Dec 16, 2003 9:36 pm

Since you have implied that this is a bruteforce password cracker I dont have much desire to help. All I will say is "permutations"
Need information on a function I've posted? Chances are it's at the MSDN.
MXP
 
Posts: 6506
Joined: Mon Sep 22, 2003 5:27 pm

Correction...

Postby _XTREME_ » Wed Dec 17, 2003 3:24 am

First of all, i said "password cracking" only as an example. This algo can be used with other purposes too. Let`s say... hmmm.... ahmm..... uhmmm.... junk generator! :lol: :lol: :lol: And second, no "permutations" will be used but COMBINATIONS. Because "permutation" of the string abc can be: acb, cab, bca... and so on. But a can`t be permutation of abc.
PostQuitMessage(0);
/* Join the Dark Forces! */
User avatar
_XTREME_
 
Posts: 102
Joined: Tue Dec 16, 2003 2:54 pm
Location: V. Tyrnovo, Bulgaria, Europe :)

Postby raimo » Wed Dec 17, 2003 4:49 am

Well, you know more than enough to code the program. Why don't you just do it? ;) I guess you know how base 3 number system works.
User avatar
raimo
 
Posts: 372
Joined: Fri Sep 26, 2003 6:50 am
Location: Finland

because...

Postby _XTREME_ » Wed Dec 17, 2003 6:30 am

..i know that this algo is as short as several lines. I can write it but too ugly. I want short, optimized code :) I WANT IT :)
PostQuitMessage(0);
/* Join the Dark Forces! */
User avatar
_XTREME_
 
Posts: 102
Joined: Tue Dec 16, 2003 2:54 pm
Location: V. Tyrnovo, Bulgaria, Europe :)

Postby raimo » Wed Dec 17, 2003 6:50 am

Well here's the answer: No one is going to write the algorithm for you.
User avatar
raimo
 
Posts: 372
Joined: Fri Sep 26, 2003 6:50 am
Location: Finland

Postby devil_slayer » Wed Dec 17, 2003 8:00 am

Code: Select all
void generate(char* buffer, int size, int length, char* alphbet, int n)
{
  int i;
  printf("%s\n",buffer);
  if(length>=(size-1)) return;
  for(i=0; i<n; i++)
  {
    buffer[length]=alphabet[i];
    buffer[length+1]=0;
    generate(buffer,size,length+1,alphabet,n);
   }
}


To run it just write:
Code: Select all
char buffer[4];
generate(buffer,4,0,"123",3);

Sorry guys, but I like algorithms...
User avatar
devil_slayer
 
Posts: 489
Joined: Wed Oct 01, 2003 3:44 am
Location: Warsaw, POLAND

10x

Postby _XTREME_ » Wed Dec 17, 2003 8:21 am

w0w! That was what am i looking for. Btw what is the last param?... int n i mean. 10q again!
PostQuitMessage(0);
/* Join the Dark Forces! */
User avatar
_XTREME_
 
Posts: 102
Joined: Tue Dec 16, 2003 2:54 pm
Location: V. Tyrnovo, Bulgaria, Europe :)

Postby devil_slayer » Wed Dec 17, 2003 8:23 am

The number of chars in the alphabet.
User avatar
devil_slayer
 
Posts: 489
Joined: Wed Oct 01, 2003 3:44 am
Location: Warsaw, POLAND

update

Postby _XTREME_ » Wed Dec 17, 2003 8:37 am

Code: Select all
void generate(char* buffer, int size, int length, char* alphabet)
{
  int i,n;
  n=strlen(alphabet);
  printf("%s\n",buffer);
  if(length>=(size-1)) return;
  for(i=0; i<n; i++)
  {
    buffer[length]=alphabet[i];
    buffer[length+1]=0;
    generate(buffer,size,length+1,alphabet);
   }
}

void main()
{
   char buffer[4];
   generate(buffer,4,0,"1234");
}

Isn`t now better? I assume the second param is the max_size_of_password-1. And what is the third?
PostQuitMessage(0);
/* Join the Dark Forces! */
User avatar
_XTREME_
 
Posts: 102
Joined: Tue Dec 16, 2003 2:54 pm
Location: V. Tyrnovo, Bulgaria, Europe :)

Postby devil_slayer » Wed Dec 17, 2003 8:40 am

The initial size of the generated password. It's the only paramter that is increased in every recursion step, so it's very important.

Yeah the code's cool now.

You could try and hack it iterativly, but I'm not in the mood now...

Maybe tomorrow...
User avatar
devil_slayer
 
Posts: 489
Joined: Wed Oct 01, 2003 3:44 am
Location: Warsaw, POLAND

Next

Return to Algorithms & Data Structures

Who is online

Users browsing this forum: No registered users and 3 guests