1Data::Password::zxcvbn:U:sMeartcChoLnitsrti(b3u)ted PerlDaDtoac:u:mPeanstsawtoirodn::zxcvbn::MatchList(3)
2
3
4
6 Data::Password::zxcvbn::MatchList - a collection of matches for a
7 password
8
10 version 1.1.2
11
13 use Data::Password::zxcvbn::MatchList;
14
15 my $list = Data::Password::zxcvbn::MatchList->omnimatch($password)
16 ->most_guessable_match_list;
17
19 zxcvbn estimates the strength of a password by guessing which way a
20 generic password cracker would produce it, and then guessing after how
21 many tries it would produce it.
22
23 This class represents a list of guesses ("matches"), covering different
24 substrings of a password.
25
27 "password"
28 Required string, the password this list is about.
29
30 "matches"
31 Arrayref, the actual list of matches.
32
33 "guesses"
34 The estimated number of attempts that a generic password cracker would
35 need to guess the whole "password". This will be set for objects
36 returned by ""most_guessable_match_list"", not for those returned by
37 ""omnimatch"".
38
40 "omnimatch"
41 my $match_list = Data::Password::zxcvbn::MatchList->omnimatch($password,\%opts);
42
43 Main constructor (the name comes from the original JS implementation).
44 Calls "->make($password,\%opts)" on all the
45 "Data::Password::zxcvbn::Match::*" classes (or the ones in
46 "@{$opts{modules}}"), combines all the matches, and returns a
47 "MatchList" holding them.
48
49 "most_guessable_match_list"
50 my $minimal_list = $match_list->most_guessable_match_list;
51
52 This method extracts, from the "matches" of the invocant, a list of
53 non-overlapping matches with minimum guesses. That list should
54 represent the way that a generic password cracker would guess the
55 "password", and as such is the one that the main function will use.
56
57 "guesses_log10"
58 The logarithm in base 10 of ""guesses"".
59
60 "score"
61 my $score = $match_list->score;
62
63 Returns an integer from 0-4 (useful for implementing a strength bar).
64 See "Data::Password::zxcvbn::TimeEstimate::guesses_to_score".
65
66 "get_feedback"
67 my %feedback = %{ $match_list->get_feedback };
68
69 my %feedback = %{ $match_list->get_feedback($max_score_for_feedback) };
70
71 If there's no matches, returns the result of
72 ""feedback_for_no_matches"".
73
74 If the match list "score" is above $max_score_for_feedback (default 2),
75 returns the result of ""feedback_above_threshold"".
76
77 Otherwise, collects all the feedback from the "matches", and returns
78 it, merged with the result of ""feedback_below_threshold"" (suggestions
79 are appended, but the warning from the matches takes precendence).
80
81 "feedback_for_no_matches"
82 Returns a feedback for when the password didn't match any of our
83 heuristics. It contains no warning, and some simple common suggestions.
84
85 "feedback_above_threshold"
86 Returns a feedback for when the password scored above the threshold
87 passed to ""get_feedback"" (i.e. the password is "good"). It's an empty
88 feedback.
89
90 "feedback_below_threshold"
91 Returns a feedback for when the password scored below the threshold
92 passed to ""get_feedback"" (i.e. the password is "bad"). It suggests to
93 add some words.
94
96 Gianni Ceccarelli <gianni.ceccarelli@broadbean.com>
97
99 This software is copyright (c) 2022 by BroadBean UK, a CareerBuilder
100 Company.
101
102 This is free software; you can redistribute it and/or modify it under
103 the same terms as the Perl 5 programming language system itself.
104
105
106
107perl v5.38.0 2023-09-1D3ata::Password::zxcvbn::MatchList(3)