Class 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 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"
        Specified by:
        estimate in interface Entropy
        Returns:
        estimated entropy bits given password properties