Class AwesomePasswordChecker
java.lang.Object
com.mycompany.awesomepasswordchecker.AwesomePasswordChecker
Utility class for analyzing and checking password strength using clustering. This class ensures
only one instance is used throughout the application.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringcomputeMd5(String input) Computes the MD5 hash of the input string using a custom implementation.doublegetDistance(String password) Computes the minimum Euclidean distance between the password's mask and cluster centers.static AwesomePasswordCheckerRetrieves the singleton instance, initialized with the default resource file.static AwesomePasswordCheckergetInstance(File file) Retrieves the singleton instance, initialized with the specified cluster center file.static voidMain method for testing the functionality ofAwesomePasswordChecker.int[]Generates a numerical mask for a given password based on character rules.
-
Method Details
-
getInstance
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
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
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
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
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
Main method for testing the functionality ofAwesomePasswordChecker.- Parameters:
args- Command-line arguments.
-