Class RandomPasswordEntropy

java.lang.Object
org.passay.entropy.RandomPasswordEntropy
All Implemented Interfaces:
Entropy

public final class RandomPasswordEntropy extends Object implements Entropy
Entropy bits estimate defined in NIST SP-800-63-1 Randomly Selected Passwords.

See PDF Publication A1. "Randomly Selected Passwords"

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
    Size of the alphabet.
    private final int
    Size of the password.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RandomPasswordEntropy(int alphaSize, int pwordSize)
    Creates a new random entropy estimate.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns the entropy bits of a randomly generated password given the size of the unique characters used (alphabetSize) and the size of the password.
    static double
    log2(double number)
    Returns the log base 2 of a given number.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • alphabetSize

      private final int alphabetSize
      Size of the alphabet.
    • passwordSize

      private final int passwordSize
      Size of the password.
  • Constructor Details

    • RandomPasswordEntropy

      public RandomPasswordEntropy(int alphaSize, int pwordSize)
      Creates a new random entropy estimate.
      Parameters:
      alphaSize - size of the alphabet used
      pwordSize - size of the password
  • Method Details

    • estimate

      public double estimate()
      Returns the entropy bits of a randomly generated password given the size of the unique characters used (alphabetSize) and the size of the password.

      See PDF Publication A1. "Randomly Selected Passwords"

      Specified by:
      estimate in interface Entropy
      Returns:
      estimated entropy bits given password properties
    • log2

      public static double log2(double number)
      Returns the log base 2 of a given number.
      Parameters:
      number - to get the log2 of
      Returns:
      log2 of number