Statistics

lib/Statistics~ Statistics

Statistics

Constructor

new Statistics(config, dict)

Description:
  • Constructor

Source:
Parameters:
Name Type Description
config Object

the current config

dict Dictionary

the current dictionary

Methods

calculateStats() → {Object}

Description:
  • Return statistics about the instance

    Returns: A dictionary of statistics indexed by the following keys:

    • dictionary_source - the source of the word list
    • dictionary_words_total - the total number of words loaded from the dictionary file
    • dictionary_words_filtered - the number of words loaded from the dictionary file that meet the length criteria set in the loaded config
    • dictionary_words_percent_available - the percentage of the total dictionary that is available for use with the loaded config
    • dictionary_filter_length_min - the minimum length world permitted by the filter
    • dictionary_filter_length_max - the maximum length world permitted by the filter
    • dictionary_contains_accents - whether or not the filtered list contains accented letters
    • password_entropy_blind_min - the entropy of the shortest password this config can generate from the point of view of a brute-force attacker in bits
    • password_entropy_blind_max - the entropy of the longest password this config can generate from the point of view of a brute-force attacker in bits
    • password_entropy_blind - the entropy of the average length of password generated by this configuration from the point of view of a brute-force attacker in bits
    • password_entropy_seen - the true entropy of passwords generated by this instance assuming the dictionary and config are known to the attacker in bits
    • password_length_min - the minimum length of passwords generated with this instance's config
    • password_length_max - the maximum length of passwords generated with this instance's config
    • password_permutations_blind_min - the number of permutations a brute-force attacker would have to try to be sure of success on the shortest possible passwords generated by this instance as a Math::BigInt object
    • password_permutations_blind_max - the number of permutations a brute-force attacker would have to try to be sure of success on the longest possible passwords generated by this instance as a Math::BigInt object
    • password_permutations_blind - the number of permutations a brute-force attacker would have to try to be sure of success on the average length password generated by this instance as a Math::BigInt object
    • password_permutations_seen - the number of permutations an attacker with a copy of the dictionary and config would need to try to be sure of cracking a password generated by this instance as a Math::BigInt object
    • password_random_numbers_required - the number of random numbers needed to generate a single password using the loaded config
    • passwords_generated - the number of passwords this instance has generated
    • randomnumbers_cached - the number of random numbers currently cached within the instance
    • randomnumbers_cache_increment - the number of random numbers generated at once to replenish the cache when it's empty
    • randomnumbers_source - the name of the class used to generate random numbers
Source:
Throws:

Error on exception

Returns:

stats - the statistics

Type
Object

configStats(suppressWarnings) → {Object}

Description:
  • Calculate statistics for a given configuration

    Returns: A statistics object indexed by the following keys:

    • minLength: the minimum possible length of a password generated by the given config
    • maxLength: the maximum possible length of a password generated by the given config
    • randomNumbersRequired: the number of random numbers needed to generate a single password using the given config Arguments: OPTIONAL 'suppressWarnings' to indicate that no warnings should be issued if the config is such that there are uncertainties in the calculation. TODO: figure out what 'carps' is Throws: an Error on invalid invocation or args, carps if multi-character substitutions are in use when not using adaptive padding

    Notes: This function ignores character replacements, if one or more multi-character replacements are used when padding is not set to adaptive, this function will return an invalid max length.

    TODO can we move this to the Presets class? ? stats in Statistics class or configStats in Presets

Source:
Parameters:
Name Type Default Description
suppressWarnings boolean false

suppress warnings, defaults to false

Throws:

Error on exception

Returns:
  • stats object on this config
Type
Object