Class Dictionary

java.lang.Object
me.gosimple.nbvcxz.resources.Dictionary

public class Dictionary extends Object
Object used for dictionary matching. This allows users to implement custom dictionaries for different languages or specialized vocabulary.

Dictionaries need to use all lower case keys for the words they contain for the algorithm to work correctly.

Author:
Adam Brusselback.
  • Constructor Details

    • Dictionary

      public Dictionary(String dictionary_name, Map<String,Integer> dictonary, boolean exclusion)
      Object used for dictionary matching.
      Parameters:
      dictionary_name - unique name of dictionary.
      dictonary - Map with the word and it's rank. The key must be lowercase for the matching to work properly.
      exclusion - true when desiring to disallow any password contained in this dictionary; false otherwise.
  • Method Details

    • getDictonary

      public Map<String,Integer> getDictonary()
      The values within this dictionary.
      Returns:
      key = values in the dictionary; value = rank
    • getSortedDictionary

      public List<String> getSortedDictionary()
      This contains the same values as in getDictionary, but is sorted for optimizing the speed of the distance calculation
      Returns:
      A list of dictionary values sorted by length then alphabetical
    • getSortedDictionaryLengthLookup

      public Map<Integer,Integer> getSortedDictionaryLengthLookup()
      A map containing different lengths, and the first index they appear in the sorted dictionary.
      Returns:
      key = length; value = first index that length appears
    • isExclusion

      public boolean isExclusion()
      Returns if this dictionary is used for password exclusion or not.

      If true, a password which matches to one of the values in the dictionary will always return 0 entropy for the portion which matches.
      Returns:
      true if excluded
    • getDictionaryName

      public String getDictionaryName()
      A description of the values contained in the dictionary.
      Returns:
      The dictionary name
    • getMaxLength

      public int getMaxLength()
      The longest length of an entry we should check with this dictionary
      Returns:
      the longest value this dictionary contains