Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Main {
    public static byte[] toMD5(byte[] bytes) throws Exception {
        try {
            MessageDigest algorithm = MessageDigest.getInstance("MD5");
            algorithm.reset();
            return algorithm.digest(bytes);
        } catch (NoSuchAlgorithmException e) {
            throw new Exception(e);
        }
    }
}