|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pf.security.crypto.HashMechanism
public class HashMechanism
Contains all information about a hashing algorithm.
Field Summary | |
---|---|
static HashMechanism |
MD5
|
static HashMechanism |
SALTED_MD5
|
static HashMechanism |
SALTED_SHA_1
|
static HashMechanism |
SALTED_SHA_2_256
|
static HashMechanism |
SALTED_SHA_2_384
|
static HashMechanism |
SALTED_SHA_2_512
|
static HashMechanism |
SHA_1
|
static HashMechanism |
SHA_2_256
|
static HashMechanism |
SHA_2_384
|
static HashMechanism |
SHA_2_512
|
Constructor Summary | |
---|---|
HashMechanism(String hashMechanismName,
CheckedHashAlgorithm algorithm,
boolean isSalted)
Creates a new instance that represents a particular hashing mechanism. |
Method Summary | |
---|---|
static HashMechanism |
create(CheckedHashAlgorithm algorithm)
Creates a new instance that represents a particular unsalted hashing mechanism. |
static HashMechanism |
create(CheckedHashAlgorithm algorithm,
boolean isSalted)
Creates a new instance that represents a particular hashing mechanism. |
static HashMechanism |
create(String hashMechanismName,
CheckedHashAlgorithm algorithm,
boolean isSalted)
Creates a new instance that represents a particular hashing mechanism. |
static String |
createHashMechanismName(CheckedHashAlgorithm algorithm,
boolean isSalted)
Returns a name for the hashing mechanism that is defined by the given parameters. |
static String |
createPrefix(String hashMechanismName)
Returns a prefix for the provided hashing mechanism name. |
boolean |
equals(Object obj)
|
static HashMechanism |
findHashMechanism(String hashType)
Tries to find a known (i.e. registered constant) hash mechanism for the given type name. |
static HashMechanism |
findSaltedHashMechanism(String hashType)
|
static HashMechanism |
findUnsaltedHashMechanism(String hashType)
|
CheckedHashAlgorithm |
getAlgorithm()
|
String |
getAlgorithmName()
|
int |
getBitLength()
|
int |
getByteLength()
|
String |
getName()
Returns the name of this mechanism. |
String |
getPrefix()
|
int |
hashCode()
|
boolean |
isSalted()
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final HashMechanism MD5
public static final HashMechanism SHA_1
public static final HashMechanism SHA_2_256
public static final HashMechanism SHA_2_384
public static final HashMechanism SHA_2_512
public static final HashMechanism SALTED_MD5
public static final HashMechanism SALTED_SHA_1
public static final HashMechanism SALTED_SHA_2_256
public static final HashMechanism SALTED_SHA_2_384
public static final HashMechanism SALTED_SHA_2_512
Constructor Detail |
---|
public HashMechanism(String hashMechanismName, CheckedHashAlgorithm algorithm, boolean isSalted)
hashMechanismName
- The name of the mechanism to be used in the prefix.algorithm
- The underlying hashing algorithm.isSalted
- Defines whether or not the mechanism is salted.Method Detail |
---|
public static String createPrefix(String hashMechanismName)
hashMechanismName
- The name to be used in the prefix (must not be null).public static String createHashMechanismName(CheckedHashAlgorithm algorithm, boolean isSalted)
Example: algorithm is "SHA-256" and isSalted = true. That returns "SSHA256".
algorithm
- Defines the underlying hashing algorithm.isSalted
- Defines whether or not the mechanism is salted.public static HashMechanism create(CheckedHashAlgorithm algorithm)
algorithm
- The underlying hashing algorithm.public static HashMechanism create(CheckedHashAlgorithm algorithm, boolean isSalted)
algorithm
- The underlying hashing algorithm.isSalted
- Defines whether or not the mechanism is salted.public static HashMechanism create(String hashMechanismName, CheckedHashAlgorithm algorithm, boolean isSalted)
hashMechanismName
- The name of the mechanism to be used in the prefix.algorithm
- The underlying hashing algorithm.isSalted
- Defines whether or not the mechanism is salted.public static HashMechanism findUnsaltedHashMechanism(String hashType)
public static HashMechanism findSaltedHashMechanism(String hashType)
public static HashMechanism findHashMechanism(String hashType)
hashType
- The name of an hashing algorithm ("SHA-1") or the prefix (e.g. "{SSHA384}").
public String getName()
public CheckedHashAlgorithm getAlgorithm()
public int getByteLength()
public String getPrefix()
public boolean isSalted()
public String getAlgorithmName()
public int getBitLength()
public String toString()
toString
in class Object
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |