Here you can find the source of md5(String s)
public static String md5(String s)
//package com.java2s; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String md5(String s) { return hash(s, "MD5"); }// w w w. j a va2s .c om private static String hash(String s, String algorithm) { String result = s; try { MessageDigest digest = MessageDigest.getInstance(algorithm); byte[] bytes = digest.digest(s.getBytes()); BigInteger biggie = new BigInteger(1, bytes); result = String .format("%0" + (bytes.length << 1) + "x", biggie); } catch (NoSuchAlgorithmException e) { // No way... } return result; } }