home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1332 < prev    next >
Internet Message Format  |  1990-12-28  |  3KB

  1. From: dave@lsuc.on.ca (David Sherman|LSUC|Toronto)
  2. Newsgroups: alt.security,alt.sources
  3. Subject: Re: automatic password creation
  4. Message-ID: <1990May13.224948.2139@lsuc.on.ca>
  5. Date: 13 May 90 22:49:48 GMT
  6.  
  7. hogan@csl.sri.com (Emmett Hogan) writes:
  8. >
  9. >On  one of our  OLD, ANCIENT, ARCHAIC  machines around  here  (so I am
  10. >told,  it  is  gone  now)  we used  to  have a  program that generated
  11. >nonsense passwords,  but used an  algorithm  that combined  vowels and
  12. >consonants in such a way as to make them pronounceable and thus easier
  13. >to  remember.  The user was  given a choice of three  or four of these
  14. >words to choose from when he/she wanted to change their password.   It
  15. >would be trivial to have the program check to make sure that it didn't
  16. >generate a "real" word by accident.
  17. >
  18. >Has anyone seen or written such a beast for UNIX systems?
  19.  
  20. I wrote this program in 1985.  It's called "genp" (generate passwords).
  21. We have about 1,200 new law students a year who need accounts, and we
  22. use genp to generate them.
  23.  
  24. ------------------ cut here, save as genp.c, and compile -----------
  25. /* genp - generate pronounceable passwords.
  26.  * David Sherman, The Law Society of Upper Canada, dave@lsuc.on.ca
  27.  */
  28.  
  29. #include <stdio.h>
  30.  
  31. char pwd[100];
  32. char *vowels[] =
  33. {
  34.     "a",
  35.     "e",
  36.     "i",
  37.     "o",
  38.     "u",
  39.     "y",
  40.     "ai",
  41.     "ou",
  42.     "oy",
  43.     "ay",
  44.     "ow",
  45.     "ar",
  46.     "al",
  47.     "el",
  48.     "er",
  49.     "or",
  50.     "ax",
  51.     "ex",
  52.     "ix",
  53.     "il",
  54.     0
  55. };
  56.  
  57. char *consonants[] =
  58. {
  59.     
  60.     "b",
  61.     "c",
  62.     "ch",
  63.     "d",
  64.     "dr",
  65.     "f",
  66.     "fl",
  67.     "g",
  68.     "h",
  69.     "j",
  70.     "k",
  71.     "kn",
  72.     "kr",
  73.     "m",
  74.     "n",
  75.     "p",
  76.     "s",
  77.     "sh",
  78.     "sm",
  79.     "sn",
  80.     "st",
  81.     "t",
  82.     "th",
  83.     "v",
  84.     "z",
  85.     0
  86. };
  87.  
  88.  
  89. main(argc, argv)
  90.     char **argv;
  91. {
  92.     register int maxvowels, maxcons;
  93.     int total;
  94.     register int r, i;
  95.     int j;
  96.     char **p;
  97. #define DEFTOTAL 50
  98.  
  99.     if(argc < 2)
  100.         total = DEFTOTAL;
  101.     else
  102.         total = atoi(argv[1]);
  103.     if(total < 1)
  104.         total = DEFTOTAL;
  105.  
  106.     for(p=vowels; *p; p++)
  107.         ;
  108.     maxvowels = p-vowels;
  109.  
  110.     for(p=consonants; *p; p++)
  111.         ;
  112.     maxcons = p-consonants;
  113.  
  114.  
  115.     srand(getpid());
  116.  
  117.     for(j=0; j<total; j++)
  118.     {
  119.         r = rand();
  120.         strcpy(pwd, consonants[r%maxcons]);
  121.         for(i=r%5; i>0; i--)
  122.             r = rand();
  123.         strcat(pwd, vowels[r%maxvowels]);
  124.         r = rand();
  125.         strcat(pwd, consonants[r%maxcons]);
  126.         for(i=r%7; i>0; i--)
  127.             r = rand();
  128.         strcat(pwd, vowels[r%maxvowels]);
  129.         r = rand();
  130.         strcat(pwd, consonants[r%maxcons]);
  131.         for(i=r%3; i>0; i--)
  132.             r = rand();
  133.         strcat(pwd, vowels[r%maxvowels]);
  134.         puts(pwd);
  135.     }
  136. }
  137. ------------------ cut here -----------------------------------------
  138. Sample passwords:
  139.  
  140. moypexcex
  141. caypeldai
  142. shipelpor
  143. malfyfay
  144. gaysnowthor
  145. powhousnai
  146. koydrosax
  147. howjerkar
  148. flyzilcai
  149. dipalfa
  150. >
  151. >What are your thoughts concerning such an approach to the password dilemma?
  152.  
  153. I have one concern.  If the program source is known, it's possible
  154. to predict the possible passwords -- there are only 30000 lists,
  155. using getpid() as the seed.  So, if you are planning on using this
  156. for passwords that matter (our student accounts can't do anything except
  157. take CAI courses), I'd recommend you make a minor change.  Add or delete
  158. an entry to or from the vowel or consonant lists, or change the number
  159. of times rand() is called in any of the lines above.  Then protect the source.
  160. (I've made such a change already before posting this:-)
  161.  
  162. David Sherman
  163. The Law Society of Upper Canada
  164. Toronto
  165. -- 
  166. Moderator, mail.yiddish
  167. { uunet!attcan  att  utzoo }!lsuc!dave          dave@lsuc.on.ca
  168.