I've been assiting a co-forum member on the Damnsmalllinux forum with his project to test the hardness of his wifi key.

He was originally trying to brute force it in bash :=) and running out of memory, so some lines of Perl using the Algorithm::Permute module was a definite improvement, leaving aside for the time being that anything like this probably ought to be done in C or Assembly anyway. (In any case, the main bottleneck is the time it takes to try each perm on openssl.)

However - Algorithm::Permute does not seem to be able to properly do perms _with replacement_ - to get more than one occurence of a char in a set you have to feed it the set twice etc and you get some redundant perms output. Also, less importantly, it does not appear to be thread safe since if I write a threads implementation it segfaults (though that could be my skill level at fault!).

Algorithm::Loop looks like it can handle perms with replacement and seems to be Praised and Glorified on high by some monks:

http://search.cpan.org/~tyemq/Algorithm-Loops-1.031/lib/Algorithm/Loops.pm#Introduction

I don't think I saw any reference to thread safety and I don't know if this one is XScode.

Is Algorthm::Loops the way to go?


In reply to Fastest way to do permutations with replacement by wdef2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.