Data::Password - Perl extension for assesing password quality.


Data::Password - Perl extension for assesing password quality.


        use Data::Password qw(IsBadPassword);
        print IsBadPassword("clearant");
        # Bad password - contains the word 'clear', only lowercase
        use Data::Password qw(:all);
        $DICTIONARY = 0;
        $GROUPS = 0;
        print IsBadPassword("clearant");


This modules checks potential passwords for crackability. It checks that the password is in the appropriate length, that it has enough character groups, that it does not contain the same chars repeatedly or ascending or descending characters, or charcters close to each other in the keyboard. It will also attempt to search the ispell word file for existance of whole words. The module's policies can be modified by changing its variables. (Check VARIABLES). For doing it, it is recommended to import the ':all' shortcut when requiring it:

use Data::Password qw(:all);


  1. IsBadPassword(password)

    Returns undef if the password is ok, or a textual description of the fault if any.

  2. IsBadPasswordForUNIX(user, password)

    Performs two additional checks: compares the password against the login name and the ``comment'' (ie, real name) found on the user file.



    Minimal length for dictionary words that are not allowed to appear in the password. Set to false to disable dictionary check.


    Maximal length of characters in a row to allow if the same or following. If $FOLLOWING_KEYBOARD is true (default), the module will also check for alphabetical keys following, according to the English keyboard layout. Set $FOLLOWING to false to bypass this check.

  3. $GROUPS

    Groups of characters are lowercase letters, uppercase letters, digits and the rest of the allowed characters. Set $GROUPS to the number of minimal character groups a password is required to have. Setting to false or to 1 will bypass the check.

  4. $MINLEN


    Minimum and maximum length of a password. Both can be set to false.


    Location where we are looking for dictionary files. You may want to set this variable if you are using not *NIX like operating system.



See the Data::Password::BasicCheck manpage if you need only basic password checking.


Raz Information Systems,,


Copyright (c) 2001, 2002, 2003, 2004 Raz Information Systems Ltd.

This package is distributed under the same terms as Perl itself, see the Artistic License on Perl's home page.

 Data::Password - Perl extension for assesing password quality.