|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.uplanet.security.KeyedSaltedHashing
@Scriptable public final class KeyedSaltedHashing
Keyed Salted Hashing
This class implements a keyed and SALTed hashing algorithm. It is closely related to the mechanism described in RFC 2104, HMAC: Keyed-Hashing for Message Authentication. Beyond that, it supports SALT in a way that is compatible with common password storing strategies
Constructor Summary | |
---|---|
KeyedSaltedHashing()
Contruct the hashing class with SHA-1 as the undelying hashing algorithm |
|
KeyedSaltedHashing(java.lang.String p_strAlgorithm)
Contruct the hashing class with the specified hashing algorithm |
Method Summary | |
---|---|
boolean |
equals(KeyedSaltedHashing p_another)
Compare the digest of this object with the digest of another KeyedSaltedHashing |
byte[] |
getDigest()
Get the digest. |
byte[] |
makeDigest(byte[] p_arHashedPwd,
byte[] p_arKey)
Make the digest. |
byte[] |
makeDigest(byte[] p_arPwd,
byte[] p_arSalt,
byte[] p_arKey)
Make the digest. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KeyedSaltedHashing() throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException
- If the SHA-1 algorithm is not available in the caller's environment.
This should never happen.public KeyedSaltedHashing(java.lang.String p_strAlgorithm) throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException
- If the algorithm is not available in the caller's environment.Method Detail |
---|
public boolean equals(KeyedSaltedHashing p_another)
KeyedSaltedHashing
p_another
- Another instance of KeyedSaltedHashing
to compare with.
true
if the two underlying digests are the same or both digest
are null
, false
otherwise.public byte[] makeDigest(byte[] p_arPwd, byte[] p_arSalt, byte[] p_arKey) throws java.lang.NullPointerException
The response digest is computed from the password, the SALT and a key
p_arPwd
- The plain password as a byte
-array.p_arSalt
- The SALT as a byte
-array or
null
if SALT should not be used.p_arKey
- The key/challenge as a byte
-array.
java.lang.NullPointerException
- if p_arPwd
or
p_arKey
is null
public byte[] makeDigest(byte[] p_arHashedPwd, byte[] p_arKey) throws java.lang.NullPointerException
The response digest is computed from a hashed password-SALT pair and a key
p_arHashedPwd
- The hashed and password-SALT-pair as a byte
-array.p_arKey
- The key/challenge as a byte
-array.
java.lang.NullPointerException
- if p_arHashedPwd
or
p_arKey
is null
public byte[] getDigest()
null
if none is available.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |