Class AwesomePasswordChecker

java.lang.Object
com.mycompany.awesomepasswordchecker.AwesomePasswordChecker

public final class AwesomePasswordChecker extends Object
Utility class for analyzing and checking password strength using clustering. This class ensures only one instance is used throughout the application.
  • Method Details

    • getInstance

      public static AwesomePasswordChecker getInstance(File file) throws IOException
      Retrieves the singleton instance, initialized with the specified cluster center file.
      Parameters:
      file - The file containing cluster center data.
      Returns:
      The singleton instance of AwesomePasswordChecker.
      Throws:
      IOException - If an error occurs while reading the file.
    • getInstance

      public static AwesomePasswordChecker getInstance() throws IOException
      Retrieves the singleton instance, initialized with the default resource file.
      Returns:
      The singleton instance of AwesomePasswordChecker.
      Throws:
      IOException - If an error occurs while reading the default resource file.
    • maskAff

      public int[] maskAff(String password)
      Generates a numerical mask for a given password based on character rules.
      Parameters:
      password - The password to analyze.
      Returns:
      An integer array representing the character mask of the password.
    • getDistance

      public double getDistance(String password)
      Computes the minimum Euclidean distance between the password's mask and cluster centers.
      Parameters:
      password - The password to analyze.
      Returns:
      The minimum distance as a double.
    • computeMd5

      public static String computeMd5(String input)
      Computes the MD5 hash of the input string using a custom implementation.
      Parameters:
      input - the string to hash
      Returns:
      the MD5 hash as a hexadecimal string
    • main

      public static void main(String[] args)
      Main method for testing the functionality of AwesomePasswordChecker.
      Parameters:
      args - Command-line arguments.