Suprtool

Simple Password Generator

Here is a real word password generator that selects words from Robelle's spelling dictionary to use as passwords. Say you want to generate 6-letter passwords. Suprtool's string pattern match can give you a list of 6-letter words sorted in alphabetical order.

Although Suprtool does not have a function that randomly selects from a list of words, it can select words based on these not-so-obvious algorithms:

The 3-step example below generates 50 passwords that are 6 characters long. To generate n-character long passwords, it uses n number of question marks (?) in the If command (step 1). To vary words, the example changes the first number in the Def Int commands (step 2), changes the ij or removes this check (step 2), or changes the number in the Input command (step 3). To generate a different number of passwords, the example changes the value of the Numrecs command (step 3).
  • Select all 6-character words from the dictionary:
        input  maincomm.spdata.robelle
        def    word,1,24
        if     word=="??????~"
               {pattern match on 6 characters followed by a space}
        out    word6
        xeq
    
    Randomize the list by converting one of the letters to an integer and sorting on it. This task also reduces the number of words in the list by comparing the integer representation of two letters.
        def i,6,2,int           {1st num can range from 1..n-1}
        def j,5,2,int           {1st num can range from 1..n-1}
        def k,3,2,int           {1st num can be 1..n-1, but 2..n-2 is better}
        in     word6
        if     i>j              {ij}
        sort   k
        ext    word
        purge  word6a
        out    word6a
        xeq
    
    Make a selection from the file--in this case every 43rd record to a maximum of 50 records.
        in      word6a(#43)
        numrecs 50
        purge   passwd
        out     passwd
        xeq
    
    Because these passwords come from a list of real words, you should review the final list to eliminate easy-to-guess words.

    Another method - harder-to-guess passwords

    In the section above, we showed you a Suprtool task that extracts a random list of n-letter words to use as passwords. Of course, some real-world situations require slightly harder-to-guess passwords that are also only slightly more difficult to remember. This time we will use a Suprtool task to simulate the telephone-book algorithm for generating passwords: open the phone book to a random page, point at a name, and use the first four letters of the name plus the last four digits of the phone number as the password (e.g., smit3681).

    1. Select words greater than four letters. In this example, we use words with 6 letters or more.
          input     maincomm.spdata.robelle
          define    word,1,24
          if        word == "??????@"   {n = number of ?'s, 5..16 }
          :purge    words
          output    words
          xeq
      
    2. Extract the first four letters and make up a "phone number" by treating part of the word as numeric data. The list of "passwords" is randomized by sorting on the nondisplayed portion of the word (i.e., beyond the first four letters).
          input     words
          define    word4,1,4           {4 letters}
          define    i,2,2,int           {start pos can range from 1..n-1}
          define    j,4,2,int           {start pos can range from 1..n-1}
          define    k,6,2,int           {start pos can range from 5..n-1}
          define    digits,1,4,display  {4 digits}
          sort      k
          extract   word4
          extract   digits = (i * j) mod 10000
          :purge    passwds
          output    passwds
          xeq
      
      The example shows fields i, j, and k starting at byte positions 2, 4, and 6, but you can choose any starting positions you like within the record.

    3. Find a random entry. Suprtool's Input command always selects the first record, so we need to select two records. It is the second record in the resulting file that is the password.
          :setvar   size finfo('passwds','eof') - 1
          :setvar    finger ((!hpconnsecs + !hpsusan) mod size) + 1
          :echo     input passwds(#!finger) >usefile
          use       usefile
          numrecs   2
          :purge    passwd
          output    passwd
          xeq
          :print    passwd;start=2
      
    [Paul Gobes and Dave Lo]

    ....Back to the Suprtool Q&A Page