Assuming you have traditional, 8 character passwords:
sub decrypt {
my $crypted = shift;
my $str = "";
foreach my $s1 (0 .. 255) {
my $str = $str . chr $s1;
foreach my $s2 (0 .. 255) {
my $str = $str . chr $s2;
foreach my $s3 (0 .. 255) {
my $str = $str . chr $3;
foreach my $s4 (0 .. 255) {
my $str = $str . chr $4;
foreach my $s5 (0 .. 255) {
my $str = $str . chr $5;
foreach my $s6 (0 .. 255) {
my $str = $str . chr $6;
foreach my $s7 (0 .. 255) {
my $str = $str . chr $7;
foreach my $s8 (0 .. 255) {
my $str = $str . $chr $8;
if ($cryped eq crypt($str, $crypted)) {
return $str
}
}
}
}
}
}
}
}
}
}
This will take at most 18446744073709551616 tries. If you do a billion of them per second, it only takes about 584 years at most. Less 293 years expected!
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, details, 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, summary, 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.