[net.sources] quick gibberish password generator

dave@lsuc.UUCP (David Sherman) (01/24/85)

I'm sure there are better ways and better algorithms, but I
just had to install 1,000 accounts for our students. I wanted
passwords which are gibberish yet rememberable. The following program
generates passwords with alternating consonant and vowel sequences,
using "consonant" and "vowel" as defined in the tables.

Sample output:
$ genp 3
viflaver
douparster
flaxchewjay

Obviously, if you're really concerned about security you can
expand the consonant and vowel lists to your heart's content.
For security, you should also change the calls to rand()
along the way to depend on current time, since otherwise
there's a finite list (30000) of sets of passwords which can
be generated. Or keep the source hidden.

Oh yeah: if anyone wants the code to create and install the
accounts, generate the passwords and simultaneously print
an account/password form for each student, I can provide it.
But it's a qed script.


Dave Sherman
The Law Society of Upper Canada
Toronto
========== cut here: genp.c =====================
/*
 *	genp - password generator
 *
 *	Usage: genp N, where N is the number of passwords you want
 *
 *	David Sherman, The Law Society of Upper Canada, Toronto
 *	ihnp4!utzoo!lsuc!dave
 *	Dedicated to the public domain (please let me know if you
 *	use it and find it useful)
 *
 */
#include <stdio.h>

char pwd[100];
char *vowels[] =
{
	"a",
	"e",
	"i",
	"o",
	"u",
	"y",
	"ai",
	"ou",
	"oy",
	"ay",
	"ew",
	"ow",
	"ar",
	"al",
	"el",
	"er",
	"or",
	"ax",
	"ex",
	"ix",
	"il",
	0
};

char *consonants[] =
{
	
	"b",
	"c",
	"ch",
	"d",
	"dr",
	"f",
	"fl",
	"g",
	"h",
	"j",
	"k",
	"kn",
	"kr",
	"m",
	"n",
	"p",
	"s",
	"sh",
	"sm",
	"sn",
	"st",
	"t",
	"th",
	"v",
	"z",
	0
};


main(argc, argv)
	char **argv;
{
	register int maxvowels, maxcons;
	int total;
	register int r, i;
	int j;
	char **p;
#define DEFTOTAL 20

	if(argc < 2)
		total = DEFTOTAL;
	else
		total = atoi(argv[1]);
	if(total < 1)
		total = DEFTOTAL;

	for(p=vowels; *p; p++)
		;
	maxvowels = p-vowels;

	for(p=consonants; *p; p++)
		;
	maxcons = p-consonants;


	srand(getpid());

	for(j=0; j<total; j++)
	{
		r = rand();
		strcpy(pwd, consonants[r%maxcons]);
		for(i=r%7; i>0; i--)
			r = rand();
		strcat(pwd, vowels[r%maxvowels]);
		r = rand();
		strcat(pwd, consonants[r%maxcons]);
		for(i=r%5; i>0; i--)
			r = rand();
		strcat(pwd, vowels[r%maxvowels]);
		r = rand();
		strcat(pwd, consonants[r%maxcons]);
		for(i=r%3; i>0; i--)
			r = rand();
		strcat(pwd, vowels[r%maxvowels]);
		puts(pwd);
	}
}
========================================================
-- 
{utzoo pesnta nrcaero utcs}!lsuc!dave
{allegra decvax ihnp4 linus}!utcsrgv!lsuc!dave