08-03-2014, 01:07 PM
EDIT (Aug 4): Fixed a really stupid bug. Thanks Joe.
I needed to generate a WEP key to set up an access point for legacy gear, but didn't have a tool handy that would allow me to restrict the output to a 13-digit hexadecimal number. But I've got a 48, so that problem didn't last long!
Input:
2: Length of password
1: Allowable characters (enter as a single string, e.g. "0123456789ABCDEF")
Output:
1: Random password
Disclaimer: This is only as cryptographically secure as the quality of the random number generator built in to the 48. Don't use it for securing warheads or anything like that.
I needed to generate a WEP key to set up an access point for legacy gear, but didn't have a tool handy that would allow me to restrict the output to a 13-digit hexadecimal number. But I've got a 48, so that problem didn't last long!
Input:
2: Length of password
1: Allowable characters (enter as a single string, e.g. "0123456789ABCDEF")
Output:
1: Random password
Code:
\<< DUP SIZE \-> L C S
\<< "" 1 L
START C RAND S * CEIL DUP SUB +
NEXT
\>>
\>>
Disclaimer: This is only as cryptographically secure as the quality of the random number generator built in to the 48. Don't use it for securing warheads or anything like that.