PRCYCoin  2.0.0.7rc1
P2P Digital Currency
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
zxcvbn Namespace Reference

Namespaces

 _frequency_lists
 
 optional
 
 util
 

Classes

struct  AttackTimes
 
struct  BruteforceMatch
 
struct  DateMatch
 
struct  DictionaryMatch
 
struct  DMY
 
struct  Feedback
 
class  Match
 
struct  pattern_type_to_pmc
 
struct  PortableRegexMatch
 
struct  RegexMatch
 
struct  RepeatMatch
 
struct  ScoringResult
 
struct  SequenceMatch
 
struct  SpatialMatch
 
struct  UnknownMatch
 
struct  ZxcvbnResult
 

Typedefs

using Graph = std::unordered_map< std::string, std::vector< optional::optional< std::string > >>
 
using Graphs = std::unordered_map< GraphTag, Graph >
 
using degree_t = double
 
using guesses_t = zxcvbn_guesses_t
 
using guesses_log10_t = int
 
using score_t = unsigned
 
using idx_t = std::string::size_type
 
using DictionaryTag = _frequency_lists::DictionaryTag
 
using RankedDicts = std::unordered_map< DictionaryTag, const RankedDict & >
 
using rank_t = std::size_t
 
using RankedDict = std::unordered_map< std::string, rank_t >
 
using date_t = unsigned
 
using time_t = double
 

Enumerations

enum  GraphTag { GraphTag::QWERTY, GraphTag::DVORAK, GraphTag::KEYPAD, GraphTag::MAC_KEYPAD }
 
enum  RegexTag { RegexTag::RECENT_YEAR, RegexTag::ALPHA_LOWER, RegexTag::ALPHANUMERIC }
 
enum  SequenceTag { SequenceTag::UPPER, SequenceTag::LOWER, SequenceTag::DIGITS, SequenceTag::UNICODE }
 
enum  MatchPattern
 

Functions

const Graphsgraphs ()
 
Feedback get_feedback (score_t score, const std::vector< Match > &sequence)
 
RankedDicts convert_to_ranked_dicts (std::unordered_map< DictionaryTag, RankedDict > &ranked_dicts)
 
RankedDicts default_ranked_dicts ()
 
template<class T >
RankedDict build_ranked_dict (const T &ordered_list)
 
std::vector< Matchomnimatch (const std::string &password, const std::vector< std::string > &ordered_list)
 
std::vector< Matchdictionary_match (const std::string &password, const RankedDicts &ranked_dictionaries)
 
std::vector< Matchreverse_dictionary_match (const std::string &password, const RankedDicts &ranked_dictionaries)
 
std::unordered_map< std::string, std::vector< std::string > > relevant_l33t_subtable (const std::string &password, const std::vector< std::pair< std::string, std::vector< std::string >>> &table)
 
std::vector< std::unordered_map< std::string, std::string > > enumerate_l33t_subs (const std::unordered_map< std::string, std::vector< std::string >> &table)
 
std::vector< Matchl33t_match (const std::string &password, const RankedDicts &ranked_dictionaries, const std::vector< std::pair< std::string, std::vector< std::string >>> &l33t_table)
 
std::vector< Matchspatial_match (const std::string &password, const Graphs &graphs)
 
std::vector< Matchrepeat_match (const std::string &password)
 
std::vector< Matchsequence_match (const std::string &password)
 
std::vector< Matchregex_match (const std::string &password, const std::vector< std::pair< RegexTag, std::regex >> &regexen)
 
std::vector< Matchdate_match (const std::string &password)
 
template<class Tret , class Tin >
Tret factorial (Tin n)
 
ScoringResult most_guessable_match_sequence (const std::string &password, std::vector< Match > &matches, bool exclude_additive)
 
guesses_t estimate_guesses (Match &match, const std::string &password)
 
guesses_t unknown_guesses (const Match &match)
 
guesses_t bruteforce_guesses (const Match &match)
 
guesses_t repeat_guesses (const Match &match)
 
guesses_t sequence_guesses (const Match &match)
 
guesses_t regex_guesses (const Match &match)
 
guesses_t date_guesses (const Match &match)
 
guesses_t spatial_guesses (const Match &match)
 
