viGuy,
I don't see this as un-ethical, but if the purpose is to provide a brute force crack against passwords - it is probably pretty silly. For instance - take a look at this thread for some numbers. If this is your goal, you would be much better off using a C compiled based program design for that effort. Even that is not un-ethical if the purpose is to ensure the integrity of the passwords of a given system you are responsible for the security of and you have ensured that it is legal. Since you didn't ask for that, I won't point you in the right direction.
Do you have something else in mind?
Cheers - L~R
Update: I was looking for an iterative solution an tye recommended Algorithm::Loops. Even though he hasn't uploaded it yet, the source is available here. My original sentiment stands, but this is how I would do it if I could think of a legitimate reason to do it.
#!/usr/bin/perl -w
use strict;
my @chars = ('a' .. 'z', 'A' .. 'Z', 0 .. 9);
my $length = 8;
my $get_combo = nestedLoops([ ([@chars]) x $length ]);
my @list;
while( @list= $get_combo->() ) {
print "@list\n";
}
# tye's nestedLoops code for future Algorithm::Loops
sub nestedLoops {
my( $loops, $params )= @_;
my $code= $params && $params->{Code};
my @list;
my $when= $params && $params->{OnlyWhen}
|| sub { @_ == @$loops };
my $i= -1;
my @idx;
my @vals= @$loops;
my $iter= sub {
while( 1 ) {
# Prepare to append one more value:
if( $i < $#$loops ) {
$idx[++$i]= -1;
$vals[$i]= $loops->[$i]->(@list)
if 'CODE' eq ref $loops->[$i];
}
# Increment furthest value, chopping if done there:
while( @{$vals[$i]} <= ++$idx[$i] ) {
# Return if all done:
return if --$i < 0;
pop @list;
}
$list[$i]= $vals[$i][$idx[$i]];
if( ! ref $when || $when->( @list ) ) {
return @list;
}
}
};
return $iter if ! $code;
while( $iter->() ) {
$code->( @list );
}
}
On my Mom's mediocre computer, this would take 555 years to complete - give or take a few months :-)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|