|There's more than one way to do things|
Fastest way to do permutations with replacementby wdef2 (Acolyte)
|on Apr 16, 2008 at 14:04 UTC||Need Help??|
wdef2 has asked for the
wisdom of the Perl Monks concerning the following question:
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:
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?