guesses_t dictionary_guesses (const Match &match)
 
guesses_t uppercase_variations (const Match &match)
 
guesses_t l33t_variations (const Match &match)
 
template<class T >
nCk (T n, T k)
 
 MATCH_RUN ()
 
AttackTimes estimate_attack_times (guesses_t guesses)
 
ZxcvbnResult zxcvbn (const std::string &password, const std::vector< std::string > &user_inputs)
 

Variables

const auto no = optional::nullopt
 
const Graphs _graphs
 
const degree_t KEYBOARD_AVERAGE_DEGREE = calc_average_degree(_graphs.at(GraphTag::QWERTY))
 
const degree_t KEYPAD_AVERAGE_DEGREE = calc_average_degree(_graphs.at(GraphTag::KEYPAD))
 
const std::size_t KEYBOARD_STARTING_POSITIONS = _graphs.at(GraphTag::QWERTY).size()
 
const std::size_t KEYPAD_STARTING_POSITIONS = _graphs.at(GraphTag::KEYPAD).size()
 
const Feedback DEFAULT_FEEDBACK
 
const std::vector< std::pair< std::string, std::vector< std::string > > > L33T_TABLE
 
const std::vector< std::pair< RegexTag, std::regex > > REGEXEN
 
const auto DATE_MAX_YEAR = 2050
 
const auto DATE_MIN_YEAR = 1000
 
constexpr std::initializer_list< std::pair< int, int > > DATE_SPLITS []
 
const auto SHIFTED_RX = std::regex("[~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:\"ZXCVBNM<>?]")
 
const auto MAX_DELTA = 5
 
const auto BRUTEFORCE_CARDINALITY = static_cast<guesses_t>(10)
 
const auto MIN_GUESSES_BEFORE_GROWING_SEQUENCE = static_cast<guesses_t>(10000)
 
const auto MIN_SUBMATCH_GUESSES_SINGLE_CHAR = static_cast<guesses_t>(10)
 
const auto MIN_SUBMATCH_GUESSES_MULTI_CHAR = static_cast<guesses_t>(50)
 
const auto START_UPPER = std::regex(R"(^[A-Z][^A-Z]+$)")
 
const auto END_UPPER = std::regex(R"(^[^A-Z]+[A-Z]$)")
 
const auto ALL_UPPER = std::regex(R"(^[^a-z]+$)")
 
const auto ALL_LOWER = std::regex(R"(^[^A-Z]+$)")
 
const guesses_t MIN_YEAR_SPACE = 20
 
const auto REFERENCE_YEAR = 2016
 

Typedef Documentation

◆ date_t

using zxcvbn::date_t = typedef unsigned

Definition at line 634 of file matching.cpp.

◆ degree_t

using zxcvbn::degree_t = typedef double

Definition at line 42 of file adjacency_graphs.hpp.

◆ DictionaryTag

Definition at line 13 of file frequency_lists.hpp.

◆ Graph

using zxcvbn::Graph = typedef std::unordered_map<std::string, std::vector<optional::optional<std::string> >>

Definition at line 38 of file adjacency_graphs.hpp.

◆ Graphs

using zxcvbn::Graphs = typedef std::unordered_map<GraphTag, Graph>

Definition at line 39 of file adjacency_graphs.hpp.

◆ guesses_log10_t

using zxcvbn::guesses_log10_t = typedef int

Definition at line 16 of file common.hpp.

◆ guesses_t

Definition at line 15 of file common.hpp.

◆ idx_t

using zxcvbn::idx_t = typedef std::string::size_type

Definition at line 18 of file common.hpp.

◆ rank_t

using zxcvbn::rank_t = typedef std::size_t

Definition at line 12 of file frequency_lists_common.hpp.

◆ RankedDict

using zxcvbn::RankedDict = typedef std::unordered_map<std::string, rank_t>

Definition at line 13 of file frequency_lists_common.hpp.

◆ RankedDicts

using zxcvbn::RankedDicts = typedef std::unordered_map<DictionaryTag, const RankedDict &>

Definition at line 30 of file frequency_lists.hpp.

◆ score_t

using zxcvbn::score_t = typedef unsigned

Definition at line 17 of file common.hpp.

◆ time_t

