com.baidubce.util
Class HashUtils

java.lang.Object
  extended by com.baidubce.util.HashUtils

public class HashUtils
extends Object

Utility methods for computing MD5 sums.


Constructor Summary
HashUtils()
           
 
Method Summary
static byte[] computeHash(InputStream is, MessageDigest messageDigest)
           
static byte[] computeMd5Hash(InputStream is)
          Computes the MD5 hash of the data in the given input stream and returns it as an array of bytes.
static byte[] computeSha256Hash(InputStream is)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HashUtils

public HashUtils()
Method Detail

computeMd5Hash

public static byte[] computeMd5Hash(InputStream is)
                             throws NoSuchAlgorithmException,
                                    IOException
Computes the MD5 hash of the data in the given input stream and returns it as an array of bytes.

Throws:
NoSuchAlgorithmException
IOException

computeSha256Hash

public static byte[] computeSha256Hash(InputStream is)
                                throws NoSuchAlgorithmException,
                                       IOException
Throws:
NoSuchAlgorithmException
IOException

computeHash

public static byte[] computeHash(InputStream is,
                                 MessageDigest messageDigest)
                          throws IOException
Throws:
IOException


Copyright © 2018. All rights reserved.