Reply to Re: Generate all possibilities

Your name:

Reply:


Posted by Bob Stearns on 10/02/06 08:15

Hans Worst wrote:

> You know them brute force password crackers... Just give the min/max
> passwordlength and the character scope in which they have to search.
>
> min length: 1
> max length: 7
> scope:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890!@#$%^&*()_
>
> Can anybody help me with a compact code for generating all possibilities?
>
>
You do realize that at the maxlength there are 10,030,613,004,288
combinations, at that a generation and test rate of 1,000,000 per
second, it would take over 100 days to test them all?

There is a more complicated way, which lets max length be a variable,
but this is short and easy:

for($i1=0; $i1<strlen($scope); $i1++) {
$key = substr($scope, $i1, 1);
print $key;
for($i2=0; $i2<strlen($scope); $i2++) {
$key = substr($key,0,1) . substr($scope, $i2, 1);
print $key;
for($i3=0; $i3<strlen(scope); $i++) {
$key = substr($key,0,2) . substr($scope, $i3, 1);
print $key;
}
}
}

Make further loops inside the ones already present to increase the key
length beyond 3. Note that each loop increases the run time and output
lines by a factor of 72

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация