org.clazzes.util.sec
Class SSHA1PasswordHasher

java.lang.Object
  extended by org.clazzes.util.sec.PlainPasswordHasher
      extended by org.clazzes.util.sec.SSHA1PasswordHasher
All Implemented Interfaces:
PasswordHasher

public class SSHA1PasswordHasher
extends PlainPasswordHasher
implements PasswordHasher

The SSHA1 hasher


Field Summary
 
Fields inherited from class org.clazzes.util.sec.PlainPasswordHasher
algo_prefix
 
Constructor Summary
SSHA1PasswordHasher()
           
 
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 org.clazzes.util.sec.PlainPasswordHasher
getAlgorithmPrefix, hashPassword, prependAlgorithmKey, stripAlgorithmKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.clazzes.util.sec.PasswordHasher
hashPassword
 

Constructor Detail

SSHA1PasswordHasher

public SSHA1PasswordHasher()
Method Detail

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.