Here you can find the source of getKeyedDigest(String strSrc, String key)
public static String getKeyedDigest(String strSrc, String key)
//package com.java2s; //License from project: Apache License import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String getKeyedDigest(String strSrc, String key) { try {//from w w w .j a v a 2 s .c o m MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.update(strSrc.getBytes("UTF8")); String result = ""; byte[] temp; temp = md5.digest(key.getBytes("UTF8")); for (int i = 0; i < temp.length; i++) { result += Integer.toHexString((0x000000ff & temp[i]) | 0xffffff00).substring(6); } return result; } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return null; } }