using zxcvbn::time_t = typedef double

Definition at line 10 of file time_estimates.hpp.

Enumeration Type Documentation

◆ GraphTag

enum zxcvbn::GraphTag
strong
Enumerator
QWERTY 
DVORAK 
KEYPAD 
MAC_KEYPAD 

Definition at line 16 of file adjacency_graphs.hpp.

◆ MatchPattern

enum zxcvbn::MatchPattern
strong

Definition at line 62 of file common.hpp.

◆ RegexTag

enum zxcvbn::RegexTag
strong
Enumerator
RECENT_YEAR 
ALPHA_LOWER 
ALPHANUMERIC 

Definition at line 31 of file common.hpp.

◆ SequenceTag

enum zxcvbn::SequenceTag
strong
Enumerator
UPPER 
LOWER 
DIGITS 
UNICODE 

Definition at line 37 of file common.hpp.

Function Documentation

◆ bruteforce_guesses()

guesses_t zxcvbn::bruteforce_guesses ( const Match match)

Definition at line 298 of file scoring.cpp.

◆ build_ranked_dict()

template<class T >
RankedDict zxcvbn::build_ranked_dict ( const T &  ordered_list)

Definition at line 16 of file frequency_lists_common.hpp.

Here is the caller graph for this function:

◆ convert_to_ranked_dicts()

RankedDicts zxcvbn::convert_to_ranked_dicts ( std::unordered_map< DictionaryTag, RankedDict > &  ranked_dicts)

Definition at line 9 of file frequency_lists.cpp.

Here is the caller graph for this function:

◆ date_guesses()

guesses_t zxcvbn::date_guesses ( const Match match)

Definition at line 372 of file scoring.cpp.

◆ date_match()

std::vector< Match > zxcvbn::date_match ( const std::string &  password)

Definition at line 648 of file matching.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ default_ranked_dicts()

RankedDicts zxcvbn::default_ranked_dicts ( )

Definition at line 19 of file frequency_lists.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dictionary_guesses()

guesses_t zxcvbn::dictionary_guesses ( const Match match)

Definition at line 434 of file scoring.cpp.

Here is the call graph for this function:

◆ dictionary_match()

std::vector< Match > zxcvbn::dictionary_match ( const std::string &  password,
const RankedDicts ranked_dictionaries 
)

Definition at line 143 of file matching.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ enumerate_l33t_subs()

std::vector< std::unordered_map< std::string, std::string > > zxcvbn::enumerate_l33t_subs ( const std::unordered_map< std::string, std::vector< std::string >> &  table)

Definition at line 221 of file matching.cpp.

Here is the caller graph for this function:

◆ estimate_attack_times()

AttackTimes zxcvbn::estimate_attack_times ( guesses_t  guesses)

Definition at line 20 of file time_estimates.cpp.

◆ estimate_guesses()

guesses_t zxcvbn::estimate_guesses ( Match match,
const std::string &  password 
)

Definition at line 273 of file scoring.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ factorial()

template<class Tret , class Tin >
Tret zxcvbn::factorial ( Tin  n)

Definition at line 31 of file scoring.cpp.

◆ get_feedback()

Feedback zxcvbn::get_feedback ( score_t  score,
const std::vector< Match > &  sequence 
)

Definition at line 26 of file feedback.cpp.

◆ graphs()

const Graphs & zxcvbn::graphs ( )

Definition at line 270 of file adjacency_graphs.cpp.

Here is the caller graph for this function:

◆ l33t_match()

std::vector< Match > zxcvbn::l33t_match ( const std::string &  password,
const RankedDicts ranked_dictionaries,
const std::vector< std::pair< std::string, std::vector< std::string >>> &  l33t_table 
)

Definition at line 280 of file matching.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ l33t_variations()

guesses_t zxcvbn::l33t_variations ( const Match match)

Definition at line 475 of file scoring.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MATCH_RUN()

zxcvbn::MATCH_RUN ( )
Here is the caller graph for this function:

◆ most_guessable_match_sequence()

ScoringResult zxcvbn::most_guessable_match_sequence ( const std::string &  password,
std::vector< Match > &  matches,
bool  exclude_additive 
)
Todo:
: we store bruteforce matches in this vector so that we can

