Package com.linkare.commons.utils
Class PasswordEncryptor
- java.lang.Object
-
- com.linkare.commons.utils.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
-
-
Field Summary
Fields Modifier and Type Field Description private static intPASSWORD_RADIX
-
Constructor Summary
Constructors Modifier Constructor Description privatePasswordEncryptor()Hiding constructor so that this utility class cannot be instantiated from outside.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanareEquals(String encryptedPassword, String notEncryptedPassword)static StringencryptPassword(String password)private static MessageDigestgetMessageDigest()
-
-
-
Field Detail
-
PASSWORD_RADIX
private static final int PASSWORD_RADIX
- See Also:
- Constant Field Values
-
-
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.
-
-