Here you can find the source of MD5(String string)
public static String MD5(String string)
//package com.java2s; //License from project: Apache License import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String MD5(String string) { try {//from www. ja v a2 s. c o m MessageDigest md = MessageDigest.getInstance("MD5"); md.update(string.getBytes()); byte[] digest = md.digest(); StringBuilder sb = new StringBuilder(); for (byte b : digest) { sb.append(String.format("%02x", b & 0xff)); } return sb.toString(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return null; } }