note
Limbic~Region
[viGuy],
<br>
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 [252378|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 <b>and</b> you have ensured that it is legal. Since you didn't ask for that, I won't point you in the right [http://www.google.com|direction].
<p>
Do you have something else in mind?
<p>
Cheers - [Limbic~Region|L~R]
<p>
<b>Update:</b> I was looking for an iterative solution an [tye] recommended [cpan://Algorithm::Loops]. Even though he hasn't uploaded it yet, the source is available [249979|here]. My original sentiment stands, but this is how I would do it if I could think of a legitimate reason to do it.
<readmore>
<code>
#!/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 );
}
}
</code>
</readmore>
<p>
On my Mom's mediocre computer, this would take 555 years to complete - give or take a few months :-)
285933
285933