SiriusStarr / elm-password-strength / ZxcvbnPlus.MatchTypes

This module is not necessary for normal use of the ZxcvbnPlus module; instead, it contains the types necessary for examining the actual matches in the most-guessable sequence contained in ZxcvbnPlusResult.matchSequence.

Match Types


type alias ScoredMatch =
{ pattern : MatchDetails
, token : String
, i : Basics.Int
, j : Basics.Int
, guesses : Basics.Int 
}

A match for which estimated guesses have been calculated.


type MatchDetails
    = DictionaryMatch ({ dictionaryDetails : DictionaryDetails, dictionary : Dictionary, rank : Basics.Int, matchedWord : String })
    | KeyAdjacencyMatch ({ layout : KeyboardLayout, turns : Basics.Int, shiftedKeys : Basics.Int })
    | OrdinalSequenceMatch ({ sequence : OrdinalSequence, delta : Basics.Int, obviousStart : Basics.Bool })
    | RepeatMatch ({ baseToken : String, baseGuesses : Basics.Int, baseMatchSequence : List ScoredMatch, repeatCount : Basics.Int })
    | DateMatch ({ dateDetails : DateDetails, year : Basics.Int })
    | BruteforceMatch

MatchDetails type to specify the type and details of a specific match.

Dictionary Match Specific


type DictionaryDetails
    = NormalDictionary
    | ReverseDictionary
    | L33tDictionary (Dict Char Char)

DictionaryDetails specifies which kind of dictionary match a specific match is and any other relevant details (e.g. which substitutions were made for l33t matches).


type Dictionary
    = CommonPassword
    | EnglishWord EnglishSource
    | Name NameType
    | UserPattern

The source for a dictionary match.


type EnglishSource
    = Wikipedia
    | TvAndFilm

The frequency list against which an English word was matched.


type NameType
    = Surname
    | MaleName
    | FemaleName

The type of name (e.g. surname, female given name, etc.) a common name is.

Date Match Specific


type DateDetails
    = RecentYear
    | FullDate ({ separator : Maybe Char, month : Basics.Int, day : Basics.Int })

The specific details for a date match.

Key Adjacency Match Specific


type KeyboardLayout
    = Qwerty
    | Dvorak
    | Keypad
    | MacKeypad

The specific keyboard layout a key adjacency match was made against.

Ordinal Sequence Specific


type OrdinalSequence
    = UppercaseLatin
    | LowercaseLatin
    | Digits
    | Unicode

The specific ordinal sequence of characters that was matched.