package org.zanata.util;

import java.security.MessageDigest;

import org.apache.commons.codec.binary.Hex;

public class HashUtil
{

   public static String generateHash(String key)
   {
      try
      {
         MessageDigest md5 = MessageDigest.getInstance("MD5");
         md5.reset();
         return new String(Hex.encodeHex(md5.digest(key.getBytes("UTF-8"))));
      }
      catch (Exception exc)
      {
         throw new RuntimeException(exc);
      }
   }

}

@@ -99,16 +99,68 @@
 ary.Hex;
+%0Aimport org.apache.commons.codec.digest.DigestUtils;
 %0A%0Apublic
@@ -512,11 +512,113 @@
  %7D%0A   %7D%0A
+   %0A   public static String md5Hex(String message)%0A   %7B%0A      return DigestUtils.md5Hex(message);%0A   %7D
 %0A%7D%0A

Add Gravatar support.