in reply to Re: gettin back crypted password
in thread gettin back crypted password
Now for the complexity analysis. Generating every string of up to length 8 with each character being chosen from a pool of 95 available will create (95**(8+1))-1 strings. By my math, that's 6634204312890624 strings...which is about 0.03% of your estimate. At a billion a second, this will take 19 years...a significant savings over 584!use strict; use warnings; use Math::BaseArith; my $max_length = 8; for(my $i = 0; $i < 95**$max_length; $i++) { my @base; if ($i) { #can't take log(0) @base = ("95") x (int((log $i) / (log 95))+1); } else { @base = ("95") x (int((log 1) / (log 95))+1); } my $num = encode($i, \@base); my $password = join('', map {chr($_+32)} @$num); }
P.S. I used ascii 32 - 126 because it was contiguous. I leave it as an exercise to the reader to add things like tab that can be typed in a keyboard but are not in that range. :-)
thor
Feel the white light, the light within
Be your own disciple, fan the sparks of will
For all of us waiting, your kingdom will come
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: gettin back crypted password
by Anonymous Monk on Mar 09, 2005 at 14:22 UTC | |
|
Re^3: gettin back crypted password
by 5mi11er (Deacon) on Mar 09, 2005 at 17:58 UTC | |
by thor (Priest) on Mar 09, 2005 at 19:46 UTC |