Class PasswordEncryptor


  • public final class PasswordEncryptor
    extends Object
    Generic class to encrypt a password according to the MED5 algorithm. It has utility classes to check a given (unencrypted) password with another (encrypted) password that may be used as a helper method in an authentication procedure.
    Since:
    0.0.1
    Author:
    Paulo Zenida - Linkare TI
    • Constructor Detail

      • PasswordEncryptor

        private PasswordEncryptor()
        Hiding constructor so that this utility class cannot be instantiated from outside.
    • Method Detail

      • encryptPassword

        public static String encryptPassword​(String password)
        Parameters:
        password - the password to be encrypted.
        Returns:
        the encrypted password according to the MD5 algorithm.
      • areEquals

        public static boolean areEquals​(String encryptedPassword,
                                        String notEncryptedPassword)
        Parameters:
        encryptedPassword - the encrypted password to be compared.
        notEncryptedPassword - the non encrypted password to be compared.
        Returns:
        true if the non encrypted password, after being encrypted, is the equal to the encrypted password. Returns false otherwise.
      • getMessageDigest

        private static MessageDigest getMessageDigest()
        Returns:
        the MD5 digest algorithm.