|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sibvisions.util.SecureHash
public class SecureHash
The SecureHash class provides the functionality of a message digest algorithm,
such as MD5 or SHA. Message digests are secure one-way hash functions that take
arbitrary-sized data and output a fixed-length hash value.
MessageDigest| Field Summary | |
|---|---|
static java.lang.String |
MD2
the MD2 hash algorithm. |
static java.lang.String |
MD4
the MD4 hash algorithm. |
static java.lang.String |
MD5
the MD5 hash algorithm. |
static java.lang.String |
SHA
the SHA hash algorithm. |
static java.lang.String |
SHA_256
the SHA-256 hash algorithm. |
static java.lang.String |
SHA_384
the SHA-384 hash algorithm. |
static java.lang.String |
SHA_512
the SHA-512 hash algorithm. |
| Constructor Summary | |
|---|---|
SecureHash(java.lang.String pAlgorithm)
Creates a new instance of SecureHash for a specific hash algorithm. |
|
| Method Summary | |
|---|---|
void |
add(byte[] pData)
Adds data to the digest. |
void |
add(java.io.InputStream pData)
Adds data to the digest. |
java.lang.String |
getHash()
Gets the current hash. |
static java.lang.String |
getHash(java.lang.String pAlgorithm,
byte[] pData)
Gets the hash of specific data. |
static java.lang.String |
getHash(java.lang.String pAlgorithm,
java.io.InputStream pData)
Gets the hash of all content read from an InputStream. |
byte[] |
getRawHash()
Gets the current raw hash. |
static byte[] |
getRawHash(java.lang.String pAlgorithm,
byte[] pData)
Gets the raw hash of specific data. |
static byte[] |
getRawHash(java.lang.String pAlgorithm,
java.io.InputStream pData)
Gets the raw hash of all content read from an InputStream. |
void |
reset()
Resets the digest. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String MD2
public static final java.lang.String MD4
public static final java.lang.String MD5
public static final java.lang.String SHA
public static final java.lang.String SHA_256
public static final java.lang.String SHA_384
public static final java.lang.String SHA_512
| Constructor Detail |
|---|
public SecureHash(java.lang.String pAlgorithm)
SecureHash for a specific hash algorithm.
pAlgorithm - the hash algorithm
MD5
SHA| Method Detail |
|---|
public static java.lang.String getHash(java.lang.String pAlgorithm,
java.io.InputStream pData)
throws java.security.NoSuchAlgorithmException,
java.io.IOException
InputStream.
pAlgorithm - the hash algorithmpData - the data stream
java.security.NoSuchAlgorithmException - specified algorithm is not available
java.io.IOException - if an error occurs during reading from the stream
public static byte[] getRawHash(java.lang.String pAlgorithm,
java.io.InputStream pData)
throws java.security.NoSuchAlgorithmException,
java.io.IOException
InputStream.
pAlgorithm - the hash algorithmpData - the data stream
java.security.NoSuchAlgorithmException - specified algorithm is not available
java.io.IOException - if an error occurs during reading from the stream
public static java.lang.String getHash(java.lang.String pAlgorithm,
byte[] pData)
throws java.security.NoSuchAlgorithmException
pAlgorithm - the hash algorithmpData - the data
java.security.NoSuchAlgorithmException - specified algorithm is not available
public static byte[] getRawHash(java.lang.String pAlgorithm,
byte[] pData)
throws java.security.NoSuchAlgorithmException
pAlgorithm - the hash algorithmpData - the data
java.security.NoSuchAlgorithmException - specified algorithm is not available
public void add(java.io.InputStream pData)
throws java.security.NoSuchAlgorithmException,
java.io.IOException
pData - the data stream
java.security.NoSuchAlgorithmException - specified algorithm is not available
java.io.IOException - if an error occurs during reading from the stream
public void add(byte[] pData)
throws java.security.NoSuchAlgorithmException
pData - the data
java.security.NoSuchAlgorithmException - specified algorithm is not availablepublic void reset()
public java.lang.String getHash()
public byte[] getRawHash()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||