Package rs.baselib.crypto
Interface PasswordHasher
- All Known Subinterfaces:
ExtendedPasswordHasher
- All Known Implementing Classes:
BlowfishPasswordHasher,CombinedPasswordHasher,DummyPasswordHasher,Md5PasswordHasher,PhpPasswordHasher,Sha256PasswordHasher,Sha512PasswordHasher
public interface PasswordHasher
An interface that is able to hash passwords and check existing hashes against a password.
- Since:
- 1.2.9
- Author:
- ralph
-
Method Summary
Modifier and Type Method Description java.lang.StringgetPasswordHash(java.lang.String plainPassword)Returns a hash of the given plain password.booleantestPassword(java.lang.String plainPassword, java.lang.String passwordHash)Tests a plain Password whether it is the same as a previously hashed password.
-
Method Details
-
getPasswordHash
java.lang.String getPasswordHash(java.lang.String plainPassword)Returns a hash of the given plain password.- Parameters:
plainPassword- the password to be hashed- Returns:
- the hash of the password
-
testPassword
boolean testPassword(java.lang.String plainPassword, java.lang.String passwordHash)Tests a plain Password whether it is the same as a previously hashed password.- Parameters:
plainPassword- the plain password to be checkedpasswordHash- the hash of another password- Returns:
truewhen both passwords match each other
-