Java tutorial
//package com.java2s; //License from project: Apache License import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String getMD5Str(String password) { String strResult = ""; MessageDigest md5; try { md5 = MessageDigest.getInstance("MD5"); md5.update(password.getBytes("UTF-8")); byte[] bzpassword_1 = md5.digest(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < bzpassword_1.length; ++i) { sb.append(String.format("%02x", bzpassword_1[i])); } md5.update(sb.toString().getBytes("UTF-8")); return sb.toString(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return null; } }