The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Data::Password::Meter - Check the strength of passwords

SYNOPSIS

  my $pwdm = Data::Password::Meter->new(28);

  # Check a password
  if ($pwdm->strong('s3cur3-p4ssw0rd')) {
    print "The password is strong enough!\n";
    print 'Scored ' . $pwdm->score . ' points!';
  }
  else {
    warn $pwdm->errstr;
  };

DESCRIPTION

Check the strength of a password. The scoring is based on Passwordmeter by Steve Moitozo.

ATTRIBUTES

errstr

  print $pwdm->errstr;

The error string of the last failing check.

score

  print $pwdm->score;

The score of the last check.

threshold

  print $pwdm->threshold;
  $pwdm->threshold(28);

The scoring threshold, the determining factor when a password is too weak. Every password that is below this threshold is considered weak. Defaults to a score of 25.

METHODS

new

  my $pwd = Data::Password::Meter->new(28);

Constructs a new password check object. Accepts an optional value for the threshold.

strong

  if ($pwdm->strong('mypassword')) {
    print 'This password is strong!';
  }
  else {
    print 'This password is weak!';
  };

Checks a password for strength. Returns a false value in case the password is considered to be weak.

ERROR STRINGS

Possible error strings are:

  • There is no password given

  • Passwords are not allowed to contain control sequences

  • Passwords are not allowed to consist of repeating characters only

  • The password is too short

  • The password should contain special characters

  • The password should contain combinations of letters, numbers and special characters

  • The password is too short and should contain special characters

  • The password is too short and should contain combinations of letters, numbers and special characters

  • The password is too short, should contain special characters and should contain combinations of letters, numbers and special characters

  • The password should contain special characters and should contain combinations of letters, numbers and special characters

DEPENDENCIES

No dependencies other than core.

AVAILABILITY

  https://github.com/Akron/Data-Password-Meter

COPYRIGHT AND LICENSE

Copyright (C) 2006, Steve Moitozo, (C) 2013, Nils Diewald.

Licensed under the MIT License