Package org.passay.entropy
Class ShannonEntropy
- java.lang.Object
-
- org.passay.entropy.ShannonEntropy
-
- All Implemented Interfaces:
Entropy
public class ShannonEntropy extends Object implements Entropy
Entropy bits estimate defined in NIST SP-800-63-1 User Selected Passwords. See PDF Publication A1. "User Selected Passwords"- Author:
- Middleware Services
-
-
Field Summary
Fields Modifier and Type Field Description static double
FIRST_PHASE_BONUS
Entropy bonus of the first phase.static int
FIRST_PHASE_LENGTH
Length of the first phase.static double
SECOND_PHASE_BONUS
Entropy bonus of the second phase.static int
SECOND_PHASE_LENGTH
Length of the second phase.static int[]
SHANNON_COMPOSITION_SIEVE
Array used for determining composition "bonus" for calculating the Shannon entropy estimate.static int[]
SHANNON_DICTIONARY_SIEVE
Array used for determining dictionary entropy "bonus" for calculating the Shannon entropy estimate.static double
THIRD_PHASE_BONUS
Entropy bonus of the third phase.static int
THIRD_PHASE_LENGTH
Length of the second phase.
-
Constructor Summary
Constructors Constructor Description ShannonEntropy(boolean dictionaryCheck, boolean compositionCheck, int pwordSize)
Creates a new shannon entropy estimate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
estimate()
Returns the entropy bits of a user selected password.
-
-
-
Field Detail
-
FIRST_PHASE_LENGTH
public static final int FIRST_PHASE_LENGTH
Length of the first phase.- See Also:
- Constant Field Values
-
SECOND_PHASE_LENGTH
public static final int SECOND_PHASE_LENGTH
Length of the second phase.- See Also:
- Constant Field Values
-
THIRD_PHASE_LENGTH
public static final int THIRD_PHASE_LENGTH
Length of the second phase.- See Also:
- Constant Field Values
-
FIRST_PHASE_BONUS
public static final double FIRST_PHASE_BONUS
Entropy bonus of the first phase.- See Also:
- Constant Field Values
-
SECOND_PHASE_BONUS
public static final double SECOND_PHASE_BONUS
Entropy bonus of the second phase.- See Also:
- Constant Field Values
-
THIRD_PHASE_BONUS
public static final double THIRD_PHASE_BONUS
Entropy bonus of the third phase.- See Also:
- Constant Field Values
-
SHANNON_DICTIONARY_SIEVE
public static final int[] SHANNON_DICTIONARY_SIEVE
Array used for determining dictionary entropy "bonus" for calculating the Shannon entropy estimate.
-
SHANNON_COMPOSITION_SIEVE
public static final int[] SHANNON_COMPOSITION_SIEVE
Array used for determining composition "bonus" for calculating the Shannon entropy estimate.
-
-
Constructor Detail
-
ShannonEntropy
public ShannonEntropy(boolean dictionaryCheck, boolean compositionCheck, int pwordSize)
Creates a new shannon entropy estimate.- Parameters:
dictionaryCheck
- whether or not a common passwords dictionary is checked against the password (50,000 dictionary words are recommended)compositionCheck
- whether or not at least 1 uppercase and special/symbol character is enforced (not using common substitutions such as s to $ are recommended)pwordSize
- size of the password
-
-
Method Detail
-
estimate
public double estimate()
Returns the entropy bits of a user selected password. This estimate is based on a 94 Character Alphabet and is a "ballpark" estimate based on Claude Shannon's observations. See PDF Publication A1. "User Selected Passwords"
-
-