Android Utililty Methods File MD5 Hash

List of utility methods to do File MD5 Hash


The list of methods to do File MD5 Hash are organized into topic(s).


StringgetMD5Sum(String file)
Returns the lowercase string representation of the file's MD5 sum.
try {
    MessageDigest digest = MessageDigest.getInstance("MD5");
    InputStream is = new FileInputStream(file);
    byte[] buffer = new byte[8192];
    int read = 0;
    while ((read = > 0) {
        digest.update(buffer, 0, read);
    byte[] md5sum = digest.digest();
    BigInteger bigInt = new BigInteger(1, md5sum);
    return bigInt.toString(16);
} catch (NoSuchAlgorithmException e) {
    return "";