Definition at line 93 of file scoring.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nCk()

template<class T >
T zxcvbn::nCk ( n,
k 
)

Definition at line 31 of file scoring.hpp.

Here is the caller graph for this function:

◆ omnimatch()

std::vector< Match > zxcvbn::omnimatch ( const std::string &  password,
const std::vector< std::string > &  ordered_list 
)

Definition at line 109 of file matching.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ regex_guesses()

guesses_t zxcvbn::regex_guesses ( const Match match)

Definition at line 340 of file scoring.cpp.

◆ regex_match()

std::vector< Match > zxcvbn::regex_match ( const std::string &  password,
const std::vector< std::pair< RegexTag, std::regex >> &  regexen 
)

Definition at line 603 of file matching.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ relevant_l33t_subtable()

std::unordered_map< std::string, std::vector< std::string > > zxcvbn::relevant_l33t_subtable ( const std::string &  password,
const std::vector< std::pair< std::string, std::vector< std::string >>> &  table 
)

Definition at line 201 of file matching.cpp.

Here is the caller graph for this function:

◆ repeat_guesses()

guesses_t zxcvbn::repeat_guesses ( const Match match)

Definition at line 308 of file scoring.cpp.

◆ repeat_match()

std::vector< Match > zxcvbn::repeat_match ( const std::string &  password)

Definition at line 443 of file matching.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reverse_dictionary_match()

std::vector< Match > zxcvbn::reverse_dictionary_match ( const std::string &  password,
const RankedDicts ranked_dictionaries 
)

Definition at line 175 of file matching.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sequence_guesses()

guesses_t zxcvbn::sequence_guesses ( const Match match)

Definition at line 312 of file scoring.cpp.

Here is the call graph for this function:

◆ sequence_match()

std::vector< Match > zxcvbn::sequence_match ( const std::string &  password)

Definition at line 512 of file matching.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spatial_guesses()

guesses_t zxcvbn::spatial_guesses ( const Match match)

Definition at line 392 of file scoring.cpp.

Here is the call graph for this function:

◆ spatial_match()

std::vector< Match > zxcvbn::spatial_match ( const std::string &  password,
const Graphs graphs 
)

Definition at line 337 of file matching.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unknown_guesses()

guesses_t zxcvbn::unknown_guesses ( const Match match)

Definition at line 293 of file scoring.cpp.

◆ uppercase_variations()

guesses_t zxcvbn::uppercase_variations ( const Match match)

Definition at line 442 of file scoring.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ zxcvbn()

ZxcvbnResult zxcvbn::zxcvbn ( const std::string &  password,
const std::vector< std::string > &  user_inputs 
)

Variable Documentation

◆ _graphs

const Graphs zxcvbn::_graphs

Definition at line 19 of file adjacency_graphs.cpp.

◆ ALL_LOWER

const auto zxcvbn::ALL_LOWER = std::regex(R"(^[^A-Z]+$)")

Definition at line 17 of file scoring.hpp.

◆ ALL_UPPER

const auto zxcvbn::ALL_UPPER = std::regex(R"(^[^a-z]+$)")

Definition at line 16 of file scoring.hpp.

◆ BRUTEFORCE_CARDINALITY

const auto zxcvbn::BRUTEFORCE_CARDINALITY = static_cast<guesses_t>(10)

Definition at line 25 of file scoring.cpp.

◆ DATE_MAX_YEAR

const auto zxcvbn::DATE_MAX_YEAR = 2050

Definition at line 45 of file matching.cpp.

◆ DATE_MIN_YEAR

const auto zxcvbn::DATE_MIN_YEAR = 1000

Definition at line 46 of file matching.cpp.

◆ DATE_SPLITS

constexpr std::initializer_list<std::pair<int, int> > zxcvbn::DATE_SPLITS[]
constexpr
Initial value:
= {
{
{1, 2},
{2, 3},
},
{
{1, 3},
{2, 3},
},
{
{1, 2},
{2, 4},
{4, 5},
},
{
{1, 3},
{2, 3},
{4, 5},
{4, 6},
},
{
{2, 4},
{4, 6},
},
}

Definition at line 47 of file matching.cpp.

◆ DEFAULT_FEEDBACK

