| |
|
| java.lang.Object org.gomba.utils.token.IdGenerator
IdGenerator | public class IdGenerator (Code) | | Random id generator. This code has been *stolen* and adapted from Tomcat 5
org.apache.catalina.session.ManagerBase . Thank you guys! :)
author: Craig R. McClanahan author: Flavio Tordini version: $Id: IdGenerator.java,v 1.1 2004/11/26 17:52:58 flaviotordini Exp $ |
Field Summary | |
final protected static String | DEFAULT_ALGORITHM The default message digest algorithm to use if we cannot use the
requested one. | protected String | algorithm The message digest algorithm to be used when generating session
identifiers. | protected MessageDigest | digest Return the MessageDigest implementation to be used when creating session
identifiers. | protected String | entropy A String initialization parameter used to increase the entropy of the
initialization of our random number generator. | protected int | idLength The session id length created by this class. | protected Random | random A random number generator to use when generating session identifiers. | protected String | randomClass The Java class name of the random number generator class to be used when
generating session identifiers. |
Method Summary | |
public String | generateId() Generate and return a new identifier. | public MessageDigest | getDigest() Return the MessageDigest object to be used for calculating session
identifiers. | public String | getEntropy() Return the entropy increaser value, or compute a semi-useful value if
this String has not yet been set. | public Random | getRandom() Return the random number generator instance we should use for generating
session identifiers. | protected void | getRandomBytes(byte bytes) | public void | setEntropy(String entropy) Set the entropy increaser value. |
DEFAULT_ALGORITHM | final protected static String DEFAULT_ALGORITHM(Code) | | The default message digest algorithm to use if we cannot use the
requested one.
|
algorithm | protected String algorithm(Code) | | The message digest algorithm to be used when generating session
identifiers. This must be an algorithm supported by the
java.security.MessageDigest class on your platform.
|
digest | protected MessageDigest digest(Code) | | Return the MessageDigest implementation to be used when creating session
identifiers.
|
entropy | protected String entropy(Code) | | A String initialization parameter used to increase the entropy of the
initialization of our random number generator.
|
idLength | protected int idLength(Code) | | The session id length created by this class.
|
random | protected Random random(Code) | | A random number generator to use when generating session identifiers.
|
randomClass | protected String randomClass(Code) | | The Java class name of the random number generator class to be used when
generating session identifiers.
|
generateId | public String generateId()(Code) | | Generate and return a new identifier.
|
getDigest | public MessageDigest getDigest()(Code) | | Return the MessageDigest object to be used for calculating session
identifiers. If none has been created yet, initialize one the first time
this method is called.
|
getEntropy | public String getEntropy()(Code) | | Return the entropy increaser value, or compute a semi-useful value if
this String has not yet been set.
|
getRandom | public Random getRandom()(Code) | | Return the random number generator instance we should use for generating
session identifiers. If there is no such generator currently defined,
construct and seed a new one.
|
getRandomBytes | protected void getRandomBytes(byte bytes)(Code) | | |
setEntropy | public void setEntropy(String entropy)(Code) | | Set the entropy increaser value.
Parameters: entropy - The new entropy increaser value |
|
|
|