Class TreeHashGenerator

    • Constructor Detail

      • TreeHashGenerator

        public TreeHashGenerator()
    • Method Detail

      • calculateTreeHash

        public static String calculateTreeHash​(File file)
                                        throws AmazonClientException
        Calculates a hex encoded binary hash using a tree hashing algorithm for the data in the specified file.
        Parameters:
        file - The file containing the data to hash.
        Returns:
        The hex encoded binary tree hash for the data in the specified file.
        Throws:
        AmazonClientException - If any problems were encountered reading the data or computing the hash.
      • calculateTreeHash

        public static String calculateTreeHash​(InputStream input)
                                        throws AmazonClientException
        Calculates a hex encoded binary hash using a tree hashing algorithm for the data in the specified input stream. The method will consume all the inputStream and close it when returned.
        Parameters:
        input - The input stream containing the data to hash.
        Returns:
        The hex encoded binary tree hash for the data in the specified input stream.
        Throws:
        AmazonClientException - If problems were encountered reading the data or calculating the hash.
      • calculateTreeHash

        public static String calculateTreeHash​(List<byte[]> checksums)
                                        throws AmazonClientException
        Returns the hex encoded binary tree hash for the individual checksums given. The sums are assumed to have been generated from sequential 1MB portions of a larger file, with the possible exception of the last part, which may be less than a full MB.
        Returns:
        The combined hex encoded binary tree hash for the individual checksums specified.
        Throws:
        AmazonClientException - If problems were encountered reading the data or calculating the hash.