Here you can find the source of md52(String string)
public static String md52(String string)
//package com.java2s; //License from project: Apache License import java.io.UnsupportedEncodingException; import java.security.MessageDigest; public class Main { public static String md52(String string) { if (string == null || string.trim().length() < 1) { return null; }//w w w. j ava 2 s . c o m try { return getMD52(string.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e.getMessage(), e); } } private static String getMD52(byte[] source) { try { MessageDigest md5 = MessageDigest.getInstance("MD5"); StringBuffer result = new StringBuffer(); for (byte b : md5.digest(source)) { result.append(Integer.toHexString((b & 0xf0) >>> 4)); result.append(Integer.toHexString(b & 0x0f)); } return result.toString(); } catch (Exception e) { e.printStackTrace(); return ""; } } }