java.lang.Object
me.gosimple.nbvcxz.matching.match.BaseMatch
- All Implemented Interfaces:
Match
- Direct Known Subclasses:
BruteForceMatch,DateMatch,DictionaryMatch,RepeatMatch,SeparatorMatch,SequenceMatch,SpacialMatch,YearMatch
Abstract class which takes care of a lot of the boiler plate for implementing
Match.- Author:
- Adam Brusselback
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Configurationprotected static final doubleprotected static final doubleprotected static final doubleprotected static final doubleprotected static final doubleprotected static final double -
Constructor Summary
ConstructorsConstructorDescriptionBaseMatch(String match, Configuration configuration, int start_index, int end_index) Create a newBaseMatch -
Method Summary
Modifier and TypeMethodDescriptionfinal doubleCalculate the entropy for the current matchdoubleGet the average entropy per character of the current matchReturns details about this match in the form of a String to be printed directlyintReturns the end index of this part of the passwordintReturns the length of this part of the passwordintReturns the start index of this part of the passwordgetToken()protected static doublelog2(double value) Calculate the base 2 logarithm of a valueprotected static longnCk(int n, int k) Calculate binomial coefficients (the number of possible "choose k among n")protected voidsetEntropy(double entropy)
-
Field Details
-
LOG_2
protected static final double LOG_2 -
LOG_10
protected static final double LOG_10 -
LOG_26
protected static final double LOG_26 -
LOG_129
protected static final double LOG_129 -
LOG_37200
protected static final double LOG_37200 -
LOG_47988
protected static final double LOG_47988 -
configuration
-
-
Constructor Details
-
BaseMatch
Create a newBaseMatch- Parameters:
match- theStringwe are creating theBaseMatchfrom.configuration- theConfigurationobject.start_index- the start index in the password for this match.end_index- the end index in the password for this match.
-
-
Method Details
-
log2
protected static double log2(double value) Calculate the base 2 logarithm of a value- Parameters:
value- thedoublewe are calculating the log from- Returns:
- double
-
nCk
protected static long nCk(int n, int k) Calculate binomial coefficients (the number of possible "choose k among n")- Parameters:
n- the total size of the setk- the size of the selection- Returns:
- the binomial coefficient
-
setEntropy
protected void setEntropy(double entropy) -
calculateEntropy
public final double calculateEntropy()Description copied from interface:MatchCalculate the entropy for the current match- Specified by:
calculateEntropyin interfaceMatch- Returns:
- a
doublerepresenting the entropy of the currentMatch.
-
getAverageEntropy
public double getAverageEntropy()Description copied from interface:MatchGet the average entropy per character of the current match- Specified by:
getAverageEntropyin interfaceMatch- Returns:
- a
doublerepresenting the average entropy per character of the currentMatch.
-
getToken
-
getStartIndex
public int getStartIndex()Description copied from interface:MatchReturns the start index of this part of the password- Specified by:
getStartIndexin interfaceMatch- Returns:
- the
intstart index of thisMatch.
-
getEndIndex
public int getEndIndex()Description copied from interface:MatchReturns the end index of this part of the password- Specified by:
getEndIndexin interfaceMatch- Returns:
- the
intend index of thisMatch.
-
getLength
public int getLength()Description copied from interface:MatchReturns the length of this part of the password -
getDetails
Description copied from interface:MatchReturns details about this match in the form of a String to be printed directly- Specified by:
getDetailsin interfaceMatch- Returns:
- all specific details about this
Matchin printable String format.
-