Here you can find the source of md5(String password)
public static String md5(String password) throws NoSuchAlgorithmException
//package com.java2s; //License from project: Apache License import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String md5(String password) throws NoSuchAlgorithmException { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(password.getBytes());/*from w w w . j ava 2 s .c o m*/ return new BigInteger(1, md.digest()).toString(16); } public static String md5(String username, String password) throws NoSuchAlgorithmException { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(username.getBytes()); md.update(password.getBytes()); return new BigInteger(1, md.digest()).toString(16); } }