org.clazzes.util.sec
Class HashTools

java.lang.Object
  extended by org.clazzes.util.sec.HashTools

public class HashTools
extends java.lang.Object

A view [Password]Hasher helpers center For usage, see classes Hasher and PersonOperations


Field Summary
static byte DEFAULT_SALTLENGTH
          The recommended default salt length.
static java.util.Random randomizer
           
 
Constructor Summary
HashTools()
           
 
Method Summary
static java.lang.String parseAlorithmName(java.lang.String from_hashed_password)
          Parses the algorithm name from the given hashed password's algorithm prefix.
static java.lang.String randomSalt()
           
static java.lang.String randomSalt(int length)
          Creates a random salt with the given length.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SALTLENGTH

public static final byte DEFAULT_SALTLENGTH
The recommended default salt length. But be warned, the best known and widely used crypt algorithm uses a 2 char salt only.

See Also:
Constant Field Values

randomizer

public static java.util.Random randomizer
Constructor Detail

HashTools

public HashTools()
Method Detail

randomSalt

public static java.lang.String randomSalt()
Returns:
a random salt with the default salt length.

randomSalt

public static java.lang.String randomSalt(int length)
Creates a random salt with the given length.

Parameters:
length - the wanted length of the salt. must be > 0 and <= 256.
Returns:
the random salt

parseAlorithmName

public static java.lang.String parseAlorithmName(java.lang.String from_hashed_password)
Parses the algorithm name from the given hashed password's algorithm prefix.

Parameters:
from_hashed_password - a hashed password including the algorithm prefix.
Returns:
the algorithm specified in the given hashed password's algorithm prefix. null in case of any parsing error.


Copyright © 2009. All Rights Reserved.