public static String getMD5(String input) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
}
catch(NoSuchAlgorithmException e)
{
log.fatal("Not such algorithm, application may fail to run correctly");
}
try {
byte[] messageDigest = md.digest(input.getBytes("UTF-8"));
byte[] encoded = Base64.encode(messageDigest);
String retValue = new String(encoded);
return retValue;
} catch (UnsupportedEncodingException ex) {
log.error("Assertion: MD5 unsupported encodingException. This should never orccur.");
ex.printStackTrace();
}
return input;
}