On Fri, 9 Nov 2007, Stuart Guthrie wrote:
Field that must have 2 out of 3 of these:

standard a-z/A-Z
arabic numbers 0-9
special chars %$#@

What's wrong with brute force?

bool password_characters_good_choice(char *s) {
  int matches;

  matches = (match("abcdefghijklmnopqrstuvwxyz", s) +
             match("ABCDEFGHIJKLMNOPQRSTUVWXYZ", s) > 0);
  matches += (match("0123456789", s) > 0);
  matches += (match("%$#@", s) > 0);
  return (matches > 2);
}

where match(s1, s2) returns the number of occurances of
the characters of s1 in s2. That's pretty easy to implement
and is a prewritten function in a lot of languages.

Cheers, Glen
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to