|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.dna.common.util.SecureHash
@Immutable public class SecureHash

A simple utility to generate various kinds of secure hashes.
| Nested Class Summary | |
|---|---|
static class |
SecureHash.Algorithm
Commonly-used hashing algorithms. |
| Constructor Summary | |
|---|---|
SecureHash()
|
|
| Method Summary | |
|---|---|
static byte[] |
getHash(SecureHash.Algorithm algorithm,
byte[] content)
Get the hash of the supplied content, using the supplied digest algorithm. |
static byte[] |
getHash(SecureHash.Algorithm algorithm,
File file)
Get the hash of the supplied content, using the supplied digest algorithm. |
static byte[] |
getHash(SecureHash.Algorithm algorithm,
InputStream stream)
Get the hash of the supplied content, using the supplied digest algorithm. |
static byte[] |
getHash(String digestName,
byte[] content)
Get the hash of the supplied content, using the digest identified by the supplied name. |
static byte[] |
getHash(String digestName,
File file)
Get the hash of the supplied content, using the digest identified by the supplied name. |
static byte[] |
getHash(String digestName,
InputStream stream)
Get the hash of the supplied content, using the digest identified by the supplied name. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SecureHash()
| Method Detail |
|---|
public static byte[] getHash(SecureHash.Algorithm algorithm,
byte[] content)
throws NoSuchAlgorithmException
algorithm - the hashing function algorithm that should be usedcontent - the content to be hashed; may not be null
NoSuchAlgorithmException - if the supplied algorithm could not be found
IllegalArgumentException - if the algorithm is null
public static byte[] getHash(SecureHash.Algorithm algorithm,
File file)
throws NoSuchAlgorithmException,
IOException
algorithm - the hashing function algorithm that should be usedfile - the file containing the content to be hashed; may not be null
NoSuchAlgorithmException - if the supplied algorithm could not be found
IllegalArgumentException - if the algorithm is null
IOException - if there is an error reading the file
public static byte[] getHash(SecureHash.Algorithm algorithm,
InputStream stream)
throws NoSuchAlgorithmException,
IOException
algorithm - the hashing function algorithm that should be usedstream - the stream containing the content to be hashed; may not be null
NoSuchAlgorithmException - if the supplied algorithm could not be found
IllegalArgumentException - if the algorithm is null
IOException - if there is an error reading the stream
public static byte[] getHash(String digestName,
byte[] content)
throws NoSuchAlgorithmException
digestName - the name of the hashing function (or message digest) that should be usedcontent - the content to be hashed; may not be null
NoSuchAlgorithmException - if the supplied algorithm could not be found
public static byte[] getHash(String digestName,
File file)
throws NoSuchAlgorithmException,
IOException
digestName - the name of the hashing function (or message digest) that should be usedfile - the file whose content is to be hashed; may not be null
NoSuchAlgorithmException - if the supplied algorithm could not be found
IOException - if there is an error reading the file
public static byte[] getHash(String digestName,
InputStream stream)
throws NoSuchAlgorithmException,
IOException
digestName - the name of the hashing function (or message digest) that should be usedstream - the stream containing the content to be hashed; may not be null
NoSuchAlgorithmException - if the supplied algorithm could not be found
IOException - if there is an error reading the stream
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||