Repetition of a few characters shouldn't be too tough, you can split on a null string.
The patterns part is a bit tougher, a monk higher up the food chain may want to tackle that, but I'd suggest with low enough ratios for the different letters and individual letters, you will probably trap those problems.my @letters = split //, $pass; # get the letters into # an array my %lc = (); # initialize a hash for use in a count. foreach my $letter (@letters) { $lc{$letter}++; # count the occurrence of each letter } my @keys = keys %lc; get the individual characters used. if (($#keys+1)/length($foo) < .6) { # if there are less than 60% unique characters print "not enough different letters\n"; } my $ok = 1; # just a flag foreach my $key (@keys) { # check the frequency of individual letters. # if a character occurs more than 20% of the time, it is # no good. # an alternate way to do this would be to check the actual # occurrences of each character: # $ok = 0 if ($lc{$key} >= 2); $ok = 0 if ($lc{$key}/length($foo) > .2) } print "You have to have more different letters." unless $ok;
In reply to Re: Minimal password check, again
by saintbrie
in thread Minimal password check, again
by bronto
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |