Author Topic: Fun && frolics with password generators (a.k.a. A better mousetrap?)  (Read 2969 times)

Andrew Stephenson

  • Newbie
  • *
  • Posts: 20
  • Karma: +1/-0
    • View Profile
In another topic, "Copying text strings to AOS-5.1 clipboard in 'C'", I asked if anyone could guide me in programming copying text to the OS/2 clipboard. This got kicked around, with suggestions made for further reading (which I am still exploring, thanks all). Martin Iturbide wrote:

Quote
[...]  If you want to develop something, and don't mind sharing the source code, I would recommend you to post here your sample and what error/stopper you get, and see if we can help. [...]

I am still open to ideas about the clipboard.  Meanwhile, here's the help screen from a strictly-for-fun CLI  project, which caused the question, that I've been visualising for when I can get back to Real Programming -- a try at a better password generator.  If features ought to change, constructive criticisms are welcome.

HELP SCREEN FOR REVISED PASSWORD GENERATOR, 2023-11-17
----
PASSWORD 2.0 : Copyright (c) 2023 by Andrew Stephenson, free for non-profit use
Usage: PASSWORD  [<Modes>] [<MinSymQty> [<MaxSymQty> [<PwdQty>]]] [<XList>]
   [...]   optional items.  <Modes> and X/x act in turn, likewise <...Qty>s.
Password (pwd) symbols (syms) are ASCII printables. // LUDPSA toggle sym types ON/OFF.
ETGC set behaviours ON. // Sym types are...
   L or l   Lower case letters -- default qty = 26  )
   U or u   Upper case letters -- default qty = 26  )
   D or d   Digits -- default qty = 10              ) A or a : All of LUDPS
   P or p   Punctuation -- default qty = 21         )
   S or s   Separators /|\<>(){}[]                  )
If none of LUDPS is ON, LUD are set ON. Each 8 syms, or part of 8, causes inclusion of
at least one sym of each ON type. // Behaviours are...
   E or e   Exclude XList syms. Default = XList is ignored without this mode.
   T or t   Type of sym is chosen randomly, then sym is chosen randomly. Default =
      sym is chosen from a pool of used types (for different probabilities).
   G or g   Group pwd syms in blocks of 5, 10 blocks/line.
   C or c   [[coding hazy]] Copy pwd to clipboard with <PwdQty> forced = 1.
<MinSymQty>   Minimum sym qty. Range = 6..200, default = 8.
<MaxSymQty>   Maximum sym qty. Range = <MinSymQty>..200, default = <MinSymQty>.
<PwdQty>   How many pwds to generate. Range = 1..10, default = 1.
<XList>      X (or x) then a sym string. Default = XBDIOQSZbl| (digit look-alikes).
Examples:   "PASSWORD" works as "PASSWORD LUD 8 8 1".
      "PASSWORD p Xgreeps 9 d 15 L 7" works as "PASSWORD LDP 9 15 7 Xgreps".
----

New User is likely to test the generator with just "PASSWORD", which produces:
   PASSWORD 2.0 : Copyright (c) 2023 by Andrew Stephenson, free for non-profit use
   To see help screen, enter bad command -- eg "PASSWORD ?"
   ...then password appears

RNG = C 32-bit Galois m-sequence generator (see Wikipedia) seeded by 'clock_gettime()'.
High 16 bits are used for random number. This allows all-0 values; also, precision when
scaling greatest range (LUDPS w/o XList, 0..93) feels good enough. When seeding, RNG is
likely to be called once for each 1-bit in time's microseconds value.

Early on, the bits in an 'unsigned long' are counted. 32 or more is okay; anything less
causes a warning message plus the help screen (as above), then an exit.

A tricky algorithm discourages runs like "qqq", "321" or "567" without forbidding them.


Note Mode C (copy) which needs clipboard code for the password text: up to 201 chars of ASCII. The text is held in the same block of RAM that holds the Help Screen, which might only be displayed early in the program's execution, during parsing and reconciliation of the command line's elements

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4749
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Fun && frolics with password generators (a.k.a. A better mousetrap?)
« Reply #1 on: November 17, 2023, 10:34:43 pm »
Hello

It does not look bad for me. It is a lot of information for one screen in the command line, but I guess it will displayed in pieces for the user to click enter to continue.

I will try it  out when you decide it is ready.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.