java.lang.Object
me.gosimple.nbvcxz.resources.Dictionary
public class Dictionary
extends java.lang.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 Summary
Constructors Constructor Description Dictionary(java.lang.String dictionary_name, java.util.Map<java.lang.String,java.lang.Integer> dictonary, boolean exclusion)Object used for dictionary matching. -
Method Summary
Modifier and Type Method Description java.lang.StringgetDictionaryName()A description of the values contained in the dictionary.java.util.Map<java.lang.String,java.lang.Integer>getDictonary()The values within this dictionary.java.util.List<java.lang.String>getSortedDictionary()This contains the same values as in getDictionary, but is sorted for optimizing the speed of the distance calculationjava.util.Map<java.lang.Integer,java.lang.Integer>getSortedDictionaryLengthLookup()A map containing different lengths, and the first index they appear in the sorted dictionary.booleanisExclusion()Returns if this dictionary is used for password exclusion or not.
-
Constructor Details
-
Dictionary
public Dictionary(java.lang.String dictionary_name, java.util.Map<java.lang.String,java.lang.Integer> dictonary, boolean exclusion)Object used for dictionary matching.- Parameters:
dictionary_name- unique name of dictionary.dictonary-Mapwith the word and it's rank. The key must be lowercase for the matching to work properly.exclusion-truewhen desiring to disallow any password contained in this dictionary;falseotherwise.
-
-
Method Details
-
getDictonary
public java.util.Map<java.lang.String,java.lang.Integer> getDictonary()The values within this dictionary.- Returns:
- key = values in the dictionary; value = rank
-
getSortedDictionary
public java.util.List<java.lang.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 java.util.Map<java.lang.Integer,java.lang.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 java.lang.String getDictionaryName()A description of the values contained in the dictionary.- Returns:
- The dictionary name
-