const Feedback zxcvbn::DEFAULT_FEEDBACK
Initial value:
= {
"",
{
"Use a few words, avoid common phrases",
"No need for symbols, digits, or uppercase letters",
},
}

Definition at line 12 of file feedback.cpp.

◆ END_UPPER

const auto zxcvbn::END_UPPER = std::regex(R"(^[^A-Z]+[A-Z]$)")

Definition at line 15 of file scoring.hpp.

◆ KEYBOARD_AVERAGE_DEGREE

const degree_t zxcvbn::KEYBOARD_AVERAGE_DEGREE = calc_average_degree(_graphs.at(GraphTag::QWERTY))

Definition at line 44 of file adjacency_graphs.hpp.

◆ KEYBOARD_STARTING_POSITIONS

const std::size_t zxcvbn::KEYBOARD_STARTING_POSITIONS = _graphs.at(GraphTag::QWERTY).size()

Definition at line 47 of file adjacency_graphs.hpp.

◆ KEYPAD_AVERAGE_DEGREE

const degree_t zxcvbn::KEYPAD_AVERAGE_DEGREE = calc_average_degree(_graphs.at(GraphTag::KEYPAD))

Definition at line 45 of file adjacency_graphs.hpp.

◆ KEYPAD_STARTING_POSITIONS

const std::size_t zxcvbn::KEYPAD_STARTING_POSITIONS = _graphs.at(GraphTag::KEYPAD).size()

Definition at line 48 of file adjacency_graphs.hpp.

◆ L33T_TABLE

const std::vector< std::pair< std::string, std::vector< std::string > > > zxcvbn::L33T_TABLE
Initial value:
= {
{"a", {"4", "@"}},
{"b", {"8"}},
{"c", {"(", "{", "[", "<"}},
{"e", {"3"}},
{"g", {"6", "9"}},
{"i", {"1", "!", "|"}},
{"l", {"1", "|", "7"}},
{"o", {"0"}},
{"s", {"$", "5"}},
{"t", {"+", "7"}},
{"x", {"%"}},
{"z", {"2"}},
}
Todo:
: make this a constexpr

Definition at line 13 of file matching.hpp.

◆ MAX_DELTA

const auto zxcvbn::MAX_DELTA = 5

Definition at line 511 of file matching.cpp.

◆ MIN_GUESSES_BEFORE_GROWING_SEQUENCE

const auto zxcvbn::MIN_GUESSES_BEFORE_GROWING_SEQUENCE = static_cast<guesses_t>(10000)

Definition at line 26 of file scoring.cpp.

◆ MIN_SUBMATCH_GUESSES_MULTI_CHAR

const auto zxcvbn::MIN_SUBMATCH_GUESSES_MULTI_CHAR = static_cast<guesses_t>(50)

Definition at line 28 of file scoring.cpp.

◆ MIN_SUBMATCH_GUESSES_SINGLE_CHAR

const auto zxcvbn::MIN_SUBMATCH_GUESSES_SINGLE_CHAR = static_cast<guesses_t>(10)

Definition at line 27 of file scoring.cpp.

◆ MIN_YEAR_SPACE

const guesses_t zxcvbn::MIN_YEAR_SPACE = 20

Definition at line 19 of file scoring.hpp.

◆ no

const auto zxcvbn::no = optional::nullopt

Definition at line 17 of file adjacency_graphs.cpp.

◆ REFERENCE_YEAR

const auto zxcvbn::REFERENCE_YEAR = 2016

Definition at line 20 of file scoring.hpp.

◆ REGEXEN

const std::vector< std::pair< RegexTag, std::regex > > zxcvbn::REGEXEN
Initial value:
= {
{RegexTag::RECENT_YEAR, std::regex(R"(19\d\d|200\d|201\d)")},
}
Todo:
: make this constexpr

Definition at line 14 of file matching.hpp.

◆ SHIFTED_RX

const auto zxcvbn::SHIFTED_RX = std::regex("[~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:\"ZXCVBNM<>?]")

Definition at line 347 of file matching.cpp.

◆ START_UPPER

const auto zxcvbn::START_UPPER = std::regex(R"(^[A-Z][^A-Z]+$)")

Definition at line 14 of file scoring.hpp.