Documentation

L33tMatch extends DictionaryMatch
in package

Class L33tMatch extends DictionaryMatch to translate l33t into dictionary words for matching.

Table of Contents

Constants

ALL_LOWER  = "/^[^A-Z]+\$/u"
ALL_UPPER  = "/^[^a-z]+\$/u"
END_UPPER  = "/^[^A-Z]+[A-Z]\$/u"
START_UPPER  = "/^[A-Z][^A-Z]+\$/u"

Properties

$begin  : mixed
$dictionaryName  : string
$end  : mixed
$l33t  : bool
$matchedWord  : string
$password  : mixed
$pattern  : mixed
$rank  : int
$reversed  : bool
$sub  : array<string|int, mixed>
$subDisplay  : string
$token  : mixed
$rankedDictionaries  : array<string|int, mixed>

Methods

__construct()  : mixed
binom()  : float
Calculate binomial coefficient (n choose k).
findAll()  : array<string|int, mixed>
Find all occurrences of regular expression in a string.
getFeedback()  : array{'warning': string, "suggestions": string[]}
Get feedback to a user based on the match.
getFeedbackWarning()  : string
getGuesses()  : float
getGuessesLog10()  : float
match()  : array<string|int, L33tMatch>
Match occurences of l33t words in password to dictionary words.
dictionaryMatch()  : array<string|int, mixed>
Attempts to find the provided password (as well as all possible substrings) in a dictionary.
getL33tSubstitutions()  : array<string|int, mixed>
getL33tSubtable()  : array<string|int, mixed>
getL33tTable()  : array<string|int, mixed>
getL33tVariations()  : float
getMinimumGuesses()  : float
getRankedDictionaries()  : array<string|int, mixed>
Load ranked frequency dictionaries.
getRawGuesses()  : float
getUppercaseVariations()  : float
substitutionTableHelper()  : array<string|int, mixed>
translate()  : string

Constants

Properties

$dictionaryName

public string $dictionaryName

The name of the dictionary that the token was found in.

$l33t

public bool $l33t = true

Whether or not the token contained l33t substitutions.

$matchedWord

public string $matchedWord

The word that was matched from the dictionary.

$reversed

public bool $reversed = false

Whether or not the matched word was reversed in the token.

$sub

public array<string|int, mixed> $sub = []

An array of substitutions made to get from the token to the dictionary word.

$subDisplay

public string $subDisplay

A user-readable string that shows which substitutions were detected.

$rankedDictionaries

protected static array<string|int, mixed> $rankedDictionaries = []

A cache of the frequency_lists json file

Methods

__construct()

public __construct(string $password, int $begin, int $end, string $token[, array<string|int, mixed> $params = [] ]) : mixed
Parameters
$password : string
$begin : int
$end : int
$token : string
$params : array<string|int, mixed> = []

An array with keys: [sub, sub_display].

binom()

Calculate binomial coefficient (n choose k).

public static binom(int $n, int $k) : float
Parameters
$n : int
$k : int
Return values
float

findAll()

Find all occurrences of regular expression in a string.

public static findAll(string $string, string $regex[, int $offset = 0 ]) : array<string|int, mixed>
Parameters
$string : string

String to search.

$regex : string

Regular expression with captures.

$offset : int = 0
Return values
array<string|int, mixed>

Array of capture groups. Captures in a group have named indexes: 'begin', 'end', 'token'. e.g. fishfish /(fish)/ array( array( array('begin' => 0, 'end' => 3, 'token' => 'fish'), array('begin' => 0, 'end' => 3, 'token' => 'fish') ), array( array('begin' => 4, 'end' => 7, 'token' => 'fish'), array('begin' => 4, 'end' => 7, 'token' => 'fish') ) )

getFeedback()

Get feedback to a user based on the match.

public getFeedback(bool $isSoleMatch) : array{'warning': string, "suggestions": string[]}
Parameters
$isSoleMatch : bool

Whether this is the only match in the password

Return values
array{'warning': string, "suggestions": string[]}

getFeedbackWarning()

public getFeedbackWarning(bool $isSoleMatch) : string
Parameters
$isSoleMatch : bool
Return values
string

getGuesses()

public getGuesses() : float
Return values
float

getGuessesLog10()

public getGuessesLog10() : float
Return values
float

match()

Match occurences of l33t words in password to dictionary words.

public static match(string $password[, array<string|int, mixed> $userInputs = [] ][, array<string|int, mixed> $rankedDictionaries = [] ]) : array<string|int, L33tMatch>
Parameters
$password : string
$userInputs : array<string|int, mixed> = []
$rankedDictionaries : array<string|int, mixed> = []
Return values
array<string|int, L33tMatch>

dictionaryMatch()

Attempts to find the provided password (as well as all possible substrings) in a dictionary.

protected static dictionaryMatch(string $password, array<string|int, mixed> $dict) : array<string|int, mixed>
Parameters
$password : string
$dict : array<string|int, mixed>
Return values
array<string|int, mixed>

getL33tSubstitutions()

protected static getL33tSubstitutions(array<string|int, mixed> $subtable) : array<string|int, mixed>
Parameters
$subtable : array<string|int, mixed>
Return values
array<string|int, mixed>

getL33tSubtable()

protected static getL33tSubtable(string $password) : array<string|int, mixed>
Parameters
$password : string
Return values
array<string|int, mixed>

getL33tTable()

protected static getL33tTable() : array<string|int, mixed>
Return values
array<string|int, mixed>

getL33tVariations()

protected getL33tVariations() : float
Return values
float

getMinimumGuesses()

protected getMinimumGuesses() : float
Return values
float

getRankedDictionaries()

Load ranked frequency dictionaries.

protected static getRankedDictionaries() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRawGuesses()

protected getRawGuesses() : float
Return values
float

getUppercaseVariations()

protected getUppercaseVariations() : float
Return values
float

substitutionTableHelper()

protected static substitutionTableHelper(array<string|int, mixed> $table, array<string|int, mixed> $keys, array<string|int, mixed> $subs) : array<string|int, mixed>
Parameters
$table : array<string|int, mixed>
$keys : array<string|int, mixed>
$subs : array<string|int, mixed>
Return values
array<string|int, mixed>

translate()

protected static translate(string $string, array<string|int, mixed> $map) : string
Parameters
$string : string
$map : array<string|int, mixed>
Return values
string

        
On this page

Search results