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

NAME

Data::Password::zxcvbn::MatchList - a collection of matches for a password

VERSION

version 1.0.1

SYNOPSIS

  use Data::Password::zxcvbn::MatchList;

  my $list = Data::Password::zxcvbn::MatchList->omnimatch($password)
              ->most_guessable_match_list;

DESCRIPTION

zxcvbn estimates the strength of a password by guessing which way a generic password cracker would produce it, and then guessing after how many tries it would produce it.

This class represents a list of guesses ("matches"), covering different substrings of a password.

ATTRIBUTES

password

Required string, the password this list is about.

matches

Arrayref, the actual list of matches.

guesses

The estimated number of attempts that a generic password cracker would need to guess the whole "password". This will be set for objects returned by "most_guessable_match_list", not for those returned by "omnimatch".

METHODS

omnimatch

  my $match_list = Data::Password::zxcvbn::MatchList->omnimatch($password,\%opts);

Main constructor (the name comes from the original JS implementation). Calls ->make($password,\%opts) on all the Data::Password::zxcvbn::Match::* classes (or the ones in @{$opts{modules}}), combines all the matches, and returns a MatchList holding them.

most_guessable_match_list

  my $minimal_list = $match_list->most_guessable_match_list;

This method extracts, from the "matches" of the invocant, a list of non-overlapping matches with minimum guesses. That list should represent the way that a generic password cracker would guess the "password", and as such is the one that the "Data::Password::zxcvbn/password_strength" in main function will use.

guesses_log10

The logarithm in base 10 of "guesses".

score

  my $score = $match_list->score;

Returns an integer from 0-4 (useful for implementing a strength bar). See Data::Password::zxcvbn::TimeEstimate::guesses_to_score.

get_feedback

  my %feedback = %{ $match_list->get_feedback };

Collects all the feedback from the "matches", and returns it.

AUTHOR

Gianni Ceccarelli <gianni.ceccarelli@broadbean.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by BroadBean UK, a CareerBuilder Company.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.