Reply to Re: Generate all possibilities

Your name:

Reply:


Posted by Kimmo Laine on 10/02/06 11:14

"Hans Worst" <hans@worst.invalid> wrote in message
news:_bSdnS2yHsoVe73YRVnyiw@scarlet.biz...
>
> "Kimmo Laine" <spam@outolempi.net> schreef in bericht
> news:_t5Ug.24461$yn7.16238@reader1.news.jippii.net...
>> "Hans Worst" <hans@worst.invalid> wrote in message
>> news:noSdnZa8GfspSr3YnZ2dnUVZ8sidnZ2d@scarlet.biz...
>>>
>>> "Bob Stearns" <rstearns1241@charter.net> schreef in bericht
>>> news:PU3Ug.2834$xt3.194@newsfe07.lga...
>>>> 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
>>> Bob,
>>>
>>> Thanks for the example but there is something wrong - I cannot find what
>>> though...
>>>
>>> I put $scope = "abcdefghijklmnopqrstuvwxyz";
>>> and I put <BR>'s after every print
>>> The script outputs a aa aaa aaa aaa aaa aaa aaa
>>>
>>
>> try indexing the keys as well:
>>
>> for($i1=0; $i1<strlen($scope); $i1++) {
>> $key1 = $scope{$i1};
>> print $key1;
>> for($i2=0; $i2<strlen($scope); $i2++) {
>> $key2 = $key1 . $scope{$i2};
>> print $key2;
>> for($i3=0; $i3<strlen(scope); $i++) {
>> $key3 = $key2 . $scope{$i3};
>> print $key3;
>> }
>> }
>> }
> I still only get aaaaaaaaaaaaaaaaaaaaaaaa...

Strange... I just tried this:

$scope = 'abcdef';
for($i1=0; $i1<strlen($scope); $i1++) {
$key1 = $scope{$i1};
print $key1.'<br>';
for($i2=0; $i2<strlen($scope); $i2++) {
$key2 = $key1 . $scope{$i2};
print $key2.'<br>';
for($i3=0; $i3<strlen($scope); $i3++) {
$key3 = $key2 . $scope{$i3};
print $key3.'<br>';
}
}
}

And it prints
a
aa
aaa
aab
aac
aad
aae
aaf
ab
aba
abb
abc
abd
abe
abf
ac
aca
acb
acc
acd
ace
acf
....

and so on...


and so on....-- "Ohjelmoija on organismi joka muuttaa kofeiinia
koodiksi" - lpkhttp://outolempi.net/ahdistus/ - Satunnaisesti pδivittyvδ
nettisarjisspam@outolempi.net || Gedoon-S @ IRCnet ||
rot13(xvzzb@bhgbyrzcv.arg)

[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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация