public class TreeHashGenerator
extends java.lang.Object
For more information on tree hashing, see http://en.wikipedia.org/wiki/Hash_tree.
Constructor and Description |
---|
TreeHashGenerator() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
calculateTreeHash(java.io.File file)
Calculates a hex encoded binary hash using a tree hashing algorithm for
the data in the specified file.
|
static java.lang.String |
calculateTreeHash(java.io.InputStream input)
Calculates a hex encoded binary hash using a tree hashing algorithm for
the data in the specified input stream.
|
static java.lang.String |
calculateTreeHash(java.util.List<byte[]> checksums)
Returns the hex encoded binary tree hash for the individual checksums
given.
|
private static byte[] |
computeSHA256Hash(byte[] data) |
public static java.lang.String calculateTreeHash(java.io.File file) throws AmazonClientException
file
- The file containing the data to hash.AmazonClientException
- If any problems were encountered reading the data or
computing the hash.public static java.lang.String calculateTreeHash(java.io.InputStream input) throws AmazonClientException
input
- The input stream containing the data to hash.AmazonClientException
- If problems were encountered reading the data or calculating
the hash.public static java.lang.String calculateTreeHash(java.util.List<byte[]> checksums) throws AmazonClientException
AmazonClientException
- If problems were encountered reading the data or calculating
the hash.private static byte[] computeSHA256Hash(byte[] data) throws java.security.NoSuchAlgorithmException, java.io.IOException
java.security.NoSuchAlgorithmException
java.io.IOException