|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.evanmclean.evlib.security.Digests
public final class Digests
Various utilities to make it simpler to get common message digests.
| Method Summary | |
|---|---|
static String |
digest(File file,
MessageDigest digest)
Run a digest against the contents of a file. |
static String |
digest(InputStream in,
MessageDigest digest)
Run a digest against the input stream. |
static MessageDigest |
getDigest(String algorithm)
Returns a MessageDigest object that implements the specified digest algorithm. |
static MessageDigest |
getMd5Digest()
Returns a MessageDigest object that implements the MD5 algorithm. |
static MessageDigest |
getShaDigest()
Returns a MessageDigest object that implements the SHA algorithm. |
static String |
hex(byte[] buffer)
Converts an array of bytes into a String representing the
hexidecimal values of each byte in order. |
static String |
hex(MessageDigest digest)
Converts the results of MessageDigest.digest() into a
String representing the hexidecimal values of each byte in
order. |
static String |
md5(File file)
Product an MD5 checksum against contents of a file. |
static String |
md5(FileInputStream in)
Product an MD5 checksum against a file input stream. |
static String |
md5(InputStream in)
Product an MD5 checksum against an input stream. |
static String |
sha(File file)
Product an SHA checksum against contents of a file. |
static String |
sha(FileInputStream in)
Product an SHA checksum against a file input stream. |
static String |
sha(InputStream in)
Product an SHA checksum against an input stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static String digest(File file,
MessageDigest digest)
throws IOException
file - The file to read.digest - The digest object to use.
digest.digest() converted to a
hexidecimal string.
IOException
public static String digest(InputStream in,
MessageDigest digest)
throws IOException
in - The input stream to read.digest - The digest object to use.
digest.digest() converted to a
hexidecimal string.
IOExceptionpublic static MessageDigest getDigest(String algorithm)
MessageDigest.getInstance(String) that throws a
RuntimeException instead of a
NoSuchAlgorithmException.
algorithm - The name of the algorithm requested.
RuntimeException - If no Provider supports a MessageDigestSpi implementation for the
specified algorithm.public static MessageDigest getMd5Digest()
RuntimeException - If no Provider supports a MessageDigestSpi implementation for the
MD5 algorithm.public static MessageDigest getShaDigest()
RuntimeException - If no Provider supports a MessageDigestSpi implementation for the
SHA algorithm.public static String hex(byte[] buffer)
String representing the
hexidecimal values of each byte in order.
buffer - A byte[] to convert to Hex characters.
public static String hex(MessageDigest digest)
MessageDigest.digest() into a
String representing the hexidecimal values of each byte in
order.
digest - A digest to convert to Hex characters.
public static String md5(File file)
throws IOException
file - The file to read.
IOException
public static String md5(FileInputStream in)
throws IOException
in - The file input stream to read.
IOException
public static String md5(InputStream in)
throws IOException
in - The input stream to read.
IOException
public static String sha(File file)
throws IOException
file - The file to read.
IOException
public static String sha(FileInputStream in)
throws IOException
in - The file input stream to read.
IOException
public static String sha(InputStream in)
throws IOException
in - The input stream to read.
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||