Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.util.Log;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Main {
    public static byte[] getMessageDigest(byte[] data, String algorithm) {
        try {
            final MessageDigest md = MessageDigest.getInstance(algorithm);
            final byte[] digest = md.digest(data);
            return digest;
        } catch (final NoSuchAlgorithmException e) {
            Log.e(e.getMessage(), e.getMessage());
            throw new RuntimeException(e);
        }
    }
}