in reply to Words without a Dictionary

If the intent is to make the passwords easier for users to remember, one trick is to alternate random consonants with random vowels, so they form an "almost word". However, even if you switch cases, and throw in some punctuation, this reduces the security of your password system by making it easier to brute-force search.

Replies are listed 'Best First'.
Re: Re: Words without a Dictionary
by Anonymous Monk on Jul 22, 2003 at 19:13 UTC
    Hi simonm, would you be able to show me how to do this? I am fairly new to perl and still learning the ropes. I wouldn't worry too much about it being hacked, as each user is responsible for changing their own password after the random one has been assigned, no users have any important data stored, keeping the easy password is 'at their own risk', and there would be no compramise to the main system even if an account was attacked (the important accounts all have 16 character long passwords with symbols).

      would you be able to show me how to do this?

      By the standards of the Perl Monks, it would be better for you to start by posting your current "totally random" code, and making at least a partial attempt to make the change, instead of just asking someone else to write your code for you.

      Nonetheless, here's some working example code. You could easily extend this to make the words longer, or add a list of punctuation characters to mix in, or randomly switch around between a few different patterns of words, like "CVCVC", "VCVCC", and "CVVCV".

      # Build arrays of vowels and consonants my @vowels = qw( a e i o u y ); my %vowels = map { $_ => 1 } @vowels; my @consns = grep { ! $vowels{$_} } ( 'a' .. 'z' ); # Also include uppercase letters push @vowels, map uc, @vowels; push @consns, map uc, @consns; # subroutine to pick a random entry from an array sub pick_one { my $array_ref = shift; return $array_ref->[ int rand( @$array_ref ) ]; } # Define a pattern of "CVCVC" my @syntax = ( \@consns, \@vowels, \@consns, \@vowels, \@consns ); # Do this part each time you need a new password foreach ( 1 .. 10 ) { # Generate a random psuedo-word my $word = join '', map { pick_one( $_ ) } @syntax; # Then do something with it... print "$word\n"; }