org.clazzes.util.sec
Class CryptPasswordHasher
java.lang.Object
org.clazzes.util.sec.PlainPasswordHasher
org.clazzes.util.sec.CryptPasswordHasher
- All Implemented Interfaces:
- PasswordHasher
public class CryptPasswordHasher
- extends PlainPasswordHasher
- implements PasswordHasher
The Crypt hasher
Method Summary |
boolean |
checkPassword(java.lang.String cleartext,
java.lang.String hashed)
Checks if the given cleartext password conforms to the given hashed representation. |
java.lang.String |
getAlgorithmName()
|
int |
getSaltLength()
|
java.lang.String |
hashPassword(java.lang.String cleartext,
java.lang.String salt)
Hashes the given password using the given salt. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CryptPasswordHasher
public CryptPasswordHasher()
hashPassword
public java.lang.String hashPassword(java.lang.String cleartext,
java.lang.String salt)
- Description copied from interface:
PasswordHasher
- Hashes the given password using the given salt.
- Specified by:
hashPassword
in interface PasswordHasher
- Overrides:
hashPassword
in class PlainPasswordHasher
- Parameters:
cleartext
- Password to hash.salt
- the salt to use.
- Returns:
- the hashed i.e. encrypted password. includes the algorithm prefix.
checkPassword
public boolean checkPassword(java.lang.String cleartext,
java.lang.String hashed)
- Description copied from interface:
PasswordHasher
- Checks if the given cleartext password conforms to the given hashed representation.
- Specified by:
checkPassword
in interface PasswordHasher
- Overrides:
checkPassword
in class PlainPasswordHasher
- Parameters:
cleartext
- cleartext password to check.hashed
- hashed correct password to check against. may include the algorithm prefix.
- Returns:
- true if the password seems correct.
getAlgorithmName
public java.lang.String getAlgorithmName()
- Specified by:
getAlgorithmName
in interface PasswordHasher
- Overrides:
getAlgorithmName
in class PlainPasswordHasher
- Returns:
- the name (key) of the algorithm implemented by this hasher, as used in the algorithm prefix of hashed passwords.
getSaltLength
public int getSaltLength()
- Specified by:
getSaltLength
in interface PasswordHasher
- Overrides:
getSaltLength
in class PlainPasswordHasher
- Returns:
- the (default resp. relevant) salt length for the hash algorithm
Copyright © 2010. All Rights Reserved.