Here you can find the source of generateHash(final String data)
public static String generateHash(final String data)
//package com.java2s; //License from project: Apache License import java.io.UnsupportedEncodingException; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { private static final String SECRET_SALT = "geheim"; public static String generateHash(final String data) { String result = null;//from www .j a v a 2 s . c om StringBuffer toHash = new StringBuffer(); toHash.append(data); toHash.append(SECRET_SALT); try { byte[] bytesOfMessage = toHash.toString().getBytes("UTF-8"); MessageDigest md = MessageDigest.getInstance("MD5"); byte[] thedigest = md.digest(bytesOfMessage); result = new BigInteger(1, thedigest).toString(16); while (result.length() < 32) { result = "0" + result; } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return result; } }