Post Reply 
(48) Password Generator
08-03-2014, 01:07 PM (This post was last modified: 08-04-2014 01:20 PM by Dave Britten.)
Post: #1
(48) Password Generator
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

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.
Visit this user's website Find all posts by this user
Quote this message in a reply
08-04-2014, 03:35 AM (This post was last modified: 08-04-2014 03:41 AM by Joe Horn.)
Post: #2
RE: (48) Password Generator
(08-03-2014 01:07 PM)Dave Britten Wrote:  
Code:
\<< DUP SIZE \-> L C S
  \<< "" 1 L
    START C RAND S * 1 + DUP SUB +
    NEXT
  \>>
\>>

Please note that the first character in the input string will have a greater probability of getting picked than any other, and the final one will have less probability, and sometimes the output will be shorter than L, since SUB rounds to the nearest integer. I therefore suggest replacing 1 + with CEIL. This evens out the probabilities, fixes the length bug, and is a tad shorter and faster too.

<0|ΙΈ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
08-04-2014, 11:28 AM
Post: #3
RE: (48) Password Generator
(08-04-2014 03:35 AM)Joe Horn Wrote:  
(08-03-2014 01:07 PM)Dave Britten Wrote:  
Code:
\<< DUP SIZE \-> L C S
  \<< "" 1 L
    START C RAND S * 1 + DUP SUB +
    NEXT
  \>>
\>>

Please note that the first character in the input string will have a greater probability of getting picked than any other, and the final one will have less probability, and sometimes the output will be shorter than L, since SUB rounds to the nearest integer. I therefore suggest replacing 1 + with CEIL. This evens out the probabilities, fixes the length bug, and is a tad shorter and faster too.

Thanks Joe, can't believe I missed that. I blame the fact that I'm in the hospital for a couple days, and was on pain medication when I wrote that. Wink
Visit this user's website Find all posts by this user
Quote this message in a reply
03-22-2017, 04:38 PM
Post: #4
RE: (48) Password Generator
This is a nice idea!

I will try to expand it in phonetic passwords, since a crude random password may be too difficult to type.


PS: a thing is that all the programs are according to a calculator but actually many calculators are compatible to each other, so I discard the non-50g threads while actually I miss many useful threads.

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)